7 Commits

Author SHA1 Message Date
caozehui
32fc732f2e Merge remote-tracking branch 'origin/qr_branch' into qr_branch 2026-03-26 14:24:12 +08:00
caozehui
ef59d7b514 微调 2026-03-26 14:24:05 +08:00
caozehui
5e9cc50e6b 微调 2026-03-26 13:35:29 +08:00
caozehui
8aac33c14b 报告改成读取指定目录下的 2026-03-25 14:30:10 +08:00
caozehui
d6f2dbe64c 报告封面微调 2025-12-26 10:14:18 +08:00
caozehui
303c8dd4f0 微调 2025-12-23 15:48:57 +08:00
caozehui
753a303fec 报告设备类型调整 2025-12-23 15:12:11 +08:00
14 changed files with 32 additions and 12 deletions

View File

@@ -65,7 +65,9 @@ import com.njcn.gather.storage.service.AdNonHarmonicService;
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum; import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
import com.njcn.gather.system.cfg.service.ISysTestConfigService; import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictType;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.system.dictionary.service.IDictTypeService;
import com.njcn.gather.type.pojo.po.DevType; import com.njcn.gather.type.pojo.po.DevType;
import com.njcn.gather.type.service.IDevTypeService; import com.njcn.gather.type.service.IDevTypeService;
import com.njcn.http.util.RestTemplateUtil; import com.njcn.http.util.RestTemplateUtil;
@@ -84,6 +86,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -161,9 +164,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
@Value("${report.dateFormat}") @Value("${report.dateFormat}")
private String dateFormat; private String dateFormat;
// 设备出厂装置型号字典对应的code
private final String EX_FACTORY_DEV_TYPE = "Ex-factory_Dev_Type";
private final IPqDevService iPqDevService; private final IPqDevService iPqDevService;
private final PqDevMapper pqDevMapper; private final PqDevMapper pqDevMapper;
private final IDictTypeService dictTypeService;
private final IDictDataService dictDataService; private final IDictDataService dictDataService;
private final IAdPlanService adPlanService; private final IAdPlanService adPlanService;
@@ -594,7 +601,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
} }
// 读取模板文件 // 读取模板文件
ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX); // ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX);
FileSystemResource resource = new FileSystemResource(templatePath + File.separator + reportName.getCode() + ReportConstant.DOCX);
try (InputStream inputStream = resource.getInputStream()) { try (InputStream inputStream = resource.getInputStream()) {
// 加载Word文档 // 加载Word文档
XWPFDocument baseModelDocument = new XWPFDocument(inputStream); XWPFDocument baseModelDocument = new XWPFDocument(inputStream);
@@ -1426,6 +1434,17 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
Map<String, String> baseModelMap = new HashMap<>(32); Map<String, String> baseModelMap = new HashMap<>(32);
// 获取设备型号 // 获取设备型号
baseModelMap.put(prefix + BaseReportKeyEnum.DEV_TYPE.getKey() + suffix, devType.getName()); baseModelMap.put(prefix + BaseReportKeyEnum.DEV_TYPE.getKey() + suffix, devType.getName());
DictType dictType = dictTypeService.getByCode(EX_FACTORY_DEV_TYPE);
if (ObjectUtil.isNotNull(dictType)) {
List<DictData> dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
DictData targetDictData = dictDataList.stream().filter(dictData -> dictData.getCode().equals(devType.getName())).findFirst().orElse(null);
if (ObjectUtil.isNotNull(targetDictData)) {
String name = devType.getName();
name = name.substring(0, name.lastIndexOf(StrUtil.DASHED));
baseModelMap.put(prefix + BaseReportKeyEnum.DEV_TYPE.getKey() + suffix, name + "(" + targetDictData.getValue() + ")");
}
}
// 检测员 // 检测员
baseModelMap.put(prefix + BaseReportKeyEnum.INSPECTOR.getKey() + suffix, pqDevVO.getCheckBy() + ""); baseModelMap.put(prefix + BaseReportKeyEnum.INSPECTOR.getKey() + suffix, pqDevVO.getCheckBy() + "");
String datePattern = DatePattern.NORM_DATE_PATTERN; String datePattern = DatePattern.NORM_DATE_PATTERN;
@@ -1467,9 +1486,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
// 委托方 // 委托方
String delegate = pqDevVO.getDelegate(); String delegate = pqDevVO.getDelegate();
if (StrUtil.isNotBlank(delegate)) { if (StrUtil.isNotBlank(delegate)) {
DictData delegateDictData = dictDataService.getDictDataById(pqDevVO.getManufacturer()); DictData delegateDictData = dictDataService.getDictDataById(pqDevVO.getDelegate());
if (ObjectUtil.isNotNull(delegateDictData)) { if (ObjectUtil.isNotNull(delegateDictData)) {
baseModelMap.put(prefix + BaseReportKeyEnum.DELEGATE.getKey() + suffix, dictData.getName()); baseModelMap.put(prefix + BaseReportKeyEnum.DELEGATE.getKey() + suffix, delegateDictData.getName());
} else { } else {
baseModelMap.put(prefix + BaseReportKeyEnum.DELEGATE.getKey() + suffix, StrPool.TAB); baseModelMap.put(prefix + BaseReportKeyEnum.DELEGATE.getKey() + suffix, StrPool.TAB);
} }
@@ -1508,12 +1527,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
//String scriptId = adPlan.getScriptId(); //String scriptId = adPlan.getScriptId();
Integer devChns = pqDevVO.getDevChns(); Integer devChns = pqDevVO.getDevChns();
for (int i = 1; i <= devChns; i++) { for (int i = 1; i <= devChns; i++) {
String path = "/model/report_table.docx"; String path = "/report_table.docx";
DevType devType = devTypeService.getById(pqDevVO.getDevType()); DevType devType = devTypeService.getById(pqDevVO.getDevType());
if (devType.getName().equals("PQ-COM")) { if (devType.getName().equals("PQ-COM")) {
path = "/model/report_table - PQ-COM.docx"; path = "/report_table - PQ-COM.docx";
} }
ClassPathResource resource = new ClassPathResource(path); // ClassPathResource resource = new ClassPathResource(path);
FileSystemResource resource = new FileSystemResource(templatePath + path);
XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream()); XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream());
SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam(); SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();

View File

@@ -6,12 +6,12 @@ spring:
datasource: datasource:
druid: druid:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.24:13306/pqs9100_bj?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai # url: jdbc:mysql://192.168.1.24:13306/pqs91002?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
# username: root
# password: njcnpqs
url: jdbc:mysql://192.168.1.24:13306/pqs9100_2f?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
username: root username: root
password: njcnpqs password: njcnpqs
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
# username: root
# password: root
#初始化建立物理连接的个数、最小、最大连接数 #初始化建立物理连接的个数、最小、最大连接数
initial-size: 5 initial-size: 5
min-idle: 5 min-idle: 5
@@ -49,10 +49,10 @@ phaseAngle:
socket: socket:
source: source:
ip: 192.168.1.125 ip: 127.0.0.1
port: 62000 port: 62000
device: device:
ip: 192.168.1.125 ip: 127.0.0.1
port: 61000 port: 61000
# source: # source:
# ip: 192.168.1.121 # ip: 192.168.1.121