|
@@ -33,8 +33,8 @@ public class CaseImportAndExportController {
|
|
|
@Autowired
|
|
|
private MongoAPIService mongoAPIService;
|
|
|
|
|
|
- //private String rootPath = "/var/www/download/";
|
|
|
- private String rootPath = "H://";
|
|
|
+ private String rootPath = "/var/www/download";
|
|
|
+ //private String rootPath = "H://download/";
|
|
|
|
|
|
private String rootZipFileName = "resource.zip";
|
|
|
|
|
@@ -71,7 +71,11 @@ public class CaseImportAndExportController {
|
|
|
@RequestMapping(value = UrlConstants.API + "caseImport", method = RequestMethod.POST)
|
|
|
public Map<String, Object> caseImport(MultipartHttpServletRequest request) {
|
|
|
//TODO 解压压缩包到指定位置
|
|
|
- String filePath = rootPath + "temp/";
|
|
|
+ String filePath = rootPath + System.currentTimeMillis()+ "_temp/";
|
|
|
+ File dir = new File(filePath);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ dir.mkdirs();
|
|
|
+ }
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
try {
|
|
|
//获取上传的文件
|
|
@@ -89,6 +93,7 @@ public class CaseImportAndExportController {
|
|
|
return res;
|
|
|
}
|
|
|
FileUtils.unZipMultiFile(filePath + fileNames.get(0), rootPath);
|
|
|
+ FileUtils.unZipMultiFile(filePath + fileNames.get(0), filePath);
|
|
|
/*
|
|
|
if (!fileNames.get(0).equals(fileName)) {
|
|
|
//TODO 返回错误信息
|
|
@@ -106,7 +111,7 @@ public class CaseImportAndExportController {
|
|
|
if (ownerId == null || ownerId.equals("")) {
|
|
|
ownerId = SecurityUtils.getSubject().getSession().getAttribute("userId").toString();
|
|
|
}
|
|
|
- Map<String, Object> tempMap = caseImportLogic.importCases(rootPath, ip, ownerId, fileName);
|
|
|
+ Map<String, Object> tempMap = caseImportLogic.importCases(filePath, ip, ownerId, fileName);
|
|
|
if (!tempMap.get("code").equals(0)) {
|
|
|
res.put("code", 4);
|
|
|
res.put("message", tempMap.get("message"));
|