xiaofei 1 rok temu
rodzic
commit
1514d1c7da

+ 4 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientUpgradeServiceImpl.java

@@ -85,11 +85,11 @@ public class ClientUpgradeServiceImpl extends ServiceImpl<ClientUpgradeMapper, C
                 parentDirVar = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
                 parentDirVar = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
 //                file.transferTo(parentDirVar);
 //                file.transferTo(parentDirVar);
                 FileUtils.copyToFile(file.getInputStream(), parentDirVar);
                 FileUtils.copyToFile(file.getInputStream(), parentDirVar);
-                ZipReader zipReader1 = new ZipReader(parentDirVar);
+                ZipReader zipReader = new ZipReader(parentDirVar);
                 String mainfestJson = "mainfest.json";
                 String mainfestJson = "mainfest.json";
 
 
                 // 读取指定文件内容mainfest.josn
                 // 读取指定文件内容mainfest.josn
-                String mainfestContent = readMainfest(zipReader1.read(mainfestJson));
+                String mainfestContent = readMainfest(zipReader.read(mainfestJson));
                 if (StringUtils.isBlank(mainfestContent)) {
                 if (StringUtils.isBlank(mainfestContent)) {
                     throw ExceptionResultEnum.ERROR.exception("读取mainfest.json文件内容失败");
                     throw ExceptionResultEnum.ERROR.exception("读取mainfest.json文件内容失败");
                 }
                 }
@@ -116,7 +116,6 @@ public class ClientUpgradeServiceImpl extends ServiceImpl<ClientUpgradeMapper, C
                 clientUpgrade.setUpgradePath(JSON.toJSONString(filePathVo));
                 clientUpgrade.setUpgradePath(JSON.toJSONString(filePathVo));
 
 
                 // 上传mainfest.json文件
                 // 上传mainfest.json文件
-                ZipReader zipReader = new ZipReader(parentDirVar);
                 String mainfestPathName = buildPath(true, UploadFileEnum.UPGRADE.getTitle(), "update", platform, version, String.valueOf(build)) + mainfestJson;
                 String mainfestPathName = buildPath(true, UploadFileEnum.UPGRADE.getTitle(), "update", platform, version, String.valueOf(build)) + mainfestJson;
                 FilePathVo mainfestPathVo = fileUploadService.uploadFile(zipReader.read(mainfestJson), UploadFileEnum.UPGRADE, mainfestPathName, DigestUtils.md5Hex(zipReader.read(mainfestJson)));
                 FilePathVo mainfestPathVo = fileUploadService.uploadFile(zipReader.read(mainfestJson), UploadFileEnum.UPGRADE, mainfestPathName, DigestUtils.md5Hex(zipReader.read(mainfestJson)));
                 clientUpgrade.setMainfestPath(JSON.toJSONString(mainfestPathVo));
                 clientUpgrade.setMainfestPath(JSON.toJSONString(mainfestPathVo));
@@ -145,7 +144,7 @@ public class ClientUpgradeServiceImpl extends ServiceImpl<ClientUpgradeMapper, C
             }
             }
             // 保存或更新
             // 保存或更新
             this.saveOrUpdate(clientUpgrade);
             this.saveOrUpdate(clientUpgrade);
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw ExceptionResultEnum.ERROR.exception(type.getName() + "上传失败:" + e.getMessage());
             throw ExceptionResultEnum.ERROR.exception(type.getName() + "上传失败:" + e.getMessage());
         } finally {
         } finally {
             if (parentDirVar != null) {
             if (parentDirVar != null) {
@@ -159,7 +158,7 @@ public class ClientUpgradeServiceImpl extends ServiceImpl<ClientUpgradeMapper, C
             return;
             return;
         }
         }
         // 上传
         // 上传
-        String filePath = pathType + File.separator + fileName;
+        String filePath = FileUtil.replaceSplit(pathType + File.separator + fileName);
         String dataPathName = buildPath(true, UploadFileEnum.UPGRADE.getTitle(), "update", platform, version, String.valueOf(build), pathType) + fileName;
         String dataPathName = buildPath(true, UploadFileEnum.UPGRADE.getTitle(), "update", platform, version, String.valueOf(build), pathType) + fileName;
         try {
         try {
             fileUploadService.uploadFile(zipReader.read(filePath), UploadFileEnum.UPGRADE, dataPathName, DigestUtils.md5Hex(zipReader.read(filePath)));
             fileUploadService.uploadFile(zipReader.read(filePath), UploadFileEnum.UPGRADE, dataPathName, DigestUtils.md5Hex(zipReader.read(filePath)));