|
@@ -1,6 +1,10 @@
|
|
|
package cn.start.tz.module.pressure2.service.pipetaskorderinput;
|
|
package cn.start.tz.module.pressure2.service.pipetaskorderinput;
|
|
|
|
|
|
|
|
|
|
+import cn.start.tz.framework.common.exception.ErrorCode;
|
|
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.dynamictb.DynamicTbDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.dynamictbins.DynamicTbInsDO;
|
|
import cn.start.tz.module.pressure2.dal.dataobject.dynamictbins.DynamicTbInsDO;
|
|
|
|
|
+import cn.start.tz.module.pressure2.dal.mysql.dynamictb.DynamicTbMapper;
|
|
|
|
|
+import cn.start.tz.module.pressure2.enums.TaskOrderItemReportTypeEnum;
|
|
|
import cn.start.tz.module.pressure2.service.dynamictbins.DynamicTbInsService;
|
|
import cn.start.tz.module.pressure2.service.dynamictbins.DynamicTbInsService;
|
|
|
import cn.start.tz.module.pressure2.service.pdf.PdfService;
|
|
import cn.start.tz.module.pressure2.service.pdf.PdfService;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
@@ -47,6 +51,10 @@ public class PipeTaskOrderInputServiceImpl extends ServiceImpl<PipeTaskOrderInpu
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private PdfService pdfService;
|
|
private PdfService pdfService;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private DynamicTbMapper dynamicTbMapper;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private DynamicTbInsService dynamicTbInsService;
|
|
private DynamicTbInsService dynamicTbInsService;
|
|
|
|
|
|
|
@@ -99,15 +107,24 @@ public class PipeTaskOrderInputServiceImpl extends ServiceImpl<PipeTaskOrderInpu
|
|
|
PDFMergerUtility mergerUtility = new PDFMergerUtility();
|
|
PDFMergerUtility mergerUtility = new PDFMergerUtility();
|
|
|
for (PipeTaskOrderInputPrintReqVO printReqVO : printReqVOS) {
|
|
for (PipeTaskOrderInputPrintReqVO printReqVO : printReqVOS) {
|
|
|
String templateId = printReqVO.getTemplateId();
|
|
String templateId = printReqVO.getTemplateId();
|
|
|
- String instanceId = null;
|
|
|
|
|
- if (printReqVO.getTaskStatus() >= 520) {
|
|
|
|
|
- templateId = printReqVO.getReportTemplateId();
|
|
|
|
|
- instanceId = dynamicTbInsService.getDynamicRefId("report_" + printReqVO.getId()).getId();
|
|
|
|
|
- } else {
|
|
|
|
|
- instanceId = dynamicTbInsService.getDynamicRefId(printReqVO.getId()).getId();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ DynamicTbDO dynamicTbDO = dynamicTbMapper.selectById(templateId);
|
|
|
|
|
+ if (dynamicTbDO != null){
|
|
|
|
|
+ String instanceId = null;
|
|
|
|
|
+ // 意见通知书、检验方案、作业指导书等特殊报告类型处理
|
|
|
|
|
+ if (TaskOrderItemReportTypeEnum.isSpecialReportType(dynamicTbDO.getReportType())) {
|
|
|
|
|
+ instanceId = dynamicTbInsService.getDynamicRefId(printReqVO.getId()).getId();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if (printReqVO.getTaskStatus() >= 520) {
|
|
|
|
|
+ templateId = printReqVO.getReportTemplateId();
|
|
|
|
|
+ instanceId = dynamicTbInsService.getDynamicRefId("report_" + printReqVO.getId()).getId();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ instanceId = dynamicTbInsService.getDynamicRefId(printReqVO.getId()).getId();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ byte[] pdf = pdfService.pdf(templateId, instanceId);
|
|
|
|
|
+ mergerUtility.addSource(new ByteArrayInputStream(pdf));
|
|
|
}
|
|
}
|
|
|
- byte[] pdf = pdfService.pdf(templateId, instanceId);
|
|
|
|
|
- mergerUtility.addSource(new ByteArrayInputStream(pdf));
|
|
|
|
|
}
|
|
}
|
|
|
mergerUtility.setDestinationStream(mergeOutputStream);
|
|
mergerUtility.setDestinationStream(mergeOutputStream);
|
|
|
mergerUtility.mergeDocuments(null);
|
|
mergerUtility.mergeDocuments(null);
|
|
@@ -137,16 +154,29 @@ public class PipeTaskOrderInputServiceImpl extends ServiceImpl<PipeTaskOrderInpu
|
|
|
for (int i = 0; i < printReqVOS.size(); i++) {
|
|
for (int i = 0; i < printReqVOS.size(); i++) {
|
|
|
PipeTaskOrderInputPrintReqVO printReqVO = printReqVOS.get(i);
|
|
PipeTaskOrderInputPrintReqVO printReqVO = printReqVOS.get(i);
|
|
|
String templateId = printReqVO.getTemplateId();
|
|
String templateId = printReqVO.getTemplateId();
|
|
|
|
|
+
|
|
|
String instanceId = null;
|
|
String instanceId = null;
|
|
|
- DynamicTbInsDO dynamicRefId;
|
|
|
|
|
- // 根据任务状态确定模板 ID 和实例 ID
|
|
|
|
|
- if (printReqVO.getTaskStatus() >= 520) {
|
|
|
|
|
- templateId = printReqVO.getReportTemplateId();
|
|
|
|
|
- dynamicRefId = dynamicTbInsService.getDynamicRefId("report_" + printReqVO.getId());
|
|
|
|
|
- instanceId = dynamicRefId.getId();
|
|
|
|
|
- } else {
|
|
|
|
|
- dynamicRefId = dynamicTbInsService.getDynamicRefId(printReqVO.getId());
|
|
|
|
|
- instanceId = dynamicRefId.getId();
|
|
|
|
|
|
|
+ DynamicTbInsDO dynamicRefId = new DynamicTbInsDO();
|
|
|
|
|
+ DynamicTbDO dynamicTbDO = dynamicTbMapper.selectById(templateId);
|
|
|
|
|
+ if (dynamicTbDO != null){
|
|
|
|
|
+ // 意见通知书、检验方案、作业指导书等特殊报告类型处理
|
|
|
|
|
+ if (TaskOrderItemReportTypeEnum.isSpecialReportType(dynamicTbDO.getReportType())) {
|
|
|
|
|
+ dynamicRefId = dynamicTbInsService.getDynamicRefId(printReqVO.getId());
|
|
|
|
|
+ instanceId = dynamicRefId.getId();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ // 根据任务状态确定模板 ID 和实例 ID
|
|
|
|
|
+ if (printReqVO.getTaskStatus() >= 520) {
|
|
|
|
|
+ templateId = printReqVO.getReportTemplateId();
|
|
|
|
|
+ dynamicRefId = dynamicTbInsService.getDynamicRefId("report_" + printReqVO.getId());
|
|
|
|
|
+ instanceId = dynamicRefId.getId();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ dynamicRefId = dynamicTbInsService.getDynamicRefId(printReqVO.getId());
|
|
|
|
|
+ instanceId = dynamicRefId.getId();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw exception(new ErrorCode(500, "报表模板不存在"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 生成 PDF
|
|
// 生成 PDF
|