|
@@ -9,9 +9,11 @@ import cn.start.tz.module.pressure2.controller.admin.dynamictb.vo.DynamicTbRespV
|
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbcol.vo.DynamicTbColRespVO;
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbcol.vo.DynamicTbColRespVO;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbval.vo.DynamicTBAndColVO;
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbval.vo.DynamicTBAndColVO;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbval.vo.DynamicTBViewOrAddVO;
|
|
import cn.start.tz.module.pressure2.controller.admin.dynamictbval.vo.DynamicTBViewOrAddVO;
|
|
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.boilerconnectrecordreport.BoilerConnectRecordReportDO;
|
|
|
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.dataobject.dynamictbval.DynamicTbValDO;
|
|
import cn.start.tz.module.pressure2.dal.dataobject.dynamictbval.DynamicTbValDO;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.dynamictbins.DynamicTbInsMapper;
|
|
import cn.start.tz.module.pressure2.dal.mysql.dynamictbins.DynamicTbInsMapper;
|
|
|
|
|
+import cn.start.tz.module.pressure2.service.boilerconnectrecordreport.BoilerConnectRecordReportService;
|
|
|
import cn.start.tz.module.pressure2.service.dynamictb.DynamicTbService;
|
|
import cn.start.tz.module.pressure2.service.dynamictb.DynamicTbService;
|
|
|
import cn.start.tz.module.pressure2.service.dynamictbcol.DynamicTbColService;
|
|
import cn.start.tz.module.pressure2.service.dynamictbcol.DynamicTbColService;
|
|
|
import cn.start.tz.module.pressure2.service.dynamictbins.DynamicTbInsService;
|
|
import cn.start.tz.module.pressure2.service.dynamictbins.DynamicTbInsService;
|
|
@@ -48,6 +50,9 @@ public class PdfServiceImpl implements PdfService {
|
|
|
@Resource
|
|
@Resource
|
|
|
private StandardTemplateService standardTemplateService;
|
|
private StandardTemplateService standardTemplateService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private BoilerConnectRecordReportService boilerConnectRecordReportService;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private DynamicTbValService dynamicTbValService;
|
|
private DynamicTbValService dynamicTbValService;
|
|
|
|
|
|
|
@@ -163,6 +168,44 @@ public class PdfServiceImpl implements PdfService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getPdfUrlByProjectId(String projectId, String refId, boolean isReport) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ BoilerConnectRecordReportDO project = boilerConnectRecordReportService.getById(projectId);
|
|
|
|
|
+ if (project == null) {
|
|
|
|
|
+ throw new Exception("没有该检验项目");
|
|
|
|
|
+ }
|
|
|
|
|
+ String templateId = null;
|
|
|
|
|
+ if (isReport) {
|
|
|
|
|
+ templateId = project.getReportTemplateId();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ templateId = project.getRecordTemplateId();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ DynamicTbInsDO dynamicTbInsDO = dynamicTbInsMapper.selectOne(new LambdaQueryWrapperX<DynamicTbInsDO>()
|
|
|
|
|
+ .eq(DynamicTbInsDO::getRefId, refId), false);
|
|
|
|
|
+
|
|
|
|
|
+ if (dynamicTbInsDO != null) {
|
|
|
|
|
+ String fileUrl = standardTemplateService.getById(templateId).getFileUrl();
|
|
|
|
|
+ byte[] bytes = null;
|
|
|
|
|
+ bytes = fileApi.getFileByPath(fileUrl).getCheckedData();
|
|
|
|
|
+ GrapeCityReqDTO grapeCityReqDTO = new GrapeCityReqDTO();
|
|
|
|
|
+ grapeCityReqDTO.setTemplateBytes(bytes);
|
|
|
|
|
+
|
|
|
|
|
+ List<DynamicTbValDO> list = dynamicTbValService.lambdaQuery().eq(DynamicTbValDO::getInsId, dynamicTbInsDO.getId()).list();
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ List<String> imgIns = dynamicTbColService.getImgTb(templateId).stream().map(DynamicTbColRespVO::getColCode).toList();
|
|
|
|
|
+
|
|
|
|
|
+ for (DynamicTbValDO dynamicTbValDO : list) {
|
|
|
|
|
+ map.put(dynamicTbValDO.getColCode(), dynamicTbValDO.getValValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ byte[] pdfBytes = this.fullPdf(bytes, map, imgIns, templateId, dynamicTbInsDO.getId());
|
|
|
|
|
+ return fileApi.createFile(pdfBytes);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ throw new Exception("没有该检验报告");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public byte[] fullPdf(byte[] templateBytes, Map<String, Object> data, List<String> imgIns, String templateId, String instanceId) throws Exception {
|
|
public byte[] fullPdf(byte[] templateBytes, Map<String, Object> data, List<String> imgIns, String templateId, String instanceId) throws Exception {
|
|
|
// 将 data 中的 JSON 字符串值解析为实际对象/数组,确保 GcExcel 模板引擎能正确处理表格绑定
|
|
// 将 data 中的 JSON 字符串值解析为实际对象/数组,确保 GcExcel 模板引擎能正确处理表格绑定
|