|
@@ -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","文件生成失败,请联系系统管理员!");
|
|
|
}
|
|
|
}
|
|
|
|