Compare commits
92 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fa7ec91c4 | ||
|
|
fdb4b7060a | ||
| 3f47b0f008 | |||
|
|
cb431b5af1 | ||
|
|
153428b24f | ||
|
|
d92544f7c4 | ||
|
|
3f1ae1886a | ||
|
|
af4863af65 | ||
|
|
4b7c1259a7 | ||
|
|
de1496389e | ||
| 79003cd0f4 | |||
|
|
c3443fcc91 | ||
|
|
5105e77823 | ||
|
|
eb068b76a4 | ||
| 9f11f7ec11 | |||
| 2012221b73 | |||
|
|
9ab5d42439 | ||
| 7abcaefeb1 | |||
|
|
f4df52dd1c | ||
| db115bb27d | |||
|
|
68d96e67aa | ||
| 3f94012faa | |||
| 41c557118c | |||
| 6596a572d6 | |||
| 139c7b0651 | |||
|
|
ab236cd34f | ||
|
|
786bd5d660 | ||
|
|
21d2c2b7a7 | ||
|
|
48fa4c2390 | ||
|
|
033330b005 | ||
|
|
f81123c3f7 | ||
|
|
5539cb2887 | ||
|
|
1df9c8d703 | ||
|
|
1cbed2a620 | ||
| 89667367ea | |||
| 92b95dd86d | |||
|
|
6b7e38fef6 | ||
|
|
f10debe2f2 | ||
|
|
9d15351fba | ||
|
|
2339a006ec | ||
|
|
7fd904ab79 | ||
|
|
61f149b562 | ||
|
|
57ee3a4d43 | ||
| 563eb80b65 | |||
|
|
dae10378dd | ||
|
|
40cb153656 | ||
|
|
af4f000b13 | ||
|
|
f922ee97aa | ||
|
|
321ec97130 | ||
|
|
0dd3502942 | ||
|
|
26c5e933f5 | ||
|
|
00ba09faae | ||
|
|
40e39d651b | ||
|
|
02c8164b7e | ||
|
|
8c598aec1e | ||
|
|
2c59defdc2 | ||
|
|
5642bf2b31 | ||
|
|
ba76df66b0 | ||
|
|
57c419eb70 | ||
|
|
98f4ecef6c | ||
|
|
20e07712cb | ||
|
|
ac1d98efdc | ||
|
|
5d161acfad | ||
|
|
1534327f6f | ||
|
|
04ada8740a | ||
|
|
98cca582f6 | ||
|
|
a2de4b80a7 | ||
|
|
c7d8fc3168 | ||
|
|
071c6e3d64 | ||
| b4878d4a25 | |||
|
|
bb22857fc9 | ||
|
|
b0a4458c56 | ||
| 6357cde72b | |||
| dddffe43cb | |||
|
|
51fdf6bf59 | ||
|
|
b53ef274cf | ||
|
|
90d618b66f | ||
| e81413eaa9 | |||
| 33cefdd0b1 | |||
| 80a886a5eb | |||
| 0a85b433ba | |||
|
|
66786200bd | ||
| 15e93b6734 | |||
|
|
6843497908 | ||
|
|
cd486f419f | ||
|
|
7394762e28 | ||
|
|
2f75fe062b | ||
|
|
d4e09a09cf | ||
|
|
d58452012d | ||
|
|
014ac7931e | ||
|
|
6ef908ff60 | ||
|
|
7461801657 |
@@ -139,6 +139,12 @@
|
|||||||
<artifactId>report-generator</artifactId>
|
<artifactId>report-generator</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--激活工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.gather</groupId>
|
||||||
|
<artifactId>activate-tool</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -439,6 +439,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
//告诉前端当前项开始了
|
//告诉前端当前项开始了
|
||||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
|
FormalTestManager.currentIssue = sourceIssues.get(0);
|
||||||
String type = sourceIssues.get(0).getType();
|
String type = sourceIssues.get(0).getType();
|
||||||
if (ResultUnitEnum.P.getCode().equals(type)) {
|
if (ResultUnitEnum.P.getCode().equals(type)) {
|
||||||
sourceIssues.get(0).setType(ResultUnitEnum.V_ABSOLUTELY.getCode());
|
sourceIssues.get(0).setType(ResultUnitEnum.V_ABSOLUTELY.getCode());
|
||||||
@@ -612,7 +613,7 @@ public class SocketDevResponseService {
|
|||||||
|
|
||||||
private void assemblyEntity(List<DevData> deList, DevXiNumData.F F, DevXiNumData.GF startF, CoefficientVO coefficientVO, CoefficientVO.DevParameter devParameter) {
|
private void assemblyEntity(List<DevData> deList, DevXiNumData.F F, DevXiNumData.GF startF, CoefficientVO coefficientVO, CoefficientVO.DevParameter devParameter) {
|
||||||
//表示接收完成,必须保证3个数
|
//表示接收完成,必须保证3个数
|
||||||
if (deList.size() >= 3) {
|
if (deList.size() >= 7) {
|
||||||
List<Double> aList = deList.stream().map(it -> it.getSqlData().get(0).getList().getA()).collect(Collectors.toList());
|
List<Double> aList = deList.stream().map(it -> it.getSqlData().get(0).getList().getA()).collect(Collectors.toList());
|
||||||
List<Double> bList = deList.stream().map(it -> it.getSqlData().get(0).getList().getB()).collect(Collectors.toList());
|
List<Double> bList = deList.stream().map(it -> it.getSqlData().get(0).getList().getB()).collect(Collectors.toList());
|
||||||
List<Double> cList = deList.stream().map(it -> it.getSqlData().get(0).getList().getC()).collect(Collectors.toList());
|
List<Double> cList = deList.stream().map(it -> it.getSqlData().get(0).getList().getC()).collect(Collectors.toList());
|
||||||
@@ -687,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() - 3, valList.size() - 1).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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,6 +954,7 @@ public class SocketDevResponseService {
|
|||||||
} else {
|
} else {
|
||||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
||||||
}
|
}
|
||||||
|
FormalTestManager.currentIssue = sourceIssues.get(0);
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + type);
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + type);
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
@@ -1210,6 +1212,7 @@ public class SocketDevResponseService {
|
|||||||
} else {
|
} else {
|
||||||
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
webSocketVO.setRequestId(sourceIssues.get(0).getType() + CnSocketUtil.START_TAG);
|
||||||
}
|
}
|
||||||
|
FormalTestManager.currentIssue = sourceIssues.get(0);
|
||||||
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + type);
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + type);
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
@@ -1782,6 +1785,7 @@ public class SocketDevResponseService {
|
|||||||
} else {
|
} else {
|
||||||
dataRule = DictDataEnum.SECTION_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
|
FormalTestManager.currentTestPlan = plan;
|
||||||
|
|
||||||
String code = dictDataService.getDictDataById(plan.getPattern()).getCode();
|
String code = dictDataService.getDictDataById(plan.getPattern()).getCode();
|
||||||
FormalTestManager.patternEnum = PatternEnum.getEnum(code);
|
FormalTestManager.patternEnum = PatternEnum.getEnum(code);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.gather.detection.handler;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
|
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
|
||||||
@@ -14,7 +15,12 @@ import com.njcn.gather.detection.util.socket.*;
|
|||||||
import com.njcn.gather.detection.util.socket.websocket.WebServiceManager;
|
import com.njcn.gather.detection.util.socket.websocket.WebServiceManager;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||||
|
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||||
|
import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
|
||||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
|
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||||
|
import com.njcn.gather.source.service.IPqSourceService;
|
||||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -56,6 +62,8 @@ public class SocketSourceResponseService {
|
|||||||
* 设备信息服务,提供设备基础信息查询功能
|
* 设备信息服务,提供设备基础信息查询功能
|
||||||
*/
|
*/
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
|
private final IAdPlanSourceService adPlanSourceService;
|
||||||
|
private final IPqSourceService pqSourceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Socket连接管理器,负责管理设备和源的Socket连接
|
* Socket连接管理器,负责管理设备和源的Socket连接
|
||||||
@@ -334,9 +342,9 @@ public class SocketSourceResponseService {
|
|||||||
// 系数校验固定检测项:实时电压有效值和实时电流有效值
|
// 系数校验固定检测项:实时电压有效值和实时电流有效值
|
||||||
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$IRMS"));
|
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$IRMS"));
|
||||||
// 读取3次数据用于系数计算
|
// 读取3次数据用于系数计算
|
||||||
phaseSequenceParam.setReadCount(3);
|
phaseSequenceParam.setReadCount(7); //3
|
||||||
// 忽略前4次数据,等待测量稳定
|
// 忽略前4次数据,等待测量稳定
|
||||||
phaseSequenceParam.setIgnoreCount(4);
|
phaseSequenceParam.setIgnoreCount(3); //4
|
||||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
@@ -363,18 +371,32 @@ public class SocketSourceResponseService {
|
|||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
switch (dictDataEnumByCode) {
|
switch (dictDataEnumByCode) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//todo 前端推送收到的消息暂未处理好
|
if (FormalTestManager.unknownError) {
|
||||||
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
FormalTestManager.unknownError = false;
|
||||||
//开始设备通讯检测(发送设备初始化)
|
|
||||||
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
//重新下发脚本
|
||||||
map.put("deviceList", FormalTestManager.devList);
|
String type = FormalTestManager.currentIssue.getType();
|
||||||
String jsonString = JSON.toJSONString(map);
|
if (ResultUnitEnum.P.getCode().equals(type)) {
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
FormalTestManager.currentIssue.setType(ResultUnitEnum.V_ABSOLUTELY.getCode());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
}
|
||||||
socketMsg.setData(jsonString);
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
String json = JSON.toJSONString(socketMsg);
|
socketMsg.setData(JSON.toJSONString(FormalTestManager.currentIssue));
|
||||||
// 使用智能发送工具类,自动管理设备连接
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + type);
|
||||||
socketManager.smartSendToDevice(param, json);
|
SocketManager.sendMsg(param.getUserPageId() + CnSocketUtil.SOURCE_TAG, JSON.toJSONString(socketMsg));
|
||||||
|
} else {
|
||||||
|
//todo 前端推送收到的消息暂未处理好
|
||||||
|
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
||||||
|
//开始设备通讯检测(发送设备初始化)
|
||||||
|
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||||
|
map.put("deviceList", FormalTestManager.devList);
|
||||||
|
String jsonString = JSON.toJSONString(map);
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
||||||
|
socketMsg.setData(jsonString);
|
||||||
|
String json = JSON.toJSONString(socketMsg);
|
||||||
|
// 使用智能发送工具类,自动管理设备连接
|
||||||
|
socketManager.smartSendToDevice(param, json);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
||||||
@@ -570,6 +592,10 @@ public class SocketSourceResponseService {
|
|||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
||||||
break;
|
break;
|
||||||
|
case UNKNOWN_ERROR: //-1源未知异常
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
FormalTestManager.unknownError = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sendErrorAndQuit(param, socketDataMsg, dictDataEnumByCode);
|
sendErrorAndQuit(param, socketDataMsg, dictDataEnumByCode);
|
||||||
break;
|
break;
|
||||||
@@ -601,9 +627,23 @@ public class SocketSourceResponseService {
|
|||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//通讯校验成功
|
if (FormalTestManager.unknownError) {
|
||||||
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
//获取源初始化参数
|
||||||
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
AdPlanSource planSource = adPlanSourceService.getOne(new LambdaQueryWrapper<AdPlanSource>().eq(AdPlanSource::getPlanId, param.getPlanId()));
|
||||||
|
SourceInitialize sourceParam = pqSourceService.getSourceInitializeParam(planSource.getSourceId());
|
||||||
|
if (ObjectUtil.isNotNull(sourceParam)) {
|
||||||
|
SocketMsg<String> socketMsg1 = new SocketMsg<>();
|
||||||
|
socketMsg1.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||||
|
socketMsg1.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
|
socketMsg1.setData(JSON.toJSONString(sourceParam));
|
||||||
|
//使用智能发送工具类,自动管理与源控程序的socket连接
|
||||||
|
socketManager.smartSendToSource(param, JSON.toJSONString(socketMsg1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//通讯校验成功
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + CnSocketUtil.SOURCE_TAG);
|
||||||
|
sendWebSocketMessage(param.getUserPageId(), socketDataMsg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
break;
|
break;
|
||||||
@@ -653,6 +693,8 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
// 同步更新系数管理器中的设备列表
|
// 同步更新系数管理器中的设备列表
|
||||||
XiNumberManager.xiDevList = devList;
|
XiNumberManager.xiDevList = devList;
|
||||||
|
FormalTestManager.unknownError = false;
|
||||||
|
FormalTestManager.currentIssue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public enum SourceOperateCodeEnum {
|
|||||||
SERVER_ERROR("server_error","服务端主动关闭连接,请稍后再试"),
|
SERVER_ERROR("server_error","服务端主动关闭连接,请稍后再试"),
|
||||||
DEVICE_ERROR("device_error","设备主动关闭连接,请稍后再试"),
|
DEVICE_ERROR("device_error","设备主动关闭连接,请稍后再试"),
|
||||||
|
|
||||||
|
FLICKER_DATA_CHECK("flicker_data_check","闪变数据校验"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ public enum SourceResponseCodeEnum {
|
|||||||
FAIL(25002,"失败"),
|
FAIL(25002,"失败"),
|
||||||
ALL_FAIL(25003,"校验失败"),
|
ALL_FAIL(25003,"校验失败"),
|
||||||
RECEIVE_DATA_TIME_OUT(25004,"接收数据超时"),
|
RECEIVE_DATA_TIME_OUT(25004,"接收数据超时"),
|
||||||
REAL_DATA_CHECK_FAIL(25005,"实时数据校验失败"),
|
REAL_DATA_CHECK_FAIL(25005,"实时数据不符合"),
|
||||||
STATISTICS_DATA_CHECK_FAIL(25006,"统计数据校验失败")
|
STATISTICS_DATA_CHECK_FAIL(25006,"统计数据不符合"),
|
||||||
|
FLICKER_DATA_START(25007,"开始接收闪变数据")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,4 +43,9 @@ public class ContrastDetectionParam {
|
|||||||
private List<Boolean> testItemList;
|
private List<Boolean> testItemList;
|
||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否进行相许校验
|
||||||
|
*/
|
||||||
|
private Integer phaseCheck;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,9 @@ public class DetectionData {
|
|||||||
* 误差体系详情ID(比对式使用)
|
* 误差体系详情ID(比对式使用)
|
||||||
*/
|
*/
|
||||||
private String errorDtlId;
|
private String errorDtlId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效组数
|
||||||
|
*/
|
||||||
|
private Integer validGroupNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
@@ -1567,6 +1570,9 @@ public class DetectionServiceImpl {
|
|||||||
private Map<String, Integer> singleMonitorProcessing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Integer num, String code, Integer waveNum, DataSourceEnum dataSourceEnum) {
|
private Map<String, Integer> singleMonitorProcessing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Integer num, String code, Integer waveNum, DataSourceEnum dataSourceEnum) {
|
||||||
Map<String, Integer> resultMap = new HashMap<>();
|
Map<String, Integer> resultMap = new HashMap<>();
|
||||||
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(testItemCodeList)) {
|
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(testItemCodeList)) {
|
||||||
|
devDataList = devDataList.stream().sorted(Comparator.comparing(DevData::getTime)).collect(Collectors.toList());
|
||||||
|
standardDevDataList = standardDevDataList.stream().sorted(Comparator.comparing(DevData::getTime)).collect(Collectors.toList());
|
||||||
|
// 处理谐波数据
|
||||||
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
||||||
String[] split1 = devDataList.get(0).getId().split("_");
|
String[] split1 = devDataList.get(0).getId().split("_");
|
||||||
String devMonitorId = devIdMapComm.get(split1[0]) + "_" + split1[1];
|
String devMonitorId = devIdMapComm.get(split1[0]) + "_" + split1[1];
|
||||||
@@ -1605,13 +1611,13 @@ public class DetectionServiceImpl {
|
|||||||
|
|
||||||
switch (anEnum) {
|
switch (anEnum) {
|
||||||
case FREQ:
|
case FREQ:
|
||||||
if (ObjectUtil.isNull(waveNum)) {
|
// if (ObjectUtil.isNull(waveNum)) {
|
||||||
devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
|
// devDataList.stream().forEach(devData -> devData.getSqlData().stream().filter(sqlData -> sqlData.getDesc().equals(DetectionCodeEnum.FREQ.getCode())).findFirst().ifPresent(sqlData -> {
|
||||||
DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
|
// DevData.SqlDataDTO.ListDTO listDTO = sqlData.getList();
|
||||||
listDTO.setT(55.0);
|
// listDTO.setT(55.0);
|
||||||
sqlData.setList(listDTO);
|
// sqlData.setList(listDTO);
|
||||||
}));
|
// }));
|
||||||
}
|
// }
|
||||||
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
|
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
|
||||||
break;
|
break;
|
||||||
case VRMS:
|
case VRMS:
|
||||||
@@ -1654,7 +1660,7 @@ public class DetectionServiceImpl {
|
|||||||
resultMap.put(PowerIndexEnum.HSI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
|
resultMap.put(PowerIndexEnum.HSI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
|
||||||
break;
|
break;
|
||||||
case PST:
|
case PST:
|
||||||
resultMap.put(PowerIndexEnum.PST.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn , DetectionCodeEnum.PST.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, dataSourceEnum));
|
resultMap.put(PowerIndexEnum.F.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn, DetectionCodeEnum.PST.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum, DataSourceEnum.MINUTE_STATISTICS_AVG));
|
||||||
break;
|
break;
|
||||||
case UNKNOWN_ERROR:
|
case UNKNOWN_ERROR:
|
||||||
break;
|
break;
|
||||||
@@ -1750,8 +1756,16 @@ public class DetectionServiceImpl {
|
|||||||
result.setDataType(DataSourceEnum.WAVE_DATA.getValue());
|
result.setDataType(DataSourceEnum.WAVE_DATA.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, List<Double>> validData = this.getValidData(standardDevDataList, desc);
|
||||||
|
|
||||||
|
Integer validGroupNum = 0;
|
||||||
if (map.containsKey(TYPE_T)) {
|
if (map.containsKey(TYPE_T)) {
|
||||||
|
if (ObjectUtil.isNotNull(validData)) {
|
||||||
|
List<Double> tValidDataList = validData.get(TYPE_T);
|
||||||
|
validGroupNum = this.getValidGroupNum(tValidDataList, null, errSysDtls, fData, scale, dataRule);
|
||||||
|
}
|
||||||
List<DetectionData> tList = rangeComparisonList(map.get(TYPE_T).get(0), map.get(TYPE_T).get(1), errSysDtls, fData, scale, dataRule);
|
List<DetectionData> tList = rangeComparisonList(map.get(TYPE_T).get(0), map.get(TYPE_T).get(1), errSysDtls, fData, scale, dataRule);
|
||||||
|
this.setValidGroupNum(tList, validGroupNum);
|
||||||
result.setTValue(JSON.toJSONString(tList));
|
result.setTValue(JSON.toJSONString(tList));
|
||||||
result.setResultFlag(setResultFlag(tList));
|
result.setResultFlag(setResultFlag(tList));
|
||||||
} else {
|
} else {
|
||||||
@@ -1768,7 +1782,13 @@ public class DetectionServiceImpl {
|
|||||||
phases.add(TYPE_B);
|
phases.add(TYPE_B);
|
||||||
|
|
||||||
for (String phase : phases) {
|
for (String phase : phases) {
|
||||||
|
if (ObjectUtil.isNotNull(validData)) {
|
||||||
|
List<Double> validDataList = validData.get(phase);
|
||||||
|
validGroupNum = this.getValidGroupNum(validDataList, null, errSysDtls, fData, scale, dataRule);
|
||||||
|
}
|
||||||
|
|
||||||
List<DetectionData> phaseList = rangeComparisonList(map.get(phase).get(0), map.get(phase).get(1), errSysDtls, fData, scale, dataRule);
|
List<DetectionData> phaseList = rangeComparisonList(map.get(phase).get(0), map.get(phase).get(1), errSysDtls, fData, scale, dataRule);
|
||||||
|
this.setValidGroupNum(phaseList, validGroupNum);
|
||||||
resultFlag.addAll(phaseList);
|
resultFlag.addAll(phaseList);
|
||||||
BiConsumer<ContrastNonHarmonicResult, List<DetectionData>> setter = setters.get(phase);
|
BiConsumer<ContrastNonHarmonicResult, List<DetectionData>> setter = setters.get(phase);
|
||||||
setter.accept(result, phaseList);
|
setter.accept(result, phaseList);
|
||||||
@@ -1783,6 +1803,169 @@ public class DetectionServiceImpl {
|
|||||||
return StorageUtil.getInteger(resultFlag);
|
return StorageUtil.getInteger(resultFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, List<Double>> getValidData(List<DevData> dev, String desc) {
|
||||||
|
List<Double> aDev = new ArrayList<>();
|
||||||
|
List<Double> bDev = new ArrayList<>();
|
||||||
|
List<Double> cDev = new ArrayList<>();
|
||||||
|
List<Double> tDev = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < dev.size(); i++) {
|
||||||
|
List<DevData.SqlDataDTO> devSqlData = dev.get(i).getSqlData();
|
||||||
|
|
||||||
|
String finalDesc = desc;
|
||||||
|
List<DevData.SqlDataDTO.ListDTO> devList = devSqlData.stream().filter(j -> finalDesc.equals(j.getDesc()))
|
||||||
|
.map(DevData.SqlDataDTO::getList).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(devList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
aDev.addAll(devList.stream().filter(x -> ObjectUtil.isNotNull(x.getA()))
|
||||||
|
.map(x -> x.getA().doubleValue())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
bDev.addAll(devList.stream().filter(x -> ObjectUtil.isNotNull(x.getB()))
|
||||||
|
.map(x -> x.getB().doubleValue())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
cDev.addAll(devList.stream().filter(x -> ObjectUtil.isNotNull(x.getC()))
|
||||||
|
.map(x -> x.getC().doubleValue())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
tDev.addAll(devList.stream().filter(x -> ObjectUtil.isNotNull(x.getT()))
|
||||||
|
.map(x -> x.getT().doubleValue())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HashMap() {
|
||||||
|
{
|
||||||
|
put(TYPE_A, aDev);
|
||||||
|
put(TYPE_B, bDev);
|
||||||
|
put(TYPE_C, cDev);
|
||||||
|
put(TYPE_T, tDev);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Map<Double, List<Double>>> getHarmValidData(List<DevData> dev, String fundCode, String harmCode, Integer harmonicFlag) {
|
||||||
|
// key为相别、value{key为谐波次数,value为按数据处理原则处理后的数据}
|
||||||
|
Map<String, Map<Double, List<Double>>> devMap = new HashMap<>(3);
|
||||||
|
|
||||||
|
List<Double> harmNum = new ArrayList<>();
|
||||||
|
if (1 == harmonicFlag) {
|
||||||
|
harmNum.addAll(Stream.iterate(0.5, x -> x + 1.0).limit(50).collect(Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
harmNum.addAll(Stream.iterate(1.0, x -> x + 1.0).limit(50).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < dev.size(); i++) {
|
||||||
|
List<DevData.SqlDataDTO> devSqlData = dev.get(i).getSqlData();
|
||||||
|
|
||||||
|
Optional<DevData.SqlDataDTO> first1 = Optional.empty();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(devSqlData)) {
|
||||||
|
first1 = devSqlData.stream().filter(j -> fundCode.equals(j.getDesc())).collect(Collectors.toList()).stream().findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
DevData.SqlDataDTO fund1 = null;
|
||||||
|
if (first1.isPresent()) {
|
||||||
|
fund1 = first1.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DevData.SqlDataHarmDTO> devHarmList = dev.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(devHarmList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(devHarmList)) {
|
||||||
|
DevData.SqlDataHarmDTO devHarm = devHarmList.get(0);
|
||||||
|
if (ObjectUtil.isNotNull(fund1)) {
|
||||||
|
harmPut(TYPE_A, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getA()), harmonicFlag);
|
||||||
|
harmPut(TYPE_B, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getB()), harmonicFlag);
|
||||||
|
harmPut(TYPE_C, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getC()), harmonicFlag);
|
||||||
|
} else {
|
||||||
|
harmPut(TYPE_A, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
harmPut(TYPE_B, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
harmPut(TYPE_C, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return devMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getValidGroupNum(List<Double> devDataList, List<Double> U1List, List<PqErrSysDtls> errSysDtls, Double fData, Integer scale, DictDataEnum dataRule) {
|
||||||
|
int result = 0;
|
||||||
|
if (dataRule.getCode().equals(DictDataEnum.Own_value.getCode()) || dataRule.getCode().equals(DictDataEnum.SECTION_VALUE.getCode())) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < devDataList.size(); i++) {
|
||||||
|
Double U1 = CollUtil.isNotEmpty(U1List) ? U1List.get(i) : null;
|
||||||
|
Double stdDevData = BigDecimal.valueOf(devDataList.get(i)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
Double devData = BigDecimal.valueOf(devDataList.get(i)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
DetectionData detectionData = new DetectionData();
|
||||||
|
detectionData.setIsData(ResultEnum.NO_ERROR_SYS.getValue());
|
||||||
|
|
||||||
|
//获得误差体系
|
||||||
|
List<PqErrSysDtls> errSysDtls1 = errSysDtls.stream().filter(x -> rangeComparison(startRadiusEnd(x.getStartValue(), fData, stdDevData, x.getConditionType(), scale),
|
||||||
|
x.getStartFlag(),
|
||||||
|
startRadiusEnd(x.getEndValue(), fData, stdDevData, x.getConditionType(), scale),
|
||||||
|
x.getEndFlag(),
|
||||||
|
ObjectUtil.isNotNull(U1) ? stdDevData * U1 * 0.01 : stdDevData)).collect(Collectors.toList());
|
||||||
|
detectionData.setData(devData);
|
||||||
|
detectionData.setResultData(stdDevData);
|
||||||
|
if (CollUtil.isNotEmpty(errSysDtls1)) {
|
||||||
|
result++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Double, Integer> getHarmValidGroupNum(Map<Double, List<Double>> devDataMap, List<Double> U1List, List<PqErrSysDtls> errSysDtls, Double fData, Integer scale, DictDataEnum dataRule) {
|
||||||
|
Map<Double, Integer> resultMap = new HashMap<>();
|
||||||
|
devDataMap.forEach((harmNum, dataList) -> {
|
||||||
|
if (dataRule.getCode().equals(DictDataEnum.Own_value.getCode()) || dataRule.getCode().equals(DictDataEnum.SECTION_VALUE.getCode())) {
|
||||||
|
resultMap.put(harmNum, 1);
|
||||||
|
} else {
|
||||||
|
Integer validGroupNum = 0;
|
||||||
|
for (int i = 0; i < dataList.size(); i++) {
|
||||||
|
Double U1 = CollUtil.isNotEmpty(U1List) ? U1List.get(i) : null;
|
||||||
|
Double stdDevData = BigDecimal.valueOf(dataList.get(i)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
Double devData = BigDecimal.valueOf(dataList.get(i)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
DetectionData detectionData = new DetectionData();
|
||||||
|
detectionData.setIsData(ResultEnum.NO_ERROR_SYS.getValue());
|
||||||
|
|
||||||
|
//获得误差体系
|
||||||
|
List<PqErrSysDtls> errSysDtls1 = errSysDtls.stream().filter(x -> rangeComparison(startRadiusEnd(x.getStartValue(), fData, stdDevData, x.getConditionType(), scale),
|
||||||
|
x.getStartFlag(),
|
||||||
|
startRadiusEnd(x.getEndValue(), fData, stdDevData, x.getConditionType(), scale),
|
||||||
|
x.getEndFlag(),
|
||||||
|
ObjectUtil.isNotNull(U1) ? stdDevData * U1 * 0.01 : stdDevData)).collect(Collectors.toList());
|
||||||
|
detectionData.setData(devData);
|
||||||
|
detectionData.setResultData(stdDevData);
|
||||||
|
if (CollUtil.isNotEmpty(errSysDtls1)) {
|
||||||
|
validGroupNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resultMap.put(harmNum, validGroupNum);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setValidGroupNum(List<DetectionData> tList, Integer validGroupNum) {
|
||||||
|
tList.forEach(detectionData -> {
|
||||||
|
detectionData.setValidGroupNum(validGroupNum);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setHarmValidGroupNum(List<DetectionData> integerBooleanA, Map<Double, Integer> harmValidGroupNumA) {
|
||||||
|
integerBooleanA.forEach(detectionData -> {
|
||||||
|
Double harmNum = detectionData.getNum();
|
||||||
|
Integer validGroupNum = harmValidGroupNumA.get(harmNum);
|
||||||
|
detectionData.setValidGroupNum(validGroupNum);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理谐波数据
|
* 处理谐波数据
|
||||||
@@ -1852,6 +2035,9 @@ public class DetectionServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<Map<Double, List<Double>>>> devMap = devHarmListMap(devDataList, standardDevDataList, fundCode, harmCode, harmonicFlag, dataRule);
|
Map<String, List<Map<Double, List<Double>>>> devMap = devHarmListMap(devDataList, standardDevDataList, fundCode, harmCode, harmonicFlag, dataRule);
|
||||||
|
if (ObjectUtil.isNull(devMap)) {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
ContrastHarmonicResult result = new ContrastHarmonicResult();
|
ContrastHarmonicResult result = new ContrastHarmonicResult();
|
||||||
result.setWaveNum(waveNum);
|
result.setWaveNum(waveNum);
|
||||||
|
|
||||||
@@ -1866,9 +2052,22 @@ public class DetectionServiceImpl {
|
|||||||
result.setDataType(DataSourceEnum.WAVE_DATA.getValue());
|
result.setDataType(DataSourceEnum.WAVE_DATA.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Map<Double, List<Double>>> harmValidData = this.getHarmValidData(standardDevDataList, fundCode, harmCode, harmonicFlag);
|
||||||
|
|
||||||
List<DetectionData> integerBooleanA = harmRangeComparison(devMap.get(TYPE_A).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale, dataRule);
|
List<DetectionData> integerBooleanA = harmRangeComparison(devMap.get(TYPE_A).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||||
List<DetectionData> integerBooleanB = harmRangeComparison(devMap.get(TYPE_B).get(0), devMap.get(TYPE_B).get(1), errSysDtls, type, fData, scale, dataRule);
|
List<DetectionData> integerBooleanB = harmRangeComparison(devMap.get(TYPE_B).get(0), devMap.get(TYPE_B).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||||
List<DetectionData> integerBooleanC = harmRangeComparison(devMap.get(TYPE_C).get(0), devMap.get(TYPE_C).get(1), errSysDtls, type, fData, scale, dataRule);
|
List<DetectionData> integerBooleanC = harmRangeComparison(devMap.get(TYPE_C).get(0), devMap.get(TYPE_C).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||||
|
|
||||||
|
Map<String, Map<Double, List<Double>>> U1ListMap = this.getU1ListMap(standardDevDataList, fundCode, harmCode, harmonicFlag);
|
||||||
|
Map<Double, Integer> harmValidGroupNumA = this.getHarmValidGroupNum(harmValidData.get(TYPE_A), U1ListMap.get(TYPE_A).get(0.0), errSysDtls, fData, scale, dataRule);
|
||||||
|
this.setHarmValidGroupNum(integerBooleanA, harmValidGroupNumA);
|
||||||
|
|
||||||
|
Map<Double, Integer> harmValidGroupNumB = this.getHarmValidGroupNum(harmValidData.get(TYPE_B), U1ListMap.get(TYPE_B).get(0.0), errSysDtls, fData, scale, dataRule);
|
||||||
|
this.setHarmValidGroupNum(integerBooleanB, harmValidGroupNumB);
|
||||||
|
|
||||||
|
Map<Double, Integer> harmValidGroupNumC = this.getHarmValidGroupNum(harmValidData.get(TYPE_C), U1ListMap.get(TYPE_C).get(0.0), errSysDtls, fData, scale, dataRule);
|
||||||
|
this.setHarmValidGroupNum(integerBooleanC, harmValidGroupNumC);
|
||||||
|
|
||||||
reflectHarmonic(true, "a", integerBooleanA, result, harmonicFlag);
|
reflectHarmonic(true, "a", integerBooleanA, result, harmonicFlag);
|
||||||
reflectHarmonic(true, "b", integerBooleanB, result, harmonicFlag);
|
reflectHarmonic(true, "b", integerBooleanB, result, harmonicFlag);
|
||||||
reflectHarmonic(true, "c", integerBooleanC, result, harmonicFlag);
|
reflectHarmonic(true, "c", integerBooleanC, result, harmonicFlag);
|
||||||
@@ -1885,6 +2084,59 @@ public class DetectionServiceImpl {
|
|||||||
return StorageUtil.getInteger(resultFlag);
|
return StorageUtil.getInteger(resultFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, Map<Double, List<Double>>> getU1ListMap(List<DevData> devDataList, String fundCode, String harmCode, Integer harmonicFlag) {
|
||||||
|
Map<String, Map<Double, List<Double>>> resultMap = new HashMap<>(3);
|
||||||
|
|
||||||
|
// key为相别、value{key为谐波次数,value为按数据处理原则处理后的数据}
|
||||||
|
Map<String, Map<Double, List<Double>>> devMap = new HashMap<>(3);
|
||||||
|
|
||||||
|
List<Double> harmNum = new ArrayList<>();
|
||||||
|
if (1 == harmonicFlag) {
|
||||||
|
harmNum.addAll(Stream.iterate(0.5, x -> x + 1.0).limit(50).collect(Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
harmNum.addAll(Stream.iterate(1.0, x -> x + 1.0).limit(50).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < devDataList.size(); i++) {
|
||||||
|
List<DevData.SqlDataDTO> standardDevSqlData = devDataList.get(i).getSqlData();
|
||||||
|
|
||||||
|
Optional<DevData.SqlDataDTO> first1 = Optional.empty();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(standardDevSqlData)) {
|
||||||
|
first1 = standardDevSqlData.stream().filter(j -> fundCode.equals(j.getDesc())).collect(Collectors.toList()).stream().findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
DevData.SqlDataDTO fund1 = null;
|
||||||
|
if (first1.isPresent()) {
|
||||||
|
fund1 = first1.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DevData.SqlDataHarmDTO> devHarmList = devDataList.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(devHarmList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(devHarmList)) {
|
||||||
|
DevData.SqlDataHarmDTO devHarm = devHarmList.get(0);
|
||||||
|
if (ObjectUtil.isNotNull(fund1)) {
|
||||||
|
harmPut(TYPE_A, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getA()), harmonicFlag);
|
||||||
|
harmPut(TYPE_B, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getB()), harmonicFlag);
|
||||||
|
harmPut(TYPE_C, devMap, harmNum, devHarm, String.valueOf(fund1.getList().getC()), harmonicFlag);
|
||||||
|
} else {
|
||||||
|
harmPut(TYPE_A, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
harmPut(TYPE_B, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
harmPut(TYPE_C, devMap, harmNum, devHarm, "1.0", harmonicFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resultMap.put(TYPE_A, devMap.get(TYPE_A));
|
||||||
|
resultMap.put(TYPE_B, devMap.get(TYPE_C));
|
||||||
|
resultMap.put(TYPE_C, devMap.get(TYPE_C));
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理非谐波类取值
|
* 处理非谐波类取值
|
||||||
@@ -1905,6 +2157,7 @@ public class DetectionServiceImpl {
|
|||||||
List<Double> cStandardDev = new ArrayList<>();
|
List<Double> cStandardDev = new ArrayList<>();
|
||||||
List<Double> tDev = new ArrayList<>();
|
List<Double> tDev = new ArrayList<>();
|
||||||
List<Double> tStandardDev = new ArrayList<>();
|
List<Double> tStandardDev = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < dev.size(); i++) {
|
for (int i = 0; i < dev.size(); i++) {
|
||||||
List<DevData.SqlDataDTO> devSqlData = dev.get(i).getSqlData();
|
List<DevData.SqlDataDTO> devSqlData = dev.get(i).getSqlData();
|
||||||
List<DevData.SqlDataDTO> standardDevSqlData = standardDev.get(i).getSqlData();
|
List<DevData.SqlDataDTO> standardDevSqlData = standardDev.get(i).getSqlData();
|
||||||
@@ -1949,66 +2202,66 @@ public class DetectionServiceImpl {
|
|||||||
.map(x -> x.getT().doubleValue())
|
.map(x -> x.getT().doubleValue())
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
List<Integer> aIdxs = DetectionUtil.sort(aDev, false);
|
List<Integer> aIdxs = DetectionUtil.sort(aStandardDev, false);
|
||||||
List<Integer> bIdxs = DetectionUtil.sort(bDev, false);
|
List<Integer> bIdxs = DetectionUtil.sort(bStandardDev, false);
|
||||||
List<Integer> cIdxs = DetectionUtil.sort(cDev, false);
|
List<Integer> cIdxs = DetectionUtil.sort(cStandardDev, false);
|
||||||
List<Integer> tIdxs = DetectionUtil.sort(tDev, false);
|
List<Integer> tIdxs = DetectionUtil.sort(tStandardDev, false);
|
||||||
switch (dataRule) {
|
switch (dataRule) {
|
||||||
case SECTION_VALUE:
|
case SECTION_VALUE:
|
||||||
if (aDev.size() > 2) {
|
if (aStandardDev.size() > 2) {
|
||||||
aDev.remove(aIdxs.get(0));
|
aStandardDev.remove(0);
|
||||||
aDev.remove(aIdxs.get(aIdxs.size() - 1));
|
aStandardDev.remove(aStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(aStandardDev, aIdxs.subList(1, aIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(aDev, aIdxs.subList(1, aIdxs.size() - 1));
|
||||||
aStandardDev.clear();
|
aDev.clear();
|
||||||
aStandardDev.addAll(newArray);
|
aDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bDev.size() > 2) {
|
if (bStandardDev.size() > 2) {
|
||||||
bDev.remove(bIdxs.get(0));
|
bStandardDev.remove(0);
|
||||||
bDev.remove(bIdxs.get(bIdxs.size() - 1));
|
bStandardDev.remove(bStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(bStandardDev, bIdxs.subList(1, bIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(bDev, bIdxs.subList(1, bIdxs.size() - 1));
|
||||||
bStandardDev.clear();
|
bDev.clear();
|
||||||
bStandardDev.addAll(newArray);
|
bDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cDev.size() > 2) {
|
if (cStandardDev.size() > 2) {
|
||||||
cDev.remove(cIdxs.get(0));
|
cStandardDev.remove(0);
|
||||||
cDev.remove(cIdxs.get(cIdxs.size() - 1));
|
cStandardDev.remove(cStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(cStandardDev, cIdxs.subList(1, cIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(cDev, cIdxs.subList(1, cIdxs.size() - 1));
|
||||||
cStandardDev.clear();
|
cDev.clear();
|
||||||
cStandardDev.addAll(newArray);
|
cDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tDev.size() > 2) {
|
if (tStandardDev.size() > 2) {
|
||||||
tDev.remove(tIdxs.get(0));
|
tStandardDev.remove(0);
|
||||||
tDev.remove(tIdxs.get(tIdxs.size() - 1));
|
tStandardDev.remove(tStandardDev.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(tStandardDev, tIdxs.subList(1, tIdxs.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(tDev, tIdxs.subList(1, tIdxs.size() - 1));
|
||||||
tStandardDev.clear();
|
tDev.clear();
|
||||||
tStandardDev.addAll(newArray);
|
tDev.addAll(newArray);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CP95_VALUE:
|
case CP95_VALUE:
|
||||||
if (CollUtil.isNotEmpty(aDev)) {
|
if (CollUtil.isNotEmpty(aStandardDev)) {
|
||||||
int cp95Idx = DetectionUtil.getCP95Idx(aDev);
|
int cp95Idx = DetectionUtil.getCP95Idx(aStandardDev);
|
||||||
aDev = Collections.singletonList(aDev.get(cp95Idx));
|
|
||||||
aStandardDev = Collections.singletonList(aStandardDev.get(cp95Idx));
|
aStandardDev = Collections.singletonList(aStandardDev.get(cp95Idx));
|
||||||
|
aDev = Collections.singletonList(aDev.get(aIdxs.get(cp95Idx)));
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(bDev)) {
|
if (CollUtil.isNotEmpty(bStandardDev)) {
|
||||||
int cp95Idx = DetectionUtil.getCP95Idx(bDev);
|
int cp95Idx = DetectionUtil.getCP95Idx(bStandardDev);
|
||||||
bDev = Collections.singletonList(bDev.get(cp95Idx));
|
|
||||||
bStandardDev = Collections.singletonList(bStandardDev.get(cp95Idx));
|
bStandardDev = Collections.singletonList(bStandardDev.get(cp95Idx));
|
||||||
|
bDev = Collections.singletonList(bDev.get(bIdxs.get(cp95Idx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(cDev)) {
|
if (CollUtil.isNotEmpty(cStandardDev)) {
|
||||||
int cp95Idx = DetectionUtil.getCP95Idx(cDev);
|
int cp95Idx = DetectionUtil.getCP95Idx(cStandardDev);
|
||||||
cDev = Collections.singletonList(cDev.get(cp95Idx));
|
|
||||||
cStandardDev = Collections.singletonList(cStandardDev.get(cp95Idx));
|
cStandardDev = Collections.singletonList(cStandardDev.get(cp95Idx));
|
||||||
|
cDev = Collections.singletonList(cDev.get(cIdxs.get(cp95Idx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(tDev)) {
|
if (CollUtil.isNotEmpty(tStandardDev)) {
|
||||||
int cp95Idx = DetectionUtil.getCP95Idx(tDev);
|
int cp95Idx = DetectionUtil.getCP95Idx(tStandardDev);
|
||||||
tDev = Collections.singletonList(tDev.get(cp95Idx));
|
|
||||||
tStandardDev = Collections.singletonList(tStandardDev.get(cp95Idx));
|
tStandardDev = Collections.singletonList(tStandardDev.get(cp95Idx));
|
||||||
|
tDev = Collections.singletonList(tDev.get(tIdxs.get(cp95Idx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2106,9 +2359,12 @@ public class DetectionServiceImpl {
|
|||||||
fund2 = first2.get();
|
fund2 = first2.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DevData.SqlDataHarmDTO> devHarmList = dev.get(i).getSqlDataHarm().stream().filter(x -> x.getDesc().equals(harmCode)).collect(Collectors.toList());
|
List<DevData.SqlDataHarmDTO> devHarmList = dev.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
|
||||||
List<DevData.SqlDataHarmDTO> stdDevHarmList = standardDev.get(i).getSqlDataHarm().stream().filter(x -> x.getDesc().equals(harmCode)).collect(Collectors.toList());
|
List<DevData.SqlDataHarmDTO> stdDevHarmList = standardDev.get(i).getSqlDataHarm().stream().filter(x -> harmCode.equals(x.getDesc())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(devHarmList) || CollUtil.isEmpty(stdDevHarmList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// // 如果角型接法中,不存在线电压谐波电压含有率,则取相电压谐波电压含有率进行计算
|
// // 如果角型接法中,不存在线电压谐波电压含有率,则取相电压谐波电压含有率进行计算
|
||||||
// if (CollUtil.isEmpty(devHarmList)) {
|
// if (CollUtil.isEmpty(devHarmList)) {
|
||||||
// if (DetectionCodeEnum.PV2_50.getCode().equals(harmCode)) {
|
// if (DetectionCodeEnum.PV2_50.getCode().equals(harmCode)) {
|
||||||
@@ -2147,18 +2403,18 @@ public class DetectionServiceImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
devMap.forEach((typeKey, typeValue) -> {
|
standardDevMap.forEach((typeKey, typeValue) -> {
|
||||||
typeValue.forEach((key, value) -> {
|
typeValue.forEach((key, value) -> {
|
||||||
if (CollUtil.isNotEmpty(value)) {
|
if (CollUtil.isNotEmpty(value)) {
|
||||||
List<Integer> idx = DetectionUtil.sort(value, false);
|
List<Integer> idx = DetectionUtil.sort(value, false);
|
||||||
switch (dataRule) {
|
switch (dataRule) {
|
||||||
case SECTION_VALUE:
|
case SECTION_VALUE:
|
||||||
if (value.size() > 2) {
|
if (value.size() > 2) {
|
||||||
value.remove(idx.get(0));
|
value.remove(0);
|
||||||
value.remove(idx.get(idx.size() - 1));
|
value.remove(value.size() - 1);
|
||||||
List<Double> newArray = DetectionUtil.getNewArray(standardDevMap.get(typeKey).get(key), idx.subList(1, idx.size() - 1));
|
List<Double> newArray = DetectionUtil.getNewArray(devMap.get(typeKey).get(key), idx.subList(1, idx.size() - 1));
|
||||||
standardDevMap.get(typeKey).get(key).clear();
|
devMap.get(typeKey).get(key).clear();
|
||||||
standardDevMap.get(typeKey).get(key).addAll(newArray);
|
devMap.get(typeKey).get(key).addAll(newArray);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CP95_VALUE:
|
case CP95_VALUE:
|
||||||
@@ -2167,18 +2423,18 @@ public class DetectionServiceImpl {
|
|||||||
List<Double> newValue = Collections.singletonList(value.get(cp95Idx));
|
List<Double> newValue = Collections.singletonList(value.get(cp95Idx));
|
||||||
value.clear();
|
value.clear();
|
||||||
value.addAll(newValue);
|
value.addAll(newValue);
|
||||||
Double standardCP95Data = standardDevMap.get(typeKey).get(key).get(cp95Idx);
|
Double devCP95Data = devMap.get(typeKey).get(key).get(idx.get(cp95Idx));
|
||||||
standardDevMap.get(typeKey).get(key).clear();
|
devMap.get(typeKey).get(key).clear();
|
||||||
standardDevMap.get(typeKey).get(key).add(standardCP95Data);
|
devMap.get(typeKey).get(key).add(devCP95Data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AVG_VALUE:
|
case AVG_VALUE:
|
||||||
List<Double> avgDoubles = DetectionUtil.getAvgDoubles(value);
|
List<Double> avgDoubles = DetectionUtil.getAvgDoubles(value);
|
||||||
value.clear();
|
value.clear();
|
||||||
value.addAll(avgDoubles);
|
value.addAll(avgDoubles);
|
||||||
List<Double> standardAvgData = DetectionUtil.getAvgDoubles(standardDevMap.get(typeKey).get(key));
|
List<Double> devAvgData = DetectionUtil.getAvgDoubles(devMap.get(typeKey).get(key));
|
||||||
standardDevMap.get(typeKey).get(key).clear();
|
devMap.get(typeKey).get(key).clear();
|
||||||
standardDevMap.get(typeKey).get(key).addAll(standardAvgData);
|
devMap.get(typeKey).get(key).addAll(devAvgData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
private final SocketManager socketManager;
|
private final SocketManager socketManager;
|
||||||
|
|
||||||
@Value("${log.homeDir}")
|
@Value("${report.reportDir}")
|
||||||
private String alignDataFilePath;
|
private String alignDataFilePath;
|
||||||
|
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportAlignData() {
|
public void exportAlignData() {
|
||||||
String fileName = "实时数据.xlsx";
|
String fileName = "对齐数据.xlsx";
|
||||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||||
response.reset();
|
response.reset();
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.njcn.gather.device.pojo.vo.PreDetection;
|
|||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
||||||
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -180,4 +181,31 @@ public class FormalTestManager {
|
|||||||
|
|
||||||
|
|
||||||
public static boolean isWaveCheck;
|
public static boolean isWaveCheck;
|
||||||
|
|
||||||
|
public static List<String> pstDataType;
|
||||||
|
|
||||||
|
public static boolean isPstData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否在检测中
|
||||||
|
*/
|
||||||
|
public static boolean isTesting;
|
||||||
|
|
||||||
|
public static boolean realProtocol;
|
||||||
|
|
||||||
|
public static boolean statisticsProtocol;
|
||||||
|
|
||||||
|
public static boolean voltageProtocol;
|
||||||
|
|
||||||
|
public static boolean unknownError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前下发的脚本
|
||||||
|
*/
|
||||||
|
public static SourceIssue currentIssue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否进行相序校验
|
||||||
|
*/
|
||||||
|
public static boolean isXu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,20 +88,33 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
|
|||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
|
if (evt instanceof IdleStateEvent) { //IdleState.在一段时间内没有收到任何消息时,会触发该事件
|
||||||
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
||||||
System.out.println(LocalDateTime.now() + "contrastClientHandler触发读超时函数**************************************");
|
if (FormalTestManager.isTesting) {
|
||||||
|
System.out.println(LocalDateTime.now() + "contrastClientHandler触发读超时函数**************************************");
|
||||||
|
|
||||||
if (!FormalTestManager.isRemoveSocket && ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
|
if (!FormalTestManager.isRemoveSocket && ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
|
||||||
long time = SocketManager.contrastClockMap.get(FormalTestManager.nonWaveDataSourceEnum) + 60L;
|
long time = SocketManager.contrastClockMap.get(FormalTestManager.nonWaveDataSourceEnum) + 60L;
|
||||||
SocketManager.contrastClockMap.put(FormalTestManager.nonWaveDataSourceEnum, time);
|
SocketManager.contrastClockMap.put(FormalTestManager.nonWaveDataSourceEnum, time);
|
||||||
|
|
||||||
if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
|
if (FormalTestManager.isPstData) {
|
||||||
if (time >= 60) {
|
if (time > 60 * 10) {
|
||||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
|
||||||
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_02);
|
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||||
|
}
|
||||||
|
if (FormalTestManager.isWaveCheck) {
|
||||||
|
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||||
|
}
|
||||||
|
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, true);
|
||||||
|
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
|
||||||
|
}
|
||||||
|
} else if (DataSourceEnum.REAL_DATA == FormalTestManager.nonWaveDataSourceEnum) {
|
||||||
|
if (time >= 60) {
|
||||||
|
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||||
|
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_02);
|
||||||
|
}
|
||||||
|
} else if (time >= FormalTestManager.maxTime) {
|
||||||
|
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, true);
|
||||||
|
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
|
||||||
}
|
}
|
||||||
} else if (time >= FormalTestManager.maxTime) {
|
|
||||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
|
||||||
timeoutSend(SourceOperateCodeEnum.QUIT_INIT_01);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
devLineTestResult.setDeviceName(dev.getDevName());
|
devLineTestResult.setDeviceName(dev.getDevName());
|
||||||
|
|
||||||
Integer[] resultFlags = dev.getMonitorList().stream()
|
Integer[] resultFlags = dev.getMonitorList().stream()
|
||||||
.map(monitor -> ResultEnum.NETWORK_TIMEOUT)
|
.map(monitor -> ResultEnum.NETWORK_TIMEOUT.getValue())
|
||||||
.toArray(Integer[]::new);
|
.toArray(Integer[]::new);
|
||||||
devLineTestResult.setChnResult(resultFlags);
|
devLineTestResult.setChnResult(resultFlags);
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
|||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
|
||||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import io.netty.handler.codec.CorruptedFrameException;
|
import io.netty.handler.codec.CorruptedFrameException;
|
||||||
@@ -373,34 +371,43 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
// 使用该用户的检测参数关闭Socket连接
|
// 使用该用户的检测参数关闭Socket连接
|
||||||
log.info("使用用户检测参数关闭Socket连接,userId: {}", userId);
|
log.info("使用用户检测参数关闭Socket连接,userId: {}", userId);
|
||||||
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
|
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
|
||||||
if (FormalTestManager.isRemoveSocket) {
|
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
||||||
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||||
if (channelActive) {
|
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||||
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
// if (FormalTestManager.isRemoveSocket) {
|
||||||
}
|
// boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||||
} else {
|
// if (channelActive) {
|
||||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
// }
|
||||||
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
|
// } else {
|
||||||
if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
|
// if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1) {
|
||||||
if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
// } else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
|
||||||
} else {
|
// if (ObjectUtil.isNotNull(FormalTestManager.nonWaveDataSourceEnum)) {
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
// if (FormalTestManager.nonWaveDataSourceEnum == DataSourceEnum.REAL_DATA) {
|
||||||
}
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||||
if (FormalTestManager.isWaveCheck) {
|
// if (FormalTestManager.statisticsProtocol) {
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
if (FormalTestManager.isWaveCheck) {
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
// }
|
||||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
// if (FormalTestManager.isWaveCheck) {
|
||||||
}
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
// if (FormalTestManager.statisticsProtocol) {
|
||||||
}
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_01, false);
|
||||||
}
|
// }
|
||||||
|
// if (FormalTestManager.isWaveCheck) {
|
||||||
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||||
|
// CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// SocketManager.removeUser(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
CnSocketUtil.quitSendSource(preDetectionParam);
|
CnSocketUtil.quitSendSource(preDetectionParam);
|
||||||
CnSocketUtil.quitSend(preDetectionParam);
|
CnSocketUtil.quitSend(preDetectionParam);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.njcn.common.utils.LogUtil;
|
|||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
|
||||||
import com.njcn.gather.type.service.IDevTypeService;
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.FileUtil;
|
import com.njcn.web.utils.FileUtil;
|
||||||
@@ -101,7 +100,7 @@ public class PqDevController extends BaseController {
|
|||||||
@OperateInfo(operateType = OperateType.DELETE)
|
@OperateInfo(operateType = OperateType.DELETE)
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@ApiOperation("删除被检设备")
|
@ApiOperation("删除被检设备")
|
||||||
@ApiImplicitParam(name = "ids", value = "被检设备id", required = true)
|
@ApiImplicitParam(name = "param", value = "删除参数", required = true)
|
||||||
public HttpResult<Boolean> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
public HttpResult<Boolean> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
||||||
@@ -137,7 +136,7 @@ public class PqDevController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||||
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<Boolean> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, HttpServletResponse response) {
|
public HttpResult importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, @RequestParam(value = "cover", defaultValue = "0") Integer cover, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importDev");
|
String methodDescribe = getMethodDescribe("importDev");
|
||||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||||
@@ -147,12 +146,7 @@ public class PqDevController extends BaseController {
|
|||||||
if ("null".equals(planId)) {
|
if ("null".equals(planId)) {
|
||||||
planId = null;
|
planId = null;
|
||||||
}
|
}
|
||||||
Boolean result = pqDevService.importDev(file, patternId, planId, response);
|
return pqDevService.importDev(file, patternId, planId, response, cover);
|
||||||
if (result) {
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
|
||||||
} else {
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -168,10 +162,31 @@ public class PqDevController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@GetMapping("/getSelectOptions")
|
@GetMapping("/getSelectOptions")
|
||||||
@ApiOperation("根据历史记录信息来获取下拉框内容")
|
@ApiOperation("从历史数据中查询下拉框选项")
|
||||||
|
@ApiImplicitParam(name = "pattern", value = "模式id", required = true)
|
||||||
public HttpResult<Map<String, List<String>>> getSelectOptions(@RequestParam("pattern") String pattern) {
|
public HttpResult<Map<String, List<String>>> getSelectOptions(@RequestParam("pattern") String pattern) {
|
||||||
String methodDescribe = getMethodDescribe("getSelectOptions");
|
String methodDescribe = getMethodDescribe("getSelectOptions");
|
||||||
Map<String, List<String>> result = pqDevService.listSelectOptions(pattern);
|
Map<String, List<String>> result = pqDevService.listSelectOptions(pattern);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||||
|
@PostMapping(value = "/ttt")
|
||||||
|
@ApiOperation("批量导入被检设备")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||||
|
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult ttt(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, @RequestParam("planId") String planId, @RequestParam(value = "cover", defaultValue = "0") Integer cover, HttpServletResponse response) {
|
||||||
|
String methodDescribe = getMethodDescribe("ttt");
|
||||||
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
|
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||||
|
if (!fileType) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
|
}
|
||||||
|
if ("null".equals(planId)) {
|
||||||
|
planId = null;
|
||||||
|
}
|
||||||
|
return pqDevService.importDev(file, patternId, planId, response, cover);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,17 +149,17 @@ public class PqStandardDevController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/listByPlanId")
|
// @PostMapping("/listByPlanId")
|
||||||
@ApiOperation("查询出指定计划已关联的标准设备")
|
// @ApiOperation("查询出指定计划已关联的标准设备")
|
||||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
// @ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||||
public HttpResult<List<PqStandardDev>> listByPlanId(@RequestParam("planId") String planId) {
|
// public HttpResult<List<PqStandardDev>> listByPlanId(@RequestParam("planId") String planId) {
|
||||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
// String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
// LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||||
List<PqStandardDev> pqDevVOList = pqStandardDevService.listByPlanId(planId);
|
// List<PqStandardDev> pqDevVOList = pqStandardDevService.listByPlanId(planId);
|
||||||
|
//
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
order by dev.Create_Time DESC, dev.Name ASC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class ContrastDevExcel implements Serializable {
|
|||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "设备序列号*", width = 20, needMerge = true, orderNum = "5")
|
@Excel(name = "设备序列号", width = 20, needMerge = true, orderNum = "5")
|
||||||
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
// @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||||
private String createId;
|
private String createId;
|
||||||
|
|
||||||
@Excel(name = "设备类型*", width = 20, needMerge = true, orderNum = "6")
|
@Excel(name = "设备类型*", width = 20, needMerge = true, orderNum = "6")
|
||||||
@@ -91,8 +91,8 @@ public class ContrastDevExcel implements Serializable {
|
|||||||
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
|
||||||
private LocalDate inspectDate;
|
private LocalDate inspectDate;
|
||||||
|
|
||||||
@Excel(name = "谐波系统设备id*", width = 30, needMerge = true, orderNum = "18")
|
@Excel(name = "谐波系统设备id", width = 30, needMerge = true, orderNum = "18")
|
||||||
@NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
|
// @NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
|
||||||
private String harmSysId;
|
private String harmSysId;
|
||||||
|
|
||||||
@ExcelCollection(name = "监测点信息", orderNum = "19")
|
@ExcelCollection(name = "监测点信息", orderNum = "19")
|
||||||
|
|||||||
@@ -111,4 +111,9 @@ public class PqDevVO extends PqDev {
|
|||||||
* 是否已经分配。0-未分配、1-已分配、2-所有
|
* 是否已经分配。0-未分配、1-已分配、2-所有
|
||||||
*/
|
*/
|
||||||
private Integer assign;
|
private Integer assign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测点结果
|
||||||
|
*/
|
||||||
|
private List<Integer> monitorResults;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.gather.device.service;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.common.pojo.poi.PullDown;
|
import com.njcn.common.pojo.poi.PullDown;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
@@ -124,7 +125,7 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @param devId
|
* @param devId
|
||||||
* @param userId
|
* @param userId
|
||||||
*/
|
*/
|
||||||
void updateResult(String devId,String userId);
|
void updateResult(String devId, String userId);
|
||||||
|
|
||||||
void updatePqDevReportState(String devId, int i);
|
void updatePqDevReportState(String devId, int i);
|
||||||
|
|
||||||
@@ -160,7 +161,7 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @param planId 计划Id
|
* @param planId 计划Id
|
||||||
* @param response 响应
|
* @param response 响应
|
||||||
*/
|
*/
|
||||||
boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
HttpResult importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入灿能二楼设备数据
|
* 导入灿能二楼设备数据
|
||||||
@@ -254,7 +255,7 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @param planId 计划Id
|
* @param planId 计划Id
|
||||||
* @param response 响应
|
* @param response 响应
|
||||||
*/
|
*/
|
||||||
boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
HttpResult importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入比对式设备数据
|
* 导入比对式设备数据
|
||||||
@@ -262,7 +263,7 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @param contrastDevExcelList
|
* @param contrastDevExcelList
|
||||||
* @param patternId
|
* @param patternId
|
||||||
*/
|
*/
|
||||||
boolean importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId);
|
HttpResult importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId, Integer cover);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取比对式设备导出、导出文件模板的下拉列表
|
* 获取比对式设备导出、导出文件模板的下拉列表
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public interface IPqStandardDevService extends IService<PqStandardDev> {
|
|||||||
* @param planId
|
* @param planId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PqStandardDev> listByPlanId(String planId);
|
// List<PqStandardDev> listByPlanId(String planId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询出标准设备所需的检测信息
|
* 查询出标准设备所需的检测信息
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||||
@@ -19,8 +20,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.poi.PullDown;
|
import com.njcn.common.pojo.poi.PullDown;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.EncryptionUtil;
|
import com.njcn.common.utils.EncryptionUtil;
|
||||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||||
@@ -34,6 +37,7 @@ import com.njcn.gather.device.service.IPqDevSubService;
|
|||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
|
||||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
||||||
@@ -49,6 +53,7 @@ import com.njcn.gather.user.user.pojo.po.SysUser;
|
|||||||
import com.njcn.gather.user.user.service.ISysUserService;
|
import com.njcn.gather.user.user.service.ISysUserService;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import com.njcn.web.utils.PoiUtil;
|
import com.njcn.web.utils.PoiUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -63,6 +68,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -212,7 +218,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||||
for (String id : param.getIds()) {
|
for (String id : param.getIds()) {
|
||||||
if (ObjectUtils.isNotEmpty(pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(id)))) {
|
if (ObjectUtils.isNotEmpty(pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(id)))) {
|
||||||
throw new BusinessException(DetectionResponseEnum.PQ_DEV_HAS_MONITOR);
|
// throw new BusinessException(DetectionResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||||
|
pqMonitorService.removeByDevId(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,6 +293,33 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<PqDevVO> pqDevList = this.baseMapper.selectByQueryParam(param);
|
List<PqDevVO> pqDevList = this.baseMapper.selectByQueryParam(param);
|
||||||
|
pqDevList.forEach(pqDev -> {
|
||||||
|
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(pqDev.getId()));
|
||||||
|
List<PqMonitor> enabledMonitorList = monitorList.stream().filter(x -> x.getCheckFlag() == 1).collect(Collectors.toList());
|
||||||
|
pqDev.setMonitorResults(enabledMonitorList.stream().map(x -> {
|
||||||
|
if (ObjectUtil.isNull(x.getResultType())) {
|
||||||
|
return CheckResultEnum.UNCHECKED.getValue();
|
||||||
|
} else {
|
||||||
|
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(x.getResultType());
|
||||||
|
|
||||||
|
switch (dataSourceEnum) {
|
||||||
|
case REAL_DATA:
|
||||||
|
return x.getRealtimeResult();
|
||||||
|
case MINUTE_STATISTICS_AVG:
|
||||||
|
case MINUTE_STATISTICS_CP95:
|
||||||
|
case MINUTE_STATISTICS_MIN:
|
||||||
|
case MINUTE_STATISTICS_MAX:
|
||||||
|
return x.getStatisticsResult();
|
||||||
|
case WAVE_DATA:
|
||||||
|
return x.getRecordedResult();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CheckResultEnum.UNCHECKED.getValue();
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
});
|
||||||
|
|
||||||
return pqDevList;
|
return pqDevList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,19 +563,27 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
PqDev dev = this.getById(devId);
|
PqDev dev = this.getById(devId);
|
||||||
Integer checkState = pqMonitorService.getDevCheckState(devId);
|
Integer checkState = pqMonitorService.getDevCheckState(devId);
|
||||||
Integer checkResult = pqMonitorService.getDevCheckResult(devId);
|
Integer checkResult = pqMonitorService.getDevCheckResult(devId);
|
||||||
|
if (checkResult == 1) {
|
||||||
|
checkResult = CheckResultEnum.ACCORD.getValue();
|
||||||
|
}
|
||||||
|
if (checkResult == 2) {
|
||||||
|
checkResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SysUser user = userService.getById(userId);
|
SysUser user = userService.getById(userId);
|
||||||
|
|
||||||
LambdaUpdateChainWrapper<PqDevSub> w = pqDevSubService.lambdaUpdate()
|
LambdaUpdateChainWrapper<PqDevSub> w = pqDevSubService.lambdaUpdate()
|
||||||
.set(PqDevSub::getCheckState, checkState)
|
.set(PqDevSub::getCheckState, checkState)
|
||||||
.set(PqDevSub::getCheckResult, checkResult)
|
.set(PqDevSub::getCheckResult, checkResult)
|
||||||
|
.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
||||||
.set(PqDevSub::getCheckTime, LocalDateTime.now())
|
.set(PqDevSub::getCheckTime, LocalDateTime.now())
|
||||||
.eq(PqDevSub::getDevId, devId);
|
.eq(PqDevSub::getDevId, devId);
|
||||||
|
|
||||||
if(ObjectUtil.isNotNull(user)){
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
w.set(PqDevSub::getCheckBy, user.getName());
|
w.set(PqDevSub::getCheckBy, user.getName());
|
||||||
}
|
}
|
||||||
if(checkState.equals(CheckStateEnum.CHECKED.getValue())){
|
if (checkState.equals(CheckStateEnum.CHECKED.getValue())) {
|
||||||
w.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue());
|
w.set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue());
|
||||||
}
|
}
|
||||||
w.update();
|
w.update();
|
||||||
@@ -552,15 +594,23 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
List<PqDevVO> pqDevVOList = this.baseMapper.selectByQueryParam(param);
|
List<PqDevVO> pqDevVOList = this.baseMapper.selectByQueryParam(param);
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||||
Set<Integer> set = pqDevVOList.stream().map(PqDevVO::getCheckResult).collect(Collectors.toSet());
|
Set<Integer> set = pqDevVOList.stream().filter(obj -> CheckStateEnum.CHECKED.getValue().equals(obj.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(obj.getCheckState())).map(PqDevVO::getCheckResult).collect(Collectors.toSet());
|
||||||
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
|
if (checkState == CheckStateEnum.CHECKED.getValue()) {
|
||||||
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.NOT_ACCORD.getValue());
|
set.add(checkResult);
|
||||||
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
|
}
|
||||||
|
if (CollUtil.isEmpty(set)) {
|
||||||
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
|
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
|
||||||
} else {
|
} else {
|
||||||
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.ACCORD.getValue());
|
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
|
||||||
|
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.NOT_ACCORD.getValue());
|
||||||
|
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
|
||||||
|
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.UNCHECKED.getValue());
|
||||||
|
} else {
|
||||||
|
this.baseMapper.updatePlanCheckResult(planId, CheckResultEnum.ACCORD.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set = pqDevVOList.stream().map(PqDevVO::getCheckState).collect(Collectors.toSet());
|
set = pqDevVOList.stream().map(PqDevVO::getCheckState).collect(Collectors.toSet());
|
||||||
if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {
|
if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {
|
||||||
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKING.getValue());
|
this.baseMapper.updatePlanTestState(planId, CheckStateEnum.CHECKING.getValue());
|
||||||
@@ -643,25 +693,31 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
|
public HttpResult importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover) {
|
||||||
DictData dictData = dictDataService.getDictDataById(patternId);
|
DictData dictData = dictDataService.getDictDataById(patternId);
|
||||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
return this.importContrastDev(file, patternId, planId, response);
|
return this.importContrastDev(file, patternId, planId, response, cover);
|
||||||
} else {
|
} else {
|
||||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||||
switch (sceneEnum) {
|
switch (sceneEnum) {
|
||||||
case PROVINCE_PLATFORM:
|
case PROVINCE_PLATFORM:
|
||||||
return this.importProvinceDev(file, patternId, planId, response);
|
boolean result = this.importProvinceDev(file, patternId, planId, response);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, "导入成功");
|
||||||
|
}
|
||||||
case LEAVE_FACTORY_TEST:
|
case LEAVE_FACTORY_TEST:
|
||||||
return this.importCNDev(file, patternId, planId, response);
|
result = this.importCNDev(file, patternId, planId, response);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, "导入成功");
|
||||||
|
}
|
||||||
case SELF_TEST:
|
case SELF_TEST:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, "导入失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -788,21 +844,15 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
* @param isExcludeSelf 是否排除自己
|
* @param isExcludeSelf 是否排除自己
|
||||||
*/
|
*/
|
||||||
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
|
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
|
||||||
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<PqDev>()
|
||||||
queryWrapper
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
.eq("state", DataStateEnum.ENABLE.getCode())
|
.eq(StrUtil.isNotBlank(param.getIp()), PqDev::getIp, param.getIp())
|
||||||
.eq(StrUtil.isNotBlank(param.getDevType()), "Dev_Type", param.getDevType())
|
.eq(ObjectUtil.isNotNull(param.getPort()), PqDev::getPort, param.getPort())
|
||||||
.eq(StrUtil.isNotBlank(param.getPattern()), "pattern", param.getPattern())
|
.eq(StrUtil.isNotBlank(param.getPattern()), PqDev::getPattern, param.getPattern())
|
||||||
.eq(StrUtil.isNotBlank(param.getCityName()), "City_Name", param.getCityName())
|
.eq(StrUtil.isNotBlank(param.getCreateId()), PqDev::getCreateId, param.getCreateId());
|
||||||
.eq(StrUtil.isNotBlank(param.getGdName()), "Gd_Name", param.getGdName())
|
|
||||||
.eq(StrUtil.isNotBlank(param.getSubName()), "Sub_Name", param.getSubName())
|
|
||||||
.and(q -> q.eq(StrUtil.isNotBlank(param.getName()), "name", param.getName()).or()
|
|
||||||
.eq(StrUtil.isNotBlank(param.getCreateId()), "Create_Id", param.getCreateId())); //设备序列号重复
|
|
||||||
// .eq("manufacturer", param.getManufacturer())
|
|
||||||
// .eq("Dev_Type", param.getDevType()).or()
|
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
if (param instanceof PqDevParam.UpdateParam) {
|
if (param instanceof PqDevParam.UpdateParam) {
|
||||||
queryWrapper.ne("id", ((PqDevParam.UpdateParam) param).getId());
|
queryWrapper.ne(PqDev::getId, ((PqDevParam.UpdateParam) param).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int count = this.count(queryWrapper);
|
int count = this.count(queryWrapper);
|
||||||
@@ -1181,7 +1231,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response) {
|
public HttpResult importContrastDev(MultipartFile file, String patternId, String planId, HttpServletResponse response, Integer cover) {
|
||||||
ImportParams params = new ImportParams();
|
ImportParams params = new ImportParams();
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
@@ -1201,52 +1251,56 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL);
|
||||||
}
|
}
|
||||||
return this.importContrastDev(contrastDevExcelList, patternId, planId);
|
return this.importContrastDev(contrastDevExcelList, patternId, planId, cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId) {
|
public HttpResult importContrastDev(List<ContrastDevExcel> contrastDevExcelList, String patternId, String planId, Integer cover) {
|
||||||
if (CollUtil.isNotEmpty(contrastDevExcelList)) {
|
if (CollUtil.isNotEmpty(contrastDevExcelList)) {
|
||||||
// 根据设备名称分组
|
// 根据设备名称分组
|
||||||
Map<String, List<ContrastDevExcel>> listMap = contrastDevExcelList.stream()
|
Map<String, List<ContrastDevExcel>> listMap = contrastDevExcelList.stream()
|
||||||
.collect(Collectors.groupingBy(ContrastDevExcel::getName, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(ContrastDevExcel::getName, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<PqDev> oldDevList = new ArrayList<>(listMap.size());
|
List<PqDev> newDevList = new ArrayList<>(listMap.size());
|
||||||
List<PqMonitor> finalMonitorList = new ArrayList<>();
|
List<PqDev> updateDevList = new ArrayList<>();
|
||||||
|
List<PqDev> finalUpdateDevList = new ArrayList<>();
|
||||||
for (Map.Entry<String, List<ContrastDevExcel>> entry : listMap.entrySet()) {
|
for (Map.Entry<String, List<ContrastDevExcel>> entry : listMap.entrySet()) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
|
|
||||||
List<ContrastDevExcel> devExcelList = entry.getValue();
|
List<ContrastDevExcel> devExcelList = entry.getValue();
|
||||||
// 监测点数据
|
// 监测点数据
|
||||||
List<PqMonitorExcel> pqMonitorExcelList = devExcelList.stream()
|
List<PqMonitorExcel> pqMonitorExcelList = devExcelList.stream()
|
||||||
.map(ContrastDevExcel::getPqMonitorExcelList)
|
.map(ContrastDevExcel::getPqMonitorExcelList)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
|
// 过滤掉没有线路号的数据
|
||||||
|
.filter(item -> ObjectUtil.isNotNull(item.getNum()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 取第一条为设备基本信息
|
// 取第一条为设备基本信息
|
||||||
ContrastDevExcel devExcel = devExcelList.get(0);
|
ContrastDevExcel devExcel = devExcelList.get(0);
|
||||||
PqDev pqDev = BeanUtil.copyProperties(devExcel, PqDev.class);
|
PqDev importPqDev = BeanUtil.copyProperties(devExcel, PqDev.class);
|
||||||
if (pqDev.getEncryptionFlag() == 1) {
|
if (importPqDev.getEncryptionFlag() == 1) {
|
||||||
if (StrUtil.isNotBlank(pqDev.getSeries()) && StrUtil.isNotBlank(pqDev.getDevKey())) {
|
if (StrUtil.isNotBlank(importPqDev.getSeries()) && StrUtil.isNotBlank(importPqDev.getDevKey())) {
|
||||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
importPqDev.setSeries(EncryptionUtil.encodeString(1, importPqDev.getSeries()));
|
||||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
importPqDev.setDevKey(EncryptionUtil.encodeString(1, importPqDev.getDevKey()));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DevType devType = devTypeService.getByName(pqDev.getDevType());
|
DevType devType = devTypeService.getByName(importPqDev.getDevType());
|
||||||
if (ObjectUtil.isNull(devType)) {
|
if (ObjectUtil.isNull(devType)) {
|
||||||
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NOT_EXIST);
|
throw new BusinessException(DetectionResponseEnum.DEV_TYPE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
// 校验监测点数量
|
// 校验监测点数量
|
||||||
int devChns = devType.getDevChns();
|
int devChns = devType.getDevChns();
|
||||||
if (pqMonitorExcelList.size() != devChns) {
|
// if (pqMonitorExcelList.size() != devChns) {
|
||||||
throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL, "【" + name + "】的设备类型必须具备" + devChns + "个监测点信息!");
|
// throw new BusinessException(DetectionResponseEnum.IMPORT_DATA_FAIL, "【" + name + "】的设备类型必须具备" + devChns + "个监测点信息!");
|
||||||
}
|
// }
|
||||||
List<Integer> numList = pqMonitorExcelList.stream().map(PqMonitorExcel::getNum).collect(Collectors.toList());
|
List<Integer> numList = pqMonitorExcelList.stream().map(PqMonitorExcel::getNum).collect(Collectors.toList());
|
||||||
// 判断是否有重复的num
|
// 判断是否有重复的num
|
||||||
Set<Integer> uniqueNumSet = new HashSet<>(numList);
|
Set<Integer> uniqueNumSet = new HashSet<>(numList);
|
||||||
if (uniqueNumSet.size() != numList.size()) {
|
if (uniqueNumSet.size() != numList.size()) {
|
||||||
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_REPEAT);
|
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_REPEAT, "【" + name + "】该被检设备下存在相同线路号的监测点!");
|
||||||
}
|
}
|
||||||
Integer max = CollectionUtil.max(numList);
|
Integer max = CollectionUtil.max(numList);
|
||||||
Integer min = CollectionUtil.min(numList);
|
Integer min = CollectionUtil.min(numList);
|
||||||
@@ -1254,90 +1308,144 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_OUT_OF_RANGE);
|
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_OUT_OF_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pqDev.setDevType(devType.getId());
|
importPqDev.setDevType(devType.getId());
|
||||||
pqDev.setImportFlag(1);
|
importPqDev.setImportFlag(1);
|
||||||
pqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
importPqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||||
pqDev.setCreateId(pqDev.getName()); //导入时设备序列号默认与设备名称相同
|
|
||||||
List<PqMonitor> monitorList = new ArrayList<>();
|
if (StrUtil.isEmpty(importPqDev.getCreateId())) {
|
||||||
|
// 与设备名称相同
|
||||||
|
importPqDev.setCreateId(importPqDev.getName());
|
||||||
|
}
|
||||||
// 根据num排序
|
// 根据num排序
|
||||||
pqMonitorExcelList.sort(Comparator.comparingInt(PqMonitorExcel::getNum));
|
pqMonitorExcelList.sort(Comparator.comparingInt(PqMonitorExcel::getNum));
|
||||||
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
|
|
||||||
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
|
|
||||||
monitor.setDevId(pqDev.getId());
|
|
||||||
monitorList.add(monitor);
|
|
||||||
}
|
|
||||||
StringBuilder inspectChannelBuilder = new StringBuilder();
|
StringBuilder inspectChannelBuilder = new StringBuilder();
|
||||||
for (int i = 1; i <= devChns; i++) {
|
for (int i = 0; i < numList.size(); i++) {
|
||||||
inspectChannelBuilder.append(i);
|
inspectChannelBuilder.append(numList.get(i));
|
||||||
if (i < devChns) {
|
if (i < numList.size() - 1) {
|
||||||
inspectChannelBuilder.append(",");
|
inspectChannelBuilder.append(StrUtil.COMMA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pqDev.setInspectChannel(inspectChannelBuilder.toString());
|
importPqDev.setInspectChannel(inspectChannelBuilder.toString());
|
||||||
oldDevList.add(pqDev);
|
List<PqMonitor> monitorList = new ArrayList<>();
|
||||||
finalMonitorList.addAll(monitorList);
|
// 1、先判断是否有谐波系统ID
|
||||||
}
|
boolean hasHarmSys = false;
|
||||||
//逆向可视化
|
if (StrUtil.isNotBlank(importPqDev.getHarmSysId())) {
|
||||||
this.reverseVisualizeProvinceDev(oldDevList, patternId);
|
// 1.1、如果有则判断是否已存在
|
||||||
|
List<PqDev> hasList = this.lambdaQuery()
|
||||||
List<PqDev> newDevList = new ArrayList<>();
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
oldDevList.forEach(pqDev -> {
|
.eq(PqDev::getPattern, patternId)
|
||||||
PqDevParam param = BeanUtil.copyProperties(pqDev, PqDevParam.class);
|
.eq(PqDev::getHarmSysId, importPqDev.getHarmSysId())
|
||||||
this.checkRepeat(param, false);
|
.isNull(PqDev::getPlanId)
|
||||||
long count = newDevList.stream().filter(dev ->
|
.orderByDesc(PqDev::getCreateTime).list();
|
||||||
dev.getDevType().equals(pqDev.getDevType())
|
// 1.2、 存在则放入强制更新list
|
||||||
&& dev.getCityName().equals(pqDev.getCityName())
|
if (CollUtil.isNotEmpty(hasList)) {
|
||||||
&& dev.getGdName().equals(pqDev.getGdName())
|
importPqDev.setId(hasList.get(0).getId());
|
||||||
&& dev.getSubName().equals(pqDev.getSubName())
|
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
|
||||||
&& (dev.getName().equals(pqDev.getName()) || dev.getCreateId().equals(pqDev.getCreateId())))
|
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
|
||||||
.count();
|
monitor.setDevId(importPqDev.getId());
|
||||||
if (count == 0) {
|
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
|
||||||
pqDev.setPlanId(planId);
|
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
|
||||||
newDevList.add(pqDev);
|
monitorList.add(monitor);
|
||||||
}
|
}
|
||||||
});
|
importPqDev.setMonitorList(monitorList);
|
||||||
QueryWrapper<PqDev> wrapper1 = new QueryWrapper<PqDev>()
|
finalUpdateDevList.add(importPqDev);
|
||||||
.eq("pq_dev.State", DataStateEnum.ENABLE.getCode())
|
hasHarmSys = true;
|
||||||
.in("pq_dev.Harm_Sys_Id", newDevList.stream().map(PqDev::getHarmSysId).collect(Collectors.toList()));
|
|
||||||
List<PqDev> oldDevList1 = this.list(wrapper1);
|
|
||||||
if (CollUtil.isNotEmpty(oldDevList1)) {
|
|
||||||
oldDevList1.stream().forEach(oldDev -> {
|
|
||||||
PqDev newDev = newDevList.stream().filter(dev -> dev.getHarmSysId().equals(oldDev.getHarmSysId())).findFirst().orElse(null);
|
|
||||||
if (ObjectUtil.isNotNull(newDev)) {
|
|
||||||
newDevList.remove(newDev);
|
|
||||||
finalMonitorList.stream()
|
|
||||||
.filter(monitor -> monitor.getDevId().equals(newDev.getId()))
|
|
||||||
.forEach(monitor -> monitor.setDevId(oldDev.getId()));
|
|
||||||
BeanUtil.copyProperties(newDev, oldDev, "id");
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
this.updateBatchById(oldDevList1);
|
|
||||||
}
|
|
||||||
this.saveBatch(newDevList);
|
|
||||||
List<PqDevSub> pqDevSubList = new ArrayList<>();
|
|
||||||
for (PqDev dev : newDevList) {
|
|
||||||
PqDevSub pqDevSub = new PqDevSub();
|
|
||||||
pqDevSub.setDevId(dev.getId());
|
|
||||||
pqDevSub.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
|
||||||
pqDevSub.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
|
||||||
pqDevSub.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
|
||||||
pqDevSub.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
|
||||||
pqDevSub.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
|
||||||
pqDevSubList.add(pqDevSub);
|
|
||||||
}
|
|
||||||
pqDevSubService.saveBatch(pqDevSubList);
|
|
||||||
|
|
||||||
List<String> devIdList = oldDevList1.stream().map(PqDev::getId).collect(Collectors.toList());
|
}
|
||||||
if (CollUtil.isNotEmpty(devIdList)) {
|
if (!hasHarmSys) {
|
||||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<PqMonitor>()
|
// 2、查询 ip + 端口 + 序列号 + patternId + Plan_Id为空 是否存在
|
||||||
.in("pq_monitor.Dev_Id", devIdList);
|
List<PqDev> hasList = this.lambdaQuery()
|
||||||
pqMonitorService.remove(wrapper);
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.eq(PqDev::getIp, devExcel.getIp())
|
||||||
|
.eq(PqDev::getPort, devExcel.getPort())
|
||||||
|
.eq(PqDev::getPattern, patternId)
|
||||||
|
.eq(PqDev::getCreateId, devExcel.getCreateId())
|
||||||
|
.isNull(PqDev::getPlanId)
|
||||||
|
.orderByDesc(PqDev::getCreateTime).list();
|
||||||
|
// 2.1、存在则放入更新list
|
||||||
|
if (CollUtil.isNotEmpty(hasList)) {
|
||||||
|
importPqDev.setId(hasList.get(0).getId());
|
||||||
|
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
|
||||||
|
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
|
||||||
|
monitor.setDevId(importPqDev.getId());
|
||||||
|
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
|
||||||
|
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
|
||||||
|
monitorList.add(monitor);
|
||||||
|
}
|
||||||
|
importPqDev.setMonitorList(monitorList);
|
||||||
|
updateDevList.add(importPqDev);
|
||||||
|
} else {
|
||||||
|
//2.2、不存在则放入新增list
|
||||||
|
for (PqMonitorExcel pqMonitorExcel : pqMonitorExcelList) {
|
||||||
|
PqMonitor monitor = BeanUtil.copyProperties(pqMonitorExcel, PqMonitor.class);
|
||||||
|
monitor.setDevId(importPqDev.getId());
|
||||||
|
monitor.setPt(pqMonitorExcel.getPt1() + StrUtil.C_COLON + pqMonitorExcel.getPt2());
|
||||||
|
monitor.setCt(pqMonitorExcel.getCt1() + StrUtil.C_COLON + pqMonitorExcel.getCt2());
|
||||||
|
monitorList.add(monitor);
|
||||||
|
}
|
||||||
|
importPqDev.setMonitorList(monitorList);
|
||||||
|
newDevList.add(importPqDev);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pqMonitorService.reverseVisualizeMonitor(finalMonitorList);
|
// 3、是否有重复的设备
|
||||||
pqMonitorService.saveBatch(finalMonitorList);
|
if (CollUtil.isNotEmpty(updateDevList)) {
|
||||||
return true;
|
// 3.1、有则让用户确认是否覆盖
|
||||||
|
if (cover == 0) {
|
||||||
|
List<String> existDevList = new ArrayList<>();
|
||||||
|
updateDevList.forEach(pqDev -> {
|
||||||
|
existDevList.add(pqDev.getName() + "(" + pqDev.getIp() + ":" + pqDev.getPort() + ")");
|
||||||
|
});
|
||||||
|
return HttpResultUtil.assembleResult(DetectionResponseEnum.DEV_IP_PORT_EXIST.getCode(), existDevList, "请确认是否覆盖");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 3.2、确认覆盖则放入强制更新list
|
||||||
|
finalUpdateDevList.addAll(updateDevList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 4、新增list
|
||||||
|
if (CollUtil.isNotEmpty(newDevList)) {
|
||||||
|
//逆向可视化
|
||||||
|
this.reverseVisualizeProvinceDev(newDevList, patternId);
|
||||||
|
this.saveBatch(newDevList);
|
||||||
|
List<PqDevSub> pqDevSubList = new ArrayList<>();
|
||||||
|
List<PqMonitor> newMonitorList = new ArrayList<>();
|
||||||
|
for (PqDev dev : newDevList) {
|
||||||
|
PqDevSub pqDevSub = new PqDevSub();
|
||||||
|
pqDevSub.setDevId(dev.getId());
|
||||||
|
pqDevSub.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||||
|
pqDevSub.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||||
|
pqDevSub.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||||
|
pqDevSub.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||||
|
pqDevSub.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||||
|
pqDevSubList.add(pqDevSub);
|
||||||
|
newMonitorList.addAll(dev.getMonitorList());
|
||||||
|
}
|
||||||
|
pqMonitorService.reverseVisualizeMonitor(newMonitorList);
|
||||||
|
pqMonitorService.saveBatch(newMonitorList);
|
||||||
|
pqDevSubService.saveBatch(pqDevSubList);
|
||||||
|
}
|
||||||
|
// 5、更新list
|
||||||
|
if (CollUtil.isNotEmpty(finalUpdateDevList)) {
|
||||||
|
//逆向可视化
|
||||||
|
this.reverseVisualizeProvinceDev(finalUpdateDevList, patternId);
|
||||||
|
this.updateBatchById(finalUpdateDevList);
|
||||||
|
List<PqMonitor> updateMonitorList = new ArrayList<>();
|
||||||
|
for (PqDev dev : finalUpdateDevList) {
|
||||||
|
updateMonitorList.addAll(dev.getMonitorList());
|
||||||
|
}
|
||||||
|
pqMonitorService.reverseVisualizeMonitor(updateMonitorList);
|
||||||
|
for (PqMonitor monitor : updateMonitorList) {
|
||||||
|
pqMonitorService.update(monitor, new LambdaUpdateWrapper<PqMonitor>().eq(PqMonitor::getDevId, monitor.getDevId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "导入成功");
|
||||||
}
|
}
|
||||||
return false;
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, "导入失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1395,13 +1503,19 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
if (ObjectUtil.isNotNull(dictType)) {
|
if (ObjectUtil.isNotNull(dictType)) {
|
||||||
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
dictDataList = dictDataService.getDictDataByTypeId(dictType.getId());
|
||||||
pullDown = new PullDown();
|
pullDown = new PullDown();
|
||||||
pullDown.setFirstCol(startCol + 24);
|
pullDown.setFirstCol(startCol + 26);
|
||||||
pullDown.setLastCol(startCol + 24);
|
pullDown.setLastCol(startCol + 26);
|
||||||
|
|
||||||
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
pullDown.setStrings(dictDataList.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||||
pullDowns.add(pullDown);
|
pullDowns.add(pullDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pullDown = new PullDown();
|
||||||
|
pullDown.setFirstCol(startCol + 27);
|
||||||
|
pullDown.setLastCol(startCol + 27);
|
||||||
|
pullDown.setStrings(Stream.iterate(1, x -> x + 1).limit(10).map(String::valueOf).collect(Collectors.toList()));
|
||||||
|
pullDowns.add(pullDown);
|
||||||
|
|
||||||
return pullDowns;
|
return pullDowns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1463,7 +1577,22 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
contrastDevExcels.forEach(contrastDevExcel -> {
|
contrastDevExcels.forEach(contrastDevExcel -> {
|
||||||
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(contrastDevExcel.getId()));
|
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevIds(Collections.singletonList(contrastDevExcel.getId()));
|
||||||
pqMonitorService.visualizeMonitor(monitorList);
|
pqMonitorService.visualizeMonitor(monitorList);
|
||||||
List<PqMonitorExcel> pqMonitorExcelList = BeanUtil.copyToList(monitorList, PqMonitorExcel.class);
|
List<PqMonitorExcel> pqMonitorExcelList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < monitorList.size(); i++) {
|
||||||
|
PqMonitor pqMonitor = monitorList.get(i);
|
||||||
|
PqMonitorExcel pqMonitorExcel = BeanUtil.copyProperties(pqMonitor, PqMonitorExcel.class);
|
||||||
|
String pt = pqMonitor.getPt();
|
||||||
|
String[] split1 = pt.split(String.valueOf(StrUtil.C_COLON));
|
||||||
|
pqMonitorExcel.setPt1(split1[0]);
|
||||||
|
pqMonitorExcel.setPt2(split1[1]);
|
||||||
|
|
||||||
|
String ct = pqMonitor.getCt();
|
||||||
|
String[] split2 = ct.split(String.valueOf(StrUtil.C_COLON));
|
||||||
|
pqMonitorExcel.setCt1(split2[0]);
|
||||||
|
pqMonitorExcel.setCt2(split2[1]);
|
||||||
|
|
||||||
|
pqMonitorExcelList.add(pqMonitorExcel);
|
||||||
|
}
|
||||||
contrastDevExcel.setPqMonitorExcelList(pqMonitorExcelList);
|
contrastDevExcel.setPqMonitorExcelList(pqMonitorExcelList);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -18,17 +17,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.poi.PullDown;
|
import com.njcn.common.pojo.poi.PullDown;
|
||||||
import com.njcn.common.utils.EncryptionUtil;
|
import com.njcn.common.utils.EncryptionUtil;
|
||||||
import com.njcn.gather.device.mapper.PqStandardDevMapper;
|
import com.njcn.gather.device.mapper.PqStandardDevMapper;
|
||||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
|
||||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
|
||||||
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
|
import com.njcn.gather.device.pojo.param.PqStandardDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
import com.njcn.gather.device.pojo.po.PqStandardDev;
|
||||||
import com.njcn.gather.device.pojo.vo.PqStandardDevExcel;
|
import com.njcn.gather.device.pojo.vo.PqStandardDevExcel;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqStandardDevService;
|
import com.njcn.gather.device.service.IPqStandardDevService;
|
||||||
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
|
import com.njcn.gather.plan.mapper.AdPlanStandardDevMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanStandardDev;
|
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
|
||||||
import com.njcn.gather.plan.service.IAdPlanStandardDevService;
|
import com.njcn.gather.plan.service.IAdPlanStandardDevService;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
@@ -73,7 +67,8 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
|
|||||||
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
wrapper.like(StrUtil.isNotBlank(queryParam.getName()), "name", queryParam.getName())
|
||||||
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
.eq(StrUtil.isNotBlank(queryParam.getManufacturer()), "manufacturer", queryParam.getManufacturer())
|
||||||
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
.eq(StrUtil.isNotBlank(queryParam.getDevType()), "dev_type", queryParam.getDevType())
|
||||||
.eq("state", DataStateEnum.ENABLE.getCode());
|
.eq("state", DataStateEnum.ENABLE.getCode())
|
||||||
|
.orderByDesc("create_time");
|
||||||
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
|
return this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,10 +154,10 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
|
|||||||
this.importData(contrastDevExcelList);
|
this.importData(contrastDevExcelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<PqStandardDev> listByPlanId(String planId) {
|
// public List<PqStandardDev> listByPlanId(String planId) {
|
||||||
return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
// return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PreDetection> listStandardDevPreDetection(List<String> ids) {
|
public List<PreDetection> listStandardDevPreDetection(List<String> ids) {
|
||||||
@@ -311,7 +306,7 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PqStandardDev> canBindingList() {
|
public List<PqStandardDev> canBindingList() {
|
||||||
List<String> excludeStandardDevIds = new ArrayList<>();
|
/*List<String> excludeStandardDevIds = new ArrayList<>();
|
||||||
// 获取所有已绑定的标准设备
|
// 获取所有已绑定的标准设备
|
||||||
List<AdPlanStandardDev> boundList = adPlanStandardDevService.list();
|
List<AdPlanStandardDev> boundList = adPlanStandardDevService.list();
|
||||||
if (CollectionUtil.isNotEmpty(boundList)) {
|
if (CollectionUtil.isNotEmpty(boundList)) {
|
||||||
@@ -350,13 +345,13 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
excludeStandardDevIds = excludeBoundList.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
|
excludeStandardDevIds = excludeBoundList.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
List<PqStandardDev> list = this.lambdaQuery()
|
List<PqStandardDev> list = this.lambdaQuery()
|
||||||
.eq(PqStandardDev::getState, DataStateEnum.ENABLE.getCode())
|
.eq(PqStandardDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
.list();
|
.list();
|
||||||
for (PqStandardDev pqStandardDev : list) {
|
/*for (PqStandardDev pqStandardDev : list) {
|
||||||
pqStandardDev.setDisabled(excludeStandardDevIds.contains(pqStandardDev.getId()));
|
pqStandardDev.setDisabled(excludeStandardDevIds.contains(pqStandardDev.getId()));
|
||||||
}
|
}*/
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||||
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
||||||
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
@@ -18,6 +19,7 @@ import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
|||||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||||
import com.njcn.gather.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
|
import com.njcn.gather.report.pojo.enums.PowerIndexEnum;
|
||||||
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.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
@@ -219,7 +221,9 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
List<DictTree> parentDictTreeList = dictTreeService.listByIds(pids);
|
List<DictTree> parentDictTreeList = dictTreeService.listByIds(pids);
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
parentDictTreeList.forEach(dictTree -> {
|
parentDictTreeList.forEach(dictTree -> {
|
||||||
map.put(dictTree.getId(), dictTree.getName());
|
if(!dictTree.getCode().equals(PowerIndexEnum.VOLTAGE.getKey())&&!dictTree.getCode().equals(PowerIndexEnum.P.getKey())){
|
||||||
|
map.put(dictTree.getId(), dictTree.getName());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class PqIcdPathController extends BaseController {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增icd")
|
@ApiOperation("新增icd")
|
||||||
@ApiImplicitParam(name = "param", value = "icd新增参数", required = true)
|
@ApiImplicitParam(name = "param", value = "icd新增参数", required = true)
|
||||||
public HttpResult<Boolean> add(@RequestBody @Validated PqIcdPathParam param) {
|
public HttpResult<Boolean> add(PqIcdPathParam param) {
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class PqIcdPathController extends BaseController {
|
|||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("修改icd")
|
@ApiOperation("修改icd")
|
||||||
@ApiImplicitParam(name = "param", value = "icd修改参数", required = true)
|
@ApiImplicitParam(name = "param", value = "icd修改参数", required = true)
|
||||||
public HttpResult<Boolean> update(@RequestBody @Validated PqIcdPathParam.UpdateParam param) {
|
public HttpResult<Boolean> update(PqIcdPathParam.UpdateParam param) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.gather.icd.pojo.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-11-11
|
||||||
|
*/
|
||||||
|
public enum IcdResponseEnum {
|
||||||
|
FILE_NOT_NULL("A018001", "映射文件不能为空"),
|
||||||
|
FILE_TYPE_ERROR("A018002", "映射文件类型错误"),
|
||||||
|
FILE_SIZE_ERROR("A018003", "映射文件大小超出限制");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
IcdResponseEnum(String code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.njcn.web.pojo.param.BaseParam;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
@@ -32,6 +33,9 @@ public class PqIcdPathParam {
|
|||||||
@ApiModelProperty(value = "角型接线时是否使用相别的指标来进行检测,0表示否,1表示是", required = true)
|
@ApiModelProperty(value = "角型接线时是否使用相别的指标来进行检测,0表示否,1表示是", required = true)
|
||||||
private Integer usePhaseIndex;
|
private Integer usePhaseIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "映射文件", required = true)
|
||||||
|
private MultipartFile mappingFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询实体
|
* 分页查询实体
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.gather.icd.pojo.po;
|
package com.njcn.gather.icd.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -46,5 +47,18 @@ public class PqIcdPath extends BaseEntity implements Serializable {
|
|||||||
* 角型接线时是否使用相别的指标来进行检测,0表示否,1表示是
|
* 角型接线时是否使用相别的指标来进行检测,0表示否,1表示是
|
||||||
*/
|
*/
|
||||||
private Integer usePhaseIndex;
|
private Integer usePhaseIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射文件路径
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private FileVO mappingFile;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class FileVO{
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.gather.icd.service.impl;
|
package com.njcn.gather.icd.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -7,17 +8,26 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.gather.icd.mapper.PqIcdPathMapper;
|
import com.njcn.gather.icd.mapper.PqIcdPathMapper;
|
||||||
|
import com.njcn.gather.icd.pojo.enums.IcdResponseEnum;
|
||||||
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
||||||
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||||
import com.njcn.gather.icd.service.IPqIcdPathService;
|
import com.njcn.gather.icd.service.IPqIcdPathService;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
|
import com.njcn.gather.report.pojo.enums.ReportResponseEnum;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +51,13 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
|||||||
.like(StrUtil.isNotBlank(param.getName()), PqIcdPath::getName, param.getName())
|
.like(StrUtil.isNotBlank(param.getName()), PqIcdPath::getName, param.getName())
|
||||||
.orderByDesc(PqIcdPath::getCreateTime);
|
.orderByDesc(PqIcdPath::getCreateTime);
|
||||||
Page<PqIcdPath> page = this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), wrapper);
|
Page<PqIcdPath> page = this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), wrapper);
|
||||||
|
String commInstallPath = this.getCommInstallPath();
|
||||||
|
page.getRecords().forEach(pqIcdPath -> {
|
||||||
|
PqIcdPath.FileVO fileVO = new PqIcdPath.FileVO();
|
||||||
|
fileVO.setUrl(commInstallPath + "\\DeviceControl\\Config\\" + pqIcdPath.getName() + ".txt");
|
||||||
|
fileVO.setName(pqIcdPath.getName() + ".txt");
|
||||||
|
pqIcdPath.setMappingFile(fileVO);
|
||||||
|
});
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,9 +69,81 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
|||||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||||
BeanUtils.copyProperties(param, pqIcdPath);
|
BeanUtils.copyProperties(param, pqIcdPath);
|
||||||
pqIcdPath.setState(DataStateEnum.ENABLE.getCode());
|
pqIcdPath.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
|
||||||
|
String commInstallPath = this.getCommInstallPath();
|
||||||
|
System.out.println("commInstallPath = " + commInstallPath);
|
||||||
|
long FILE_SIZE_LIMIT = 1 * 1024 * 1024;
|
||||||
|
MultipartFile mappingFile = param.getMappingFile();
|
||||||
|
|
||||||
|
System.out.println("mappingFile = " + ObjectUtil.isNotNull(mappingFile) + " " + !mappingFile.isEmpty());
|
||||||
|
if (ObjectUtil.isNotNull(mappingFile) && !mappingFile.isEmpty()) {
|
||||||
|
String mappingFilename = mappingFile.getOriginalFilename();
|
||||||
|
|
||||||
|
if (!mappingFilename.endsWith(".txt")) {
|
||||||
|
throw new BusinessException(IcdResponseEnum.FILE_TYPE_ERROR);
|
||||||
|
}
|
||||||
|
if (mappingFile.getSize() > FILE_SIZE_LIMIT) {
|
||||||
|
throw new BusinessException(IcdResponseEnum.FILE_SIZE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 如果文件存在,则先删除
|
||||||
|
String mappingFilePath = commInstallPath + "\\DeviceControl\\Config\\" + mappingFilename;
|
||||||
|
System.out.println("mappingFilePath = " + mappingFilePath);
|
||||||
|
Path path = Paths.get(mappingFilePath);
|
||||||
|
File file = path.toFile();
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存文件
|
||||||
|
byte[] bytes = mappingFile.getBytes();
|
||||||
|
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(mappingFilePath));
|
||||||
|
bufferedOutputStream.write(bytes);
|
||||||
|
bufferedOutputStream.flush();
|
||||||
|
|
||||||
|
bufferedOutputStream.close();
|
||||||
|
System.out.println("File saved successfully");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BusinessException(ReportResponseEnum.FILE_UPLOAD_FAILED);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("mappingFile is null or empty");
|
||||||
|
throw new BusinessException(IcdResponseEnum.FILE_NOT_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.executeRestartCmd(commInstallPath);
|
||||||
|
|
||||||
return this.save(pqIcdPath);
|
return this.save(pqIcdPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重启通讯服务脚本
|
||||||
|
*
|
||||||
|
* @param commInstallPath
|
||||||
|
*/
|
||||||
|
private void executeRestartCmd(String commInstallPath) {
|
||||||
|
// 以管理员身份运行bat脚本
|
||||||
|
String batFilePath = commInstallPath + "\\重启所有服务.bat";
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec(batFilePath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("重启通讯服务失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCommInstallPath() {
|
||||||
|
String workDir = System.getProperty("user.dir");
|
||||||
|
// String workDir = "D:\\program\\CN_Gather";
|
||||||
|
// 获取映射文件存放文件夹
|
||||||
|
String dirPath = workDir + "\\9100";
|
||||||
|
int index = workDir.indexOf("\\resources\\extraResources\\java");
|
||||||
|
if (index != -1) {
|
||||||
|
dirPath = workDir.substring(0, workDir.indexOf("\\resources\\extraResources\\java")) + "\\9100";
|
||||||
|
}
|
||||||
|
return dirPath;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean updateIcd(PqIcdPathParam.UpdateParam param) {
|
public boolean updateIcd(PqIcdPathParam.UpdateParam param) {
|
||||||
@@ -62,12 +151,60 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
|||||||
this.checkRepeat(param, true);
|
this.checkRepeat(param, true);
|
||||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||||
BeanUtils.copyProperties(param, pqIcdPath);
|
BeanUtils.copyProperties(param, pqIcdPath);
|
||||||
|
|
||||||
|
String commInstallPath = this.getCommInstallPath();
|
||||||
|
long FILE_SIZE_LIMIT = 1 * 1024 * 1024;
|
||||||
|
MultipartFile mappingFile = param.getMappingFile();
|
||||||
|
if (ObjectUtil.isNotNull(mappingFile) && !mappingFile.isEmpty()) {
|
||||||
|
String mappingFilename = mappingFile.getOriginalFilename();
|
||||||
|
|
||||||
|
if (!mappingFilename.endsWith(".txt")) {
|
||||||
|
throw new BusinessException(IcdResponseEnum.FILE_TYPE_ERROR);
|
||||||
|
}
|
||||||
|
if (mappingFile.getSize() > FILE_SIZE_LIMIT) {
|
||||||
|
throw new BusinessException(IcdResponseEnum.FILE_SIZE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 如果文件存在,则先删除
|
||||||
|
String mappingFilePath = commInstallPath + "\\DeviceControl\\Config\\" + mappingFilename;
|
||||||
|
Path path = Paths.get(mappingFilePath);
|
||||||
|
File file = path.toFile();
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存文件
|
||||||
|
byte[] bytes = mappingFile.getBytes();
|
||||||
|
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(mappingFilePath));
|
||||||
|
bufferedOutputStream.write(bytes);
|
||||||
|
bufferedOutputStream.flush();
|
||||||
|
|
||||||
|
bufferedOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BusinessException(ReportResponseEnum.FILE_UPLOAD_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.executeRestartCmd(commInstallPath);
|
||||||
|
|
||||||
return this.updateById(pqIcdPath);
|
return this.updateById(pqIcdPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean deleteIcd(List<String> ids) {
|
public boolean deleteIcd(List<String> ids) {
|
||||||
|
List<PqIcdPath> pqIcdPaths = this.listByIds(ids);
|
||||||
|
String commInstallPath = this.getCommInstallPath();
|
||||||
|
pqIcdPaths.forEach(pqIcdPath -> {
|
||||||
|
String mappingFilePath = commInstallPath + "\\DeviceControl\\Config\\" + pqIcdPath.getName() + ".txt";
|
||||||
|
Path path = Paths.get(mappingFilePath);
|
||||||
|
File file = path.toFile();
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.njcn.gather.monitor.mapper;
|
package com.njcn.gather.monitor.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,5 +35,21 @@ public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
|||||||
PqMonitor getByDevIdAndNum(@Param("devId") String devId, @Param("num") Integer num);
|
PqMonitor getByDevIdAndNum(@Param("devId") String devId, @Param("num") Integer num);
|
||||||
|
|
||||||
List<PqMonitor> listByDevIds(@Param("devIds") List<String> devIds);
|
List<PqMonitor> listByDevIds(@Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
void updateDeviceCheckState(@Param("devId")String devId, @Param("value") Integer value);
|
||||||
|
|
||||||
|
void updateDeviceCheckResult(@Param("devId")String devId, @Param("value") Integer value);
|
||||||
|
|
||||||
|
void updateDeviceReportRState(@Param("devId")String devId, @Param("value") Integer value);
|
||||||
|
|
||||||
|
AdPlan getPlanByDevId(@Param("devId") String devId);
|
||||||
|
|
||||||
|
List<PqDevSub> listDevSubByPlanId(@Param("planId") String planId);
|
||||||
|
|
||||||
|
void updatePlanCheckState(@Param("planId") String planId, @Param("value") Integer value);
|
||||||
|
|
||||||
|
void updatePlanCheckResult(@Param("planId") String planId, @Param("value") Integer value);
|
||||||
|
|
||||||
|
void updatePlanReportRState(@Param("planId") String planId, @Param("value") Integer value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.gather.monitor.mapper.PqMonitorMapper">
|
<mapper namespace="com.njcn.gather.monitor.mapper.PqMonitorMapper">
|
||||||
|
|
||||||
|
|
||||||
<select id="selectMonitorInfo"
|
<select id="selectMonitorInfo"
|
||||||
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||||
SELECT CONCAT(pq_dev.IP, '_', Num) as lineId,
|
SELECT CONCAT(pq_dev.IP, '_', Num) as lineId,
|
||||||
@@ -41,5 +42,55 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
order by Num
|
order by Num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateDeviceCheckState">
|
||||||
|
update pq_dev_sub
|
||||||
|
set Check_State = #{value}
|
||||||
|
where dev_Id = #{devId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDeviceCheckResult">
|
||||||
|
update pq_dev_sub
|
||||||
|
set Check_Result = #{value}
|
||||||
|
where dev_Id = #{devId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDeviceReportRState">
|
||||||
|
update pq_dev_sub
|
||||||
|
set Report_State = #{value}
|
||||||
|
where dev_Id = #{devId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getPlanByDevId" resultType="com.njcn.gather.plan.pojo.po.AdPlan">
|
||||||
|
select *
|
||||||
|
from ad_plan
|
||||||
|
inner join pq_dev on ad_plan.id = pq_dev.Plan_Id
|
||||||
|
where pq_dev.Id = #{devId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listDevSubByPlanId" resultType="com.njcn.gather.device.pojo.po.PqDevSub">
|
||||||
|
select *
|
||||||
|
from pq_dev_sub
|
||||||
|
inner join pq_dev on pq_dev_sub.dev_Id = pq_dev.Id
|
||||||
|
where pq_dev.Plan_Id = #{planId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updatePlanCheckState">
|
||||||
|
update ad_plan
|
||||||
|
set Test_State = #{value}
|
||||||
|
where id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePlanCheckResult">
|
||||||
|
update ad_plan
|
||||||
|
set Result = #{value}
|
||||||
|
where id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePlanReportRState">
|
||||||
|
update ad_plan
|
||||||
|
set Report_State = #{value}
|
||||||
|
where id = #{planId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class PqMonitorParam {
|
|||||||
private Integer statInterval;
|
private Integer statInterval;
|
||||||
|
|
||||||
@ApiModelProperty(value = "谐波系统监测点id")
|
@ApiModelProperty(value = "谐波系统监测点id")
|
||||||
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
// @NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||||
private String harmSysId;
|
private String harmSysId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否做检测")
|
@ApiModelProperty(value = "是否做检测")
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import javax.validation.constraints.NotNull;
|
|||||||
@Data
|
@Data
|
||||||
public class PqMonitorExcel {
|
public class PqMonitorExcel {
|
||||||
|
|
||||||
@Excel(name = "谐波系统监测点ID*", width = 20, orderNum = "1")
|
@Excel(name = "谐波系统监测点ID", width = 20, orderNum = "1")
|
||||||
@NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
// @NotBlank(message = DetectionValidMessage.MONITOR_ID_NOT_BLANK)
|
||||||
private String harmSysId;
|
private String harmSysId;
|
||||||
|
|
||||||
@Excel(name = "所属母线*", width = 20, orderNum = "2")
|
@Excel(name = "母线名称*", width = 20, orderNum = "2")
|
||||||
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||||
private String busbar;
|
private String busbar;
|
||||||
|
|
||||||
@@ -30,19 +30,27 @@ public class PqMonitorExcel {
|
|||||||
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
@Excel(name = "PT变比(pt1:pt2)*", width = 20, orderNum = "5")
|
@Excel(name = "PT一次变比*", width = 20, orderNum = "5")
|
||||||
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||||
private String pt;
|
private String pt1;
|
||||||
|
|
||||||
@Excel(name = "CT变比(ct1:ct2)*", width = 20, orderNum = "6")
|
@Excel(name = "PT二次变比*", width = 20, orderNum = "6")
|
||||||
|
@NotBlank(message = DetectionValidMessage.PT_NOT_BLANK)
|
||||||
|
private String pt2;
|
||||||
|
|
||||||
|
@Excel(name = "CT一次变比*", width = 20, orderNum = "7")
|
||||||
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||||
private String ct;
|
private String ct1;
|
||||||
|
|
||||||
@Excel(name = "接线方式*", width = 20, orderNum = "7")
|
@Excel(name = "CT二次变比*", width = 20, orderNum = "8")
|
||||||
|
@NotBlank(message = DetectionValidMessage.CT_NOT_BLANK)
|
||||||
|
private String ct2;
|
||||||
|
|
||||||
|
@Excel(name = "接线方式*", width = 20, orderNum = "9")
|
||||||
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.CONNECTION_NOT_BLANK)
|
||||||
private String connection;
|
private String connection;
|
||||||
|
|
||||||
@Excel(name = "统计间隔*", width = 10, orderNum = "8")
|
@Excel(name = "统计间隔*", width = 20, orderNum = "10")
|
||||||
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.STAT_INTERVAL_NOT_NULL)
|
||||||
private Integer statInterval;
|
private Integer statInterval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
|||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -112,4 +111,18 @@ public interface IPqMonitorService extends IService<PqMonitor> {
|
|||||||
*/
|
*/
|
||||||
Integer getDevCheckResult(String devId);
|
Integer getDevCheckResult(String devId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据被检设备id删除监测点信息
|
||||||
|
*
|
||||||
|
* @param devId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean removeByDevId(String devId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据被检设备id和监测点编号获取监测点信息
|
||||||
|
* @param id 被检设备id
|
||||||
|
* @param monitorNum 监测点编号
|
||||||
|
*/
|
||||||
|
PqMonitor getByDevAndNum(String id, int monitorNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,15 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.device.pojo.enums.CheckResultEnum;
|
import com.njcn.gather.device.pojo.enums.CheckResultEnum;
|
||||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
||||||
|
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||||
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
||||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
|
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
import com.njcn.gather.storage.service.impl.DetectionDataServiceImpl;
|
import com.njcn.gather.storage.service.impl.DetectionDataServiceImpl;
|
||||||
@@ -26,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@@ -62,11 +67,108 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
@Transactional
|
@Transactional
|
||||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||||
// 先删除原有数据
|
// 先删除原有数据
|
||||||
this.deletePqMonitorByDevId(devId);
|
// this.deletePqMonitorByDevId(devId);
|
||||||
// 再添加新数据
|
|
||||||
|
// 添加新数据
|
||||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(paramList, PqMonitor.class);
|
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(paramList, PqMonitor.class);
|
||||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||||
return this.saveBatch(pqMonitorList);
|
|
||||||
|
List<PqMonitor> existedMonitorList = this.listPqMonitorByDevIds(Collections.singletonList(devId));
|
||||||
|
|
||||||
|
Map<Integer, List<PqMonitor>> map = pqMonitorList.stream().collect(Collectors.groupingBy(PqMonitor::getNum));
|
||||||
|
|
||||||
|
List<PqMonitor> newMonitorList = new ArrayList<>();
|
||||||
|
map.forEach((num, monitorList) -> {
|
||||||
|
PqMonitor pqMonitor = existedMonitorList.stream().filter(monitor -> monitor.getNum() == num).findFirst().orElse(null);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotNull(pqMonitor)) {
|
||||||
|
BeanUtil.copyProperties(monitorList.get(0), pqMonitor, "id", "realtimeResult", "statisticsResult", "recordedResult", "realtimeNum", "statisticsNum", "recordedNum", "resultType", "qualifiedNum");
|
||||||
|
newMonitorList.add(pqMonitor);
|
||||||
|
} else {
|
||||||
|
newMonitorList.addAll(monitorList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 同步更新设备的状态
|
||||||
|
List<PqMonitor> enableCheckMonitorList = newMonitorList.stream().filter(pqMonitor -> pqMonitor.getCheckFlag() == 1).collect(Collectors.toList());
|
||||||
|
List<PqMonitor> checkedMonitorList = enableCheckMonitorList.stream().filter(pqMonitor -> ObjectUtil.isNotNull(pqMonitor.getResultType())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (enableCheckMonitorList.size() == checkedMonitorList.size() && checkedMonitorList.size() > 0) {
|
||||||
|
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.CHECKED.getValue());
|
||||||
|
this.baseMapper.updateDeviceReportRState(devId, DevReportStateEnum.NOT_GENERATED.getValue());
|
||||||
|
}
|
||||||
|
if (enableCheckMonitorList.size() > checkedMonitorList.size() && checkedMonitorList.size() > 0) {
|
||||||
|
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.CHECKING.getValue());
|
||||||
|
this.baseMapper.updateDeviceReportRState(devId, DevReportStateEnum.NOT_GENERATED.getValue());
|
||||||
|
}
|
||||||
|
if (enableCheckMonitorList.size() > 0 && checkedMonitorList.size() == 0) {
|
||||||
|
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.UNCHECKED.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Integer> monitorResultList = checkedMonitorList.stream().map(pqMonitor -> {
|
||||||
|
String resultType = pqMonitor.getResultType();
|
||||||
|
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(resultType);
|
||||||
|
switch (dataSourceEnum) {
|
||||||
|
case REAL_DATA:
|
||||||
|
return pqMonitor.getRealtimeResult();
|
||||||
|
case WAVE_DATA:
|
||||||
|
return pqMonitor.getRecordedResult();
|
||||||
|
case MINUTE_STATISTICS_MAX:
|
||||||
|
case MINUTE_STATISTICS_MIN:
|
||||||
|
case MINUTE_STATISTICS_AVG:
|
||||||
|
case MINUTE_STATISTICS_CP95:
|
||||||
|
return pqMonitor.getStatisticsResult();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
long qualifiedCount = monitorResultList.stream().filter(result -> result != null && result == 1).count();
|
||||||
|
if (qualifiedCount == monitorResultList.size() && monitorResultList.size() > 0) {
|
||||||
|
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.ACCORD.getValue());
|
||||||
|
} else if (monitorResultList.size() > 0) {
|
||||||
|
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.NOT_ACCORD.getValue());
|
||||||
|
} else {
|
||||||
|
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.UNCHECKED.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同步更新计划的状态
|
||||||
|
AdPlan plan = this.baseMapper.getPlanByDevId(devId);
|
||||||
|
if (ObjectUtil.isNotNull(plan)) {
|
||||||
|
|
||||||
|
|
||||||
|
List<PqDevSub> devSubList = this.baseMapper.listDevSubByPlanId(plan.getId());
|
||||||
|
|
||||||
|
List<PqDevSub> checkedDevSubList = devSubList.stream().filter(pqDevSub -> pqDevSub.getCheckState() == CheckStateEnum.CHECKED.getValue()).collect(Collectors.toList());
|
||||||
|
List<PqDevSub> checkingDevSubList = devSubList.stream().filter(pqDevSub -> pqDevSub.getCheckState() == CheckStateEnum.CHECKING.getValue()).collect(Collectors.toList());
|
||||||
|
if (checkedDevSubList.size() == devSubList.size() && devSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.CHECKED.getValue());
|
||||||
|
} else if (checkedDevSubList.size() > 0 || checkingDevSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.CHECKING.getValue());
|
||||||
|
} else {
|
||||||
|
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.UNCHECKED.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PqDevSub> accordDevSubList = checkedDevSubList.stream().filter(pqDevSub -> pqDevSub.getCheckResult() == CheckResultEnum.ACCORD.getValue()).collect(Collectors.toList());
|
||||||
|
if (accordDevSubList.size() == checkedDevSubList.size() && checkedDevSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.ACCORD.getValue());
|
||||||
|
} else if (accordDevSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.NOT_ACCORD.getValue());
|
||||||
|
} else {
|
||||||
|
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.UNCHECKED.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PqDevSub> generatedDevSubList = checkedDevSubList.stream().filter(pqDevSub -> pqDevSub.getReportState() == DevReportStateEnum.GENERATED.getValue()).collect(Collectors.toList());
|
||||||
|
if (generatedDevSubList.size() == checkedDevSubList.size() && checkedDevSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_ALL_GENERATED.getValue());
|
||||||
|
} else if (generatedDevSubList.size() > 0) {
|
||||||
|
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_PARTIALLY_GENERATED.getValue());
|
||||||
|
} else {
|
||||||
|
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.saveOrUpdateBatch(newMonitorList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,10 +265,19 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
} else {
|
} else {
|
||||||
newWaveNum.set(waveNum);
|
newWaveNum.set(waveNum);
|
||||||
newMonitorResult = waveNumResultMap.get(waveNum);
|
newMonitorResult = waveNumResultMap.get(waveNum);
|
||||||
|
if (newMonitorResult == 2) {
|
||||||
|
newMonitorResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
newMonitorResult = detectionDataDealService.getMonitorResult(monitorId, adTypes, dataSourceEnum.getValue(), num, null, code);
|
newMonitorResult = detectionDataDealService.getMonitorResult(monitorId, adTypes, dataSourceEnum.getValue(), num, null, code);
|
||||||
|
if (newMonitorResult == 2) {
|
||||||
|
newMonitorResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||||
|
}
|
||||||
|
if (newMonitorResult == 1) {
|
||||||
|
newMonitorResult = CheckResultEnum.ACCORD.getValue();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +299,18 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
|
|
||||||
if (CheckResultEnum.ACCORD.getValue().equals(oldMonitorResult)) {
|
if (CheckResultEnum.ACCORD.getValue().equals(oldMonitorResult)) {
|
||||||
if (CheckResultEnum.ACCORD.getValue().equals(newMonitorResult)) {
|
if (CheckResultEnum.ACCORD.getValue().equals(newMonitorResult)) {
|
||||||
qualifiedNum += 1;
|
String oldNum = "";
|
||||||
|
if (DataSourceEnum.REAL_DATA.getValue().equals(resultType)) {
|
||||||
|
oldNum = monitor.getRealtimeNum();
|
||||||
|
} else if (DataSourceEnum.WAVE_DATA.getValue().equals(resultType)) {
|
||||||
|
oldNum = monitor.getRecordedNum();
|
||||||
|
} else {
|
||||||
|
oldNum = monitor.getStatisticsNum();
|
||||||
|
}
|
||||||
|
String[] split1 = oldNum.split(CnSocketUtil.SPLIT_TAG);
|
||||||
|
if (!split1[0].equals(num.toString())) {
|
||||||
|
qualifiedNum += 1;
|
||||||
|
}
|
||||||
updateFlag = true;
|
updateFlag = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -269,15 +391,61 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
String resultType = monitor.getResultType();
|
String resultType = monitor.getResultType();
|
||||||
if (StrUtil.isNotBlank(resultType)) {
|
if (StrUtil.isNotBlank(resultType)) {
|
||||||
if (DataSourceEnum.REAL_DATA.getValue().equals(resultType)) {
|
if (DataSourceEnum.REAL_DATA.getValue().equals(resultType)) {
|
||||||
allResultFlags.add(monitor.getRealtimeResult());
|
//allResultFlags.add(monitor.getRealtimeResult());
|
||||||
|
if (monitor.getRealtimeResult() == 0) {
|
||||||
|
allResultFlags.add(2);
|
||||||
|
}
|
||||||
|
if (monitor.getRealtimeResult() == 1) {
|
||||||
|
allResultFlags.add(1);
|
||||||
|
}
|
||||||
|
if (monitor.getRealtimeResult() == 4) {
|
||||||
|
allResultFlags.add(4);
|
||||||
|
}
|
||||||
} else if (DataSourceEnum.WAVE_DATA.getValue().equals(resultType)) {
|
} else if (DataSourceEnum.WAVE_DATA.getValue().equals(resultType)) {
|
||||||
allResultFlags.add(monitor.getRecordedResult());
|
//allResultFlags.add(monitor.getRecordedResult());
|
||||||
|
if (monitor.getRecordedResult() == 0) {
|
||||||
|
allResultFlags.add(2);
|
||||||
|
}
|
||||||
|
if (monitor.getRecordedResult() == 1) {
|
||||||
|
allResultFlags.add(1);
|
||||||
|
}
|
||||||
|
if (monitor.getRecordedResult() == 4) {
|
||||||
|
allResultFlags.add(4);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
allResultFlags.add(monitor.getStatisticsResult());
|
//allResultFlags.add(monitor.getStatisticsResult());
|
||||||
|
if (monitor.getStatisticsResult() == 0) {
|
||||||
|
allResultFlags.add(2);
|
||||||
|
}
|
||||||
|
if (monitor.getStatisticsResult() == 1) {
|
||||||
|
allResultFlags.add(1);
|
||||||
|
}
|
||||||
|
if (monitor.getStatisticsResult() == 4) {
|
||||||
|
allResultFlags.add(4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DetectionDataServiceImpl.isResultFlag(allResultFlags);
|
return DetectionDataServiceImpl.isResultFlag(allResultFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeByDevId(String devId) {
|
||||||
|
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||||
|
return this.remove(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PqMonitor getByDevAndNum(String devId, int monitorNum) {
|
||||||
|
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("pq_monitor.Dev_Id", devId)
|
||||||
|
.eq("pq_monitor.Num", monitorNum);
|
||||||
|
List<PqMonitor> pqMonitors = this.list(wrapper);
|
||||||
|
if (CollUtil.isNotEmpty(pqMonitors)) {
|
||||||
|
return pqMonitors.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -178,7 +180,7 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getBigTestItem")
|
@PostMapping("/getBigTestItem")
|
||||||
@ApiOperation("获取检测大项数据")
|
@ApiOperation("获取检测大项数据")
|
||||||
@ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
@ApiImplicitParam(name = "checkParam", value = "检测计划id", required = true)
|
||||||
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
||||||
String methodDescribe = getMethodDescribe("getBigTestItem");
|
String methodDescribe = getMethodDescribe("getBigTestItem");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
||||||
@@ -189,7 +191,7 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
@PostMapping("/analyse")
|
@PostMapping("/analyse")
|
||||||
@ApiOperation("检测数据分析")
|
@ApiOperation("检测数据分析")
|
||||||
@ApiImplicitParam(name = "planId", value = "检测计划id", required = true)
|
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
||||||
public void analyse(@RequestBody List<String> ids) {
|
public void analyse(@RequestBody List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("analyse");
|
String methodDescribe = getMethodDescribe("analyse");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
@@ -199,7 +201,7 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/listByPlanId")
|
@PostMapping("/listByPlanId")
|
||||||
@ApiOperation("查询出所有已绑定的设备")
|
@ApiOperation("查询出所有已绑定的设备")
|
||||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
@@ -239,7 +241,7 @@ public class AdPlanController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/listDevByPlanId")
|
@PostMapping("/listDevByPlanId")
|
||||||
@ApiOperation("根据计划id分页查询被检设备")
|
@ApiOperation("根据计划id分页查询被检设备")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<PqDevVO>> listDevByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
public HttpResult<Page<PqDevVO>> listDevByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
String methodDescribe = getMethodDescribe("listDevByPlanId");
|
String methodDescribe = getMethodDescribe("listDevByPlanId");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
@@ -452,7 +454,17 @@ public class AdPlanController extends BaseController {
|
|||||||
fileTypeError.setMessage("请上传zip文件");
|
fileTypeError.setMessage("请上传zip文件");
|
||||||
throw new BusinessException(fileTypeError);
|
throw new BusinessException(fileTypeError);
|
||||||
}
|
}
|
||||||
asyncPlanHandler.importAndMergePlanCheckData(file, getUserId(), planId);
|
// 创建临时文件
|
||||||
|
File tempFile = cn.hutool.core.io.FileUtil.createTempFile();
|
||||||
|
// 将MultipartFile内容写入临时文件
|
||||||
|
try {
|
||||||
|
file.transferTo(tempFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.FAIL, "文件保存失败");
|
||||||
|
}
|
||||||
|
// 获取文件路径
|
||||||
|
String filePath = tempFile.getAbsolutePath();
|
||||||
|
asyncPlanHandler.importAndMergePlanCheckData(filePath, getUserId(), planId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,8 @@ import org.springframework.scheduling.annotation.Async;
|
|||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -65,6 +63,8 @@ public class AsyncPlanHandler {
|
|||||||
private final IAdPariService adPairService;
|
private final IAdPariService adPairService;
|
||||||
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
private final JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
|
||||||
@Value("${report.reportDir}")
|
@Value("${report.reportDir}")
|
||||||
private String reportPath;
|
private String reportPath;
|
||||||
@Value("${data.homeDir}")
|
@Value("${data.homeDir}")
|
||||||
@@ -235,35 +235,28 @@ public class AsyncPlanHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Async
|
@Async
|
||||||
public void importAndMergePlanCheckData(MultipartFile file, String uid, String planId) {
|
public void importAndMergePlanCheckData(String zipFilePath, String uid, String planId) {
|
||||||
|
importAndMergePlanCheckDataLogic(zipFilePath, uid, planId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void importAndMergePlanCheckDataLogic(String zipFilePath, String uid, String planId) {
|
||||||
NonWebAutoFillValueHandler.setCurrentUserId(uid);
|
NonWebAutoFillValueHandler.setCurrentUserId(uid);
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
AtomicInteger progress = new AtomicInteger(0);
|
AtomicInteger progress = new AtomicInteger(0);
|
||||||
AtomicInteger currentProgress = new AtomicInteger(0);
|
AtomicInteger currentProgress = new AtomicInteger(0);
|
||||||
AtomicInteger dataCount = new AtomicInteger(0);
|
AtomicInteger dataCount = new AtomicInteger(0);
|
||||||
try {
|
try {
|
||||||
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "开始保存文件,请耐心等待..."));
|
|
||||||
// 创建临时目录用于解压文件
|
// 创建临时目录用于解压文件
|
||||||
File tempDir = FileUtil.mkdir(FileUtil.getTmpDirPath() + "import_plan_check_data_" + System.currentTimeMillis() + "/");
|
File tempDir = FileUtil.mkdir(FileUtil.getTmpDirPath() + "import_plan_check_data_" + System.currentTimeMillis() + "/");
|
||||||
|
|
||||||
// 将上传的zip文件保存到临时目录
|
|
||||||
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
|
||||||
try {
|
|
||||||
// 直接获取文件字节,避免依赖Tomcat临时文件
|
|
||||||
byte[] fileBytes = file.getBytes();
|
|
||||||
FileUtil.writeBytes(fileBytes, zipFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("保存上传文件失败", e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
progress.addAndGet(1);
|
progress.addAndGet(1);
|
||||||
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "开始解压文件,请耐心等待..."));
|
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "开始解压文件,请耐心等待..."));
|
||||||
|
|
||||||
// 解压zip文件
|
// 解压zip文件
|
||||||
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
||||||
ZipUtil.unzip(zipFile.getAbsolutePath(), unzipDir.getAbsolutePath());
|
ZipUtil.unzip(zipFilePath, unzipDir.getAbsolutePath());
|
||||||
|
|
||||||
// 查找解压目录中的json文件
|
// 查找解压目录中的json文件
|
||||||
File[] files = unzipDir.listFiles();
|
File[] files = unzipDir.listFiles();
|
||||||
@@ -464,14 +457,14 @@ public class AsyncPlanHandler {
|
|||||||
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "数据合并完成"));
|
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), progress, "数据合并完成"));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
log.error("导入数据失败", e);
|
log.error("导入数据失败", e);
|
||||||
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.FAIL.getCode(), progress.get() + currentProgress.get(), "导入失败"));
|
sseClient.sendMessage(uid, planId, HttpResultUtil.assembleResult(CommonResponseEnum.FAIL.getCode(), progress.get() + currentProgress.get(), "导入失败"));
|
||||||
} finally {
|
} finally {
|
||||||
NonWebAutoFillValueHandler.clearCurrentUserId();
|
NonWebAutoFillValueHandler.clearCurrentUserId();
|
||||||
}
|
}
|
||||||
|
FileUtil.del(zipFilePath);
|
||||||
sseClient.closeSse(uid);
|
sseClient.closeSse(uid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建分页查询SQL
|
// 构建分页查询SQL
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
List<PqDevVO> pqDevVOList = pqDevMapper.selectByQueryParam(queryParam1);
|
||||||
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
if (CollUtil.isNotEmpty(pqDevVOList)) {
|
||||||
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState())).count();
|
long count = pqDevVOList.stream().filter(pqDev -> CheckStateEnum.CHECKED.getValue().equals(pqDev.getCheckState()) || CheckStateEnum.DOCUMENTED.getValue().equals(pqDev.getCheckState())).count();
|
||||||
adPlanVO.setProgress((float) count / pqDevVOList.size());
|
adPlanVO.setProgress((float) count / pqDevVOList.size());
|
||||||
} else {
|
} else {
|
||||||
adPlanVO.setProgress(0.0f);
|
adPlanVO.setProgress(0.0f);
|
||||||
@@ -531,7 +531,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> listByPattern(String pattern) {
|
public List<Map<String, Object>> listByPattern(String pattern) {
|
||||||
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
|
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).orderByDesc(AdPlan::getCreateTime).list();
|
||||||
Map<Integer, List<AdPlan>> map1 = adPlanList.stream().collect(Collectors.groupingBy(AdPlan::getTestState));
|
Map<Integer, List<AdPlan>> map1 = adPlanList.stream().collect(Collectors.groupingBy(AdPlan::getTestState));
|
||||||
|
|
||||||
List<Map<String, Object>> result = new ArrayList<>();
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
@@ -554,6 +554,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
child.put("pid", adPlan.getFatherPlanId());
|
child.put("pid", adPlan.getFatherPlanId());
|
||||||
child.put("name", adPlan.getName());
|
child.put("name", adPlan.getName());
|
||||||
child.put("timeCheck", adPlan.getTimeCheck());
|
child.put("timeCheck", adPlan.getTimeCheck());
|
||||||
|
child.put("dataRule", adPlan.getDataRule());
|
||||||
|
|
||||||
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
|
||||||
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());
|
||||||
@@ -630,7 +631,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MAX.getValue())
|
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MAX.getValue())
|
||||||
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MIN.getValue())) {
|
|| datasourceId.contains(DataSourceEnum.MINUTE_STATISTICS_MIN.getValue())) {
|
||||||
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
|
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
|
||||||
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()));
|
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()).orderByAsc("sort"));
|
||||||
|
|
||||||
for (DictTree dictTree : dictTreeList) {
|
for (DictTree dictTree : dictTreeList) {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
@@ -1554,8 +1555,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本
|
// 检测脚本
|
||||||
List<Map<String, Object>> maps1 = pqScriptService.listAllPqScript(null);
|
List<PqScript> pqScriptList = pqScriptService.listAllPqScript(null);
|
||||||
List<String> scriptNameList = maps1.stream().map(m -> (String) m.get("name")).collect(Collectors.toList());
|
List<String> scriptNameList = pqScriptList.stream().map(m -> m.getName()).collect(Collectors.toList());
|
||||||
pullDown = new PullDown();
|
pullDown = new PullDown();
|
||||||
pullDown.setFirstCol(3);
|
pullDown.setFirstCol(3);
|
||||||
pullDown.setLastCol(3);
|
pullDown.setLastCol(3);
|
||||||
@@ -1721,8 +1722,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
String zipFileName = URLEncoder.encode(subPlan.getName() + ".zip", "UTF-8");
|
String zipFileName = URLEncoder.encode(subPlan.getName() + ".zip", "UTF-8");
|
||||||
File zipFile = FileUtil.file(tempDir, zipFileName);
|
File zipFile = FileUtil.file(tempDir, zipFileName);
|
||||||
|
|
||||||
// 先将json文件添加到zip中
|
// 先将json文件添加到zip中(使用UTF-8编码)
|
||||||
ZipUtil.zip(jsonFile.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, jsonFile);
|
||||||
|
|
||||||
|
|
||||||
// 创建一个临时目录存放两个文件
|
// 创建一个临时目录存放两个文件
|
||||||
@@ -1744,8 +1745,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 重新创建zip文件,包含所有文件
|
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||||
|
|
||||||
// 删除临时目录
|
// 删除临时目录
|
||||||
FileUtil.del(tempZipDir);
|
FileUtil.del(tempZipDir);
|
||||||
@@ -1779,9 +1780,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
||||||
file.transferTo(zipFile);
|
file.transferTo(zipFile);
|
||||||
|
|
||||||
// 解压zip文件
|
// 解压zip文件,使用UTF-8编码
|
||||||
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
||||||
ZipUtil.unzip(zipFile.getAbsolutePath(), unzipDir.getAbsolutePath());
|
ZipUtil.unzip(zipFile, unzipDir, CharsetUtil.CHARSET_UTF_8);
|
||||||
|
|
||||||
// 查找解压目录中的json文件
|
// 查找解压目录中的json文件
|
||||||
File[] files = unzipDir.listFiles();
|
File[] files = unzipDir.listFiles();
|
||||||
@@ -2099,8 +2100,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新创建zip文件,包含所有文件
|
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||||
|
|
||||||
// 删除临时目录
|
// 删除临时目录
|
||||||
FileUtil.del(tempZipDir);
|
FileUtil.del(tempZipDir);
|
||||||
|
|||||||
@@ -73,8 +73,9 @@ public enum DetectionResponseEnum {
|
|||||||
MONITOR_NUM_REPEAT("A02094", "该被检设备下存在相同线路号的监测点"),
|
MONITOR_NUM_REPEAT("A02094", "该被检设备下存在相同线路号的监测点"),
|
||||||
PLAN_HAS_CHILDREN("A02095", "该计划下存在子计划,请先删除子计划"),
|
PLAN_HAS_CHILDREN("A02095", "该计划下存在子计划,请先删除子计划"),
|
||||||
PLAN_REPEATED_IN_SAME_LEVEL("A02096", "该父计划下存在同名的子计划"),
|
PLAN_REPEATED_IN_SAME_LEVEL("A02096", "该父计划下存在同名的子计划"),
|
||||||
PLEASE_UNASSIGN_STANDARD_DEV("A02097","存在已分配给子计划的标准设备,请先解除分配" ),
|
PLEASE_UNASSIGN_STANDARD_DEV("A02097", "存在已分配给子计划的标准设备,请先解除分配"),
|
||||||
PLEASE_UNASSIGN_DEVICE("A02098", "存在已分配给计划的被检设备,请先解除分配");
|
PLEASE_UNASSIGN_DEVICE("A02098", "存在已分配给计划的被检设备,请先解除分配"),
|
||||||
|
DEV_IP_PORT_EXIST("A02099", "存在重复被检设备");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
||||||
|
|||||||
@@ -31,22 +31,22 @@ import java.util.List;
|
|||||||
* @data 2025/1/9 14:02
|
* @data 2025/1/9 14:02
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "报表管理")
|
@Api(tags = "报告管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/report")
|
@RequestMapping("/report")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ReportController extends BaseController {
|
public class ReportController extends BaseController {
|
||||||
|
|
||||||
private final IPqReportService pqReportService;
|
private final IPqReportService pqReportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 此方法临时的,给楼下使用,实际需要优化
|
* 此方法临时的,给楼下使用,实际需要优化
|
||||||
* 1、不同的设备需要不同的模板;
|
* 1、不同的设备需要不同的模板;
|
||||||
* 2、数据页的内容暂时是固定的,后期可能是动态的;
|
* 2、数据页的内容暂时是固定的,后期可能是动态 的;
|
||||||
*/
|
*/
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/generateReport")
|
@PostMapping("/generateReport")
|
||||||
@ApiOperation("生成测试报告")
|
@ApiOperation("生成报告")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<Object> generateReport(@RequestBody DevReportParam devReportParam) {
|
public HttpResult<Object> generateReport(@RequestBody DevReportParam devReportParam) {
|
||||||
String methodDescribe = getMethodDescribe("generateReport");
|
String methodDescribe = getMethodDescribe("generateReport");
|
||||||
@@ -60,7 +60,7 @@ public class ReportController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/downloadReport")
|
@PostMapping("/downloadReport")
|
||||||
@ApiOperation("下载测试报告")
|
@ApiOperation("下载报告")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public void downloadReport(@RequestBody DevReportParam devReportParam, HttpServletResponse response) {
|
public void downloadReport(@RequestBody DevReportParam devReportParam, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("downloadReport");
|
String methodDescribe = getMethodDescribe("downloadReport");
|
||||||
@@ -91,7 +91,7 @@ public class ReportController extends BaseController {
|
|||||||
@OperateInfo(operateType = OperateType.ADD)
|
@OperateInfo(operateType = OperateType.ADD)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增报告模板")
|
@ApiOperation("新增报告模板")
|
||||||
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
|
@ApiImplicitParam(name = "reportParam", value = "报告模板参数", required = true)
|
||||||
public HttpResult<Boolean> add(ReportParam reportParam) {
|
public HttpResult<Boolean> add(ReportParam reportParam) {
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam);
|
LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam);
|
||||||
@@ -106,7 +106,7 @@ public class ReportController extends BaseController {
|
|||||||
@OperateInfo(operateType = OperateType.UPDATE)
|
@OperateInfo(operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("更新报告模板")
|
@ApiOperation("更新报告模板")
|
||||||
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
|
@ApiImplicitParam(name = "reportParam", value = "报告模板参数", required = true)
|
||||||
public HttpResult<Boolean> update(ReportParam.UpdateParam reportParam) {
|
public HttpResult<Boolean> update(ReportParam.UpdateParam reportParam) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam);
|
LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam);
|
||||||
@@ -136,7 +136,6 @@ public class ReportController extends BaseController {
|
|||||||
@OperateInfo
|
@OperateInfo
|
||||||
@GetMapping("/listAllName")
|
@GetMapping("/listAllName")
|
||||||
@ApiOperation("查询所有报告模板名称")
|
@ApiOperation("查询所有报告模板名称")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
|
||||||
public HttpResult<List<String>> listAllName() {
|
public HttpResult<List<String>> listAllName() {
|
||||||
String methodDescribe = getMethodDescribe("listAllName");
|
String methodDescribe = getMethodDescribe("listAllName");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.listAllName(), methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.listAllName(), methodDescribe);
|
||||||
@@ -145,7 +144,7 @@ public class ReportController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/documented")
|
@PostMapping("/documented")
|
||||||
@ApiOperation("设备归档")
|
@ApiOperation("设备归档")
|
||||||
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
@ApiImplicitParam(name = "ids", value = "设备id", required = true)
|
||||||
public HttpResult<Boolean> documented(@RequestBody List<String> ids) {
|
public HttpResult<Boolean> documented(@RequestBody List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("documented");
|
String methodDescribe = getMethodDescribe("documented");
|
||||||
LogUtil.njcnDebug(log, "{},设备id为:{}", methodDescribe, ids);
|
LogUtil.njcnDebug(log, "{},设备id为:{}", methodDescribe, ids);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public enum BaseReportKeyEnum {
|
|||||||
DAY("day","日"),
|
DAY("day","日"),
|
||||||
YEAR_MONTH_DAY("year-month-day","年-月-日"),
|
YEAR_MONTH_DAY("year-month-day","年-月-日"),
|
||||||
REPORT_DATE("reportDate","年-月-日"),
|
REPORT_DATE("reportDate","年-月-日"),
|
||||||
|
GD_NAME("gdName","供电部门"),
|
||||||
SUB_NAME("subName","变电站"),
|
SUB_NAME("subName","变电站"),
|
||||||
CHECK_BY("checkBy","检测人"),
|
CHECK_BY("checkBy","检测人"),
|
||||||
AUDIT_BY("auditBy","负责人、审核人"),
|
AUDIT_BY("auditBy","负责人、审核人"),
|
||||||
@@ -38,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;
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import com.njcn.gather.device.service.IPqDevService;
|
|||||||
import com.njcn.gather.device.service.IPqDevSubService;
|
import com.njcn.gather.device.service.IPqDevSubService;
|
||||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
import com.njcn.gather.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
@@ -59,6 +61,7 @@ import com.njcn.gather.report.service.IPqReportService;
|
|||||||
import com.njcn.gather.result.service.IResultService;
|
import com.njcn.gather.result.service.IResultService;
|
||||||
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO;
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
|
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
|
||||||
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
import com.njcn.gather.storage.service.SimAndDigHarmonicService;
|
||||||
@@ -67,6 +70,7 @@ 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.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
|
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||||
import com.njcn.gather.tools.report.model.constant.ReportConstant;
|
import com.njcn.gather.tools.report.model.constant.ReportConstant;
|
||||||
import com.njcn.gather.tools.report.service.IWordReportService;
|
import com.njcn.gather.tools.report.service.IWordReportService;
|
||||||
import com.njcn.gather.tools.report.util.BookmarkUtil;
|
import com.njcn.gather.tools.report.util.BookmarkUtil;
|
||||||
@@ -85,11 +89,11 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPReply;
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.docx4j.jaxb.Context;
|
import org.docx4j.jaxb.Context;
|
||||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||||
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
|
||||||
import org.docx4j.wml.*;
|
import org.docx4j.wml.*;
|
||||||
import org.docx4j.wml.Color;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
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;
|
||||||
@@ -109,9 +113,11 @@ import java.math.BigInteger;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -161,6 +167,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Value("${qr.gcDev.path}")
|
@Value("${qr.gcDev.path}")
|
||||||
private String gcDevPath;
|
private String gcDevPath;
|
||||||
|
|
||||||
|
@Value("${report.dateFormat}")
|
||||||
|
private String dateFormat;
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
private final PqDevMapper pqDevMapper;
|
private final PqDevMapper pqDevMapper;
|
||||||
@@ -178,6 +186,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
private final ISysUserService sysUserService;
|
private final ISysUserService sysUserService;
|
||||||
private final IPqErrSysService pqErrSysService;
|
private final IPqErrSysService pqErrSysService;
|
||||||
private final IAdPlanTestConfigService adPlanTestConfigService;
|
private final IAdPlanTestConfigService adPlanTestConfigService;
|
||||||
|
private final IPqMonitorService pqMonitorService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RestTemplateUtil restTemplateUtil;
|
private RestTemplateUtil restTemplateUtil;
|
||||||
@@ -306,7 +315,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) {
|
||||||
MultipartFile baseFile = reportParam.getBaseFile();
|
MultipartFile baseFile = reportParam.getBaseFile();
|
||||||
MultipartFile detailFile = reportParam.getDetailFile();
|
MultipartFile detailFile = reportParam.getDetailFile();
|
||||||
String newDir = templatePath + File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
String relativePath = reportParam.getName() + File.separator + reportParam.getVersion() + File.separator;
|
||||||
|
String newDir = templatePath + File.separator + relativePath;
|
||||||
|
|
||||||
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
long FILE_SIZE_LIMIT = 5 * 1024 * 1024;
|
||||||
if (isAdd) {
|
if (isAdd) {
|
||||||
@@ -325,13 +335,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
pqReport.setBasePath(newDir + baseOriginalFilename);
|
pqReport.setBasePath(relativePath + baseOriginalFilename);
|
||||||
pqReport.setDetailPath(newDir + detailOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailOriginalFilename);
|
||||||
|
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseOriginalFilename);
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailOriginalFilename);
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
throw new BusinessException(ReportResponseEnum.FILE_NOT_NULL);
|
||||||
}
|
}
|
||||||
@@ -379,34 +389,34 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
//若修改了文件名称、版本号,则需要重命名文件
|
//若修改了文件名称、版本号,则需要重命名文件
|
||||||
this.createDirectory(newDir);
|
this.createDirectory(newDir);
|
||||||
if (!oldDir.equals(newDir)) {
|
if (!oldDir.equals(relativePath)) {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
String oldBasePathStr = oldPqReport.getBasePath();
|
String oldBasePathStr = oldPqReport.getBasePath();
|
||||||
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldBasePath = Paths.get(oldBasePathStr);
|
Path oldBasePath = Paths.get(templatePath + File.separator + oldBasePathStr);
|
||||||
Path newBasePath = Paths.get(newDir + baseName);
|
Path newBasePath = Paths.get(newDir + baseName);
|
||||||
pqReport.setBasePath(newDir + baseName);
|
pqReport.setBasePath(relativePath + baseName);
|
||||||
|
|
||||||
String oldDetailPathStr = oldPqReport.getDetailPath();
|
String oldDetailPathStr = oldPqReport.getDetailPath();
|
||||||
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1);
|
||||||
Path oldDetailPath = Paths.get(oldDetailPathStr);
|
Path oldDetailPath = Paths.get(templatePath + File.separator + oldDetailPathStr);
|
||||||
Path newDetailPath = Paths.get(newDir + detailName);
|
Path newDetailPath = Paths.get(newDir + detailName);
|
||||||
pqReport.setDetailPath(newDir + detailName);
|
pqReport.setDetailPath(relativePath + detailName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// windows下文件夹名称不区分大小写
|
// windows下文件夹名称不区分大小写
|
||||||
if (!oldDir.equalsIgnoreCase(newDir)) {
|
if (!oldDir.equalsIgnoreCase(relativePath)) {
|
||||||
this.clearDirectory(newDir);
|
this.clearDirectory(newDir);
|
||||||
Files.move(oldBasePath, newBasePath);
|
Files.move(oldBasePath, newBasePath);
|
||||||
Files.move(oldDetailPath, newDetailPath);
|
Files.move(oldDetailPath, newDetailPath);
|
||||||
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
if (!oldPqReport.getName().equals(reportParam.getName()) && !this.existSameName(pqReport.getId(), oldPqReport.getName())) {
|
||||||
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
this.recursionDeleteDirectory(templatePath + File.separator + oldPqReport.getName());
|
||||||
} else {
|
} else {
|
||||||
Paths.get(oldDir).toFile().delete();
|
Paths.get(templatePath + oldDir).toFile().delete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 文件夹重命名
|
// 文件夹重命名
|
||||||
Paths.get(oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
Paths.get(templatePath + oldDir).toFile().renameTo(Paths.get(newDir).toFile());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
throw new BusinessException(ReportResponseEnum.FILE_RENAME_FAILED);
|
||||||
@@ -414,16 +424,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!baseFileOriginalFilename.isEmpty()) {
|
if (!baseFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setBasePath(newDir + baseFileOriginalFilename);
|
pqReport.setBasePath(relativePath + baseFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getBasePath()).toFile().delete();
|
Paths.get(templatePath + File.separator + oldPqReport.getBasePath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(baseFile, pqReport.getBasePath());
|
this.uploadFile(baseFile, newDir + baseFileOriginalFilename);
|
||||||
}
|
}
|
||||||
if (!detailFileOriginalFilename.isEmpty()) {
|
if (!detailFileOriginalFilename.isEmpty()) {
|
||||||
pqReport.setDetailPath(newDir + detailFileOriginalFilename);
|
pqReport.setDetailPath(relativePath + detailFileOriginalFilename);
|
||||||
Paths.get(oldPqReport.getDetailPath()).toFile().delete();
|
Paths.get(templatePath + File.separator + oldPqReport.getDetailPath()).toFile().delete();
|
||||||
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete();
|
||||||
this.uploadFile(detailFile, pqReport.getDetailPath());
|
this.uploadFile(detailFile, newDir + detailFileOriginalFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -571,7 +581,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* 根据设备类型生成报告
|
* 根据设备类型生成报告
|
||||||
* 注:该方法目前仅支持楼下出厂检测场景,属于模板占位符替换方式,后期可能会有调整
|
* 注:该方法目前仅支持楼下出厂检测场景,属于模板占位符替换方式,后期可能会有调整
|
||||||
*
|
*
|
||||||
@@ -641,6 +650,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (NoSuchFileException e) {
|
||||||
|
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
|
||||||
|
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("报告文件读写异常", e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||||
@@ -779,46 +795,63 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(pqDevVO)) {
|
if (Objects.isNull(pqDevVO)) {
|
||||||
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.DEVICE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
devReportParam.setDevId(devId);
|
if (CheckStateEnum.CHECKED.getValue().compareTo(pqDevVO.getCheckState()) <= 0) {
|
||||||
// 获取设备型号
|
devReportParam.setDevId(devId);
|
||||||
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
// 获取设备型号
|
||||||
if (Objects.isNull(devType)) {
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
if (Objects.isNull(devType)) {
|
||||||
}
|
throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST);
|
||||||
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
}
|
||||||
if (Objects.isNull(report)) {
|
PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
if (Objects.isNull(report)) {
|
||||||
}
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
}
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
// 获取文档基础部分,并替换占位符
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
Map<String, String> baseModelDataMap = dealBaseModelContrastData(plan, pqDevVO, devType);
|
// 获取文档基础部分,并替换占位符
|
||||||
InputStream wordFinishInputStream = wordReportService.replacePlaceholders(baseInputStream, baseModelDataMap);
|
Map<String, String> baseModelDataMap = dealBaseModelContrastData(plan, pqDevVO, devType);
|
||||||
WordprocessingMLPackage baseModelDocument = WordprocessingMLPackage.load(wordFinishInputStream);
|
InputStream wordFinishInputStream = wordReportService.replacePlaceholders(baseInputStream, baseModelDataMap);
|
||||||
MainDocumentPart baseDocumentPart = baseModelDocument.getMainDocumentPart();
|
WordprocessingMLPackage baseModelDocument = WordprocessingMLPackage.load(wordFinishInputStream);
|
||||||
|
MainDocumentPart baseDocumentPart = baseModelDocument.getMainDocumentPart();
|
||||||
|
|
||||||
// 获取数据模版页内容,根据脚本动态组装数据页内容
|
// 获取数据模版页内容,根据脚本动态组装数据页内容
|
||||||
MainDocumentPart detailDocumentPart = detailModelDocument.getMainDocumentPart();
|
MainDocumentPart detailDocumentPart = detailModelDocument.getMainDocumentPart();
|
||||||
dealDataModelScatteredByBookmarkByPlanContrast(baseDocumentPart, detailDocumentPart, devReportParam, pqDevVO);
|
dealDataModelScatteredByBookmarkByPlanContrast(baseDocumentPart, detailDocumentPart, devReportParam, pqDevVO);
|
||||||
// 保存新的文档
|
// 保存新的文档
|
||||||
String dirPath = reportPath.concat(File.separator).concat(plan.getName());
|
String dirPath = reportPath.concat(File.separator).concat(plan.getName());
|
||||||
// 确保目录存在
|
// 确保目录存在
|
||||||
ensureDirectoryExists(dirPath);
|
ensureDirectoryExists(dirPath);
|
||||||
// 构建文件名:cityName_gdName_subName_name.docx
|
// 构建文件名:cityName_gdName_subName_name.docx
|
||||||
String fileName = String.format("%s_%s_%s_%s.docx",
|
String fileName = String.format("%s_%s_%s_%s.docx",
|
||||||
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
|
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
|
||||||
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
|
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
|
||||||
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
|
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
|
||||||
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
|
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
|
||||||
Docx4jUtil.cleanBlankPagesAndRedundantPageBreaks(baseModelDocument);
|
// 判断是否需要在报告上输出水印
|
||||||
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(fileName)));
|
String leader = baseModelDataMap.get(BaseReportKeyEnum.AUDIT_BY.getKey());
|
||||||
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
|
String loginName = RequestUtil.getLoginNameByToken();
|
||||||
} catch (Exception e) {
|
SysUser user = sysUserService.getUserByLoginName(loginName);
|
||||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
if (!leader.equals(user.getName())) {
|
||||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
log.info("当前用户不是审核人,添加非正式水印");
|
||||||
|
Docx4jUtil.addWatermarkToDocument(baseModelDocument, "非正式");
|
||||||
|
}
|
||||||
|
Docx4jUtil.cleanBlankPagesAndRedundantPageBreaks(baseModelDocument);
|
||||||
|
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(fileName)));
|
||||||
|
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
|
||||||
|
} catch (NoSuchFileException e) {
|
||||||
|
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
|
||||||
|
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("报告文件读写异常", e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||||
|
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -850,8 +883,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (Objects.isNull(report)) {
|
if (Objects.isNull(report)) {
|
||||||
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
Path basePath = Paths.get(report.getBasePath());
|
Path basePath = Paths.get(templatePath + File.separator + report.getBasePath());
|
||||||
Path detailPath = Paths.get(report.getDetailPath());
|
Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath());
|
||||||
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
try (InputStream baseInputStream = Files.newInputStream(basePath);
|
||||||
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
InputStream detailInputStream = Files.newInputStream(detailPath)) {
|
||||||
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);
|
||||||
@@ -871,6 +904,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
ensureDirectoryExists(dirPath);
|
ensureDirectoryExists(dirPath);
|
||||||
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
|
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(pqDevVO.getCreateId()).concat(ReportConstant.DOCX)));
|
||||||
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
|
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
|
||||||
|
} catch (NoSuchFileException e) {
|
||||||
|
String filePath = e.getFile() != null ? e.getFile().replaceAll("\\\\", "/") : "未知文件";
|
||||||
|
log.error("报告模板文件不存在 - 文件路径: {}", filePath, e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_NOT_FOUND);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("报告文件读写异常", e);
|
||||||
|
throw new BusinessException(SystemResponseEnum.FILE_IO_ERROR);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||||
@@ -1065,7 +1105,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* 实时数据:3秒数据(150周波数据)
|
* 实时数据:3秒数据(150周波数据)
|
||||||
* 录波:录波数据
|
* 录波:录波数据
|
||||||
* 分钟统计数据:分钟统计数据-最大值、分钟统计数据-最小值、分钟统计数据-平均值、分钟统计数据-CP95值
|
* 分钟统计数据:分钟统计数据-最大值、分钟统计数据-最小值、分钟统计数据-平均值、分钟统计数据-CP95值
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private String getDataTypeFromParam(AdPlan adPlan) {
|
private String getDataTypeFromParam(AdPlan adPlan) {
|
||||||
String dataSource = adPlan.getDatasourceId();
|
String dataSource = adPlan.getDatasourceId();
|
||||||
@@ -1088,11 +1127,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(adPlan.getId());
|
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(adPlan.getId());
|
||||||
StringBuilder sampleCount = new StringBuilder();
|
StringBuilder sampleCount = new StringBuilder();
|
||||||
for (String item : dataSourceArray) {
|
for (String item : dataSourceArray) {
|
||||||
if(item.equalsIgnoreCase(DataSourceEnum.REAL_DATA.getValue())){
|
if (item.equalsIgnoreCase(DataSourceEnum.REAL_DATA.getValue())) {
|
||||||
sampleCount.append("实时数据采集").append(adPlanTestConfig.getRealTime()).append("组,");
|
sampleCount.append("实时数据采集").append(adPlanTestConfig.getRealTime()).append("组,");
|
||||||
}else if(item.equalsIgnoreCase(DataSourceEnum.WAVE_DATA.getValue())){
|
} else if (item.equalsIgnoreCase(DataSourceEnum.WAVE_DATA.getValue())) {
|
||||||
sampleCount.append("录波数据采集").append(adPlanTestConfig.getWaveRecord()).append("组,");
|
sampleCount.append("录波数据采集").append(adPlanTestConfig.getWaveRecord()).append("组,");
|
||||||
}else{
|
} else {
|
||||||
sampleCount.append("统计数据采集").append(adPlanTestConfig.getStatistics()).append("组,");
|
sampleCount.append("统计数据采集").append(adPlanTestConfig.getStatistics()).append("组,");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1134,10 +1173,11 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
Integer monitorNum = next.getKey();
|
Integer monitorNum = next.getKey();
|
||||||
// 线路下的指标数据
|
// 线路下的指标数据
|
||||||
List<ContrastTestResult> contrastTestResults = next.getValue();
|
List<ContrastTestResult> contrastTestResults = next.getValue();
|
||||||
|
PqMonitor pqMonitor = pqMonitorService.getByDevAndNum(pqDevVO.getId(), monitorNum);
|
||||||
// 插入回路号前,先换个页
|
// 插入回路号前,先换个页
|
||||||
todoInsertList.add(Docx4jUtil.createPageBreakParagraph());
|
todoInsertList.add(Docx4jUtil.createPageBreakParagraph());
|
||||||
// 回路标题
|
// 回路标题
|
||||||
todoInsertList.add(getContrastLineTitle(contentMap, monitorNum, stepIndex, factory));
|
todoInsertList.add(getContrastLineTitle(contentMap, monitorNum, stepIndex, factory, pqDevVO));
|
||||||
int scriptIndex = 1;
|
int scriptIndex = 1;
|
||||||
for (ContrastTestResult contrastTestResult : contrastTestResults) {
|
for (ContrastTestResult contrastTestResult : contrastTestResults) {
|
||||||
// 比如电压 V
|
// 比如电压 V
|
||||||
@@ -1148,7 +1188,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
// 根据code获取对应需要填充的内容
|
// 根据code获取对应需要填充的内容
|
||||||
List<Docx4jUtil.HeadingContent> tempContent = contentMap.get(scriptCode);
|
List<Docx4jUtil.HeadingContent> tempContent = contentMap.get(scriptCode);
|
||||||
// 需要区分下谐波类和非谐波类
|
// 需要区分下谐波类和非谐波类
|
||||||
List<Object> tempList = fillContentInTemplateContrast(tempContent, factory, contrastTestResult);
|
List<Object> tempList = fillContentInTemplateContrast(tempContent, factory, contrastTestResult, pqMonitor);
|
||||||
todoInsertList.addAll(tempList);
|
todoInsertList.addAll(tempList);
|
||||||
scriptIndex++;
|
scriptIndex++;
|
||||||
}
|
}
|
||||||
@@ -1566,18 +1606,37 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
// 获取现有行的样式
|
// 获取现有行的样式
|
||||||
Tr existingRow = (Tr) tbl.getContent().get(rows.size() - 1);
|
Tr existingRow = (Tr) tbl.getContent().get(rows.size() - 1);
|
||||||
|
|
||||||
// 获取现有样式
|
// 获取现有样式
|
||||||
TrPr trPr = existingRow.getTrPr();
|
TrPr trPr = existingRow.getTrPr();
|
||||||
JAXBElement<Tc> element = (JAXBElement<Tc>) existingRow.getContent().get(0);
|
// 获取每个单元格的TcPr(保留各单元格独立的边框设置)
|
||||||
TcPr tcPr = element.getValue().getTcPr();
|
List<TcPr> tcPrList = new ArrayList<>();
|
||||||
TblWidth cellWidth = factory.createTblWidth();
|
RPr templateRPr = null;
|
||||||
cellWidth.setType("dxa");
|
for (Object cellObj : existingRow.getContent()) {
|
||||||
cellWidth.setW(BigInteger.valueOf(5000 / tableKeys.size()));
|
if (cellObj instanceof JAXBElement) {
|
||||||
tcPr.setTcW(cellWidth);
|
JAXBElement<Tc> cellElement = (JAXBElement<Tc>) cellObj;
|
||||||
|
Tc templateCell = cellElement.getValue();
|
||||||
|
TcPr tcPr = templateCell.getTcPr();
|
||||||
|
// 设置单元格宽度
|
||||||
|
if (tcPr == null) {
|
||||||
|
tcPr = factory.createTcPr();
|
||||||
|
}
|
||||||
|
TblWidth cellWidth = factory.createTblWidth();
|
||||||
|
cellWidth.setType("dxa");
|
||||||
|
cellWidth.setW(BigInteger.valueOf(5000 / tableKeys.size()));
|
||||||
|
tcPr.setTcW(cellWidth);
|
||||||
|
tcPrList.add(tcPr);
|
||||||
|
// 从第一个单元格获取字体样式
|
||||||
|
if (templateRPr == null && !templateCell.getContent().isEmpty() && templateCell.getContent().get(0) instanceof P) {
|
||||||
|
P templateP = (P) templateCell.getContent().get(0);
|
||||||
|
templateRPr = Docx4jUtil.getTcPrFromParagraph(templateP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
tbl.getContent().remove(existingRow);
|
tbl.getContent().remove(existingRow);
|
||||||
// 迭代增加行,需要填充的表格keys在tableKeys集合中
|
// 迭代增加行,需要填充的表格keys在tableKeys集合中
|
||||||
for (Map<String, String> stringStringMap : dataList) {
|
for (Map<String, String> stringStringMap : dataList) {
|
||||||
Tr newRow = Docx4jUtil.createCustomRow(factory, stringStringMap, tableKeys, trPr, tcPr, true);
|
Tr newRow = Docx4jUtil.createCustomRow(factory, stringStringMap, tableKeys, trPr, tcPrList, templateRPr, true);
|
||||||
tbl.getContent().add(newRow);
|
tbl.getContent().add(newRow);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1604,7 +1663,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<Object> fillContentInTemplateContrast(List<Docx4jUtil.HeadingContent> tempContent, ObjectFactory factory, ContrastTestResult contrastTestResult) {
|
private List<Object> fillContentInTemplateContrast(List<Docx4jUtil.HeadingContent> tempContent, ObjectFactory factory, ContrastTestResult contrastTestResult, PqMonitor pqMonitor) {
|
||||||
List<Object> todoInsertList = new ArrayList<>();
|
List<Object> todoInsertList = new ArrayList<>();
|
||||||
Docx4jUtil.HeadingContent headingContent = tempContent.get(0);
|
Docx4jUtil.HeadingContent headingContent = tempContent.get(0);
|
||||||
List<String> tableKeys = Docx4jUtil.getTableFillKeys(tempContent);
|
List<String> tableKeys = Docx4jUtil.getTableFillKeys(tempContent);
|
||||||
@@ -1718,9 +1777,47 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
// 纵向表格暂不考虑
|
// 纵向表格暂不考虑
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果存在特殊说明,在表格后添加一个段落
|
StringBuilder description = new StringBuilder();
|
||||||
if (StrUtil.isNotBlank(contrastTestResult.getSpecialCase())) {
|
if (contrastTestResult.getScriptCode().equalsIgnoreCase("I")) {
|
||||||
P specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, contrastTestResult.getSpecialCase());
|
// 获取该通道的额定电流
|
||||||
|
String ct = pqMonitor.getCt();
|
||||||
|
// 理论上ct是 xxx:xxx的格式。比如10:1,100:5
|
||||||
|
if (ct.indexOf(":") > 0) {
|
||||||
|
String[] ctArray = ct.split(":");
|
||||||
|
description.append("注:当前回路额定电流为:").append(ctArray[1]).append("A。");
|
||||||
|
}
|
||||||
|
} else if (contrastTestResult.getScriptCode().equalsIgnoreCase("V")) {
|
||||||
|
// 获取该通道的额定电压
|
||||||
|
String pt = pqMonitor.getPt();
|
||||||
|
// 理论上pt是 xxx:xxx的格式。比如380:380,10000:100
|
||||||
|
if (pt.indexOf(":") > 0) {
|
||||||
|
String[] ptArray = pt.split(":");
|
||||||
|
// 电压需要特殊处理下,处理为相电压值
|
||||||
|
String voltage = ptArray[1];
|
||||||
|
if (voltage.equalsIgnoreCase("100")) {
|
||||||
|
voltage = "57.74";
|
||||||
|
} else if (voltage.equalsIgnoreCase("380")) {
|
||||||
|
voltage = "220";
|
||||||
|
} else {
|
||||||
|
// 其他场景下就除以根号3
|
||||||
|
double result = Double.parseDouble(voltage) / Math.sqrt(3);
|
||||||
|
voltage = doubleRound(2, result);
|
||||||
|
}
|
||||||
|
description.append("注:当前回路额定电流为:").append(voltage).append("V。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果存在特殊说明,在表格后添加一个段落 如果有电压和电流需要把额定电压和电流标注进来 pqMonitor
|
||||||
|
if (StrUtil.isNotBlank(contrastTestResult.getSpecialCase()) || StrUtil.isNotBlank(description.toString())) {
|
||||||
|
P specialCaseP;
|
||||||
|
if (StrUtil.isNotBlank(description.toString())) {
|
||||||
|
if (StrUtil.isNotBlank(contrastTestResult.getSpecialCase())) {
|
||||||
|
description.append(contrastTestResult.getSpecialCase().replace("注:", ""));
|
||||||
|
}
|
||||||
|
specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, description.toString());
|
||||||
|
} else {
|
||||||
|
specialCaseP = Docx4jUtil.createSpecialCaseParagraph(factory, contrastTestResult.getSpecialCase());
|
||||||
|
}
|
||||||
todoInsertList.add(specialCaseP);
|
todoInsertList.add(specialCaseP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1805,10 +1902,10 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
if (dictDataById != null && "Contrast".equals(dictDataById.getCode())) {
|
if (dictDataById != null && "Contrast".equals(dictDataById.getCode())) {
|
||||||
// 比对模式:使用新的路径结构
|
// 比对模式:使用新的路径结构
|
||||||
String fileName = String.format("%s_%s_%s_%s.docx",
|
String fileName = String.format("%s_%s_%s_%s.docx",
|
||||||
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
|
pqDevVO.getCityName() != null ? pqDevVO.getCityName() : "未知地市",
|
||||||
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
|
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
|
||||||
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
|
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
|
||||||
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
|
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
|
||||||
filePath = reportPath.concat(File.separator).concat(plan.getName()).concat(File.separator).concat(fileName);
|
filePath = reportPath.concat(File.separator).concat(plan.getName()).concat(File.separator).concat(fileName);
|
||||||
downloadFileName = fileName;
|
downloadFileName = fileName;
|
||||||
} else {
|
} else {
|
||||||
@@ -1837,7 +1934,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
try {
|
try {
|
||||||
// 对中文文件名进行URL编码// 将+号替换为%20(空格的正确编码)
|
// 对中文文件名进行URL编码// 将+号替换为%20(空格的正确编码)
|
||||||
String encodedFileName = URLEncoder.encode(downloadFileName, "UTF-8")
|
String encodedFileName = URLEncoder.encode(downloadFileName, "UTF-8")
|
||||||
.replaceAll("\\+", "%20");
|
.replaceAll("\\+", "%20");
|
||||||
|
|
||||||
// 使用RFC 5987标准格式
|
// 使用RFC 5987标准格式
|
||||||
response.setHeader("Content-Disposition",
|
response.setHeader("Content-Disposition",
|
||||||
@@ -1879,12 +1976,12 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
for (int i = 0; i < pqDevVOList.size(); i++) {
|
for (int i = 0; i < pqDevVOList.size(); i++) {
|
||||||
pqDevVO = pqDevVOList.get(i);
|
pqDevVO = pqDevVOList.get(i);
|
||||||
|
tempPqDevVO = pqDevVO;
|
||||||
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
if (!pqDevVO.getCheckState().equals(CheckStateEnum.CHECKED.getValue())) {
|
||||||
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
throw new BusinessException(DetectionResponseEnum.DEV_UN_CHECKED);
|
||||||
}
|
}
|
||||||
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
if (!pqDevVO.getReportState().equals(DevReportStateEnum.GENERATED.getValue())) {
|
||||||
devIds.add(pqDevVO.getId());
|
devIds.add(pqDevVO.getId());
|
||||||
tempPqDevVO = pqDevVO;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1928,6 +2025,18 @@ 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.INSPECTOR.getKey(), pqDevVO.getCheckBy() + "");
|
||||||
|
String datePattern = DatePattern.NORM_DATE_PATTERN;
|
||||||
|
if (DatePattern.CHINESE_DATE_PATTERN.equals(dateFormat)) {
|
||||||
|
datePattern = DatePattern.CHINESE_DATE_PATTERN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 出厂日期
|
||||||
|
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));
|
||||||
@@ -1986,7 +2095,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* 比对模式下需要获取的数据
|
* 比对模式下需要获取的数据
|
||||||
* 处理基础模版中的信息,非数据页报告
|
* 处理基础模版中的信息,非数据页报告
|
||||||
* 因为Docx4j工具包替换时会默认增加${}
|
* 因为Docx4j工具包替换时会默认增加${}
|
||||||
@@ -1997,7 +2105,7 @@ 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(BaseReportKeyEnum.DELEGATE.getKey(), delegateDictData.getName());
|
baseModelMap.put(BaseReportKeyEnum.DELEGATE.getKey(), delegateDictData.getName());
|
||||||
} else {
|
} else {
|
||||||
@@ -2010,6 +2118,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
baseModelMap.put(BaseReportKeyEnum.SAMPLE_ID.getKey(), StrUtil.isEmpty(pqDevVO.getName()) ? StrPool.TAB : pqDevVO.getName());
|
baseModelMap.put(BaseReportKeyEnum.SAMPLE_ID.getKey(), StrUtil.isEmpty(pqDevVO.getName()) ? StrPool.TAB : pqDevVO.getName());
|
||||||
// 报告日期
|
// 报告日期
|
||||||
baseModelMap.put(BaseReportKeyEnum.REPORT_DATE.getKey(), DateUtil.format(new Date(), DatePattern.CHINESE_DATE_PATTERN));
|
baseModelMap.put(BaseReportKeyEnum.REPORT_DATE.getKey(), DateUtil.format(new Date(), DatePattern.CHINESE_DATE_PATTERN));
|
||||||
|
// 供电部门
|
||||||
|
baseModelMap.put(BaseReportKeyEnum.GD_NAME.getKey(), pqDevVO.getGdName());
|
||||||
// 变电站名称
|
// 变电站名称
|
||||||
baseModelMap.put(BaseReportKeyEnum.SUB_NAME.getKey(), pqDevVO.getSubName());
|
baseModelMap.put(BaseReportKeyEnum.SUB_NAME.getKey(), pqDevVO.getSubName());
|
||||||
// 检测人
|
// 检测人
|
||||||
@@ -2067,7 +2177,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);
|
||||||
// 读取模板文件中的占位符
|
// 读取模板文件中的占位符
|
||||||
@@ -2085,11 +2207,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<SimAndDigHarmonicResult> rawData = adHarmonicService.listAllRawData(devReportParam.getScriptId(), devReportParam.getPlanCode(), devReportParam.getDevId() + "_" + finalI);
|
||||||
|
SimAndDigHarmonicResult 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)) {
|
||||||
@@ -2157,14 +2288,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);
|
||||||
@@ -2371,16 +2502,21 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
/**
|
/**
|
||||||
* 创建回路标题到报告中
|
* 创建回路标题到报告中
|
||||||
*/
|
*/
|
||||||
private P getContrastLineTitle(Map<String, List<Docx4jUtil.HeadingContent>> contentMap, int monitorNum, int index, ObjectFactory factory) {
|
private P getContrastLineTitle(Map<String, List<Docx4jUtil.HeadingContent>> contentMap, int monitorNum, int index, ObjectFactory factory, PqDevVO pqDevVO) {
|
||||||
|
PqMonitor pqMonitor = pqMonitorService.getByDevAndNum(pqDevVO.getId(), monitorNum);
|
||||||
|
String monitorInfoName = "";
|
||||||
|
if (StrUtil.isNotBlank(pqDevVO.getSubName()) && Objects.nonNull(pqMonitor)) {
|
||||||
|
monitorInfoName = "(" + pqDevVO.getSubName() + "-" + pqMonitor.getName() + ")";
|
||||||
|
}
|
||||||
List<Docx4jUtil.HeadingContent> headingContents = contentMap.get(PowerIndexEnum.LINE_TITLE.getKey());
|
List<Docx4jUtil.HeadingContent> headingContents = contentMap.get(PowerIndexEnum.LINE_TITLE.getKey());
|
||||||
// 如果contentMap中有指定内容,创建大纲级别为2的标题
|
// 如果contentMap中有指定内容,创建大纲级别为2的标题
|
||||||
if (CollUtil.isNotEmpty(headingContents)) {
|
if (CollUtil.isNotEmpty(headingContents)) {
|
||||||
return Docx4jUtil.createTitle(factory, 2, index + ".测量回路" + monitorNum,
|
return Docx4jUtil.createTitle(factory, 2, index + ".测量回路" + monitorNum + monitorInfoName,
|
||||||
"SimSun", 30, true);
|
"SimSun", 30, true);
|
||||||
}
|
}
|
||||||
// 没有模板配置时,创建默认样式段落
|
// 没有模板配置时,创建默认样式段落
|
||||||
P titleParagraph = factory.createP();
|
P titleParagraph = factory.createP();
|
||||||
Docx4jUtil.createTitle(factory, titleParagraph, "测量回路" + monitorNum,
|
Docx4jUtil.createTitle(factory, titleParagraph, "测量回路" + monitorNum + monitorInfoName,
|
||||||
28, true);
|
28, true);
|
||||||
return titleParagraph;
|
return titleParagraph;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/reCalculate")
|
@PostMapping("/reCalculate")
|
||||||
@ApiOperation("重新计算检测结果")
|
@ApiOperation("重新计算检测结果")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "重新计算参数", required = true)
|
||||||
public HttpResult<Object> reCalculate(@RequestBody @Validated ResultParam.ChangeErrorSystemParam param) {
|
public HttpResult<Object> reCalculate(@RequestBody @Validated ResultParam.ChangeErrorSystemParam param) {
|
||||||
String methodDescribe = getMethodDescribe("reCalculate");
|
String methodDescribe = getMethodDescribe("reCalculate");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
@@ -115,7 +115,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
@GetMapping("/deleteTempTable")
|
@GetMapping("/deleteTempTable")
|
||||||
@ApiOperation("删除临时表")
|
@ApiOperation("删除临时表")
|
||||||
@ApiImplicitParam(name = "param", value = "删除参数", required = true)
|
@ApiImplicitParam(name = "code", value = "计划对应的表后缀code", required = true)
|
||||||
public HttpResult<Object> deleteTempTable(@RequestParam("code") String code) {
|
public HttpResult<Object> deleteTempTable(@RequestParam("code") String code) {
|
||||||
String methodDescribe = getMethodDescribe("deleteTempTable");
|
String methodDescribe = getMethodDescribe("deleteTempTable");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
|
||||||
@@ -127,7 +127,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getContrastFormContent")
|
@PostMapping("/getContrastFormContent")
|
||||||
@ApiOperation("获取比对式检测结果-表单内容")
|
@ApiOperation("获取比对式检测结果-表单内容")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<FormContentVO> getContrastFormContent(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
public HttpResult<FormContentVO> getContrastFormContent(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("getContrastFormContent");
|
String methodDescribe = getMethodDescribe("getContrastFormContent");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
@@ -139,7 +139,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getContrastResult")
|
@PostMapping("/getContrastResult")
|
||||||
@ApiOperation("获取比对式检测结果")
|
@ApiOperation("获取比对式检测结果")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<ContrastResultVO> getContrastResult(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
public HttpResult<ContrastResultVO> getContrastResult(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("getContrastResult");
|
String methodDescribe = getMethodDescribe("getContrastResult");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
@@ -154,7 +154,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getMonitorResult")
|
@PostMapping("/getMonitorResult")
|
||||||
@ApiOperation("获取监测点的检测结果")
|
@ApiOperation("获取监测点的检测结果")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "devId", value = "设备id", required = true)
|
||||||
public HttpResult<List<MonitorResultVO>> getMonitorResult(@RequestParam("devId") String devId) {
|
public HttpResult<List<MonitorResultVO>> getMonitorResult(@RequestParam("devId") String devId) {
|
||||||
String methodDescribe = getMethodDescribe("getMonitorResult");
|
String methodDescribe = getMethodDescribe("getMonitorResult");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, devId);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, devId);
|
||||||
@@ -180,7 +180,7 @@ public class ResultController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/updateMonitorResult")
|
@PostMapping("/updateMonitorResult")
|
||||||
@ApiOperation("更新监测点的检测结果")
|
@ApiOperation("更新监测点的检测结果")
|
||||||
@ApiImplicitParam(name = "result", value = "更新内容", required = true)
|
@ApiImplicitParam(name = "resultParams", value = "更新内容", required = true)
|
||||||
public HttpResult<Boolean> updateMonitorResult(@RequestBody @Validated MonitorResultVO resultParams) {
|
public HttpResult<Boolean> updateMonitorResult(@RequestBody @Validated MonitorResultVO resultParams) {
|
||||||
String methodDescribe = getMethodDescribe("updateMonitorResult");
|
String methodDescribe = getMethodDescribe("updateMonitorResult");
|
||||||
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, resultParams);
|
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, resultParams);
|
||||||
@@ -198,7 +198,7 @@ public class ResultController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("getCheckItem");
|
String methodDescribe = getMethodDescribe("getCheckItem");
|
||||||
|
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, monitorQueryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, monitorQueryParam);
|
||||||
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getDevId(),monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
|
List<ContrastTestItemVO> result = resultService.getCheckItem(monitorQueryParam.getPlanId(), monitorQueryParam.getDevId(), monitorQueryParam.getChnNum(), monitorQueryParam.getNum());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ public class MonitorQueryParam {
|
|||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
private Integer waveNum;
|
private Integer waveNum;
|
||||||
|
|
||||||
|
private String planId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.gather.result.pojo.param;
|
|||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -74,6 +75,8 @@ public class ResultParam {
|
|||||||
|
|
||||||
// 模式id
|
// 模式id
|
||||||
private String patternId;
|
private String patternId;
|
||||||
|
|
||||||
|
private String code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -83,7 +86,7 @@ public class ResultParam {
|
|||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "脚本Id", required = false)
|
@ApiModelProperty(value = "脚本Id")
|
||||||
private String scriptId;
|
private String scriptId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差体系Id", required = true)
|
@ApiModelProperty(value = "误差体系Id", required = true)
|
||||||
@@ -95,9 +98,16 @@ public class ResultParam {
|
|||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR)
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "计划对应表后缀", required = true)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@ApiModelProperty(value = "模式Id", required = true)
|
@ApiModelProperty(value = "模式Id", required = true)
|
||||||
private String patternId;
|
private String patternId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "通道号", required = true)
|
||||||
|
private String chnNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据处理原则", required = true)
|
||||||
|
private String dataRuleId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,58 +14,38 @@ import javax.validation.constraints.NotNull;
|
|||||||
@Data
|
@Data
|
||||||
public class MonitorResultVO implements Comparable<MonitorResultVO> {
|
public class MonitorResultVO implements Comparable<MonitorResultVO> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 监测点id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "监测点id", required = true)
|
@ApiModelProperty(value = "监测点id", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_ID_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_ID_NOT_BLANK)
|
||||||
private String monitorId;
|
private String monitorId;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "监测点序号")
|
||||||
* 监测点序号
|
|
||||||
*/
|
|
||||||
private Integer monitorNum;
|
private Integer monitorNum;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "总检测次数")
|
||||||
* 总检测次数
|
|
||||||
*/
|
|
||||||
private Integer totalNum;
|
private Integer totalNum;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "合格检测次数")
|
||||||
* 合格检测次数
|
|
||||||
*/
|
|
||||||
private Integer qualifiedNum;
|
private Integer qualifiedNum;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "不合格检测次数")
|
||||||
* 不合格检测次数
|
|
||||||
*/
|
|
||||||
private Integer unQualifiedNum;
|
private Integer unQualifiedNum;
|
||||||
|
|
||||||
/**
|
@ApiModelProperty(value = "误差体系名称")
|
||||||
* 误差体系名称
|
|
||||||
*/
|
|
||||||
private String errorSysName;
|
private String errorSysName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测结果
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "检测结果", required = true)
|
@ApiModelProperty(value = "检测结果", required = true)
|
||||||
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NOT_NULL)
|
||||||
private Integer checkResult;
|
private Integer checkResult;
|
||||||
|
|
||||||
/**
|
|
||||||
* 结论来源
|
@ApiModelProperty(value = "结论来源")
|
||||||
*/
|
|
||||||
private String resultOrigin;
|
private String resultOrigin;
|
||||||
/**
|
|
||||||
* 哪次
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "使用哪次检测结果", required = true)
|
@ApiModelProperty(value = "使用哪次检测结果", required = true)
|
||||||
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NUM_NOT_BLANK)
|
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NUM_NOT_BLANK)
|
||||||
private String whichTime;
|
private String whichTime;
|
||||||
/**
|
|
||||||
* 数据源类型
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "数据源类型", required = true)
|
@ApiModelProperty(value = "数据源类型", required = true)
|
||||||
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_RESULT_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_RESULT_TYPE_NOT_BLANK)
|
||||||
private String resultType;
|
private String resultType;
|
||||||
|
|||||||
@@ -119,17 +119,19 @@ public interface IResultService {
|
|||||||
/**
|
/**
|
||||||
* 获取检测项
|
* 获取检测项
|
||||||
*
|
*
|
||||||
|
* @param planId
|
||||||
* @param devId
|
* @param devId
|
||||||
* @param chnNum
|
* @param chnNum
|
||||||
* @param num
|
* @param num
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num);
|
List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备比对式结果,用于出比对检测的报告
|
* 获取设备比对式结果,用于出比对检测的报告
|
||||||
|
*
|
||||||
* @param devReportParam 设备报告参数
|
* @param devReportParam 设备报告参数
|
||||||
* @param pqDevVO 设备信息 省去一次sql查询
|
* @param pqDevVO 设备信息 省去一次sql查询
|
||||||
* @return 该设备的比对式结果
|
* @return 该设备的比对式结果
|
||||||
*/
|
*/
|
||||||
Map<Integer, List<ContrastTestResult>> getContrastResultForReport(DevReportParam devReportParam, PqDevVO pqDevVO);
|
Map<Integer, List<ContrastTestResult>> getContrastResultForReport(DevReportParam devReportParam, PqDevVO pqDevVO);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.gather.detection.handler.SocketContrastResponseService;
|
import com.njcn.gather.detection.handler.SocketContrastResponseService;
|
||||||
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.ResultEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.po.AdPair;
|
import com.njcn.gather.detection.pojo.po.AdPair;
|
||||||
import com.njcn.gather.detection.pojo.po.DevData;
|
import com.njcn.gather.detection.pojo.po.DevData;
|
||||||
@@ -99,6 +100,8 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.njcn.gather.plan.pojo.enums.DataSourceEnum.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
* @data 2024-12-30
|
* @data 2024-12-30
|
||||||
@@ -111,6 +114,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
private final IAdPlanTestConfigService adPlanTestConfigService;
|
private final IAdPlanTestConfigService adPlanTestConfigService;
|
||||||
private final IPqDevService pqDevService;
|
private final IPqDevService pqDevService;
|
||||||
|
private final IPqStandardDevService pqStandardDevService;
|
||||||
private final SimAndDigNonHarmonicService simAndDigNonHarmonicService;
|
private final SimAndDigNonHarmonicService simAndDigNonHarmonicService;
|
||||||
private final SimAndDigHarmonicService simAndDigHarmonicService;
|
private final SimAndDigHarmonicService simAndDigHarmonicService;
|
||||||
private final ContrastHarmonicService contrastHarmonicService;
|
private final ContrastHarmonicService contrastHarmonicService;
|
||||||
@@ -142,11 +146,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
formContentVO.setErrorSysId(plan.getErrorSysId());
|
formContentVO.setErrorSysId(plan.getErrorSysId());
|
||||||
String scriptId = null;
|
String scriptId = null;
|
||||||
if (ObjectUtil.isNotNull(plan)) {
|
if (ObjectUtil.isNotNull(plan)) {
|
||||||
|
formContentVO.setDataRule(plan.getDataRule());
|
||||||
scriptId = plan.getScriptId();
|
scriptId = plan.getScriptId();
|
||||||
adPlanService.visualize(Collections.singletonList(plan));
|
adPlanService.visualize(Collections.singletonList(plan));
|
||||||
|
formContentVO.setScriptName(plan.getScriptId());
|
||||||
}
|
}
|
||||||
formContentVO.setScriptName(plan.getScriptId());
|
|
||||||
formContentVO.setDataRule(plan.getDataRule());
|
|
||||||
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
||||||
|
|
||||||
List<Map<String, String>> chnList = new ArrayList<>();
|
List<Map<String, String>> chnList = new ArrayList<>();
|
||||||
@@ -394,8 +398,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
double cosValue = Math.cos((aDtl1.get(0).getAngle() - aDtl2.get(0).getAngle()) / 180 * Math.PI);
|
double cosValue = Math.cos((aDtl1.get(0).getAngle() - aDtl2.get(0).getAngle()) / 180 * Math.PI);
|
||||||
BigDecimal bigDecimal = BigDecimal.valueOf(cosValue).setScale(6, BigDecimal.ROUND_HALF_UP);
|
BigDecimal bigDecimal = BigDecimal.valueOf(cosValue).setScale(6, BigDecimal.ROUND_HALF_UP);
|
||||||
|
|
||||||
dtlType.setScriptTypeName(ResultUnitEnum.V_RELATIVE.getName() + "=" + v.get(0).getValue().intValue() + unitV
|
dtlType.setScriptTypeName(ResultUnitEnum.V_RELATIVE.getName() + "=" + v.get(0).getValue() + unitV
|
||||||
+ " " + ResultUnitEnum.I_RELATIVE.getName() + "=" + i.get(0).getValue().intValue() + unitI
|
+ " " + ResultUnitEnum.I_RELATIVE.getName() + "=" + i.get(0).getValue() + unitI
|
||||||
+ " cos(φ)=" + bigDecimal.doubleValue());
|
+ " cos(φ)=" + bigDecimal.doubleValue());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -411,7 +415,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
unit = ResultUnitEnum.V_ABSOLUTELY.getUnit();
|
unit = ResultUnitEnum.V_ABSOLUTELY.getUnit();
|
||||||
}
|
}
|
||||||
List<PqScriptDtls> v = scriptDtlIndexList.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
List<PqScriptDtls> v = scriptDtlIndexList.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue().intValue() + unit);
|
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue() + unit);
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
* 电流
|
* 电流
|
||||||
@@ -425,7 +429,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
unitI = ResultUnitEnum.I_ABSOLUTELY.getUnit();
|
unitI = ResultUnitEnum.I_ABSOLUTELY.getUnit();
|
||||||
}
|
}
|
||||||
List<PqScriptDtls> I = scriptDtlIndexList.stream().filter(x -> "CUR".equals(x.getValueType())).collect(Collectors.toList());
|
List<PqScriptDtls> I = scriptDtlIndexList.stream().filter(x -> "CUR".equals(x.getValueType())).collect(Collectors.toList());
|
||||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue().intValue() + unitI);
|
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue() + unitI);
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
* 谐波电压
|
* 谐波电压
|
||||||
@@ -445,12 +449,12 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
if (harmNumMap.size() > 1) {
|
if (harmNumMap.size() > 1) {
|
||||||
//叠加2~50次谐波电压(含有率为GB/T)
|
//叠加2~50次谐波电压(含有率为GB/T)
|
||||||
dtlType.setScriptTypeName("叠加" + harmNumMap.entrySet().iterator().next().getValue().get(0).getHarmNum().intValue() + "~" +
|
dtlType.setScriptTypeName("叠加" + harmNumMap.entrySet().iterator().next().getValue().get(0).getHarmNum() + "~" +
|
||||||
new ArrayList<>(harmNumMap.entrySet()).get(harmNumMap.size() - 1).getValue().get(0).getHarmNum().intValue()
|
new ArrayList<>(harmNumMap.entrySet()).get(harmNumMap.size() - 1).getValue().get(0).getHarmNum()
|
||||||
+ "次" + dictTree.getName()); // + "(含有率为GB/T)"
|
+ "次" + dictTree.getName()); // + "(含有率为GB/T)"
|
||||||
} else {
|
} else {
|
||||||
//叠加5%的2次谐波电压
|
//叠加5%的2次谐波电压
|
||||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
@@ -484,7 +488,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
dtlType.setScriptTypeName(a.toString());
|
dtlType.setScriptTypeName(a.toString());
|
||||||
} else {
|
} else {
|
||||||
//叠加5%的2次谐波电压
|
//叠加5%的2次谐波电压
|
||||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -979,10 +983,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
this.createTempResultTable(param.getCode() + "_temp", true);
|
this.createTempResultTable(param.getCode() + "_temp", true);
|
||||||
this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId());
|
this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), false, param.getDataRuleId());
|
||||||
} else {
|
} else {
|
||||||
this.createTempResultTable(param.getCode() + "_temp", false);
|
this.createTempResultTable(param.getCode() + "_temp", false);
|
||||||
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId());
|
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,9 +1000,9 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
public void reCalculate(ResultParam.ChangeErrorSystemParam param) {
|
public void reCalculate(ResultParam.ChangeErrorSystemParam param) {
|
||||||
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
DictData dictData = dictDataService.getDictDataById(param.getPatternId());
|
||||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||||
this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId());
|
this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), true, param.getDataRuleId());
|
||||||
} else {
|
} else {
|
||||||
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId());
|
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,8 +1533,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
||||||
PqDev dev = pqDevService.getById(queryParam.getDeviceId());
|
PqDev dev = pqDevService.getById(queryParam.getDeviceId());
|
||||||
DictData dictData = dictDataService.getById(plan.getDataRule());
|
formContentVO.setDataRule(plan.getDataRule());
|
||||||
formContentVO.setDataRule(dictData.getName());
|
|
||||||
formContentVO.setDeviceName(dev.getName());
|
formContentVO.setDeviceName(dev.getName());
|
||||||
formContentVO.setErrorSysId(plan.getErrorSysId());
|
formContentVO.setErrorSysId(plan.getErrorSysId());
|
||||||
|
|
||||||
@@ -1550,10 +1553,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
List<ContrastBaseResult> allResultList = new ArrayList<>();
|
List<ContrastBaseResult> allResultList = new ArrayList<>();
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, queryParam.getDeviceId(), adTypeList);
|
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, null, queryParam.getDeviceId(), adTypeList);
|
||||||
contrastNonHarmonicResults.addAll(contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, queryParam.getDeviceId(), adTypeList));
|
contrastNonHarmonicResults.addAll(contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, null, queryParam.getDeviceId(), adTypeList));
|
||||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, queryParam.getDeviceId(), adTypeList);
|
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, null, queryParam.getDeviceId(), adTypeList);
|
||||||
contrastHarmonicResults.addAll(contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, queryParam.getDeviceId(), adTypeList));
|
contrastHarmonicResults.addAll(contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, null, queryParam.getDeviceId(), adTypeList));
|
||||||
allResultList.addAll(contrastHarmonicResults);
|
allResultList.addAll(contrastHarmonicResults);
|
||||||
allResultList.addAll(contrastNonHarmonicResults);
|
allResultList.addAll(contrastNonHarmonicResults);
|
||||||
|
|
||||||
@@ -1577,8 +1580,6 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
|
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
|
||||||
ContrastResultVO contrastResultVO = new ContrastResultVO();
|
ContrastResultVO contrastResultVO = new ContrastResultVO();
|
||||||
|
|
||||||
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
|
|
||||||
|
|
||||||
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
|
||||||
|
|
||||||
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
|
||||||
@@ -1600,8 +1601,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode())));
|
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode()));
|
||||||
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode())));
|
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode(), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
|
||||||
return contrastResultVO;
|
return contrastResultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1654,6 +1655,26 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
result.setResultType(resultType + CnSocketUtil.SPLIT_TAG + waveData.get(1));
|
result.setResultType(resultType + CnSocketUtil.SPLIT_TAG + waveData.get(1));
|
||||||
result.setResultOrigin(dataSourceEnum.getMsg() + waveData.get(1));
|
result.setResultOrigin(dataSourceEnum.getMsg() + waveData.get(1));
|
||||||
break;
|
break;
|
||||||
|
case MINUTE_STATISTICS_AVG:
|
||||||
|
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||||
|
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||||
|
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||||
|
break;
|
||||||
|
case MINUTE_STATISTICS_MAX:
|
||||||
|
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||||
|
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||||
|
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||||
|
break;
|
||||||
|
case MINUTE_STATISTICS_MIN:
|
||||||
|
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||||
|
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||||
|
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||||
|
break;
|
||||||
|
case MINUTE_STATISTICS_CP95:
|
||||||
|
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||||
|
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||||
|
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1679,27 +1700,27 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
AdPlan finalPlan = plan;
|
AdPlan finalPlan = plan;
|
||||||
// 实时数据结果
|
// 实时数据结果
|
||||||
List<ContrastNonHarmonicResult> realNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
List<ContrastNonHarmonicResult> realNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, DataSourceEnum.REAL_DATA.getValue(), monitorId, null);
|
||||||
Map<Integer, List<ContrastNonHarmonicResult>> numNonHarmonicMap = realNonHarmonicResults.stream()
|
Map<Integer, List<ContrastNonHarmonicResult>> realNumNonHarmonicMap = realNonHarmonicResults.stream()
|
||||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, DataSourceEnum.REAL_DATA.getValue(), monitorId, null);
|
||||||
Map<Integer, List<ContrastHarmonicResult>> numHarmonicMap = realHarmonicResults.stream()
|
Map<Integer, List<ContrastHarmonicResult>> realNumHarmonicMap = realHarmonicResults.stream()
|
||||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
Map<Integer, List<Integer>> numResutMap = new TreeMap<>();
|
Map<Integer, List<Integer>> realNumResutMap = new TreeMap<>();
|
||||||
numNonHarmonicMap.forEach((num, resultList) -> {
|
realNumNonHarmonicMap.forEach((num, resultList) -> {
|
||||||
numResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
realNumResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||||
});
|
});
|
||||||
numHarmonicMap.forEach((num, resultList) -> {
|
realNumHarmonicMap.forEach((num, resultList) -> {
|
||||||
List<Integer> list = numResutMap.getOrDefault(num, new ArrayList<>());
|
List<Integer> list = realNumResutMap.getOrDefault(num, new ArrayList<>());
|
||||||
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||||
numResutMap.put(num, list);
|
realNumResutMap.put(num, list);
|
||||||
});
|
});
|
||||||
|
|
||||||
numResutMap.forEach((num, resultList) -> {
|
realNumResutMap.forEach((num, resultList) -> {
|
||||||
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
||||||
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
||||||
realDataSourceResultVO.setDataSourceCode(DataSourceEnum.REAL_DATA.getValue());
|
realDataSourceResultVO.setDataSourceCode(DataSourceEnum.REAL_DATA.getValue());
|
||||||
@@ -1710,14 +1731,14 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
result.put(num, dataSourceResultVOList);
|
result.put(num, dataSourceResultVOList);
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<Integer, Map<Integer, List<Integer>>> waveNumMap = new TreeMap<>();
|
|
||||||
|
|
||||||
// 录波数据结果
|
// 录波数据结果
|
||||||
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
Map<Integer, Map<Integer, List<Integer>>> waveNumMap = new TreeMap<>();
|
||||||
|
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, null, monitorId, null);
|
||||||
Map<Integer, List<ContrastNonHarmonicResult>> waveNumNonHarmonicMap = waveNonHarmonicResults.stream()
|
Map<Integer, List<ContrastNonHarmonicResult>> waveNumNonHarmonicMap = waveNonHarmonicResults.stream()
|
||||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, null, monitorId, null);
|
||||||
Map<Integer, List<ContrastHarmonicResult>> waveNumHarmonicMap = waveHarmonicResults.stream()
|
Map<Integer, List<ContrastHarmonicResult>> waveNumHarmonicMap = waveHarmonicResults.stream()
|
||||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
@@ -1759,6 +1780,62 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
result.put(num, orDefault);
|
result.put(num, orDefault);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
String dataRule = finalPlan.getDatasourceId();
|
||||||
|
String[] split1 = dataRule.split(CnSocketUtil.SPLIT_TAG);
|
||||||
|
DataSourceEnum dataType = null;
|
||||||
|
for (String s : split1) {
|
||||||
|
if (MINUTE_STATISTICS_AVG.getValue().equals(s)) {
|
||||||
|
dataType = MINUTE_STATISTICS_AVG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (MINUTE_STATISTICS_CP95.getValue().equals(s)) {
|
||||||
|
dataType = MINUTE_STATISTICS_CP95;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (MINUTE_STATISTICS_MAX.getValue().equals(s)) {
|
||||||
|
dataType = MINUTE_STATISTICS_MAX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (MINUTE_STATISTICS_MIN.getValue().equals(s)) {
|
||||||
|
dataType = MINUTE_STATISTICS_MIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 统计数据
|
||||||
|
if (ObjectUtil.isNotNull(dataType)) {
|
||||||
|
List<ContrastNonHarmonicResult> statisticsNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, dataType.getValue(), monitorId, null);
|
||||||
|
Map<Integer, List<ContrastNonHarmonicResult>> statisticsNumNonHarmonicMap = statisticsNonHarmonicResults.stream()
|
||||||
|
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||||
|
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
|
List<ContrastHarmonicResult> statisticsHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, dataType.getValue(), monitorId, null);
|
||||||
|
Map<Integer, List<ContrastHarmonicResult>> statisticsNumHarmonicMap = statisticsHarmonicResults.stream()
|
||||||
|
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||||
|
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
|
Map<Integer, List<Integer>> statisticsNumResutMap = new TreeMap<>();
|
||||||
|
statisticsNumNonHarmonicMap.forEach((num, resultList) -> {
|
||||||
|
statisticsNumResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||||
|
});
|
||||||
|
statisticsNumHarmonicMap.forEach((num, resultList) -> {
|
||||||
|
List<Integer> list = statisticsNumResutMap.getOrDefault(num, new ArrayList<>());
|
||||||
|
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||||
|
statisticsNumResutMap.put(num, list);
|
||||||
|
});
|
||||||
|
|
||||||
|
DataSourceEnum finalDataType = dataType;
|
||||||
|
statisticsNumResutMap.forEach((num, resultList) -> {
|
||||||
|
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
||||||
|
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
||||||
|
realDataSourceResultVO.setDataSourceCode(finalDataType.getValue());
|
||||||
|
realDataSourceResultVO.setDataSourceName(finalDataType.getMsg());
|
||||||
|
realDataSourceResultVO.setCheckResult(StorageUtil.getInteger(resultList));
|
||||||
|
dataSourceResultVOList.add(realDataSourceResultVO);
|
||||||
|
|
||||||
|
result.put(num, dataSourceResultVOList);
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1798,20 +1875,23 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
monitor.setRecordedResult(null);
|
monitor.setRecordedResult(null);
|
||||||
monitor.setRecordedNum(null);
|
monitor.setRecordedNum(null);
|
||||||
}
|
}
|
||||||
|
boolean flag = pqMonitorService.updateById(monitor);
|
||||||
|
|
||||||
return pqMonitorService.updateById(monitor);
|
pqDevService.updateResult(split[0], null);
|
||||||
|
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ContrastTestItemVO> getCheckItem(String devId, String chnNum, Integer num) {
|
public List<ContrastTestItemVO> getCheckItem(String planId, String devId, String chnNum, Integer num) {
|
||||||
PqDev dev = pqDevService.getById(devId);
|
// PqDev dev = pqDevService.getById(devId);
|
||||||
AdPlan plan = adPlanService.getById(dev.getPlanId());
|
AdPlan plan = adPlanService.getById(planId);
|
||||||
String code = String.valueOf(plan.getCode());
|
String code = String.valueOf(plan.getCode());
|
||||||
|
|
||||||
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
|
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> realNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
List<ContrastNonHarmonicResult> realNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, false, null, monitorId, null);
|
||||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, false, null, monitorId, null);
|
||||||
|
|
||||||
Map<String, List<Integer>> checkItemResultMap = realNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList())));
|
Map<String, List<Integer>> checkItemResultMap = realNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList())));
|
||||||
checkItemResultMap.putAll(realHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
checkItemResultMap.putAll(realHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||||
@@ -1830,8 +1910,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
checkItemResultMap.clear();
|
checkItemResultMap.clear();
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> waveNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
List<ContrastNonHarmonicResult> waveNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, true, null, monitorId, null);
|
||||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, true, null, monitorId, null);
|
||||||
if (CollUtil.isNotEmpty(waveNoHarmonicResults) && CollUtil.isNotEmpty(waveHarmonicResults)) {
|
if (CollUtil.isNotEmpty(waveNoHarmonicResults) && CollUtil.isNotEmpty(waveHarmonicResults)) {
|
||||||
checkItemResultMap.putAll(waveNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList()))));
|
checkItemResultMap.putAll(waveNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||||
checkItemResultMap.putAll(waveHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
checkItemResultMap.putAll(waveHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||||
@@ -1951,8 +2031,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
int totalDataPoints = 0; // 统计总的数据点数
|
int totalDataPoints = 0; // 统计总的数据点数
|
||||||
int zeroFilteredPoints = 0; // 统计双零过滤的数据点数
|
int zeroFilteredPoints = 0; // 统计双零过滤的数据点数
|
||||||
|
|
||||||
// 遍历 2~50 次谐波
|
// 间谐波从1开始,普通谐波从2开始
|
||||||
for (int harmNum = 2; harmNum <= 50; harmNum++) {
|
int startHarmNum = isInterHarmonic ? 1 : 2;
|
||||||
|
// 遍历谐波次数
|
||||||
|
for (int harmNum = startHarmNum; harmNum <= 50; harmNum++) {
|
||||||
String harmKey = String.valueOf(harmNum);
|
String harmKey = String.valueOf(harmNum);
|
||||||
Map<String, Map<String, Map<String, String>>> checkResultHarmonic = new LinkedHashMap<>();
|
Map<String, Map<String, Map<String, String>>> checkResultHarmonic = new LinkedHashMap<>();
|
||||||
List<String> zeroFilteredPhases = new ArrayList<>(); // 当前次数被过滤的相别
|
List<String> zeroFilteredPhases = new ArrayList<>(); // 当前次数被过滤的相别
|
||||||
@@ -1982,7 +2064,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// 双零情况,记录但不加入结果判定
|
// 双零情况,记录但不加入结果判定
|
||||||
zeroFilteredPhases.add(phase.toUpperCase() + "相");
|
zeroFilteredPhases.add(phase.toUpperCase() + "相");
|
||||||
// 将结果改为特殊标记,不参与整体结论判定
|
// 将结果改为特殊标记,不参与整体结论判定
|
||||||
singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "双零过滤");
|
singlePhaseData.put(ItemReportKeyEnum.RESULT.getKey(), "符合");
|
||||||
} else {
|
} else {
|
||||||
// 有非双零数据
|
// 有非双零数据
|
||||||
hasNonZeroData = true;
|
hasNonZeroData = true;
|
||||||
@@ -1990,7 +2072,6 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
String resultTemp = singlePhaseData.get(ItemReportKeyEnum.RESULT.getKey());
|
String resultTemp = singlePhaseData.get(ItemReportKeyEnum.RESULT.getKey());
|
||||||
if (StrUtil.isNotBlank(resultTemp)) {
|
if (StrUtil.isNotBlank(resultTemp)) {
|
||||||
allResult.add(resultTemp);
|
allResult.add(resultTemp);
|
||||||
|
|
||||||
// 收集特殊情况
|
// 收集特殊情况
|
||||||
if ("无法比较".equals(resultTemp)) {
|
if ("无法比较".equals(resultTemp)) {
|
||||||
String numOfDataStr = singlePhaseData.get(ItemReportKeyEnum.NUM_OF_DATA.getKey());
|
String numOfDataStr = singlePhaseData.get(ItemReportKeyEnum.NUM_OF_DATA.getKey());
|
||||||
@@ -2133,7 +2214,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
String phases = phaseEntry.getKey();
|
String phases = phaseEntry.getKey();
|
||||||
List<Integer> harmNums = phaseEntry.getValue();
|
List<Integer> harmNums = phaseEntry.getValue();
|
||||||
specialCaseDesc.append("第").append(formatHarmNumbers(harmNums, isInterHarmonic)).append("次谐波");
|
specialCaseDesc.append("第").append(formatHarmNumbers(harmNums, isInterHarmonic)).append("次谐波");
|
||||||
specialCaseDesc.append(phases).append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
|
// 如果是T相,则不拼接相别
|
||||||
|
if (!"T相".equals(phases)) {
|
||||||
|
specialCaseDesc.append(phases);
|
||||||
|
}
|
||||||
|
specialCaseDesc.append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2294,10 +2379,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
contrastTestResult.setHarmonic(false);
|
contrastTestResult.setHarmonic(false);
|
||||||
List<String> allResult = new ArrayList<>();
|
List<String> allResult = new ArrayList<>();
|
||||||
Map<String, Map<String, String>> checkResultNonHarmonic = new LinkedHashMap<>();
|
Map<String, Map<String, String>> checkResultNonHarmonic = new LinkedHashMap<>();
|
||||||
|
|
||||||
// 根据指标代码确定小数位数
|
// 根据指标代码确定小数位数
|
||||||
Integer decimalPlaces = getDecimalPlacesByScriptCode(dictTree.getCode());
|
Integer decimalPlaces = getDecimalPlacesByScriptCode(dictTree.getCode());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 非谐波的需要注意是否为T相还是ABC三相的
|
// 非谐波的需要注意是否为T相还是ABC三相的
|
||||||
if (PowerConstant.T_PHASE.contains(dictTree.getCode())) {
|
if (PowerConstant.T_PHASE.contains(dictTree.getCode())) {
|
||||||
@@ -2357,10 +2440,16 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// 生成无法比较的描述
|
// 生成无法比较的描述
|
||||||
if (!unComparablePhases.isEmpty()) {
|
if (!unComparablePhases.isEmpty()) {
|
||||||
specialCaseDesc.append("注:");
|
specialCaseDesc.append("注:");
|
||||||
if (unComparablePhases.size() == 1) {
|
// 如果只有T相,则不拼接相别
|
||||||
specialCaseDesc.append(unComparablePhases.get(0));
|
if (unComparablePhases.size() == 1 && "T相".equals(unComparablePhases.get(0))) {
|
||||||
|
// T相不拼接相别
|
||||||
} else {
|
} else {
|
||||||
specialCaseDesc.append(String.join("、", unComparablePhases));
|
// 其他情况拼接相别
|
||||||
|
if (unComparablePhases.size() == 1) {
|
||||||
|
specialCaseDesc.append(unComparablePhases.get(0));
|
||||||
|
} else {
|
||||||
|
specialCaseDesc.append(String.join("、", unComparablePhases));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
specialCaseDesc.append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
|
specialCaseDesc.append("无样本数据满足误差比较的前置条件,无法执行有效性判定。");
|
||||||
}
|
}
|
||||||
@@ -2417,40 +2506,38 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||||
if (CollUtil.isNotEmpty(dataList)) {
|
if (CollUtil.isNotEmpty(dataList)) {
|
||||||
DetectionData detectionData = dataList.get(0);
|
DetectionData detectionData = dataList.get(0);
|
||||||
|
|
||||||
// 相别
|
// 相别
|
||||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||||
// 有效组数 todo... 目前是对齐组数
|
// 有效组数 todo... 目前是对齐组数
|
||||||
dataMap.put(ItemReportKeyEnum.NUM_OF_DATA.getKey(), String.valueOf(numOfData));
|
dataMap.put(ItemReportKeyEnum.NUM_OF_DATA.getKey(), String.valueOf(numOfData));
|
||||||
|
|
||||||
// 标准值 - 根据参数决定是否格式化
|
// 标准值 - 根据参数决定是否格式化
|
||||||
String standardValue = String.valueOf(detectionData.getResultData());
|
String standardValue = String.valueOf(detectionData.getResultData());
|
||||||
if (decimalPlaces != null && detectionData.getResultData() != null) {
|
if (decimalPlaces != null && detectionData.getResultData() != null) {
|
||||||
standardValue = formatSignificantDigits(detectionData.getResultData(), decimalPlaces);
|
standardValue = formatSignificantDigits(detectionData.getResultData(), decimalPlaces);
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.STANDARD.getKey(), standardValue);
|
dataMap.put(ItemReportKeyEnum.STANDARD.getKey(), standardValue);
|
||||||
|
|
||||||
// 被检值 - 根据参数决定是否格式化
|
// 被检值 - 根据参数决定是否格式化
|
||||||
String testValue = String.valueOf(detectionData.getData());
|
String testValue = String.valueOf(detectionData.getData());
|
||||||
if (decimalPlaces != null && detectionData.getData() != null) {
|
if (decimalPlaces != null && detectionData.getData() != null) {
|
||||||
testValue = formatSignificantDigits(detectionData.getData(), decimalPlaces);
|
testValue = formatSignificantDigits(detectionData.getData(), decimalPlaces);
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.TEST.getKey(), testValue);
|
dataMap.put(ItemReportKeyEnum.TEST.getKey(), testValue);
|
||||||
|
|
||||||
// 误差 - 根据参数决定是否格式化
|
// 误差 - 根据参数决定是否格式化
|
||||||
String errorValue = String.valueOf(detectionData.getErrorData());
|
String errorValue = String.valueOf(detectionData.getErrorData());
|
||||||
if (decimalPlaces != null && detectionData.getErrorData() != null) {
|
if (decimalPlaces != null && detectionData.getErrorData() != null) {
|
||||||
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
|
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
|
||||||
|
} else {
|
||||||
|
errorValue = "/";
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
|
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
|
||||||
|
|
||||||
// 误差范围 - 根据参数决定是否格式化
|
// 误差范围 - 根据参数决定是否格式化
|
||||||
String errorScope = String.valueOf(detectionData.getRadius());
|
String errorScope = String.valueOf(detectionData.getRadius());
|
||||||
if (decimalPlaces != null && detectionData.getRadius() != null) {
|
if (decimalPlaces != null && detectionData.getRadius() != null) {
|
||||||
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
|
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
|
||||||
|
} else {
|
||||||
|
errorScope = "/";
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
|
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
|
||||||
|
|
||||||
// 结论
|
// 结论
|
||||||
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
||||||
} else {
|
} else {
|
||||||
@@ -2545,8 +2632,20 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||||
if (CollUtil.isNotEmpty(dataList)) {
|
if (CollUtil.isNotEmpty(dataList)) {
|
||||||
DetectionData detectionData = dataList.get(0);
|
DetectionData detectionData = dataList.get(0);
|
||||||
// 次数
|
// 次数 - 从数据对象中获取实际次数(间谐波为1.5、2.5等)
|
||||||
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
|
String timeValue;
|
||||||
|
if (detectionData.getNum() != null) {
|
||||||
|
double numValue = detectionData.getNum();
|
||||||
|
// 如果是整数,则只显示整数部分(如2.0显示为2)
|
||||||
|
if (numValue == Math.floor(numValue)) {
|
||||||
|
timeValue = String.valueOf((int) numValue);
|
||||||
|
} else {
|
||||||
|
timeValue = String.valueOf(numValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
timeValue = String.valueOf(harmNum);
|
||||||
|
}
|
||||||
|
dataMap.put(ItemReportKeyEnum.TIME.getKey(), timeValue);
|
||||||
// 相别
|
// 相别
|
||||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||||
// 有效组数 todo... 目前是对齐组数
|
// 有效组数 todo... 目前是对齐组数
|
||||||
@@ -2570,6 +2669,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
String errorValue = String.valueOf(detectionData.getErrorData());
|
String errorValue = String.valueOf(detectionData.getErrorData());
|
||||||
if (decimalPlaces != null && detectionData.getErrorData() != null) {
|
if (decimalPlaces != null && detectionData.getErrorData() != null) {
|
||||||
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
|
errorValue = formatSignificantDigits(detectionData.getErrorData().doubleValue(), decimalPlaces);
|
||||||
|
} else {
|
||||||
|
errorValue = "/";
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
|
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
|
||||||
|
|
||||||
@@ -2577,13 +2678,15 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
String errorScope = String.valueOf(detectionData.getRadius());
|
String errorScope = String.valueOf(detectionData.getRadius());
|
||||||
if (decimalPlaces != null && detectionData.getRadius() != null) {
|
if (decimalPlaces != null && detectionData.getRadius() != null) {
|
||||||
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
|
errorScope = formatErrorRange(detectionData.getRadius(), decimalPlaces);
|
||||||
|
} else {
|
||||||
|
errorScope = "/";
|
||||||
}
|
}
|
||||||
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
|
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
|
||||||
|
|
||||||
// 结论
|
// 结论
|
||||||
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
||||||
} else {
|
} else {
|
||||||
// 次数
|
// 次数 - 数据为空时用循环变量作为兜底
|
||||||
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
|
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
|
||||||
// 相别
|
// 相别
|
||||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||||
@@ -2658,8 +2761,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
private Map<String, List<RawResultDataVO>> getResultMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
|
private Map<String, List<RawResultDataVO>> getResultMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
|
||||||
Map<String, List<RawResultDataVO>> resultMap = new LinkedHashMap<>();
|
Map<String, List<RawResultDataVO>> resultMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, waveNum, isWave, monitorId, adTypeList);
|
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, waveNum, isWave, null, monitorId, adTypeList);
|
||||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(code, num, waveNum, isWave, monitorId, adTypeList);
|
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(code, num, waveNum, isWave, null, monitorId, adTypeList);
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(contrastNonHarmonicResults)) {
|
if (CollUtil.isNotEmpty(contrastNonHarmonicResults)) {
|
||||||
ContrastNonHarmonicResult contrastNonHarmonicResult = contrastNonHarmonicResults.get(0);
|
ContrastNonHarmonicResult contrastNonHarmonicResult = contrastNonHarmonicResults.get(0);
|
||||||
@@ -2705,7 +2808,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
if (CollUtil.isNotEmpty(contrastHarmonicResults)) {
|
if (CollUtil.isNotEmpty(contrastHarmonicResults)) {
|
||||||
ContrastHarmonicResult contrastHarmonicResult = contrastHarmonicResults.get(0);
|
ContrastHarmonicResult contrastHarmonicResult = contrastHarmonicResults.get(0);
|
||||||
List<Double> harmonicNum = null;
|
List<Double> harmonicNum = null;
|
||||||
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode())) {
|
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode()) || DicDataEnum.HP.getCode().equals(dictTree.getCode())) {
|
||||||
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
|
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
|
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
|
||||||
@@ -2728,6 +2831,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
List<RawResultDataVO.DetectionData> cList = JSON.parseArray(fieldC.get(contrastHarmonicResult) + "", RawResultDataVO.DetectionData.class);
|
List<RawResultDataVO.DetectionData> cList = JSON.parseArray(fieldC.get(contrastHarmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||||
|
|
||||||
List<RawResultDataVO> rawResultDataVOList = new ArrayList<>();
|
List<RawResultDataVO> rawResultDataVOList = new ArrayList<>();
|
||||||
|
List<Integer> isDataList = new ArrayList<>();
|
||||||
for (int j = 0; j < aList.size(); j++) {
|
for (int j = 0; j < aList.size(); j++) {
|
||||||
RawResultDataVO dataVO = new RawResultDataVO();
|
RawResultDataVO dataVO = new RawResultDataVO();
|
||||||
dataVO.setHarmNum(n);
|
dataVO.setHarmNum(n);
|
||||||
@@ -2737,9 +2841,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
dataVO.setDataC(cList.get(j));
|
dataVO.setDataC(cList.get(j));
|
||||||
dataVO.setRadius(aList.get(j).getRadius());
|
dataVO.setRadius(aList.get(j).getRadius());
|
||||||
dataVO.setIsData(StorageUtil.setResultFlag(Arrays.asList(aList.get(j), bList.get(j), cList.get(j))));
|
dataVO.setIsData(StorageUtil.setResultFlag(Arrays.asList(aList.get(j), bList.get(j), cList.get(j))));
|
||||||
|
isDataList.add(dataVO.getIsData());
|
||||||
rawResultDataVOList.add(dataVO);
|
rawResultDataVOList.add(dataVO);
|
||||||
}
|
}
|
||||||
resultMap.put(String.valueOf(n), rawResultDataVOList);
|
Integer isData = StorageUtil.getInteger(isDataList);
|
||||||
|
resultMap.put(n + (isData == ResultEnum.NOT_QUALIFIED.getValue() ? "(不符合)" : (isData == ResultEnum.NO_ERROR_SYS.getValue() ? "(/)" : "")), rawResultDataVOList);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -2750,36 +2856,36 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
|
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code, List<String> keys) {
|
||||||
Map<String, List<AlignDataVO.RawData>> rawMap = new LinkedHashMap<>();
|
Map<String, List<AlignDataVO.RawData>> rawMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList);
|
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 0, monitorId, adTypeList);
|
||||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 1, monitorId, adTypeList);
|
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 1, monitorId, adTypeList);
|
||||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList);
|
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 0, monitorId, adTypeList);
|
||||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, 1, monitorId, adTypeList);
|
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 1, monitorId, adTypeList);
|
||||||
|
|
||||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
List<AlignDataVO.RawData> rawDataVOList = new ArrayList<>();
|
List<AlignDataVO.RawData> rawDataVOList = new ArrayList<>();
|
||||||
for (int i = 0; i < devNonHarmonicRawDataList.size(); i++) {
|
for (int i = 0; i < devNonHarmonicRawDataList.size(); i++) {
|
||||||
AlignDataVO.RawData rawDataVO = new AlignDataVO.RawData();
|
AlignDataVO.RawData rawDataVO = new AlignDataVO.RawData();
|
||||||
rawDataVO.setUnit(unit);
|
rawDataVO.setUnit(unit);
|
||||||
ContrastNonHarmonicResult contrastNonHarmonicResult = devNonHarmonicRawDataList.get(i);
|
ContrastNonHarmonicResult contrastNonHarmonicResultDev = devNonHarmonicRawDataList.get(i);
|
||||||
rawDataVO.setTimeDev(contrastNonHarmonicResult.getTimeId().format(dtf));
|
rawDataVO.setTimeDev(contrastNonHarmonicResultDev.getTimeId().format(dtf));
|
||||||
|
|
||||||
rawDataVO.setUbDev(getValue(contrastNonHarmonicResult.getBValue()));
|
rawDataVO.setUbDev(getValue(contrastNonHarmonicResultDev.getBValue()));
|
||||||
rawDataVO.setUtDev(getValue(contrastNonHarmonicResult.getTValue()));
|
rawDataVO.setUtDev(getValue(contrastNonHarmonicResultDev.getTValue()));
|
||||||
|
|
||||||
contrastNonHarmonicResult = stdDevNonHarmonicRawDataList.get(i);
|
ContrastNonHarmonicResult contrastNonHarmonicResultStdDev = stdDevNonHarmonicRawDataList.get(i);
|
||||||
rawDataVO.setTimeStdDev(contrastNonHarmonicResult.getTimeId().format(dtf));
|
rawDataVO.setTimeStdDev(contrastNonHarmonicResultStdDev.getTimeId().format(dtf));
|
||||||
if (!DicDataEnum.IMBV.getCode().equals(dictTree.getCode()) && !DicDataEnum.IMBA.getCode().equals(dictTree.getCode())) {
|
if (!DicDataEnum.IMBV.getCode().equals(dictTree.getCode()) && !DicDataEnum.IMBA.getCode().equals(dictTree.getCode())) {
|
||||||
rawDataVO.setUaDev(getValue(contrastNonHarmonicResult.getAValue()));
|
rawDataVO.setUaDev(getValue(contrastNonHarmonicResultDev.getAValue()));
|
||||||
rawDataVO.setUcDev(getValue(contrastNonHarmonicResult.getCValue()));
|
rawDataVO.setUcDev(getValue(contrastNonHarmonicResultDev.getCValue()));
|
||||||
rawDataVO.setUaStdDev(getValue(contrastNonHarmonicResult.getAValue()));
|
rawDataVO.setUaStdDev(getValue(contrastNonHarmonicResultStdDev.getAValue()));
|
||||||
rawDataVO.setUcStdDev(getValue(contrastNonHarmonicResult.getCValue()));
|
rawDataVO.setUcStdDev(getValue(contrastNonHarmonicResultStdDev.getCValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
rawDataVO.setUbStdDev(getValue(contrastNonHarmonicResult.getBValue()));
|
rawDataVO.setUbStdDev(getValue(contrastNonHarmonicResultStdDev.getBValue()));
|
||||||
rawDataVO.setUtStdDev(getValue(contrastNonHarmonicResult.getTValue()));
|
rawDataVO.setUtStdDev(getValue(contrastNonHarmonicResultStdDev.getTValue()));
|
||||||
|
|
||||||
rawDataVOList.add(rawDataVO);
|
rawDataVOList.add(rawDataVO);
|
||||||
}
|
}
|
||||||
@@ -2789,11 +2895,14 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
if (CollUtil.isNotEmpty(devHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevHarmonicRawDataList)) {
|
if (CollUtil.isNotEmpty(devHarmonicRawDataList) && CollUtil.isNotEmpty(stdDevHarmonicRawDataList)) {
|
||||||
List<Double> harmonicNum = null;
|
List<Double> harmonicNum = null;
|
||||||
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode())) {
|
boolean isHarm = true;
|
||||||
|
if (DicDataEnum.HV.getCode().equals(dictTree.getCode()) || DicDataEnum.HI.getCode().equals(dictTree.getCode()) || DicDataEnum.HP.getCode().equals(dictTree.getCode())) {
|
||||||
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
|
harmonicNum = Stream.iterate(2.0, n -> n + 1).limit(49).collect(Collectors.toList());
|
||||||
|
isHarm = true;
|
||||||
}
|
}
|
||||||
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
|
if (DicDataEnum.HSV.getCode().equals(dictTree.getCode()) || DicDataEnum.HSI.getCode().equals(dictTree.getCode())) {
|
||||||
harmonicNum = Stream.iterate(0.5, n -> n + 1).limit(50).collect(Collectors.toList());
|
harmonicNum = Stream.iterate(0.5, n -> n + 1).limit(50).collect(Collectors.toList());
|
||||||
|
isHarm = false;
|
||||||
}
|
}
|
||||||
for (Double n : harmonicNum) {
|
for (Double n : harmonicNum) {
|
||||||
List<AlignDataVO.RawData> rawDataVOList1 = new ArrayList<>();
|
List<AlignDataVO.RawData> rawDataVOList1 = new ArrayList<>();
|
||||||
@@ -2844,7 +2953,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
rawDataVOList1.add(rawDataVO);
|
rawDataVOList1.add(rawDataVO);
|
||||||
}
|
}
|
||||||
rawMap.put(String.valueOf(n), rawDataVOList1);
|
int num1 = n.intValue();
|
||||||
|
num1 = isHarm ? num1 - 2 : num1;
|
||||||
|
String key = keys.get(num1);
|
||||||
|
rawMap.put(key, rawDataVOList1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2921,6 +3033,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
"A_Value_0 json NULL COMMENT 'A相基波有效值',\n" +
|
"A_Value_0 json NULL COMMENT 'A相基波有效值',\n" +
|
||||||
"B_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
"B_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
||||||
"C_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
"C_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
||||||
|
"Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" +
|
||||||
"PRIMARY KEY (Id)\n"
|
"PRIMARY KEY (Id)\n"
|
||||||
:
|
:
|
||||||
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" +
|
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" +
|
||||||
@@ -2951,7 +3064,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
* @param errorSysId
|
* @param errorSysId
|
||||||
* @param devId
|
* @param devId
|
||||||
*/
|
*/
|
||||||
private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId) {
|
private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId, String dataRuleId) {
|
||||||
String oldCode = code.replace("_temp", "");
|
String oldCode = code.replace("_temp", "");
|
||||||
PreDetectionParam param = new PreDetectionParam();
|
PreDetectionParam param = new PreDetectionParam();
|
||||||
param.setCode(code);
|
param.setCode(code);
|
||||||
@@ -2969,8 +3082,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// } else {
|
// } else {
|
||||||
// dataRule = DictDataEnum.SECTION_VALUE;
|
// dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
// }
|
// }
|
||||||
AdPlan plan = adPlanService.getById(planId);
|
// AdPlan plan = adPlanService.getById(planId);
|
||||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||||
if (ObjectUtil.isNotNull(dictData)) {
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
@@ -3028,8 +3141,9 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
* @param code
|
* @param code
|
||||||
* @param errorSysId
|
* @param errorSysId
|
||||||
* @param deviceId
|
* @param deviceId
|
||||||
|
* @param updateResult
|
||||||
*/
|
*/
|
||||||
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId) {
|
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, boolean updateResult, String dataRuleId) {
|
||||||
String oldCode = code.replace("_temp", "");
|
String oldCode = code.replace("_temp", "");
|
||||||
|
|
||||||
Map<String, String> devIdMapComm = new HashMap<>();
|
Map<String, String> devIdMapComm = new HashMap<>();
|
||||||
@@ -3043,18 +3157,19 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
DataSourceEnum nonWaveDataSourceEnum = DataSourceEnum.REAL_DATA;
|
DataSourceEnum nonWaveDataSourceEnum = DataSourceEnum.REAL_DATA;
|
||||||
for (String ds : dataSourceIds) {
|
for (String ds : dataSourceIds) {
|
||||||
switch (DataSourceEnum.valueOf(ds)) {
|
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(ds);
|
||||||
|
switch (dataSourceEnum) {
|
||||||
case MINUTE_STATISTICS_MIN:
|
case MINUTE_STATISTICS_MIN:
|
||||||
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_MIN;
|
nonWaveDataSourceEnum = MINUTE_STATISTICS_MIN;
|
||||||
break;
|
break;
|
||||||
case MINUTE_STATISTICS_MAX:
|
case MINUTE_STATISTICS_MAX:
|
||||||
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_MAX;
|
nonWaveDataSourceEnum = MINUTE_STATISTICS_MAX;
|
||||||
break;
|
break;
|
||||||
case MINUTE_STATISTICS_AVG:
|
case MINUTE_STATISTICS_AVG:
|
||||||
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_AVG;
|
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_AVG;
|
||||||
break;
|
break;
|
||||||
case MINUTE_STATISTICS_CP95:
|
case MINUTE_STATISTICS_CP95:
|
||||||
nonWaveDataSourceEnum = DataSourceEnum.MINUTE_STATISTICS_CP95;
|
nonWaveDataSourceEnum = MINUTE_STATISTICS_CP95;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3071,33 +3186,38 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DictDataEnum dataRule;
|
DictDataEnum dataRule;
|
||||||
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
DictData dictData = dictDataService.getDictDataById(dataRuleId);
|
||||||
if (ObjectUtil.isNotNull(dictData)) {
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
dataRule = DictDataEnum.SECTION_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pqMonitorService.lambdaUpdate().set(PqMonitor::getRecordedResult, null)
|
if (updateResult) {
|
||||||
.set(PqMonitor::getRealtimeNum, null)
|
pqMonitorService.lambdaUpdate().set(PqMonitor::getRecordedResult, null)
|
||||||
.set(PqMonitor::getRecordedResult, null)
|
.set(PqMonitor::getRealtimeNum, null)
|
||||||
.set(PqMonitor::getRecordedNum, null)
|
.set(PqMonitor::getRecordedResult, null)
|
||||||
.set(PqMonitor::getStatisticsResult, null)
|
.set(PqMonitor::getRecordedNum, null)
|
||||||
.set(PqMonitor::getStatisticsNum, null)
|
.set(PqMonitor::getStatisticsResult, null)
|
||||||
.set(PqMonitor::getResultType, null)
|
.set(PqMonitor::getStatisticsNum, null)
|
||||||
.set(PqMonitor::getQualifiedNum, 0)
|
.set(PqMonitor::getResultType, null)
|
||||||
.eq(PqMonitor::getDevId, deviceId)
|
.set(PqMonitor::getQualifiedNum, 0)
|
||||||
.eq(PqMonitor::getCheckFlag, 1)
|
.eq(PqMonitor::getDevId, deviceId)
|
||||||
.update();
|
// .eq(PqMonitor::getNum, Integer.parseInt(chnNum))
|
||||||
|
.eq(PqMonitor::getCheckFlag, 1)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// String monitorId = deviceId + CnSocketUtil.SPLIT_TAG + chnNum;
|
||||||
List<AdPair> adPairList = adPairService.listByDevIds(Arrays.asList(deviceId));
|
List<AdPair> adPairList = adPairService.listByDevIds(Arrays.asList(deviceId));
|
||||||
Map<Integer, List<AdPair>> numAdPairsMap = adPairList.stream().collect(Collectors.groupingBy(AdPair::getNum, Collectors.toList()));
|
Map<Integer, List<AdPair>> numAdPairsMap = adPairList.stream().collect(Collectors.groupingBy(AdPair::getNum, Collectors.toList()));
|
||||||
|
|
||||||
numAdPairsMap.forEach((num, pairList) -> {
|
numAdPairsMap.forEach((num, pairList) -> {
|
||||||
BiMap<String, String> parsIp = HashBiMap.create();
|
|
||||||
BiMap<String, String> parsId = HashBiMap.create();
|
|
||||||
Map<String, Integer> numMap = new HashMap<>();
|
Map<String, Integer> numMap = new HashMap<>();
|
||||||
Map<String, List<AdPair>> devMonitroIdMap = pairList.stream().collect(Collectors.groupingBy(AdPair::getDevMonitorId, Collectors.toList()));
|
Map<String, List<AdPair>> devMonitroIdMap = pairList.stream().collect(Collectors.groupingBy(AdPair::getDevMonitorId, Collectors.toList()));
|
||||||
devMonitroIdMap.forEach((devMonitorId, pairList1) -> {
|
devMonitroIdMap.forEach((devMonitorId, pairList1) -> {
|
||||||
|
BiMap<String, String> parsIp = HashBiMap.create();
|
||||||
|
BiMap<String, String> parsId = HashBiMap.create();
|
||||||
String[] split1 = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
String[] split1 = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||||
AdPair adPair = pairList1.get(0);
|
AdPair adPair = pairList1.get(0);
|
||||||
String[] split2 = adPair.getStdDevMonitorId().split(CnSocketUtil.SPLIT_TAG);
|
String[] split2 = adPair.getStdDevMonitorId().split(CnSocketUtil.SPLIT_TAG);
|
||||||
@@ -3107,40 +3227,41 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
parsId.put(dev.getId() + CnSocketUtil.SPLIT_TAG + split1[1], standardDev.getId() + CnSocketUtil.SPLIT_TAG + split2[1]);
|
parsId.put(dev.getId() + CnSocketUtil.SPLIT_TAG + split1[1], standardDev.getId() + CnSocketUtil.SPLIT_TAG + split2[1]);
|
||||||
numMap.put(devMonitorId, num);
|
numMap.put(devMonitorId, num);
|
||||||
numMap.put(adPair.getStdDevMonitorId(), num);
|
numMap.put(adPair.getStdDevMonitorId(), num);
|
||||||
});
|
devIdMapComm.put(standardDev.getIp(), standardDev.getId());
|
||||||
|
|
||||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
|
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, devMonitorId, null);
|
||||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, 1, deviceId, null);
|
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, devMonitorId, null);
|
||||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
|
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, devMonitorId, null);
|
||||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 1, deviceId, null);
|
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, devMonitorId, null);
|
||||||
|
|
||||||
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
|
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||||
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
|
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||||
|
|
||||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
|
if (CollUtil.isNotEmpty(devData) && CollUtil.isNotEmpty(standardDevData)) {
|
||||||
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null, finalNonWaveDataSourceEnum);
|
||||||
|
|
||||||
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
if (updateResult) {
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
|
||||||
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, null, oldCode);
|
pqDevService.updateResult(split1[0], null);
|
||||||
pqDevService.updateResult(split[0], null);
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
||||||
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
||||||
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, devMonitorId, null);
|
||||||
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
|
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, devMonitorId, null);
|
||||||
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, devMonitorId, null);
|
||||||
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
|
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, devMonitorId, null);
|
||||||
|
|
||||||
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
|
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||||
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
|
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i, DataSourceEnum.WAVE_DATA);
|
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, oldCode, i, DataSourceEnum.WAVE_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
parsId.forEach((devMonitorId, stdDevMonitorId) -> {
|
if (updateResult) {
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
pqMonitorService.updateMonitorResult(devMonitorId, null, WAVE_DATA, num, adPlanTestConfig.getWaveRecord(), oldCode);
|
||||||
pqMonitorService.updateMonitorResult(devMonitorId, null, finalNonWaveDataSourceEnum, num, adPlanTestConfig.getWaveRecord(), oldCode);
|
pqDevService.updateResult(split1[0], null);
|
||||||
pqDevService.updateResult(split[0], null);
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -3230,58 +3351,88 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DevData> contrastToList(List<ContrastNonHarmonicResult> nonHarm, List<ContrastHarmonicResult> harm, BiMap<String, String> testItemMap) {
|
private List<DevData> contrastToList(List<ContrastNonHarmonicResult> nonHarm, List<ContrastHarmonicResult> harm, BiMap<String, String> testItemMap, Integer flag) {
|
||||||
List<DevData> info = new ArrayList<>();
|
List<DevData> info = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(nonHarm)) {
|
|
||||||
Map<String, List<ContrastNonHarmonicResult>> devMonitorIdMap = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getDevMonitorId, Collectors.toList()));
|
Map<String, List<ContrastNonHarmonicResult>> devMonitorIdMap1 = null;
|
||||||
devMonitorIdMap.forEach((devMonitorId, value) -> {
|
if (flag == 0) {
|
||||||
|
devMonitorIdMap1 = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getDevMonitorId, Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
devMonitorIdMap1 = nonHarm.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getStdDevMonitorId, Collectors.toList()));
|
||||||
|
}
|
||||||
|
devMonitorIdMap1.forEach((devMonitorId, value) -> {
|
||||||
|
Map<LocalDateTime, List<ContrastNonHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getTimeId, Collectors.toList()));
|
||||||
|
timeListMap.forEach((time, value1) -> {
|
||||||
DevData devData = new DevData();
|
DevData devData = new DevData();
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||||
PqDev dev = pqDevService.getById(split[0]);
|
if (flag == 0) {
|
||||||
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
PqDev dev = pqDevService.getById(split[0]);
|
||||||
Map<LocalDateTime, List<ContrastNonHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getTimeId, Collectors.toList()));
|
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
||||||
timeListMap.forEach((time, value1) -> {
|
} else {
|
||||||
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
|
PqStandardDev standardDev = pqStandardDevService.getById(split[0]);
|
||||||
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
|
devData.setId(standardDev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
||||||
|
}
|
||||||
|
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
|
||||||
|
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
|
||||||
|
|
||||||
value1.forEach(x -> {
|
value1.forEach(x -> {
|
||||||
DevData.SqlDataDTO sqlDataDTO = new DevData.SqlDataDTO();
|
DevData.SqlDataDTO sqlDataDTO = new DevData.SqlDataDTO();
|
||||||
DevData.SqlDataDTO.ListDTO listDTO = new DevData.SqlDataDTO.ListDTO();
|
DevData.SqlDataDTO.ListDTO listDTO = new DevData.SqlDataDTO.ListDTO();
|
||||||
listDTO.setA(StrUtil.isNotBlank(x.getAValue()) ? Double.valueOf(x.getAValue()) : null);
|
listDTO.setA(StrUtil.isNotBlank(x.getAValue()) ? Double.valueOf(x.getAValue()) : null);
|
||||||
listDTO.setB(StrUtil.isNotBlank(x.getBValue()) ? Double.valueOf(x.getBValue()) : null);
|
listDTO.setB(StrUtil.isNotBlank(x.getBValue()) ? Double.valueOf(x.getBValue()) : null);
|
||||||
listDTO.setC(StrUtil.isNotBlank(x.getCValue()) ? Double.valueOf(x.getCValue()) : null);
|
listDTO.setC(StrUtil.isNotBlank(x.getCValue()) ? Double.valueOf(x.getCValue()) : null);
|
||||||
listDTO.setT(StrUtil.isNotBlank(x.getTValue()) ? Double.valueOf(x.getTValue()) : null);
|
listDTO.setT(StrUtil.isNotBlank(x.getTValue()) ? Double.valueOf(x.getTValue()) : null);
|
||||||
sqlDataDTO.setType(x.getDataType());
|
sqlDataDTO.setType(x.getDataType());
|
||||||
sqlDataDTO.setDesc(testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), ""));
|
sqlDataDTO.setDesc(testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), ""));
|
||||||
sqlDataDTO.setList(listDTO);
|
sqlDataDTO.setList(listDTO);
|
||||||
sqlData.add(sqlDataDTO);
|
sqlData.add(sqlDataDTO);
|
||||||
});
|
|
||||||
devData.setSqlData(sqlData);
|
|
||||||
});
|
});
|
||||||
|
devData.setSqlData(sqlData);
|
||||||
info.add(devData);
|
info.add(devData);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, List<ContrastHarmonicResult>> devMonitorIdMap2 = null;
|
||||||
|
if (flag == 0) {
|
||||||
|
devMonitorIdMap2 = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getDevMonitorId, Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
devMonitorIdMap2 = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getStdDevMonitorId, Collectors.toList()));
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(harm)) {
|
|
||||||
Map<String, List<ContrastHarmonicResult>> devMonitorIdMap = harm.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getDevMonitorId, Collectors.toList()));
|
|
||||||
devMonitorIdMap.forEach((devMonitorId, value) -> {
|
|
||||||
DevData devData = new DevData();
|
|
||||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
|
||||||
PqDev dev = pqDevService.getById(split[0]);
|
|
||||||
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
|
||||||
Map<LocalDateTime, List<ContrastHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getTimeId, Collectors.toList()));
|
|
||||||
|
|
||||||
timeListMap.forEach((time, value1) -> {
|
devMonitorIdMap2.forEach((devMonitorId, value) -> {
|
||||||
|
Map<LocalDateTime, List<ContrastHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getTimeId, Collectors.toList()));
|
||||||
|
|
||||||
|
String[] split1 = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||||
|
timeListMap.forEach((time, value1) -> {
|
||||||
|
// DevData devData = info.stream().filter(x -> x.getTime().equals(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)))).findFirst().orElse(null);
|
||||||
|
DevData devData = null;
|
||||||
|
for (int i = 0; i < info.size(); i++) {
|
||||||
|
DevData devData1 = info.get(i);
|
||||||
|
if (time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)).equals(devData1.getTime()) && devData1.getId().split(CnSocketUtil.SPLIT_TAG)[1].equals(split1[1])) {
|
||||||
|
devData = devData1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotNull(devData)) {
|
||||||
|
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||||
|
if (flag == 0) {
|
||||||
|
PqDev dev = pqDevService.getById(split[0]);
|
||||||
|
devData.setId(dev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
||||||
|
} else {
|
||||||
|
PqStandardDev standardDev = pqStandardDevService.getById(split[0]);
|
||||||
|
devData.setId(standardDev.getIp() + CnSocketUtil.SPLIT_TAG + split[1]);
|
||||||
|
}
|
||||||
|
|
||||||
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
|
devData.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)));
|
||||||
List<DevData.SqlDataDTO> sqlData = new ArrayList<>();
|
List<DevData.SqlDataDTO> sqlData = devData.getSqlData();
|
||||||
List<DevData.SqlDataHarmDTO> sqlDataHarm = new ArrayList<>();
|
List<DevData.SqlDataHarmDTO> sqlDataHarm = new ArrayList<>();
|
||||||
|
|
||||||
value1.forEach(x -> {
|
value1.forEach(x -> {
|
||||||
DevData.SqlDataHarmDTO dataHarmDTO = new DevData.SqlDataHarmDTO();
|
DevData.SqlDataHarmDTO dataHarmDTO = new DevData.SqlDataHarmDTO();
|
||||||
dataHarmDTO.setType(x.getDataType());
|
dataHarmDTO.setType(x.getDataType());
|
||||||
String desc = testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), "");
|
String desc = testItemMap.inverse().get(x.getAdType()).replace(DetectionCodeEnum.REAL_PREFIX.getCode(), "");
|
||||||
dataHarmDTO.setDesc(desc);
|
dataHarmDTO.setDesc(desc);
|
||||||
boolean notContainBaseHarm = false;
|
boolean notContainBaseHarm = false;
|
||||||
if (DetectionCodeEnum.V2_50.getCode().equals(desc) || DetectionCodeEnum.PV2_50.getCode().equals(desc) || DetectionCodeEnum.I2_50.getCode().equals(desc)) {
|
if (DetectionCodeEnum.V2_50.getCode().equals(desc) || DetectionCodeEnum.PV2_50.getCode().equals(desc) || DetectionCodeEnum.I2_50.getCode().equals(desc) || DetectionCodeEnum.P2_50.getCode().equals(desc)) {
|
||||||
dataHarmDTO.setNum(49);
|
dataHarmDTO.setNum(49);
|
||||||
notContainBaseHarm = true;
|
notContainBaseHarm = true;
|
||||||
}
|
}
|
||||||
@@ -3316,12 +3467,13 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
devData.setSqlDataHarm(sqlDataHarm);
|
devData.setSqlDataHarm(sqlDataHarm);
|
||||||
devData.setSqlData(sqlData);
|
devData.setSqlData(sqlData);
|
||||||
});
|
}
|
||||||
info.add(devData);
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3450,10 +3602,10 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
switch (scriptCode) {
|
switch (scriptCode) {
|
||||||
// 保留2位小数
|
// 保留2位小数
|
||||||
case "FREQ": // 频率
|
case "FREQ": // 频率
|
||||||
return 2;
|
return 4;
|
||||||
// 保留3位小数
|
// 保留3位小数
|
||||||
case "I": // 电流
|
case "I": // 电流
|
||||||
return 3;
|
return 5;
|
||||||
// 保留4位小数
|
// 保留4位小数
|
||||||
case "IMBV": // 电压不平衡度
|
case "IMBV": // 电压不平衡度
|
||||||
case "IMBA": // 电流不平衡度
|
case "IMBA": // 电流不平衡度
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class PqScriptController extends BaseController {
|
|||||||
@OperateInfo(operateType = OperateType.ADD)
|
@OperateInfo(operateType = OperateType.ADD)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增检测脚本")
|
@ApiOperation("新增检测脚本")
|
||||||
@ApiImplicitParam(name = "pqDevParam", value = "检测脚本", required = true)
|
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||||
public HttpResult<String> add(@RequestBody @Validated PqScriptParam param) {
|
public HttpResult<String> add(@RequestBody @Validated PqScriptParam param) {
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||||
@@ -69,7 +69,7 @@ public class PqScriptController extends BaseController {
|
|||||||
@OperateInfo(operateType = OperateType.UPDATE)
|
@OperateInfo(operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("修改检测脚本")
|
@ApiOperation("修改检测脚本")
|
||||||
@ApiImplicitParam(name = "updateParam", value = "检测脚本", required = true)
|
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||||
public HttpResult<Boolean> update(@RequestBody @Validated PqScriptParam.UpdateParam param) {
|
public HttpResult<Boolean> update(@RequestBody @Validated PqScriptParam.UpdateParam param) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||||
@@ -126,10 +126,10 @@ public class PqScriptController extends BaseController {
|
|||||||
@GetMapping("/getAll")
|
@GetMapping("/getAll")
|
||||||
@ApiOperation("获取指定模式下的所有检测脚本")
|
@ApiOperation("获取指定模式下的所有检测脚本")
|
||||||
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
||||||
public HttpResult<List<Map<String, Object>>> getAllPqScript(@RequestParam("patternId") String patternId) {
|
public HttpResult<List<PqScript>> getAllPqScript(@RequestParam("patternId") String patternId) {
|
||||||
String methodDescribe = getMethodDescribe("getAllPqScript");
|
String methodDescribe = getMethodDescribe("getAllPqScript");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
||||||
List<Map<String, Object>> result = pqScriptService.listAllPqScript(patternId);
|
List<PqScript> result = pqScriptService.listAllPqScript(patternId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ public class PqScriptParam {
|
|||||||
@Max(value = 20, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR)
|
@Max(value = 20, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR)
|
||||||
private Double ratedCurr;
|
private Double ratedCurr;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否为Fluke专用脚本")
|
||||||
|
private Integer fluke;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ public class PqScript extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Double ratedCurr;
|
private Double ratedCurr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为福禄克专用脚本。0-否 1-是
|
||||||
|
*/
|
||||||
|
private Integer fluke;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-删除 1-正常
|
* 状态:0-删除 1-正常
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -92,6 +92,18 @@ public class PqScriptDtls implements Serializable {
|
|||||||
@TableField("RetainTime")
|
@TableField("RetainTime")
|
||||||
private Double retainTime;
|
private Double retainTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂态前延时间(S)
|
||||||
|
*/
|
||||||
|
@TableField("FPreTime")
|
||||||
|
private Double fPreTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂态后延时间(S)
|
||||||
|
*/
|
||||||
|
@TableField("FAfterTime")
|
||||||
|
private Double fAfterTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变动频度(次/min)
|
* 变动频度(次/min)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public interface IPqScriptService extends IService<PqScript> {
|
|||||||
* @param patternId 模式id
|
* @param patternId 模式id
|
||||||
* @return 检测脚本列表
|
* @return 检测脚本列表
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> listAllPqScript(String patternId);
|
List<PqScript> listAllPqScript(String patternId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据脚本名称查询脚本
|
* 根据脚本名称查询脚本
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
|||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
@@ -67,14 +68,14 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
private final static String INHARM_I = "InHarm_I";
|
private final static String INHARM_I = "InHarm_I";
|
||||||
private final static String DIP = "Dip";
|
private final static String DIP = "Dip";
|
||||||
private final static String FLICKER = "Flicker";
|
private final static String FLICKER = "Flicker";
|
||||||
@Value("${Dip.fPreTime}")
|
// @Value("${Dip.fPreTime}")
|
||||||
private Double fPreTime;
|
// private Double fPreTime;
|
||||||
@Value("${Dip.fRampIn}")
|
@Value("${Dip.fRampIn}")
|
||||||
private Double fRampIn;
|
private Double fRampIn;
|
||||||
@Value("${Dip.fRampOut}")
|
@Value("${Dip.fRampOut}")
|
||||||
private Double fRampOut;
|
private Double fRampOut;
|
||||||
@Value("${Dip.fAfterTime}")
|
// @Value("${Dip.fAfterTime}")
|
||||||
private Double fAfterTime;
|
// private Double fAfterTime;
|
||||||
@Value("${Flicker.waveFluType}")
|
@Value("${Flicker.waveFluType}")
|
||||||
private String waveFluType;
|
private String waveFluType;
|
||||||
@Value("${Flicker.waveType}")
|
@Value("${Flicker.waveType}")
|
||||||
@@ -384,6 +385,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
dip.setPhase(phase);
|
dip.setPhase(phase);
|
||||||
dip.setTransValue(dipData.getFTransValue());
|
dip.setTransValue(dipData.getFTransValue());
|
||||||
dip.setRetainTime(dipData.getRetainTime());
|
dip.setRetainTime(dipData.getRetainTime());
|
||||||
|
dip.setFPreTime(dipData.getFPreTime());
|
||||||
|
dip.setFAfterTime(dipData.getFAfterTime());
|
||||||
info.add(dip);
|
info.add(dip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -959,6 +962,22 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
queryWrapper.eq(PqScriptDtls::getScriptIndex, -1)
|
queryWrapper.eq(PqScriptDtls::getScriptIndex, -1)
|
||||||
.eq(PqScriptDtls::getEnable, 1);
|
.eq(PqScriptDtls::getEnable, 1);
|
||||||
pqScriptDtls = this.list(queryWrapper);
|
pqScriptDtls = this.list(queryWrapper);
|
||||||
|
// 相序校验中电流需加量需要依据企标10650.2中章节5.5.3的描述过载能力:2 倍额定电流连续,10 倍额定电流持续 1 s。
|
||||||
|
// 考虑到有可能存在1A的额定电流,本处做特殊处理,加量分别为额定电流的0.2/0.4/0.6的标幺乘积加量
|
||||||
|
// 电压暂不做处理,原因:1、电压的企标描述过载能力为4倍,空间较大;2、额定电压比如57.74V为浮点数,存在不确定小数位,避免引起算术误差;
|
||||||
|
// 1. 获取额定电流,前端已做限制,相同额定电流才能一起检测
|
||||||
|
String deviceId = param.getDevIds().get(0);
|
||||||
|
PqDevVO pqDev = pqDevService.getPqDevById(deviceId);
|
||||||
|
String devTypeId = pqDev.getDevType();
|
||||||
|
DevType devType = devTypeService.getById(devTypeId);
|
||||||
|
Double devCurr = devType.getDevCurr();
|
||||||
|
for (int i = 0; i < pqScriptDtls.size(); i++) {
|
||||||
|
PqScriptDtls scriptDtls = pqScriptDtls.get(i);
|
||||||
|
// 注意此处scriptDtls.getValue() < 1.0,考虑到有些已经投入运行的地方,可能没有改库,避免不必要的异常
|
||||||
|
if(scriptDtls.getValueType().equalsIgnoreCase("CUR") && scriptDtls.getValue() < 1.0){
|
||||||
|
scriptDtls.setValue(devCurr * scriptDtls.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (param.getIsPhaseSequence().equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
} else if (param.getIsPhaseSequence().equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
||||||
//系数
|
//系数
|
||||||
queryWrapper.in(PqScriptDtls::getScriptIndex, param.getIndexList())
|
queryWrapper.in(PqScriptDtls::getScriptIndex, param.getIndexList())
|
||||||
@@ -1037,10 +1056,10 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
dipDataDTO.setFTransValue(0.0);
|
dipDataDTO.setFTransValue(0.0);
|
||||||
dipDataDTO.setFRetainTime(0.0);
|
dipDataDTO.setFRetainTime(0.0);
|
||||||
|
|
||||||
dipDataDTO.setFPreTime(fPreTime);
|
// dipDataDTO.setFPreTime(fPreTime);
|
||||||
dipDataDTO.setFRampIn(fRampIn);
|
dipDataDTO.setFRampIn(fRampIn);
|
||||||
dipDataDTO.setFRampOut(fRampOut);
|
dipDataDTO.setFRampOut(fRampOut);
|
||||||
dipDataDTO.setFAfterTime(fAfterTime);
|
// dipDataDTO.setFAfterTime(fAfterTime);
|
||||||
|
|
||||||
|
|
||||||
channelListDTO.setDipData(dipDataDTO);
|
channelListDTO.setDipData(dipDataDTO);
|
||||||
@@ -1087,6 +1106,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
if (CollUtil.isNotEmpty(dipList)) {
|
if (CollUtil.isNotEmpty(dipList)) {
|
||||||
PqScriptDtls dip = dipList.get(0);
|
PqScriptDtls dip = dipList.get(0);
|
||||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||||
|
dipDataDTO.setFPreTime(dip.getFPreTime());
|
||||||
|
dipDataDTO.setFAfterTime(dip.getFAfterTime());
|
||||||
if (devFly) {
|
if (devFly) {
|
||||||
// if (isValueType) {
|
// if (isValueType) {
|
||||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||||
|
|||||||
@@ -112,15 +112,15 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> listAllPqScript(String patternId) {
|
public List<PqScript> listAllPqScript(String patternId) {
|
||||||
List<PqScript> pqScriptList = this.lambdaQuery().eq(StrUtil.isNotBlank(patternId), PqScript::getPattern, patternId).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).list();
|
List<PqScript> pqScriptList = this.lambdaQuery().eq(StrUtil.isNotBlank(patternId), PqScript::getPattern, patternId).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
List<Map<String, Object>> result = pqScriptList.stream().map(pqScript -> {
|
// List<Map<String, Object>> result = pqScriptList.stream().map(pqScript -> {
|
||||||
Map<String, Object> map = new HashMap<>();
|
// Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", pqScript.getId());
|
// map.put("id", pqScript.getId());
|
||||||
map.put("name", pqScript.getName());
|
// map.put("name", pqScript.getName());
|
||||||
return map;
|
// return map;
|
||||||
}).collect(Collectors.toList());
|
// }).collect(Collectors.toList());
|
||||||
return result;
|
return pqScriptList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,7 +139,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
|||||||
wrapper.eq("state", DataStateEnum.ENABLE.getCode());
|
wrapper.eq("state", DataStateEnum.ENABLE.getCode());
|
||||||
wrapper.eq("name", param.getName());
|
wrapper.eq("name", param.getName());
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
if(param instanceof PqScriptParam.UpdateParam){
|
if (param instanceof PqScriptParam.UpdateParam) {
|
||||||
wrapper.ne("id", ((PqScriptParam.UpdateParam) param).getId());
|
wrapper.ne("id", ((PqScriptParam.UpdateParam) param).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,17 +127,5 @@ public class PqSourceController extends BaseController {
|
|||||||
List<SourceParam> result = pqSourceService.getSourceParam(sourceId);
|
List<SourceParam> result = pqSourceService.getSourceParam(sourceId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo
|
|
||||||
@GetMapping("/aa")
|
|
||||||
@ApiOperation("按照检测源ID获取源参数")
|
|
||||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
|
||||||
public HttpResult<SourceInitialize> aa(@RequestParam("sourceId") String sourceId) {
|
|
||||||
String methodDescribe = getMethodDescribe("getParam");
|
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceId);
|
|
||||||
SourceInitialize sourceInitializeParam = pqSourceService.getSourceInitializeParam(sourceId);
|
|
||||||
String jsonString = JSON.toJSONString(sourceInitializeParam);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sourceInitializeParam, methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class DevTypeController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("修改设备类型")
|
@ApiOperation("修改设备类型")
|
||||||
@ApiImplicitParam(name = "devTypeParam", value = "设备类型", required = true)
|
@ApiImplicitParam(name = "updateParam", value = "设备类型参数", required = true)
|
||||||
public HttpResult<Boolean> update(@RequestBody @Validated DevTypeParam.UpdateParam updateParam) {
|
public HttpResult<Boolean> update(@RequestBody @Validated DevTypeParam.UpdateParam updateParam) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
|||||||
@Override
|
@Override
|
||||||
public List<DevType> listAll() {
|
public List<DevType> listAll() {
|
||||||
LambdaQueryWrapper<DevType> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DevType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode());
|
queryWrapper.eq(DevType::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.orderByAsc(DevType::getName);
|
||||||
List<DevType> devTypes = this.baseMapper.selectList(queryWrapper);
|
List<DevType> devTypes = this.baseMapper.selectList(queryWrapper);
|
||||||
return devTypes;
|
return devTypes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ 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?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
# url: jdbc:mysql://192.168.1.24:13306/pqs91002?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: njcnpqs
|
# password: njcnpqs
|
||||||
url: jdbc:mysql://localhost:13306/pqs9100member?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
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
|
||||||
#初始化建立物理连接的个数、最小、最大连接数
|
#初始化建立物理连接的个数、最小、最大连接数
|
||||||
@@ -85,6 +85,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:
|
||||||
@@ -118,3 +119,7 @@ power-quality:
|
|||||||
harmonic-times: 50 # 谐波次数
|
harmonic-times: 50 # 谐波次数
|
||||||
ib-add: false # 电流基波叠加标志
|
ib-add: false # 电流基波叠加标志
|
||||||
uharm-add: false # 电压谐波叠加标志
|
uharm-add: false # 电压谐波叠加标志
|
||||||
|
# 激活配置
|
||||||
|
activate:
|
||||||
|
private-key: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCcUyYhVqczGxblL+o/xZzF/8nf+LjrfUE/dS1aRHM7uMDD0cgCArhjtfneFePrMxt+Z7W8yNBzSarub8qsfhaVNikV7Es7oaeTygfjQXTi2n4AFkir3fM07J08RpWhl5M8f8uWTCuvFUYAw00gq55typqmnbkmJa2VIUy/iQf+cMCP7abz4/jNhUzUR3qA7TV4oMRgTdIEDUp63YF8dOC+JH8XxYrCVeHXV6fLCwmesdMzl0lB2VTEKMfLbXhOmF5g7P9y/16VCcN8UBuZlbyYfn+GAxJOSbeHi5HshOKfoSuD7Jz+3WQZpNavOWjIFExKIU38/CvnJCOP7XBCqpSTAgMBAAECggEAYeWokWRE3TpvwiOZnUpR/aVMdVi75a3ROL5XIpqPV61B+t/bU3cEpl0GF9C5pUeiRi0IoStZb3mI9D1KPW/REKyUWkhabQO1gFYbTnRlkNOn6MILzKX4cwJjDaZeeo4EBPU7N+qHyOOXrU6hdH5FfxhMdV983ajm5eeuupxER1C2kAcIklTeVpTX6EKOgZb5LBp5ssOVm2P42pOauvcRozRcvZmqnErXmukv0H4l3EVNt4rHpTn9riHUC63e8JfiYzVaF6zuNUxv6nHEft0/SRMw11XSTnNfDzcKqgjz6ksFBS/6eQQYKESk+ONC53HUuYHFAknkwsPupDCT2W8FIQKBgQDLHT/xCU3nxGr4vFKBDNaO2D5oK20ECbBO4oDvLWWmQG7f+6TsMy8PgVdMnoL4RfqGlwFAKEpS6KVFHnBVqnNEhcdy9uCI7x7Xx8UnyUtxj1EDTm76uta9Ki9OrlqB6tImDM9+Ya3vGktW37ht4WOx2OsJRhG1dbf6RLwFlH7DWwKBgQDFBxvi5I1BR6hg6Tj7xd2SqOT2Y+BED3xuSYENhWbmMhLJDResaB7mjztbxlYaY2mOE0holWm2uDmVFFhMh4jYXik4hYH8nmDzq9mDpZCZ9pyjYqnAP8THoAa8EbgrUWB8A6BPH4iL3KbMnBfBKY0pIr2xrvnjQjNBAgta7KDRKQKBgCe6oe4wxrdF2TKsC2tIqpMoQxS3Icy/ZGgZr+SYuaBKTCWtoDW/UT40K3JGMxIDBhzbXphBCUCsVt9tM8Xd4EwP6tJW7dZ7B0pnve2pVwNwaAVAiz6p2yUHIle+jN+Koe5lZRSwYIg7WW81tWpwwsJfzqFyvjYDP6hJV4mz4ROvAoGAaRcdnKvjXApomShMqJ4lTPChD3q+SA8qg3jZSOj6tZXHx00gb2kp8jg7pPvpOTIFPy6x1Ha9aCRjMk0ju84fA6lVuzwa1S907wOehUVuF3Eeo1cgy9Y3k3KbpPyeixxgpkUY4JslLdSHc2NemD0dee951qhJyRmqVOZOQDUuoeECgYEAqBw2cAFk3vM97WY06TSldGA8ajVHx3BYRjj+zl62NTQthy8fw3tqxb3c5e8toOmZWKjZvDhg2TRLhsDDQWEYg3LZG87REqVIjgEPcpjNLidjygGX8n3JF2o0O5I/EMvl0s/+LVQONfduOBvhwDqr8QNisbLsyneiAq7umewMolo="
|
||||||
|
public-key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnFMmIVanMxsW5S/qP8Wcxf/J3/i4631BP3UtWkRzO7jAw9HIAgK4Y7X53hXj6zMbfme1vMjQc0mq7m/KrH4WlTYpFexLO6Gnk8oH40F04tp+ABZIq93zNOydPEaVoZeTPH/LlkwrrxVGAMNNIKuebcqapp25JiWtlSFMv4kH/nDAj+2m8+P4zYVM1Ed6gO01eKDEYE3SBA1Ket2BfHTgviR/F8WKwlXh11enywsJnrHTM5dJQdlUxCjHy214TpheYOz/cv9elQnDfFAbmZW8mH5/hgMSTkm3h4uR7ITin6Erg+yc/t1kGaTWrzloyBRMSiFN/Pwr5yQjj+1wQqqUkwIDAQAB"
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
<!-- 直接使用固定配置,避免Spring配置解析时机问题 -->
|
||||||
<property name="log.projectName" value="entrance"/>
|
<property name="log.projectName" value="entrance"/>
|
||||||
<property name="logCommonLevel" value="info"/>
|
<property name="logCommonLevel" value="info"/>
|
||||||
<property name="logHomeDir" value="D:\logs"/>
|
<property name="logHomeDir" value="${logHomeDir:-D:\logs}"/>
|
||||||
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
BIN
entrance/src/main/resources/model/report_table - PQ-COM.docx
Normal file
Binary file not shown.
@@ -25,10 +25,10 @@ public class AnalysisServiceStreamTest {
|
|||||||
private ICompareWaveService compareWaveServiceImpl;
|
private ICompareWaveService compareWaveServiceImpl;
|
||||||
|
|
||||||
// 测试文件路径 - 请根据实际情况修改
|
// 测试文件路径 - 请根据实际情况修改
|
||||||
private static final String SOURCE_CFG_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.239\\PQ_PQLD1_000574_20250910_135244_231.cfg";
|
private static final String SOURCE_CFG_PATH = "C:\\Users\\Administrator\\Desktop\\wave\\192.168.1.241\\PQ_PQLD2_000177_20251028_112422_833.cfg";
|
||||||
private static final String SOURCE_DAT_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.239\\PQ_PQLD1_000574_20250910_135244_231.dat";
|
private static final String SOURCE_DAT_PATH = "C:\\Users\\Administrator\\Desktop\\wave\\192.168.1.241\\PQ_PQLD2_000177_20251028_112422_833.dat";
|
||||||
private static final String TARGET_CFG_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.238\\PQ_PQLD2_000508_20250910_135244_197.cfg";
|
private static final String TARGET_CFG_PATH = "C:\\Users\\Administrator\\Desktop\\wave\\192.168.1.242\\PQ_PQLD2_000238_20251028_112422_518.cfg";
|
||||||
private static final String TARGET_DAT_PATH = "C:\\Users\\hongawen\\Desktop\\Event\\192.168.1.238\\PQ_PQLD2_000508_20250910_135244_197.dat";
|
private static final String TARGET_DAT_PATH = "C:\\Users\\Administrator\\Desktop\\wave\\192.168.1.242\\PQ_PQLD2_000238_20251028_112422_518.dat";
|
||||||
|
|
||||||
|
|
||||||
// private static final String SOURCE_CFG_PATH = "F:\\hatch\\wavecompare\\数据比对\\统计数据1\\B码\\217\\PQMonitor_PQM1_000006_20200430_115517_889.cfg";
|
// private static final String SOURCE_CFG_PATH = "F:\\hatch\\wavecompare\\数据比对\\统计数据1\\B码\\217\\PQMonitor_PQM1_000006_20200430_115517_889.cfg";
|
||||||
@@ -105,6 +105,54 @@ public class AnalysisServiceStreamTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试段信息保留模式的波形分析(新方法)
|
||||||
|
* <p>不进行跨段的统一降采样,保留每个段的原始采样率(超过512才降到256)</p>
|
||||||
|
* <p>跨段的窗口会被丢弃,只计算不跨段的窗口</p>
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAnalyzeWithSegmentPreservation() throws Exception {
|
||||||
|
System.out.println("========================================");
|
||||||
|
System.out.println("开始执行电能质量分析(段信息保留模式)...");
|
||||||
|
System.out.println("========================================");
|
||||||
|
|
||||||
|
// 检查文件是否存在
|
||||||
|
checkFileExists(SOURCE_CFG_PATH, "源CFG文件");
|
||||||
|
checkFileExists(SOURCE_DAT_PATH, "源DAT文件");
|
||||||
|
checkFileExists(TARGET_CFG_PATH, "目标CFG文件");
|
||||||
|
checkFileExists(TARGET_DAT_PATH, "目标DAT文件");
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
try (InputStream sourceCfgStream = new FileInputStream(SOURCE_CFG_PATH);
|
||||||
|
InputStream sourceDatStream = new FileInputStream(SOURCE_DAT_PATH);
|
||||||
|
InputStream targetCfgStream = new FileInputStream(TARGET_CFG_PATH);
|
||||||
|
InputStream targetDatStream = new FileInputStream(TARGET_DAT_PATH)) {
|
||||||
|
|
||||||
|
CompareWaveDTO result = compareWaveServiceImpl.analyzeWithSegmentPreservation(
|
||||||
|
sourceCfgStream,
|
||||||
|
sourceDatStream,
|
||||||
|
targetCfgStream,
|
||||||
|
targetDatStream,
|
||||||
|
0 // 接线方式: 0=星型接线, 1=V型接线
|
||||||
|
);
|
||||||
|
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
long duration = endTime - startTime;
|
||||||
|
|
||||||
|
// 输出分析结果
|
||||||
|
System.out.println("========================================");
|
||||||
|
System.out.println("分析完成!");
|
||||||
|
System.out.println("总耗时: " + duration + " ms (" + String.format("%.2f", duration / 1000.0) + " 秒)");
|
||||||
|
System.out.println("源文件有效窗口数: " + (result.getSourceResults() != null ? result.getSourceResults().size() : 0));
|
||||||
|
System.out.println("目标文件有效窗口数: " + (result.getTargetResults() != null ? result.getTargetResults().size() : 0));
|
||||||
|
System.out.println("========================================");
|
||||||
|
System.out.println("段信息保留模式测试完成!");
|
||||||
|
System.out.println("========================================");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查文件是否存在
|
* 检查文件是否存在
|
||||||
*/
|
*/
|
||||||
|
|||||||
33
event_smart/.gitignore
vendored
33
event_smart/.gitignore
vendored
@@ -1,33 +0,0 @@
|
|||||||
HELP.md
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
!**/src/main/**/target/
|
|
||||||
!**/src/test/**/target/
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
build/
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.njcn.gather</groupId>
|
|
||||||
<artifactId>CN_Gather</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>event_smart</artifactId>
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>njcn-common</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-redis</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>rocket-mq-springboot-starter</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
|
||||||
<version>2.7.12</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
|
||||||
<version>3.5.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>spingboot2.3.12</artifactId>
|
|
||||||
<version>2.3.12</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>mybatis-plus</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--oracle驱动-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.oracle.database.jdbc</groupId>
|
|
||||||
<artifactId>ojdbc8</artifactId>
|
|
||||||
<version>21.6.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.oracle.database.nls</groupId>
|
|
||||||
<artifactId>orai18n</artifactId>
|
|
||||||
<version>21.1.0.0</version> <!-- 版本号需要与你的ojdbc版本匹配 -->
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Spring Security -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- JWT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt-api</artifactId>
|
|
||||||
<version>0.11.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt-impl</artifactId>
|
|
||||||
<version>0.11.5</version>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
|
||||||
<version>0.11.5</version>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-event</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>common-microservice</artifactId>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>common-web</artifactId>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>32.1.3-jre</version> <!-- 使用最新稳定版 -->
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>event_smart</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<includes>
|
|
||||||
<include>**/*</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/java</directory>
|
|
||||||
<includes>
|
|
||||||
<include>**/*.xml</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.njcn.gather.event;
|
|
||||||
|
|
||||||
import com.njcn.event.file.component.WavePicComponent;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.FilterType;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
|
||||||
//@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = WavePicComponent.class))
|
|
||||||
@MapperScan("com.njcn.**.mapper")
|
|
||||||
public class EventSmartApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(EventSmartApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.config;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
|
||||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
|
||||||
import com.njcn.gather.event.transientes.service.PqsDeptsService;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/07/28 上午 9:32【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class PqlineCache {
|
|
||||||
@Autowired
|
|
||||||
private PqLineMapper pqLineMapper;
|
|
||||||
@Autowired
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
@Autowired
|
|
||||||
private PqsDeptslineService pqsDeptslineService;
|
|
||||||
@Autowired
|
|
||||||
|
|
||||||
private PqsDeptsService pqsDeptsService;
|
|
||||||
private final static String NAME_KEY = "LineCache:";
|
|
||||||
@Value("${SYS_TYPE_ZT}")
|
|
||||||
private String sysTypeZt;
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
log.info("系统启动中。。。加载pqline");
|
|
||||||
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
|
||||||
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
|
||||||
for (PqsDepts pqsDepts : list) {
|
|
||||||
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
|
|
||||||
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
|
||||||
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<Integer> result = new ArrayList<>();
|
|
||||||
if(CollUtil.isNotEmpty(deptslineIds)){
|
|
||||||
if(deptslineIds.size()> 1000 ){
|
|
||||||
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
|
|
||||||
for(List<Integer> li : listList){
|
|
||||||
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
|
|
||||||
result.addAll(temList);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
result= pqLineMapper.getRunMonitorIds(deptslineIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
public void destroy() {
|
|
||||||
log.info("系统运行结束");
|
|
||||||
redisUtil.deleteKeysByString(NAME_KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.job;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.njcn.gather.event.devcie.mapper.PqDeviceMapper;
|
|
||||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
|
||||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
|
||||||
import com.njcn.gather.event.transientes.service.PqsDeptsService;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/08/05 上午 10:17【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@EnableScheduling
|
|
||||||
public class LineCacheJob {
|
|
||||||
@Autowired
|
|
||||||
private PqLineMapper pqLineMapper;
|
|
||||||
@Autowired
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
@Autowired
|
|
||||||
private PqsDeptslineService pqsDeptslineService;
|
|
||||||
@Autowired
|
|
||||||
private PqsDeptsService pqsDeptsService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PqDeviceMapper pqDeviceMapper;
|
|
||||||
|
|
||||||
private final static String NAME_KEY = "LineCache:";
|
|
||||||
@Value("${SYS_TYPE_ZT}")
|
|
||||||
private String sysTypeZt;
|
|
||||||
@Scheduled(cron="0 0 1 * * ?" ) // 每3钟执行一次
|
|
||||||
public void lineCache(){
|
|
||||||
redisUtil.deleteKeysByString(NAME_KEY);
|
|
||||||
|
|
||||||
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
|
||||||
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
|
||||||
for (PqsDepts pqsDepts : list) {
|
|
||||||
List<String> deptAndChildren = pqsDeptsService.findDeptAndChildren(pqsDepts.getDeptsIndex());
|
|
||||||
List<PqsDeptsline> deptslines = pqsDeptslineService.lambdaQuery().in(PqsDeptsline::getDeptsIndex, deptAndChildren).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
|
||||||
List<Integer> deptslineIds = deptslines.stream().map(PqsDeptsline::getLineIndex).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<Integer> result = new ArrayList<>();
|
|
||||||
if(CollUtil.isNotEmpty(deptslineIds)){
|
|
||||||
if(deptslineIds.size()> 1000 ){
|
|
||||||
List<List<Integer>> listList = CollUtil.split(deptslineIds,1000);
|
|
||||||
for(List<Integer> li : listList){
|
|
||||||
List<Integer> temList = pqLineMapper.getRunMonitorIds(li);
|
|
||||||
result.addAll(temList);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
result= pqLineMapper.getRunMonitorIds(deptslineIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+pqsDepts.getDeptsIndex(),result);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDeviceDetail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CN_Gather
|
|
||||||
*
|
|
||||||
* @author cdf
|
|
||||||
* @date 2025/8/12
|
|
||||||
*/
|
|
||||||
public interface PqDeviceDetailMapper extends BaseMapper<PqDeviceDetail> {
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:47【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface PqDeviceMapper extends BaseMapper<PqDevice> {
|
|
||||||
List<DeviceDTO> queryListByIds(@Param("ids") List<Integer> ids);
|
|
||||||
|
|
||||||
Page<DeviceDTO> selectDeviceDTOPage(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("devIndexs") List<Integer> devIndexs);
|
|
||||||
|
|
||||||
Page<DeviceDTO> queryListByLineIds(Page<DeviceDTO> pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("lineIds") List<Integer> lineIds);
|
|
||||||
|
|
||||||
|
|
||||||
List<DeviceDeptDTO> selectDeviceDept();
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqGdCompany;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:48【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface PqGdCompanyMapper extends BaseMapper<PqGdCompany> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface PqLineMapper extends BaseMapper<PqLine> {
|
|
||||||
|
|
||||||
List<LedgerBaseInfoDTO> getBaseLineInfo(@Param("ids")List<Integer> ids);
|
|
||||||
|
|
||||||
|
|
||||||
List<LedgerBaseInfoDTO> getBaseLedger(@Param("ids")List<Integer> ids,@Param("searchValue")String searchValue);
|
|
||||||
|
|
||||||
|
|
||||||
List<Integer> getRunMonitorIds(@Param("ids")List<Integer> ids);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PqLinedetailMapper extends BaseMapper<PqLinedetail> {
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqSubstation;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:48【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface PqSubstationMapper extends BaseMapper<PqSubstation> {
|
|
||||||
List<SubstationDTO> queryListByIds(@Param("ids")List<Integer> ids);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
|
||||||
import com.njcn.gather.event.devcie.pojo.po.PqsStationMap;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface PqsStationMapMapper extends BaseMapper<PqsStationMap> {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqDeviceMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqDevice">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
<!--@Table PQ_DEVICE-->
|
|
||||||
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
|
|
||||||
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
|
|
||||||
<result column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
|
|
||||||
<result column="NAME" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="STATUS" jdbcType="DECIMAL" property="status" />
|
|
||||||
<result column="DEVTYPE" jdbcType="VARCHAR" property="devtype" />
|
|
||||||
<result column="LOGONTIME" jdbcType="TIMESTAMP" property="logontime" />
|
|
||||||
<result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
|
|
||||||
<result column="NODE_INDEX" jdbcType="DECIMAL" property="nodeIndex" />
|
|
||||||
<result column="PORTID" jdbcType="DECIMAL" property="portid" />
|
|
||||||
<result column="DEVFLAG" jdbcType="DECIMAL" property="devflag" />
|
|
||||||
<result column="DEV_SERIES" jdbcType="VARCHAR" property="devSeries" />
|
|
||||||
<result column="DEV_KEY" jdbcType="VARCHAR" property="devKey" />
|
|
||||||
<result column="IP" jdbcType="VARCHAR" property="ip" />
|
|
||||||
<result column="DEVMODEL" jdbcType="DECIMAL" property="devmodel" />
|
|
||||||
<result column="CALLFLAG" jdbcType="DECIMAL" property="callflag" />
|
|
||||||
<result column="DATATYPE" jdbcType="DECIMAL" property="datatype" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
DEV_INDEX, GD_INDEX, SUB_INDEX, "NAME", "STATUS", DEVTYPE, LOGONTIME, UPDATETIME,
|
|
||||||
NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="queryListByIds" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
|
|
||||||
select
|
|
||||||
pq_device.dev_index devId,
|
|
||||||
pq_device.name devName,
|
|
||||||
pq_device.UpdateTime updateTime,
|
|
||||||
pq_device.DevFlag devFlag,
|
|
||||||
pq_device.IP ip,
|
|
||||||
pq_device.status status,
|
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
|
||||||
PQ_SUBSTATION.name stationName,
|
|
||||||
PQ_GDINFORMATION.Name gdName
|
|
||||||
from
|
|
||||||
pq_device,
|
|
||||||
PQ_SUBSTATION,
|
|
||||||
PQ_GDINFORMATION
|
|
||||||
where
|
|
||||||
pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
|
||||||
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
|
||||||
and pq_device.DEV_INDEX in
|
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
|
|
||||||
|
|
||||||
SELECT DISTINCT
|
|
||||||
pq_device.dev_index devId,
|
|
||||||
pq_device.name devName,
|
|
||||||
pq_device.UpdateTime updateTime,
|
|
||||||
pq_device.DevFlag devFlag,
|
|
||||||
pq_device.IP ip,
|
|
||||||
pq_device.status status,
|
|
||||||
PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,
|
|
||||||
PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,
|
|
||||||
pq_device.LogonTime logonTime,
|
|
||||||
PQ_DEVICEDETAIL.MANUFACTURER
|
|
||||||
FROM
|
|
||||||
pq_device
|
|
||||||
inner JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index
|
|
||||||
<where>
|
|
||||||
pq_device.DEV_INDEX in
|
|
||||||
<foreach collection="devIndexs" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
order by pq_device.updatetime
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- <select id="selectDeviceDTOPage" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">-->
|
|
||||||
<!-- WITH temp AS(-->
|
|
||||||
<!-- SELECT DISTINCT-->
|
|
||||||
<!-- PQ_LINE.DEV_INDEX,-->
|
|
||||||
<!-- PQS_DEPTS.DEPTSNAME-->
|
|
||||||
<!-- FROM-->
|
|
||||||
<!-- PQ_LINE,-->
|
|
||||||
<!-- PQS_DEPTSLINE,-->
|
|
||||||
<!-- PQS_DEPTS-->
|
|
||||||
<!-- WHERE-->
|
|
||||||
<!-- PQ_LINE.LINE_INDEX = PQS_DEPTSLINE.LINE_INDEX-->
|
|
||||||
<!-- AND PQS_DEPTS.DEPTS_INDEX = PQS_DEPTSLINE.DEPTS_INDEX-->
|
|
||||||
<!-- )-->
|
|
||||||
<!-- SELECT DISTINCT-->
|
|
||||||
<!-- pq_device.dev_index devId,-->
|
|
||||||
<!-- pq_device.name devName,-->
|
|
||||||
<!-- pq_device.UpdateTime updateTime,-->
|
|
||||||
<!-- pq_device.DevFlag devFlag,-->
|
|
||||||
<!-- pq_device.IP ip,-->
|
|
||||||
<!-- pq_device.status status,-->
|
|
||||||
<!-- PQ_SUBSTATION.sub_index stationId,-->
|
|
||||||
<!-- PQ_SUBSTATION.name stationName,-->
|
|
||||||
<!-- PQ_GDINFORMATION.Name gdName,-->
|
|
||||||
<!-- PQS_DICDATA.DIC_Name MANUFACTURER_Name,-->
|
|
||||||
<!-- PQ_DEVICEDETAIL.ThisTimeCheck thisTimeCheck,-->
|
|
||||||
<!-- PQ_DEVICEDETAIL.NextTimeCheck nextTimeCheck,-->
|
|
||||||
<!-- pq_device.LogonTime logonTime,-->
|
|
||||||
<!-- temp.DEPTSNAME deptName-->
|
|
||||||
<!-- FROM-->
|
|
||||||
<!-- pq_device-->
|
|
||||||
<!-- LEFT JOIN PQ_SUBSTATION ON pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX-->
|
|
||||||
<!-- LEFT JOIN PQ_GDINFORMATION ON pq_device.GD_INDEX = PQ_GDINFORMATION.GD_INDEX-->
|
|
||||||
<!-- LEFT JOIN PQ_DEVICEDETAIL ON PQ_DEVICEDETAIL.dev_index = pq_device.dev_index-->
|
|
||||||
<!-- LEFT JOIN PQS_DICDATA on PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX-->
|
|
||||||
<!-- LEFT JOIN temp on temp.DEV_INDEX = pq_device.dev_index-->
|
|
||||||
<!-- where 1=1-->
|
|
||||||
<!-- <if test="searchValue!= null and searchValue!= ''">-->
|
|
||||||
<!-- AND (-->
|
|
||||||
<!-- pq_device.name LIKE '%' || #{searchValue} || '%'-->
|
|
||||||
<!-- OR PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'-->
|
|
||||||
<!-- OR PQ_GDINFORMATION.Name LIKE '%' || #{searchValue} || '%'-->
|
|
||||||
<!-- )-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="state!= null and state!= ''">-->
|
|
||||||
<!-- and pq_device.status = #{state}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- and pq_device.DEV_INDEX in-->
|
|
||||||
<!-- <foreach collection="devIndexs" item="item" open="(" close=")" separator=",">-->
|
|
||||||
<!-- #{item}-->
|
|
||||||
<!-- </foreach>-->
|
|
||||||
<!-- order by pq_device.updatetime-->
|
|
||||||
<!-- </select>-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="queryListByLineIds" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDTO">
|
|
||||||
select distinct
|
|
||||||
pq_device.dev_index devId,
|
|
||||||
pq_device.name devName,
|
|
||||||
pq_device.UpdateTime updateTime,
|
|
||||||
pq_device.DevFlag devFlag,
|
|
||||||
pq_device.IP ip,
|
|
||||||
pq_device.status status,
|
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
|
||||||
PQ_SUBSTATION.name stationName,
|
|
||||||
PQ_GDINFORMATION.Name gdName,
|
|
||||||
PQS_DICDATA.DIC_Name MANUFACTURER_Name
|
|
||||||
from
|
|
||||||
pq_line,
|
|
||||||
pq_device,
|
|
||||||
PQ_DEVICEDETAIL,
|
|
||||||
PQ_SUBSTATION,
|
|
||||||
PQ_GDINFORMATION,
|
|
||||||
PQS_DICDATA
|
|
||||||
where
|
|
||||||
pq_line.DEV_INDEX = pq_device.DEV_INDEX
|
|
||||||
and PQ_DEVICEDETAIL.dev_index =pq_device.dev_index
|
|
||||||
and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
|
||||||
and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
|
||||||
and PQ_DEVICEDETAIL.MANUFACTURER = PQS_DICDATA.DIC_INDEX
|
|
||||||
and pq_line.LINE_INDEX in
|
|
||||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDeviceDept" resultType="com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO">
|
|
||||||
|
|
||||||
SELECT DISTINCT
|
|
||||||
PQ_LINE.DEV_INDEX devId,
|
|
||||||
PQS_DEPTS.DEPTSNAME deptName,
|
|
||||||
PQS_DEPTS.DEPTS_INDEX deptId
|
|
||||||
FROM
|
|
||||||
PQ_LINE,
|
|
||||||
PQS_DEPTSLINE,
|
|
||||||
PQS_DEPTS
|
|
||||||
WHERE
|
|
||||||
PQ_LINE.LINE_INDEX = PQS_DEPTSLINE.LINE_INDEX
|
|
||||||
AND PQS_DEPTS.DEPTS_INDEX = PQS_DEPTSLINE.DEPTS_INDEX
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqLineMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqLine">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
<!--@Table PQ_LINE-->
|
|
||||||
<id column="LINE_INDEX" jdbcType="DECIMAL" property="lineIndex" />
|
|
||||||
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
|
|
||||||
<result column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
|
|
||||||
<result column="SUBV_INDEX" jdbcType="DECIMAL" property="subvIndex" />
|
|
||||||
<result column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
|
|
||||||
<result column="NAME" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="PT1" jdbcType="FLOAT" property="pt1" />
|
|
||||||
<result column="PT2" jdbcType="FLOAT" property="pt2" />
|
|
||||||
<result column="CT1" jdbcType="FLOAT" property="ct1" />
|
|
||||||
<result column="CT2" jdbcType="FLOAT" property="ct2" />
|
|
||||||
<result column="DEVCMP" jdbcType="FLOAT" property="devcmp" />
|
|
||||||
<result column="DLCMP" jdbcType="FLOAT" property="dlcmp" />
|
|
||||||
<result column="JZCMP" jdbcType="FLOAT" property="jzcmp" />
|
|
||||||
<result column="XYCMP" jdbcType="FLOAT" property="xycmp" />
|
|
||||||
<result column="SUBV_NO" jdbcType="DECIMAL" property="subvNo" />
|
|
||||||
<result column="SCALE" jdbcType="VARCHAR" property="scale" />
|
|
||||||
<result column="SUBV_NAME" jdbcType="VARCHAR" property="subvName" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
LINE_INDEX, GD_INDEX, SUB_INDEX, SUBV_INDEX, DEV_INDEX, "NAME", PT1, PT2, CT1, CT2,
|
|
||||||
DEVCMP, DLCMP, JZCMP, XYCMP, SUBV_NO, "SCALE", SUBV_NAME
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getBaseLineInfo" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
|
||||||
|
|
||||||
WITH temp AS(
|
|
||||||
select PQ_USER_LINE_ASS.LINE_INDEX LINE_INDEX,listagg(PQ_USER_LEDGER.CUSTOMER_NAME,';') within GROUP (order by PQ_USER_LEDGER.CUSTOMER_NAME) objName from PQ_USER_LINE_ASS ,PQ_USER_LEDGER where PQ_USER_LINE_ASS.USER_INDEX=PQ_USER_LEDGER.ID group by PQ_USER_LINE_ASS.LINE_INDEX
|
|
||||||
)
|
|
||||||
select
|
|
||||||
PQ_GDINFORMATION.name gdName,
|
|
||||||
pq_line.GD_INDEX gdIndex,
|
|
||||||
pq_line.line_index lineId,
|
|
||||||
pq_line.name lineName,
|
|
||||||
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
|
|
||||||
PQ_SUBVOLTAGE.name busBarName,
|
|
||||||
pq_device.dev_index devId,
|
|
||||||
pq_device.name devName,
|
|
||||||
pq_device.Status runFlag,
|
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
|
||||||
PQ_SUBSTATION.name stationName,
|
|
||||||
temp.objName objName
|
|
||||||
from
|
|
||||||
pq_line LEFT JOIN PQ_SUBVOLTAGE on pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
|
||||||
LEFT JOIN
|
|
||||||
pq_device on PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
|
||||||
LEFT JOIN PQ_SUBSTATION on pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
|
||||||
LEFT JOIN PQ_GDINFORMATION on pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
|
||||||
LEFT JOIN temp on temp.LINE_INDEX = pq_line.LINE_INDEX
|
|
||||||
where 1=1
|
|
||||||
and pq_line.line_index in
|
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getBaseLedger" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
|
||||||
select
|
|
||||||
PQ_GDINFORMATION.name gdName,
|
|
||||||
pq_line.GD_INDEX gdIndex,
|
|
||||||
pq_line.line_index lineId,
|
|
||||||
pq_line.name lineName,
|
|
||||||
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
|
|
||||||
PQ_SUBVOLTAGE.name busBarName,
|
|
||||||
pq_device.dev_index devId,
|
|
||||||
pq_device.name devName,
|
|
||||||
pq_device.Status runFlag,
|
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
|
||||||
PQ_SUBSTATION.name stationName
|
|
||||||
from
|
|
||||||
pq_line inner JOIN PQ_SUBVOLTAGE on pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
|
||||||
inner JOIN pq_device on PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
|
||||||
inner JOIN PQ_SUBSTATION on pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
|
||||||
inner JOIN PQ_GDINFORMATION on pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
|
||||||
<where>
|
|
||||||
and pq_line.line_index in
|
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
<if test="searchValue!=null and searchValue!=''">
|
|
||||||
and (
|
|
||||||
PQ_GDINFORMATION.name LIKE '%' || #{searchValue} || '%'
|
|
||||||
or PQ_SUBSTATION.name LIKE '%' || #{searchValue} || '%'
|
|
||||||
or pq_line.name LIKE '%' || #{searchValue} || '%'
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getRunMonitorIds" resultType="integer">
|
|
||||||
select DISTINCT pq_line.line_index from pq_line inner join pq_device on pq_line.DEV_INDEX = pq_device.DEV_INDEX
|
|
||||||
where pq_line.line_index in
|
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
and pq_device.DEVFLAG = 0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.njcn.gather.event.devcie.mapper.PqSubstationMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.gather.event.devcie.pojo.po.PqSubstation">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
<!--@Table PQ_SUBSTATION-->
|
|
||||||
<id column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
|
|
||||||
<result column="GD_INDEX" jdbcType="DECIMAL" property="gdIndex" />
|
|
||||||
<result column="NAME" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="SCALE" jdbcType="VARCHAR" property="scale" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
SUB_INDEX, GD_INDEX, "NAME", "SCALE"
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="queryListByIds" resultType="com.njcn.gather.event.devcie.pojo.dto.SubstationDTO">
|
|
||||||
select
|
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
|
||||||
PQ_SUBSTATION.name stationName,
|
|
||||||
PQ_GDINFORMATION.Name gdName,
|
|
||||||
PQS_MAP.LATITUDE LATITUDE,
|
|
||||||
PQS_MAP.LONGITUDE LONGITUDE
|
|
||||||
from
|
|
||||||
PQ_SUBSTATION left join
|
|
||||||
PQS_MAP on PQ_SUBSTATION.SUB_INDEX =PQS_MAP.SUB_INDEX
|
|
||||||
left join
|
|
||||||
PQ_GDINFORMATION on PQ_SUBSTATION.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
|
||||||
|
|
||||||
where
|
|
||||||
PQS_MAP.state=1
|
|
||||||
and PQ_SUBSTATION.SUB_INDEX in
|
|
||||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/27 下午 3:25【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class DeviceDTO {
|
|
||||||
private Integer devId;
|
|
||||||
private String devName;
|
|
||||||
private Integer stationId;
|
|
||||||
private String stationName;
|
|
||||||
private String gdName;
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
private String devFlag;
|
|
||||||
private String ip;
|
|
||||||
private String manufacturerName;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate thisTimeCheck;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate nextTimeCheck;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime logonTime;
|
|
||||||
|
|
||||||
private String deptName;
|
|
||||||
//通讯状态
|
|
||||||
private Integer runFlag=0;
|
|
||||||
//装置通讯状态(0:中断;1:正常)
|
|
||||||
private Integer status;
|
|
||||||
private double onLineRate=0.00;
|
|
||||||
private double integrityRate = 0.00;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/27 下午 3:25【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class DeviceDeptDTO {
|
|
||||||
private Integer devId;
|
|
||||||
private String deptId;
|
|
||||||
private String deptName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: cdf
|
|
||||||
* @CreateTime: 2025-06-25
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class LedgerBaseInfoDTO {
|
|
||||||
private String gdName;
|
|
||||||
private String gdIndex;
|
|
||||||
|
|
||||||
private Integer lineId;
|
|
||||||
|
|
||||||
private String lineName;
|
|
||||||
|
|
||||||
private Integer busBarId;
|
|
||||||
|
|
||||||
private String busBarName;
|
|
||||||
|
|
||||||
private Integer devId;
|
|
||||||
|
|
||||||
private String devName;
|
|
||||||
|
|
||||||
private String objName;
|
|
||||||
|
|
||||||
private Integer stationId;
|
|
||||||
|
|
||||||
private String stationName;
|
|
||||||
//通讯状态
|
|
||||||
private Integer runFlag=0;
|
|
||||||
|
|
||||||
private Integer eventCount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.dto;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/07/29 下午 3:15【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PqsDeptDTO {
|
|
||||||
/**
|
|
||||||
* 部门表Guid
|
|
||||||
*/
|
|
||||||
private String deptsIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门名称
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String deptsname;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
|
|
||||||
private Integer deptsDesc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (关联表PQS_User)用户表Guid
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String userIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
|
|
||||||
private LocalDateTime updatetime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门描述
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String deptsDescription;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色状态0:删除;1:正常;
|
|
||||||
*/
|
|
||||||
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 行政区域
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String area;
|
|
||||||
|
|
||||||
private String areaName;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer customDept;
|
|
||||||
|
|
||||||
|
|
||||||
private String parentnodeid;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/27 下午 3:37【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SubstationDTO {
|
|
||||||
|
|
||||||
private Integer stationId;
|
|
||||||
private String stationName;
|
|
||||||
private String gdName;
|
|
||||||
private double longitude;
|
|
||||||
private double latitude;
|
|
||||||
private Integer runFlag=0;;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:47【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@TableName(value = "PQ_DEVICE")
|
|
||||||
public class PqDevice {
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableId(value = "DEV_INDEX", type = IdType.INPUT)
|
|
||||||
private Integer devIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "GD_INDEX")
|
|
||||||
private Integer gdIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "SUB_INDEX")
|
|
||||||
private Integer subIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "\"NAME\"")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠靠(0:靠;1:靠)
|
|
||||||
*/
|
|
||||||
@TableField(value = "\"STATUS\"")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (靠縋QS_Dicdata)靠靠Guid
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEVTYPE")
|
|
||||||
private String devtype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "LOGONTIME")
|
|
||||||
private LocalDateTime logontime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "UPDATETIME")
|
|
||||||
private LocalDateTime updatetime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠縉odeInformation)靠靠靠,靠靠靠靠靠靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "NODE_INDEX")
|
|
||||||
private Integer nodeIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠ID,靠靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "PORTID")
|
|
||||||
private Long portid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠(0:靠;1:靠;2:靠)
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEVFLAG")
|
|
||||||
private Integer devflag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠?靠3ds靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEV_SERIES")
|
|
||||||
private String devSeries;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠,靠3ds靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEV_KEY")
|
|
||||||
private String devKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IP靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "IP")
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠(0:靠靠;1:靠靠)
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEVMODEL")
|
|
||||||
private Integer devmodel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "CALLFLAG")
|
|
||||||
private Integer callflag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠(0:靠靠;1:靠靠;2:靠靠)
|
|
||||||
*/
|
|
||||||
@TableField(value = "DATATYPE")
|
|
||||||
private Integer datatype;
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CN_Gather
|
|
||||||
*
|
|
||||||
* @author cdf
|
|
||||||
* @date 2025/8/12
|
|
||||||
*/
|
|
||||||
@TableName(value = "PQ_DEVICEDETAIL")
|
|
||||||
@Data
|
|
||||||
public class PqDeviceDetail {
|
|
||||||
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
@TableField(value = "DEV_INDEX")
|
|
||||||
private Long devIndex;
|
|
||||||
|
|
||||||
@TableField(value = "Manufacturer")
|
|
||||||
private String manufacturer;
|
|
||||||
|
|
||||||
@TableField(value = "CheckFlag")
|
|
||||||
private Long checkFlag;
|
|
||||||
|
|
||||||
@TableField(value="ThisTimeCheck")
|
|
||||||
private LocalDate ThisTimeCheck;
|
|
||||||
|
|
||||||
@TableField(value="NextTimeCheck")
|
|
||||||
private LocalDate NextTimeCheck;
|
|
||||||
|
|
||||||
@TableField(value="DATAPLAN")
|
|
||||||
private Long dataplan;
|
|
||||||
|
|
||||||
@TableField(value="NEWTRAFFIC")
|
|
||||||
private Long newtraffic;
|
|
||||||
|
|
||||||
|
|
||||||
@TableField(value = "electroplate")
|
|
||||||
private Integer electroplate = 0;
|
|
||||||
|
|
||||||
@TableField(value = "ONTIME")
|
|
||||||
private Integer ontime;
|
|
||||||
@TableField(value = "contract")
|
|
||||||
private String contract;
|
|
||||||
|
|
||||||
@TableField(value = "DEV_CATENA")
|
|
||||||
private String devCatnea;
|
|
||||||
|
|
||||||
@TableField(value = "SIM")
|
|
||||||
private String sim;
|
|
||||||
|
|
||||||
@TableField(value = "DEV_NO")
|
|
||||||
private String devNo;
|
|
||||||
|
|
||||||
@TableField(value = "DEV_LOCATION")
|
|
||||||
private String devLocation;
|
|
||||||
|
|
||||||
@TableField(value = "IS_ALARM")
|
|
||||||
private Integer isAlarm;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CN_Gather
|
|
||||||
*
|
|
||||||
* @author cdf
|
|
||||||
* @date 2025/8/9
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName(value = "PQ_GDINFORMATION")
|
|
||||||
public class PqGdCompany {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
@TableField(value="GD_INDEX")
|
|
||||||
private Long gdIndex;
|
|
||||||
|
|
||||||
@TableField(value="NAME")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@TableField(value="PROVINCE_INDEX")
|
|
||||||
private Long provinceIndex;
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.data.annotation.Transient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@TableName(value = "PQ_LINE")
|
|
||||||
public class PqLine {
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableId(value = "LINE_INDEX", type = IdType.INPUT)
|
|
||||||
private Integer lineIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "GD_INDEX")
|
|
||||||
private Integer gdIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "SUB_INDEX")
|
|
||||||
private Integer subIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "SUBV_INDEX")
|
|
||||||
private Integer subvIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEV_INDEX")
|
|
||||||
private Integer devIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "\"NAME\"")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PT靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "PT1")
|
|
||||||
private Double pt1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PT靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "PT2")
|
|
||||||
private Double pt2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CT靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "CT1")
|
|
||||||
private Double ct1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CT靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "CT2")
|
|
||||||
private Double ct2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "DEVCMP")
|
|
||||||
private Double devcmp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "DLCMP")
|
|
||||||
private Double dlcmp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "JZCMP")
|
|
||||||
private Double jzcmp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "XYCMP")
|
|
||||||
private Double xycmp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠?靠靠靠靠靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "SUBV_NO")
|
|
||||||
private Integer subvNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (靠PQS_Dictionary?靠靠Guid
|
|
||||||
*/
|
|
||||||
@TableField(value = "\"SCALE\"")
|
|
||||||
private String scale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "SUBV_NAME")
|
|
||||||
private String subvName;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String subName;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String deptName;
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: cdf
|
|
||||||
* @CreateTime: 2025-06-26
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("PQ_LINEDETAIL")
|
|
||||||
public class PqLinedetail {
|
|
||||||
|
|
||||||
@TableId(value = "LINE_INDEX", type = IdType.INPUT)
|
|
||||||
private Integer lineIndex;
|
|
||||||
|
|
||||||
private Integer gdIndex;
|
|
||||||
|
|
||||||
private Integer subIndex;
|
|
||||||
|
|
||||||
private String lineName;
|
|
||||||
|
|
||||||
private Integer pttype;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date lastTime;
|
|
||||||
|
|
||||||
private Integer tinterval;
|
|
||||||
|
|
||||||
private String loadtype;
|
|
||||||
|
|
||||||
private String businesstype;
|
|
||||||
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
private String monitorId;
|
|
||||||
|
|
||||||
private Integer powerid;
|
|
||||||
|
|
||||||
private String objname;
|
|
||||||
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Integer statflag;
|
|
||||||
|
|
||||||
private String lineGrade;
|
|
||||||
|
|
||||||
private String powerSubstationName;
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.njcn.gather.event.devcie.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Date: 2025/06/19 下午 1:48【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 靠靠靠
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@TableName(value = "PQ_SUBSTATION")
|
|
||||||
public class PqSubstation {
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@TableId(value = "SUB_INDEX", type = IdType.INPUT)
|
|
||||||
private Integer subIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠靠
|
|
||||||
*/
|
|
||||||
@TableField(value = "GD_INDEX")
|
|
||||||
private Integer gdIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 靠靠?
|
|
||||||
*/
|
|
||||||
@TableField(value = "\"NAME\"")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@TableField(value = "\"SCALE\"")
|
|
||||||
private String scale;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user