xiahan 4 тижнів тому
батько
коміт
7823a90007

+ 10 - 10
qhse-common/src/main/java/com/rongwei/bscommon/sys/service/impl/FileFormatConversionServiceImpl.java

@@ -55,7 +55,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
     public SysFileItemDo fileCheck(String id) {
         SysFileItemDo sysFileItemDo = sysFileItemServiceImpl.getById(id);
         if (sysFileItemDo == null) {
-            throw new CustomException("无法根据ID获取到文件信息");
+            throw new CustomException("200","无法根据ID获取到文件信息");
         }
         log.debug("获取到的文件id:{}", sysFileItemDo.getId());
         return sysFileItemDo;
@@ -75,7 +75,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
         log.info("开始进行文件格式转换Id为:{}", id);
         if (StringUtils.isBlank(id)) {
             log.error("参数异常");
-            throw new CustomException("文件ID为空,请联系系统管理员");
+            throw new CustomException("200","文件ID为空,请联系系统管理员");
         }
         SysFileItemDo sysFileItemDo = fileCheck(id);
         String lowerCaseFileTYpe = sysFileItemDo.getFiletype().toLowerCase();
@@ -84,7 +84,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
         try {
             fileName = URLEncoder.encode(sysFileItemDo.getFilename(), "utf-8");
         } catch (Exception e) {
-            throw new CustomException("文件名转换失败!请联系系统管理员");
+            throw new CustomException("200","文件名转换失败!请联系系统管理员");
         }
 
         response.setHeader("Content-Disposition", "inline; filename=" + fileName);
@@ -114,7 +114,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
                 Files.copy(Paths.get(fullpath), response.getOutputStream());
             } catch (Exception e) {
                 log.error("文件名:{}格式化失败- 原因: {} | 异常类型: {}", sysFileItemDo.getFilename(), e.getMessage(), e.getClass().getSimpleName(), e);
-                throw new CustomException("获取预览文件失败!请联系系统管理员");
+                throw new CustomException("200","获取预览文件失败!请联系系统管理员");
             }
 
         }
@@ -185,7 +185,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
             }
         } catch (Exception e) {
             log.error("图片加水印处理失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-            throw new CustomException("文件处理异常");
+            throw new CustomException("200","文件处理异常");
         }
     }
 
@@ -225,7 +225,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
             out.flush();
         } catch (Exception e) {
             log.error("pdf预览失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-            throw new CustomException("获取预览文件失败!请联系系统管理员");
+            throw new CustomException("200","获取预览文件失败!请联系系统管理员");
         }
     }
 
@@ -267,7 +267,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
                 }
             } catch (Exception e) {
                 log.error("Excel转PDF失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-                throw new CustomException("文件转换失败,请联系系统管理员");
+                throw new CustomException("200","文件转换失败,请联系系统管理员");
             }
 
         } else {
@@ -290,7 +290,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
                 out.flush();
             } catch (Exception e) {
                 log.error("excel转pdf失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-                throw new CustomException("获取预览文件失败!请联系系统管理员");
+                throw new CustomException("200","获取预览文件失败!请联系系统管理员");
             }
         }
 
@@ -367,7 +367,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
                 }
             } catch (Exception e) {
                 log.error("Excel转PDF失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-                throw new CustomException("文件转换失败,请联系系统管理员");
+                throw new CustomException("200","文件转换失败,请联系系统管理员");
             }
 
         } else {
@@ -382,7 +382,7 @@ public class FileFormatConversionServiceImpl implements FileFormatConversionServ
                 out.flush();
             } catch (Exception e) {
                 log.error("word转pdf失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-                throw new CustomException("获取预览文件失败!请联系系统管理员");
+                throw new CustomException("200","获取预览文件失败!请联系系统管理员");
             }
         }
     }

+ 17 - 17
qhse-common/src/main/java/com/rongwei/bscommon/sys/service/impl/QhseTargetResponsibilityDocumentServiceImpl.java

@@ -64,11 +64,11 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
         QhseTargetResponsibilityDocumentDo qhseTargetResponsibilityDocumentDo = this.getById(mainId);
         if (qhseTargetResponsibilityDocumentDo == null) {
             log.error("无法获取到责任书信息");
-            throw new CustomException("无法获取到责任书信息");
+            throw new CustomException("200","无法获取到责任书信息");
         }
         String responsibilityfiles = qhseTargetResponsibilityDocumentDo.getResponsibilityfiles();
         if (StringUtils.isBlank(responsibilityfiles)) {
-            throw new CustomException("未上传责任书附件");
+            throw new CustomException("200","未上传责任书附件");
         }
         String fileId = responsibilityfiles.split(FILE_SEPARATOR)[1];
 
@@ -88,30 +88,30 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
         SysFileItemDo tempDo = fileFormatConversionService.fileCheck(fileId);
         if (tempDo == null) {
             log.error("无法根据id:{}获取到责任书文件信息", fileId);
-            throw new CustomException("无法获取到责任书");
+            throw new CustomException("200","无法获取到责任书");
         }
         // 模板路径
         String tempFullpath = tempDo.getFullpath();
         if (StringUtils.isBlank(tempFullpath)) {
             log.error("无法根据id:{}获取到责任书文件信息", fileId);
-            throw new CustomException("无法获取到责任书");
+            throw new CustomException("200","无法获取到责任书");
         }
         SysFileItemDo signatureDo = fileFormatConversionService.fileCheck(signatureId);
         if (signatureDo == null) {
             log.error("无法根据id:{}获取到签名信息", signatureId);
-            throw new CustomException("无法获取到签名");
+            throw new CustomException("200","无法获取到签名");
         }
         // 乙方签名路径
         String signaturePath = signatureDo.getFullpath();
         if (StringUtils.isBlank(signaturePath)) {
             log.error("无法根据id:{}获取到签名信息", signatureId);
-            throw new CustomException("无法获取到签名");
+            throw new CustomException("200","无法获取到签名");
         }
 
         String filetype = tempDo.getFiletype();
         if (!DOCX.equals(filetype) && !DOC.equals(filetype)) {
             log.error("责任书格式:{}不正确", filetype);
-            throw new CustomException("责任书格式不正确");
+            throw new CustomException("200","责任书格式不正确");
         }
 
         try (InputStream templateStream = Files.newInputStream(Paths.get(tempFullpath));
@@ -128,7 +128,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
             try {
                 fileName = URLEncoder.encode(tempDo.getFilename(), "utf-8");
             } catch (Exception e) {
-                throw new CustomException("文件名转换异常");
+                throw new CustomException("200","文件名转换异常");
             }
             response.setContentType("application/pdf");
             response.setHeader("Content-Disposition", "inline; filename=" + fileName);
@@ -143,7 +143,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
             out.flush();
         } catch (Exception e) {
             log.error("excel转pdf失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-            throw new CustomException("获取签名责任书失败!请联系系统管理员");
+            throw new CustomException("200","获取签名责任书失败!请联系系统管理员");
         }
     }
 
@@ -162,22 +162,22 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
         QhseTargetResponsibilityDocumentDo qhseTargetResponsibilityDocumentDo = this.getById(id);
         if (qhseTargetResponsibilityDocumentDo == null) {
             log.error("无法获取到责任书信息");
-            throw new CustomException("该记录可能已被其他人删除,请联系系统管理员");
+            throw new CustomException("200","该记录可能已被其他人删除,请联系系统管理员");
         }
         if (StringUtils.isBlank(qhseTargetResponsibilityDocumentDo.getResponsibilityfiles())) {
             log.error("责任书目录不存在");
-            throw new CustomException("无法获取到责任书信息,请联系系统管理员");
+            throw new CustomException("200","无法获取到责任书信息,请联系系统管理员");
         }
         String responsibilityfiles = qhseTargetResponsibilityDocumentDo.getResponsibilityfiles();
         SysFileItemDo tempFile = sysFileItemServiceImpl.getById(responsibilityfiles.split(FILE_SEPARATOR, 2)[1]);
         if (tempFile == null) {
             log.error("责任书在目录中存在");
-            throw new CustomException("无法获取到责任书信息,请联系系统管理员");
+            throw new CustomException("200","无法获取到责任书信息,请联系系统管理员");
         }
 
         if (StringUtils.isBlank(tempFile.getFullpath())) {
             log.error("责任书在目录中存在");
-            throw new CustomException("无法获取到责任书信息,请联系系统管理员");
+            throw new CustomException("200","无法获取到责任书信息,请联系系统管理员");
         }
 
 
@@ -188,7 +188,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
 
         boolean noSignatureData = documentSignatureDo.stream().anyMatch(info -> StringUtils.isNotBlank(info.getSignature()));
         if (!noSignatureData) {
-            throw new CustomException("目标责任书未含甲方及乙方的签名,无法下载!");
+            throw new CustomException("200","目标责任书未含甲方及乙方的签名,无法下载!");
         }
 
         Map<String, String> signatureDataMap = documentSignatureDo.stream().filter(info -> StringUtils.isNotBlank(info.getSignature())).collect(Collectors.groupingBy(QhseTargetResponsibilityDocumentSignatureDo::getSignaturesource,
@@ -242,7 +242,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
         try {
             fileName = URLEncoder.encode(value + docName + ".zip", "utf-8");
         } catch (Exception e) {
-            throw new CustomException("文件名转换异常");
+            throw new CustomException("200","文件名转换异常");
         }
         response.setContentType("application/zip");
         response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
@@ -256,7 +256,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
             templateBytes = Files.readAllBytes(Paths.get(tempPath));
         } catch (IOException e) {
             log.error("模板文件读取失败: {}", tempPath, e);
-            throw new CustomException("模板文件加载失败");
+            throw new CustomException("200","模板文件加载失败");
         }
 
 
@@ -284,7 +284,7 @@ public class QhseTargetResponsibilityDocumentServiceImpl extends ServiceImpl<Qhs
             }
         } catch (Exception e) {
             log.error("责任书压缩包生成失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-            throw new CustomException("文件生成失败,请联系系统管理员!");
+            throw new CustomException("200","文件生成失败,请联系系统管理员!");
         }
     }
 

+ 6 - 6
qhse-common/src/main/java/com/rongwei/bscommon/sys/service/impl/QhseVisitorManagementServiceImpl.java

@@ -95,27 +95,27 @@ public class QhseVisitorManagementServiceImpl extends ServiceImpl<QhseVisitorMan
         SysFileItemDo tempDo = fileFormatConversionService.fileCheck(fileId);
         if (tempDo == null) {
             logger.error("无法根据id:{}获取到文件信息", fileId);
-            throw new CustomException("无法获取到附件模板");
+            throw new CustomException("200","无法获取到附件模板");
         }
 
         // 模板路径
         String tempFullpath = tempDo.getFullpath();
         if (StringUtils.isBlank(tempFullpath)) {
             logger.error("无法根据id:{}获取到文件信息", fileId);
-            throw new CustomException("无法获取到附件模板");
+            throw new CustomException("200","无法获取到附件模板");
         }
 
         String signatureId = signature.split(FILE_SEPARATOR)[1];
         SysFileItemDo signatureDo = fileFormatConversionService.fileCheck(signatureId);
         if (signatureDo == null) {
             logger.error("无法根据id:{}获取到签名信息", signatureId);
-            throw new CustomException("无法获取到签名");
+            throw new CustomException("200","无法获取到签名");
         }
         // 乙方签名路径
         String signaturePath = signatureDo.getFullpath();
         if (StringUtils.isBlank(signaturePath)) {
             logger.error("无法根据id:{}获取到签名信息", signatureId);
-            throw new CustomException("无法获取到签名");
+            throw new CustomException("200","无法获取到签名");
         }
 
         File file = new File(tempFullpath);
@@ -135,7 +135,7 @@ public class QhseVisitorManagementServiceImpl extends ServiceImpl<QhseVisitorMan
                fileName = URLEncoder.encode(tempDo.getFilename(), "utf-8");
 
             } catch (Exception e) {
-                throw new CustomException("文件名转换异常");
+                throw new CustomException("200","文件名转换异常");
             }
             response.setContentType("application/pdf");
 
@@ -152,7 +152,7 @@ public class QhseVisitorManagementServiceImpl extends ServiceImpl<QhseVisitorMan
             out.flush();
         } catch (Exception e) {
             logger.error("excel转pdf失败- 原因: {} | 异常类型: {}", e.getMessage(), e.getClass().getSimpleName(), e);
-            throw new CustomException("获取签名责任书失败!请联系系统管理员");
+            throw new CustomException("200","获取签名责任书失败!请联系系统管理员");
         }
     }
 }

+ 4 - 4
qhse-common/src/main/java/com/rongwei/bscommon/sys/service/impl/RohhServiceImpl.java

@@ -113,12 +113,12 @@ public class RohhServiceImpl implements RohhService {
     public void taskTransfer(TaskTransferVo taskTransferVo) {
         List<String> ids = taskTransferVo.getIds();
         if (ids == null || ids.isEmpty()) {
-            throw new CustomException("参数异常");
+            throw new CustomException("200","参数异常");
         }
         String userId = taskTransferVo.getUserId();
         String userName = taskTransferVo.getUserName();
         if (StringUtils.isBlank(userId) || StringUtils.isBlank(userName)) {
-            throw new CustomException("重新选择的整改人为空");
+            throw new CustomException("200","重新选择的整改人为空");
         }
         QhseRohhDo qhseRohhDo;
         QhseRohhEventDo qhseRohhEventDo;
@@ -168,11 +168,11 @@ public class RohhServiceImpl implements RohhService {
      */
     public QhseRohhDo rohhCheck(String id) {
         if (StringUtils.isBlank(id)) {
-            throw new CustomException("参数异常");
+            throw new CustomException("200","参数异常");
         }
         QhseRohhDo qhseRohhDo = qhseRohhService.getById(id);
         if (qhseRohhDo == null) {
-            throw new CustomException("无法获取到隐患任务信息");
+            throw new CustomException("200","无法获取到隐患任务信息");
         }
 
         return qhseRohhDo;

+ 2 - 2
qhse-common/src/main/java/com/rongwei/bscommon/sys/utils/WordUtils.java

@@ -30,7 +30,7 @@ public class WordUtils {
             // response.setHeader("Content-Disposition", "attachment;filename=AccidentHandlingSheet.docx");
             // doc.save(response.getOutputStream(), SaveFormat.DOCX);
         } catch (Exception e) {
-            throw new CustomException("文件导出异常");
+            throw new CustomException("200","文件导出异常");
         }
     }
     public static void MailMergeFill(Map<String, String> wordMap, Document doc) {
@@ -45,7 +45,7 @@ public class WordUtils {
             // response.setHeader("Content-Disposition", "attachment;filename=AccidentHandlingSheet.docx");
             // doc.save(response.getOutputStream(), SaveFormat.DOCX);
         } catch (Exception e) {
-            throw new CustomException("文件导出异常");
+            throw new CustomException("200","文件导出异常");
         }
     }
 }