diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 9bdc2074..14a875ce 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -688,7 +688,7 @@ public class SocketDevResponseService { */ private Double reduceList(List valList) { // valList.subList(0, 5).clear(); - valList.subList(valList.size() - 2, valList.size()).clear(); + valList.subList(valList.size() - 2, valList.size()).clear(); return valList.stream().mapToDouble(Double::doubleValue).average().getAsDouble(); } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index e9c4fe82..14f372e9 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -809,6 +809,9 @@ public class DetectionServiceImpl { )) .collect(Collectors.toList()); DetectionData a = setDetectionData(isQualified, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A, scale); + if (CollUtil.isEmpty(mag.get(TYPE_A))) { + a.setIsData(2); + } result.setAValue(JSON.toJSONString(a)); result.setTValue(JSON.toJSONString(a)); result.setResultFlag(a.getIsData()); diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/enums/BaseReportKeyEnum.java b/detection/src/main/java/com/njcn/gather/report/pojo/enums/BaseReportKeyEnum.java index f68986e1..e63ac024 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/enums/BaseReportKeyEnum.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/enums/BaseReportKeyEnum.java @@ -39,7 +39,10 @@ public enum BaseReportKeyEnum { CREATE_DATE("createDate","生产日期"), TEMPERATURE("temp","温度"), HUMIDITY("hum","相对湿度"), - DELEGATE("delegate","委托方"); + DELEGATE("delegate","委托方"), + CREATEDATE("createDate","出厂日期"), + HW_VERSION("hardwareVersion","硬件版本"), + SW_VERSION("softwareVersion","软件版本"); private String key; diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 75d69e02..de9a5a7a 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -2020,6 +2020,12 @@ public class PqReportServiceImpl extends ServiceImpl i baseModelMap.put(BaseReportKeyEnum.DEV_TYPE.getKey(), devType.getName()); // 检测员 baseModelMap.put(BaseReportKeyEnum.INSPECTOR.getKey(), pqDevVO.getCheckBy() + ""); + // 出厂日期 + baseModelMap.put(BaseReportKeyEnum.CREATEDATE.getKey(), pqDevVO.getCreateDate().format(DateTimeFormatter.ofPattern(datePattern))); + // 硬件版本 + baseModelMap.put(BaseReportKeyEnum.HW_VERSION.getKey(), StrUtil.isNotBlank(pqDevVO.getHardwareVersion()) ? pqDevVO.getHardwareVersion() : StrUtil.EMPTY); + // 软件版本 + baseModelMap.put(BaseReportKeyEnum.SW_VERSION.getKey(), StrUtil.isNotBlank(pqDevVO.getSoftwareVersion()) ? pqDevVO.getSoftwareVersion() : StrUtil.EMPTY); // 调试日期 if (pqDevVO.getCheckTime() != null) { baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN)); @@ -2059,7 +2065,7 @@ public class PqReportServiceImpl extends ServiceImpl i // 实验室温度 baseModelMap.put(BaseReportKeyEnum.TEMPERATURE.getKey(), Objects.isNull(pqDevVO.getTemperature()) ? StrPool.TAB : pqDevVO.getTemperature().toString()); // 实验室湿度 - baseModelMap.put(BaseReportKeyEnum.HUMIDITY.getKey(), Objects.isNull(pqDevVO.getHumidity()) ? StrPool.TAB : pqDevVO.getHumidity().toString()); + baseModelMap.put(prefix + BaseReportKeyEnum.HUMIDITY.getKey() + suffix, Objects.isNull(pqDevVO.getHumidity()) ? StrPool.TAB : pqDevVO.getHumidity().toString()); // 样品编号 baseModelMap.put(BaseReportKeyEnum.SAMPLE_ID.getKey(), StrUtil.isEmpty(pqDevVO.getSampleId()) ? StrPool.TAB : pqDevVO.getSampleId()); @@ -2160,7 +2166,19 @@ public class PqReportServiceImpl extends ServiceImpl i private void dealDataModel(List wordFileInputStreams, DevReportParam devReportParam, PqDevVO pqDevVO) throws Exception { Integer devChns = pqDevVO.getDevChns(); for (int i = 1; i <= devChns; i++) { - ClassPathResource resource = new ClassPathResource("/model/report_table.docx"); + String path = "/model/report_table.docx"; + DevType devType = devTypeService.getById(pqDevVO.getDevType()); + if (devType.getName().equals("PQ-COM")) { + path = "/model/report_table - PQ-COM.docx"; + } + ClassPathResource resource = new ClassPathResource(path); + XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream()); + + SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam(); + singleNonHarmParam.setPlanCode(devReportParam.getPlanCode()); + singleNonHarmParam.setDevId(pqDevVO.getId()); + singleNonHarmParam.setChannelNo(i); + // 获取数据 Map dataModelMap = new HashMap<>(16); // 读取模板文件中的占位符 @@ -2178,11 +2196,20 @@ public class PqReportServiceImpl extends ServiceImpl i List adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i); // 填充数据 + int finalI = i; indexKeysMap.forEach((index, keys) -> { String s1 = keys.stream().findFirst().get(); // 谐波类 if (DetectionCodeEnum.V2_50.getCode().equals(s1) || DetectionCodeEnum.I2_50.getCode().equals(s1) || DetectionCodeEnum.SV_1_49.getCode().equals(s1) || DetectionCodeEnum.SI_1_49.getCode().equals(s1)) { - fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index); + // 查找一下U1 + double u1 = 57.74; + List rawData = adHarmonicService.listAllRawData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + finalI); + AdHarmonicResult adHarmonicResult = rawData.stream().filter(obj -> obj.getAdType().equals(DetectionCodeEnum.V2_50.getCode())).sorted((obj1, obj2) -> obj2.getTimeId().compareTo(obj1.getTimeId())).findFirst().orElse(null); + if (ObjectUtil.isNotNull(adHarmonicResult)) { + String aValue1 = adHarmonicResult.getAValue1(); + u1 = Double.parseDouble(aValue1); + } + fillMapValueHarm(adHarmonicResultList, dataModelMap, keys, index, u1); } else { // 非谐波类 if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) { @@ -2250,14 +2277,14 @@ public class PqReportServiceImpl extends ServiceImpl i * @param keys key * @param index index */ - private void fillMapValueHarm(List allHarmonicResultList, Map dataModelMap, Set keys, String index) { + private void fillMapValueHarm(List allHarmonicResultList, Map dataModelMap, Set keys, String index, double baseValue) { keys.forEach(key -> { List resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(resultList)) { SimAndDigHarmonicResult adHarmonicResult = resultList.get(0); if (Objects.nonNull(adHarmonicResult)) { if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) { - fillHarm(dataModelMap, adHarmonicResult, index, key, 57.74, 100); + fillHarm(dataModelMap, adHarmonicResult, index, key, baseValue, 100); } if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) { fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1); diff --git a/entrance/src/main/resources/application.yml b/entrance/src/main/resources/application.yml index c9048e7d..88266258 100644 --- a/entrance/src/main/resources/application.yml +++ b/entrance/src/main/resources/application.yml @@ -6,12 +6,12 @@ spring: datasource: druid: driver-class-name: com.mysql.cj.jdbc.Driver -# 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_nx?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true + url: jdbc:mysql://192.168.1.24:13306/pqs9100_2f?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai username: root password: njcnpqs +# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT +# username: root +# password: root #初始化建立物理连接的个数、最小、最大连接数 initial-size: 5 min-idle: 5 @@ -38,12 +38,14 @@ mybatis-plus: #配置sql日志输出 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #关闭日志输出 - # log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl +# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl global-config: db-config: #指定主键生成策略 id-type: assign_uuid +phaseAngle: + isEnable: false socket: source: @@ -85,6 +87,7 @@ log: report: template: D:\template reportDir: D:\report + dateFormat: yyyy年MM月dd日 data: homeDir: D:\data qr: diff --git a/entrance/src/main/resources/model/NPQS-580.docx b/entrance/src/main/resources/model/NPQS-580.docx index ed0c7853..361c6c5c 100644 Binary files a/entrance/src/main/resources/model/NPQS-580.docx and b/entrance/src/main/resources/model/NPQS-580.docx differ diff --git a/entrance/src/main/resources/model/NPQS680.docx b/entrance/src/main/resources/model/NPQS680.docx index 4a8620a3..fb8e7730 100644 Binary files a/entrance/src/main/resources/model/NPQS680.docx and b/entrance/src/main/resources/model/NPQS680.docx differ diff --git a/entrance/src/main/resources/model/PQ-COM.docx b/entrance/src/main/resources/model/PQ-COM.docx index abd178ed..a421ec07 100644 Binary files a/entrance/src/main/resources/model/PQ-COM.docx and b/entrance/src/main/resources/model/PQ-COM.docx differ diff --git a/entrance/src/main/resources/model/PQV-700.docx b/entrance/src/main/resources/model/PQV-700.docx index 7d310707..a230d05e 100644 Binary files a/entrance/src/main/resources/model/PQV-700.docx and b/entrance/src/main/resources/model/PQV-700.docx differ diff --git a/entrance/src/main/resources/model/njcn_882.docx b/entrance/src/main/resources/model/njcn_882.docx index d7b3d83c..96aaf094 100644 Binary files a/entrance/src/main/resources/model/njcn_882.docx and b/entrance/src/main/resources/model/njcn_882.docx differ diff --git a/entrance/src/main/resources/model/njcn_882A.docx b/entrance/src/main/resources/model/njcn_882A.docx index fac34146..13ad3073 100644 Binary files a/entrance/src/main/resources/model/njcn_882A.docx and b/entrance/src/main/resources/model/njcn_882A.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B1.docx b/entrance/src/main/resources/model/njcn_882B1.docx index c87f11b7..895a3b2f 100644 Binary files a/entrance/src/main/resources/model/njcn_882B1.docx and b/entrance/src/main/resources/model/njcn_882B1.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B2.docx b/entrance/src/main/resources/model/njcn_882B2.docx index d0c21f06..19fb0a78 100644 Binary files a/entrance/src/main/resources/model/njcn_882B2.docx and b/entrance/src/main/resources/model/njcn_882B2.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B3.docx b/entrance/src/main/resources/model/njcn_882B3.docx index 2b1f2f6f..cc155213 100644 Binary files a/entrance/src/main/resources/model/njcn_882B3.docx and b/entrance/src/main/resources/model/njcn_882B3.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B4.docx b/entrance/src/main/resources/model/njcn_882B4.docx index 08b2dd44..0c7d191c 100644 Binary files a/entrance/src/main/resources/model/njcn_882B4.docx and b/entrance/src/main/resources/model/njcn_882B4.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B5.docx b/entrance/src/main/resources/model/njcn_882B5.docx index e1b9185e..8758bc59 100644 Binary files a/entrance/src/main/resources/model/njcn_882B5.docx and b/entrance/src/main/resources/model/njcn_882B5.docx differ diff --git a/entrance/src/main/resources/model/njcn_882B6.docx b/entrance/src/main/resources/model/njcn_882B6.docx index e3e58aa1..326f7874 100644 Binary files a/entrance/src/main/resources/model/njcn_882B6.docx and b/entrance/src/main/resources/model/njcn_882B6.docx differ diff --git a/entrance/src/main/resources/model/report_table - PQ-COM.docx b/entrance/src/main/resources/model/report_table - PQ-COM.docx new file mode 100644 index 00000000..bffc3ace Binary files /dev/null and b/entrance/src/main/resources/model/report_table - PQ-COM.docx differ diff --git a/license.key b/license.key new file mode 100644 index 00000000..2770bedc --- /dev/null +++ b/license.key @@ -0,0 +1 @@ +AoNUHvLQag9nPPxWDsf5EwwBqifh5wnoFjrU01w+kIA7TPdRl0AQDBSA3IU7AY28Liubt6Rl8CsDtxEDrz8L5m0FqQrmZ1TmIJtZWbBR16NxXRgf8izM5JurYEY6ZbjU021yCu0fitxB0DJZ8LB8zfUDsV1MFGHl+yPjh4ZQrYDffID4rk/mRe/EE6F7bS19upStSOnQxVQVJSXwCVVHgsuFXqiuagM21OmxpYNjqaPnvAKoHRXTTxXn9BrSgZBocxuHB/IE+a0a+Q2eQo4RZa2IQpneEA/QIKEqezqsABxmM33duQ4eKt17hAttISV1J0R1cKpwZ4tYuSoHCuMONA== \ No newline at end of file