代码调整
This commit is contained in:
@@ -12,6 +12,7 @@ import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
||||
import com.njcn.gather.detection.pojo.vo.*;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
|
||||
@@ -58,7 +59,7 @@ public class SocketDevResponseService {
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||
|
||||
|
||||
private final List<String> nonHarmonicList = Stream.of(DicDataEnum.FREQ.getCode(), DicDataEnum.V.getCode(), DicDataEnum.I.getCode(), DicDataEnum.IMBV.getCode(), DicDataEnum.IMBA.getCode()).collect(Collectors.toList());
|
||||
private final List<String> nonHarmonicList = Stream.of(DicDataEnum.FREQ.getCode(), DicDataEnum.V.getCode(), DicDataEnum.I.getCode(), DicDataEnum.IMBV.getCode(), DicDataEnum.IMBA.getCode(),DicDataEnum.VOLTAGE.getCode()).collect(Collectors.toList());
|
||||
private final List<String> harmonicList = Stream.of(DicDataEnum.HV.getCode(), DicDataEnum.HI.getCode(), DicDataEnum.HP.getCode(), DicDataEnum.HSV.getCode(), DicDataEnum.HSI.getCode()).collect(Collectors.toList());
|
||||
|
||||
private final WebSocketHandler webSocketHandler;
|
||||
@@ -389,7 +390,7 @@ public class SocketDevResponseService {
|
||||
} else if (XiNumberManager.stepNumber == 3) {
|
||||
sendWebSocket(param.getUserPageId(), SourceOperateCodeEnum.Coefficient_Check.getValue(), SourceOperateCodeEnum.small_comp_end.getValue(), XiNumberManager.devParameterList.get(1));
|
||||
System.out.println("-------------------------已经全部结束----------------------");
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -547,22 +548,20 @@ public class SocketDevResponseService {
|
||||
|
||||
case DEV_ERROR:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case DEV_TARGET:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case RE_OPERATE:
|
||||
//出现已经初始化情况,发送用户用户确认是否继续检测
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case NO_INIT_DEV:
|
||||
//发起关闭操作
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
default:
|
||||
WebSocketVO<String> webSocketVO = new WebSocketVO<>();
|
||||
@@ -678,17 +677,17 @@ public class SocketDevResponseService {
|
||||
break;
|
||||
case DEV_ERROR:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case DEV_TARGET:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
|
||||
case RE_OPERATE:
|
||||
//出现已经初始化情况,发送用户用户确认是否继续检测
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
default:
|
||||
WebSocketVO<String> webSocketVO = new WebSocketVO<>();
|
||||
@@ -752,7 +751,7 @@ public class SocketDevResponseService {
|
||||
if(param.getOperateType().equals(SourceOperateCodeEnum.PRE_TEST.getValue())){
|
||||
System.out.println("预检测流程接受-----------------关闭源");
|
||||
//同时关闭设备三个步骤
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
}else if(param.getOperateType().equals(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue())){
|
||||
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||
webSocketVO.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||
@@ -785,13 +784,11 @@ public class SocketDevResponseService {
|
||||
break;
|
||||
case DEV_ERROR:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case DEV_TARGET:
|
||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), MsgUtil.msgToWebData(socketDataMsg, devNameMapComm, 2));
|
||||
quitSend(param);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
break;
|
||||
case RE_OPERATE:
|
||||
break;
|
||||
@@ -877,7 +874,7 @@ public class SocketDevResponseService {
|
||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, MsgUtil.toJsonWithNewLinePlain(xuMsg));
|
||||
} else {
|
||||
//TODO 是否最终检测完成需要推送给用户
|
||||
quitSend(param);
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
|
||||
successComm.clear();
|
||||
@@ -932,7 +929,7 @@ public class SocketDevResponseService {
|
||||
case QUIT_INIT_01:
|
||||
//关闭所有
|
||||
SocketManager.removeUser(s);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
break;
|
||||
case QUIT_INIT_02:
|
||||
socketMsg.setRequestId("quit");
|
||||
@@ -954,7 +951,7 @@ public class SocketDevResponseService {
|
||||
switch (operateCodeEnum) {
|
||||
case QUIT_INIT_01:
|
||||
SocketManager.removeUser(s);
|
||||
quitSendSource(param);
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
break;
|
||||
case QUIT_INIT_02:
|
||||
socketMsg.setRequestId("quit");
|
||||
@@ -1179,7 +1176,10 @@ public class SocketDevResponseService {
|
||||
* @date 2024/12/29
|
||||
*/
|
||||
private void baseDataInsert(List<DevData> devDataList, SourceIssue sourceIssue, PreDetectionParam param, Map<String, String> checkDataMap) {
|
||||
Runnable runnable = () -> {
|
||||
// Runnable runnable = () -> {
|
||||
|
||||
|
||||
|
||||
System.out.println("原始数据插入数据库开始执行=========================================");
|
||||
List<AdNonHarmonicResult> adNonHarmonicResultList = new ArrayList<>();
|
||||
List<AdHarmonicResult> adHarmonicResultList = new ArrayList<>();
|
||||
@@ -1286,8 +1286,8 @@ public class SocketDevResponseService {
|
||||
detectionDataDealService.acceptAd(adHarmonicResultList, "1");
|
||||
}
|
||||
System.out.println("原始数据插入数据库执行成功=========================================");
|
||||
};
|
||||
executorPool.submit(runnable);
|
||||
// };
|
||||
// executorPool.submit(runnable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -665,7 +665,7 @@ public class DetectionServiceImpl {
|
||||
*/
|
||||
private void setDetection(DictDataEnum dataRule, List<Double> harmDataList, PqErrSysDtls errSysDtl, DetectionData data, Double v) {
|
||||
List<Double> qualifiedList = harmDataList.stream()
|
||||
.filter(x -> v == 0 ? x == v : NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()),
|
||||
.filter(x -> v == 0 ? x == v : x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()),
|
||||
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
|
||||
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
|
||||
data.setRadius(-errSysDtl.getMaxErrorValue() + "~" + errSysDtl.getMaxErrorValue());
|
||||
@@ -764,7 +764,7 @@ public class DetectionServiceImpl {
|
||||
public DetectionData rangeComparisonList(List<Double> list, List<PqErrSysDtls> pqErrSysDtls, Double data, Double channelData, DictDataEnum dataRule) {
|
||||
DetectionData detectionData = new DetectionData();
|
||||
detectionData.setIsData(4);
|
||||
detectionData.setData(list.get(0));
|
||||
detectionData.setData(CollUtil.isNotEmpty(list) ? list.get(0) : null);
|
||||
//先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断
|
||||
//获得误差体系
|
||||
List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(multiply(x.getStartValue(), data, x.getConditionType()),
|
||||
|
||||
@@ -100,6 +100,8 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
//闪变
|
||||
//CnSocketUtil.quitSend(param);
|
||||
} else if (sourceIssue.getType().equals(DicDataEnum.VOLTAGE.getCode()) || sourceIssue.getType().equals(DicDataEnum.HP.getCode())) {
|
||||
|
||||
System.out.println("进入统计数据3分钟读超时。。。。。。");
|
||||
CnSocketUtil.quitSend(param);
|
||||
|
||||
WebSocketVO<String> socketVO = new WebSocketVO<>();
|
||||
@@ -109,6 +111,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketVO));
|
||||
//统计数据项
|
||||
}else {
|
||||
System.out.println("进入实时数据3分钟读超时。。。。。。");
|
||||
//实时数据
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
@@ -116,8 +119,8 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("进入10S超时。。。。。。");
|
||||
//当连接超过10S和发送消息后10S无响应时候,关闭channel
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
queryWrapper.selectAll(PqScriptDtls.class)
|
||||
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
.eq(PqScriptDtls::getEnable, 1);;
|
||||
.eq(PqScriptDtls::getEnable, 1);
|
||||
|
||||
if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) {
|
||||
//相序
|
||||
queryWrapper.eq(PqScriptDtls::getIndex, -1)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
B_Value varchar(30) DEFAULT NULL COMMENT 'B相值',
|
||||
C_Value varchar(30) DEFAULT NULL COMMENT 'C相值',
|
||||
T_Value varchar(30) DEFAULT NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||
PRIMARY KEY (Monitor_Id, Time_Id, Script_Id, Sort, Data_Type)
|
||||
PRIMARY KEY (Monitor_Id, Time_Id, Script_Id, Sort, AD_Type)
|
||||
) COMMENT='监测数据表';
|
||||
</update>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
B_Value json NULL COMMENT 'B相值',
|
||||
C_Value json NULL COMMENT 'C相值',
|
||||
T_Value json NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||
PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)
|
||||
PRIMARY KEY (Monitor_Id, Script_Id, Sort, AD_Type)
|
||||
) COMMENT='监测数据表';
|
||||
</update>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
" Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" +
|
||||
" Result_Flag int(1) NULL COMMENT '0.不合格 1.合格',\n" +
|
||||
A+B+C+
|
||||
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" +
|
||||
" PRIMARY KEY (Monitor_Id,Time_Id, Script_Id, Sort, AD_Type)\n" +
|
||||
") COMMENT='监测数据表';";
|
||||
tableGenMapper.genAdHarmonicTable(sql);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
" Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" +
|
||||
" Result_Flag int(1) NOT NULL COMMENT '0.不合格 1.合格',\n" +
|
||||
A+B+C+
|
||||
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" +
|
||||
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, AD_Type)\n" +
|
||||
") COMMENT='监测数据表';";
|
||||
tableGenMapper.genAdHarmonicTable(sql2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user