This commit is contained in:
2025-01-15 13:50:28 +08:00
parent d41471f152
commit 188b091f8d
3 changed files with 36 additions and 44 deletions

View File

@@ -736,6 +736,14 @@ public class SocketDevResponseService {
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssues.get(0).getType());
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
//告诉前端当前项开始了
WebSocketVO<Object> webSocketVO = new WebSocketVO();
webSocketVO.setRequestId(sourceIssues.get(0).getType() + stepBegin);
webSocketVO.setDesc(null);
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
} else if (SourceOperateCodeEnum.PRE_TEST.getValue().equals(param.getOperateType()) || SourceOperateCodeEnum.COEFFICIENT_TEST.getValue().equals(param.getOperateType())) {
//预检测的相序检测 以及系数校验都需要进行相序检测
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.PHASE_TEST.getValue());
@@ -838,9 +846,9 @@ public class SocketDevResponseService {
temStr = "电压";
} else if ("IRMS".equals(sourceCompareDev.getDesc())) {
temStr = "电流";
}else if ("VA".equals(sourceCompareDev.getDesc())) {
} else if ("VA".equals(sourceCompareDev.getDesc())) {
temStr = "电压相角";
}else if ("IA".equals(sourceCompareDev.getDesc())) {
} else if ("IA".equals(sourceCompareDev.getDesc())) {
temStr = "电流相角";
}
dataMsg.setData(sourceCompareDev.getDevName() + splitTag + sourceCompareDev.getLineNum() + temStr + "校验结果:" + (sourceCompareDev.getIsQualified() ? "合格" : "不合格"));
@@ -923,6 +931,7 @@ public class SocketDevResponseService {
List<DevLineTestResult> allDevTestList = new ArrayList<>();
/**
* 正式检测
*/
@@ -989,14 +998,15 @@ public class SocketDevResponseService {
if (tem == 0) {
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
//当val为0则认为大项中的小项已经全部跑完开始组装信息推送给前端
List<DevLineTestResult> resultList = new ArrayList<>(); Map<String,List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
map.forEach((dev,list)->{
List<DevLineTestResult> resultList = new ArrayList<>();
Map<String, List<DevLineTestResult>> map = allDevTestList.stream().collect(Collectors.groupingBy(DevLineTestResult::getDeviceId));
map.forEach((dev, list) -> {
DevLineTestResult devTem = new DevLineTestResult();
devTem.setDeviceId(dev);
devTem.setDeviceName(list.get(0).getDeviceName());
Integer[] arr = list.get(0).getChnResult();
for(int i =0;i<arr.length;i++){
List<Integer[]> arrList = list.stream().map(DevLineTestResult::getChnResult).collect(Collectors.toList());
for (int i = 0; i < arr.length; i++) {
List<Integer[]> arrList = list.stream().map(DevLineTestResult::getChnResult).collect(Collectors.toList());
Integer[] resultArr = getMaxIntArray(arrList);
devTem.setChnResult(resultArr);
}
@@ -1101,7 +1111,6 @@ public class SocketDevResponseService {
}
/**
* 退出检测返回
*/

View File

@@ -56,7 +56,6 @@ public class SocketSourceResponseService {
private List<String> monitorIdList = new ArrayList<>();
public void deal(PreDetectionParam param, String msg) throws Exception {
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
String[] tem = socketDataMsg.getRequestId().split(stepTag);
@@ -80,21 +79,20 @@ public class SocketSourceResponseService {
coefficient(param, socketDataMsg);
break;
case QUITE_SOURCE:
quitDeal(socketDataMsg,param);
quitDeal(socketDataMsg, param);
break;
case YXT:
break;
}
} else {
System.out.println("fggggggggggggggggggggg"+enumByCode);
System.out.println("fggggggggggggggggggggg" + enumByCode);
}
}
/**
* 系数校验源数据返回处理
*/
@@ -112,14 +110,13 @@ public class SocketSourceResponseService {
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
phaseSequenceParam.setMoniterIdList(monitorIdList);
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS","real$IRMS"));
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$IRMS"));
phaseSequenceParam.setReadCount(10);
phaseSequenceParam.setIgnoreCount(7);
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
break;
case UNPROCESSED_BUSINESS:
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
@@ -199,7 +196,6 @@ public class SocketSourceResponseService {
break;
default:
socketMsg = new SocketMsg<>();
socketMsg.setRequestId(socketDataMsg.getRequestId());
@@ -259,7 +255,6 @@ public class SocketSourceResponseService {
}
/**
* 组装和装置要数据
*
@@ -273,29 +268,29 @@ public class SocketSourceResponseService {
switch (dictDataEnumByCode) {
case SUCCESS:
//向前端推送信息
// webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
// webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
String s = param.getUserPageId() + DEV;
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
List<String> comm = sourceIssue.getDevValueTypeList();
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue()+stepTag+sourceIssue.getType());
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
int ignoreCount;
int readData;
if(sourceIssue.getType().equals(DicDataEnum.F.getCode())){
if (sourceIssue.getType().equals(DicDataEnum.F.getCode())) {
ignoreCount = 1;
readData = 2;
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue());
}else if(sourceIssue.getType().equals(DicDataEnum.HP.getCode())){
} else if (sourceIssue.getType().equals(DicDataEnum.HP.getCode())) {
ignoreCount = 2;
readData = 5;
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue());
}else if(DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())){
} else if (DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())) {
ignoreCount = 5;
readData = 1;
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue());
}else {
} else {
ignoreCount = 1;
readData = 1;
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
@@ -304,7 +299,7 @@ public class SocketSourceResponseService {
List<String> moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList());
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
System.out.println("向装置下发的参数"+comm);
System.out.println("向装置下发的参数" + comm);
phaseSequenceParam.setMoniterIdList(moniterIdList);
phaseSequenceParam.setDataType(comm);
phaseSequenceParam.setReadCount(readData);
@@ -315,9 +310,8 @@ public class SocketSourceResponseService {
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
List<DevLineTestResult> devListRes = new ArrayList<>();
devList.forEach(item->{
devList.forEach(item -> {
DevLineTestResult devLineTestResult = new DevLineTestResult();
devLineTestResult.setDeviceId(item.getDevId());
devLineTestResult.setDeviceName(item.getDevName());
@@ -325,24 +319,10 @@ public class SocketSourceResponseService {
});
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
if(SocketManager.getSourceList().get(0).getIndex() == 1){
//告诉前端当前项开始了
webSocketVO.setRequestId(SocketManager.getSourceList().get(0).getType()+stepBegin);
webSocketVO.setDesc(null);
webSocketVO.setData(devListRes);
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
webSocketVO.setRequestId(SocketManager.getSourceList().get(0).getType()+stepBegin);
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
webSocketVO.setData(devListRes);
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
}else {
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1]+stepBegin);
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
webSocketVO.setData(devListRes);
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
}
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepBegin);
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
webSocketVO.setData(devListRes);
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
break;
@@ -385,7 +365,7 @@ public class SocketSourceResponseService {
}
public void initList(PreDetectionParam param){
public void initList(PreDetectionParam param) {
devList.clear();
monitorIdList.clear();
this.devList = iPqDevService.getDevInfo(param.getDevIds());

View File

@@ -20,8 +20,10 @@ import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
import com.njcn.gather.storage.pojo.vo.RawDataVO;
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -43,6 +45,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
private final AdNonHarmonicMapper adNonHarmonicMapper;
private final IDictDataService dictDataService;
private final DictTreeMapper dictTreeMapper;
@Override
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, Integer code) {
@@ -136,7 +139,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
if(CollUtil.isNotEmpty(adHarmonicResults)){
List<Double> harmNum = param.getHarmNum();
RawResultDataVO dataVO;
DictData dictData = dictDataService.getDictDataById(adHarmonicResults.get(0).getAdType());
DictTree dictData = dictTreeMapper.selectById(adHarmonicResults.get(0).getAdType());
String unit;
if(DictDataEnum.I2_50.getCode().equals(dictData.getCode())||DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())){
unit="A";