Merge branch 'qr_branch'

# Conflicts:
#	detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java
#	detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java
#	detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java
#	detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java
#	detection/src/main/java/com/njcn/gather/report/utils/BookmarkUtil.java
#	detection/src/main/java/com/njcn/gather/report/utils/Docx4jUtil.java
#	detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java
#	entrance/src/main/resources/application.yml
This commit is contained in:
caozehui
2025-12-22 08:52:13 +08:00
19 changed files with 49 additions and 12 deletions

View File

@@ -688,7 +688,7 @@ public class SocketDevResponseService {
*/ */
private Double reduceList(List<Double> valList) { private Double reduceList(List<Double> valList) {
// valList.subList(0, 5).clear(); // 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(); return valList.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
} }

View File

@@ -809,6 +809,9 @@ public class DetectionServiceImpl {
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData a = setDetectionData(isQualified, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A, scale); 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.setAValue(JSON.toJSONString(a));
result.setTValue(JSON.toJSONString(a)); result.setTValue(JSON.toJSONString(a));
result.setResultFlag(a.getIsData()); result.setResultFlag(a.getIsData());

View File

@@ -39,7 +39,10 @@ public enum BaseReportKeyEnum {
CREATE_DATE("createDate","生产日期"), CREATE_DATE("createDate","生产日期"),
TEMPERATURE("temp","温度"), TEMPERATURE("temp","温度"),
HUMIDITY("hum","相对湿度"), HUMIDITY("hum","相对湿度"),
DELEGATE("delegate","委托方"); DELEGATE("delegate","委托方"),
CREATEDATE("createDate","出厂日期"),
HW_VERSION("hardwareVersion","硬件版本"),
SW_VERSION("softwareVersion","软件版本");
private String key; private String key;

View File

@@ -2020,6 +2020,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
baseModelMap.put(BaseReportKeyEnum.DEV_TYPE.getKey(), devType.getName()); baseModelMap.put(BaseReportKeyEnum.DEV_TYPE.getKey(), devType.getName());
// 检测员 // 检测员
baseModelMap.put(BaseReportKeyEnum.INSPECTOR.getKey(), pqDevVO.getCheckBy() + ""); 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) { if (pqDevVO.getCheckTime() != null) {
baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN)); baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(pqDevVO.getCheckTime(), DatePattern.CHINESE_DATE_PATTERN));
@@ -2059,7 +2065,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
// 实验室温度 // 实验室温度
baseModelMap.put(BaseReportKeyEnum.TEMPERATURE.getKey(), Objects.isNull(pqDevVO.getTemperature()) ? StrPool.TAB : pqDevVO.getTemperature().toString()); 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()); baseModelMap.put(BaseReportKeyEnum.SAMPLE_ID.getKey(), StrUtil.isEmpty(pqDevVO.getSampleId()) ? StrPool.TAB : pqDevVO.getSampleId());
@@ -2160,7 +2166,19 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
private void dealDataModel(List<InputStream> wordFileInputStreams, DevReportParam devReportParam, PqDevVO pqDevVO) throws Exception { private void dealDataModel(List<InputStream> wordFileInputStreams, DevReportParam devReportParam, PqDevVO pqDevVO) throws Exception {
Integer devChns = pqDevVO.getDevChns(); Integer devChns = pqDevVO.getDevChns();
for (int i = 1; i <= devChns; i++) { 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<String, String> dataModelMap = new HashMap<>(16); Map<String, String> dataModelMap = new HashMap<>(16);
// 读取模板文件中的占位符 // 读取模板文件中的占位符
@@ -2178,11 +2196,20 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
List<SimAndDigHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i); List<SimAndDigHarmonicResult> adHarmonicResultList = adHarmonicService.listAllResultData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + i);
// 填充数据 // 填充数据
int finalI = i;
indexKeysMap.forEach((index, keys) -> { indexKeysMap.forEach((index, keys) -> {
String s1 = keys.stream().findFirst().get(); 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)) { 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<AdHarmonicResult> 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 { } else {
// 非谐波类 // 非谐波类
if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) { if (DetectionCodeEnum.V_UNBAN.getCode().equals(s1) || DetectionCodeEnum.FREQ.getCode().equals(s1)) {
@@ -2250,14 +2277,14 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
* @param keys key * @param keys key
* @param index index * @param index index
*/ */
private void fillMapValueHarm(List<SimAndDigHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index) { private void fillMapValueHarm(List<SimAndDigHarmonicResult> allHarmonicResultList, Map<String, String> dataModelMap, Set<String> keys, String index, double baseValue) {
keys.forEach(key -> { keys.forEach(key -> {
List<SimAndDigHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList()); List<SimAndDigHarmonicResult> resultList = allHarmonicResultList.stream().filter(obj -> obj.getAdType().equals(key) && obj.getSort().toString().equals(index)).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(resultList)) { if (CollectionUtil.isNotEmpty(resultList)) {
SimAndDigHarmonicResult adHarmonicResult = resultList.get(0); SimAndDigHarmonicResult adHarmonicResult = resultList.get(0);
if (Objects.nonNull(adHarmonicResult)) { if (Objects.nonNull(adHarmonicResult)) {
if (DetectionCodeEnum.V2_50.getCode().equals(key) || DetectionCodeEnum.SV_1_49.getCode().equals(key)) { 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)) { if (DetectionCodeEnum.I2_50.getCode().equals(key) || DetectionCodeEnum.SI_1_49.getCode().equals(key)) {
fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1); fillHarm(dataModelMap, adHarmonicResult, index, key, 1, 1);

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/pqs91002?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://192.168.1.24:13306/pqs9100_nx?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
@@ -38,12 +38,14 @@ mybatis-plus:
#配置sql日志输出 #配置sql日志输出
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 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: global-config:
db-config: db-config:
#指定主键生成策略 #指定主键生成策略
id-type: assign_uuid id-type: assign_uuid
phaseAngle:
isEnable: false
socket: socket:
source: source:
@@ -85,6 +87,7 @@ log:
report: report:
template: D:\template template: D:\template
reportDir: D:\report reportDir: D:\report
dateFormat: yyyy年MM月dd日
data: data:
homeDir: D:\data homeDir: D:\data
qr: qr:

1
license.key Normal file
View File

@@ -0,0 +1 @@
AoNUHvLQag9nPPxWDsf5EwwBqifh5wnoFjrU01w+kIA7TPdRl0AQDBSA3IU7AY28Liubt6Rl8CsDtxEDrz8L5m0FqQrmZ1TmIJtZWbBR16NxXRgf8izM5JurYEY6ZbjU021yCu0fitxB0DJZ8LB8zfUDsV1MFGHl+yPjh4ZQrYDffID4rk/mRe/EE6F7bS19upStSOnQxVQVJSXwCVVHgsuFXqiuagM21OmxpYNjqaPnvAKoHRXTTxXn9BrSgZBocxuHB/IE+a0a+Q2eQo4RZa2IQpneEA/QIKEqezqsABxmM33duQ4eKt17hAttISV1J0R1cKpwZ4tYuSoHCuMONA==