Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -39,10 +39,4 @@ public class SimulateDetectionParam {
|
||||
*/
|
||||
@NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK)
|
||||
private String sourceId;
|
||||
|
||||
/**
|
||||
* 脚本值类型 1绝对值脚本、2相对值脚本
|
||||
*/
|
||||
@NotNull(message = PqScriptValidMessage.VALUE_TYPE_NOT_NULL)
|
||||
private int valueType;
|
||||
}
|
||||
|
||||
@@ -948,7 +948,11 @@ public class DetectionServiceImpl {
|
||||
.sorted().distinct().collect(Collectors.toList()));
|
||||
}
|
||||
for (DevData devData : dev) {
|
||||
Optional<DevData.SqlDataDTO> first = devData.getSqlData().stream().filter(x -> x.getDesc().equals(fundCode)).collect(Collectors.toList()).stream().findFirst();
|
||||
List<DevData.SqlDataDTO> sqlDataDTOList = devData.getSqlData();
|
||||
Optional<DevData.SqlDataDTO> first = Optional.empty();
|
||||
if(CollUtil.isNotEmpty(sqlDataDTOList)){
|
||||
first = sqlDataDTOList.stream().filter(x -> x.getDesc().equals(fundCode)).collect(Collectors.toList()).stream().findFirst();
|
||||
}
|
||||
DevData.SqlDataDTO fund = null;
|
||||
if (first.isPresent()) {
|
||||
fund = first.get();
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.njcn.gather.detection.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||
@@ -13,7 +12,6 @@ import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.service.PreDetectionService;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
@@ -43,7 +41,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -261,10 +258,8 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
//issueParam.setDevIds(param.getDevIds());
|
||||
issueParam.setScriptId(param.getScriptId());
|
||||
issueParam.setType(1);
|
||||
issueParam.setValueType(param.getValueType()); // 设置脚本类型
|
||||
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue());
|
||||
|
||||
|
||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
sourceIssues = sourceIssues.stream()
|
||||
.filter(s -> s.getIndex().equals(param.getScriptIndex()))
|
||||
|
||||
@@ -78,7 +78,7 @@ public class MsgUtil {
|
||||
|
||||
public static List<DevData> toList(List<AdNonHarmonicResult> nonHarm, List<AdHarmonicResult> harm) {
|
||||
List<DevData> info = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(nonHarm)) {
|
||||
// if (CollUtil.isNotEmpty(nonHarm)) {
|
||||
if (CollUtil.isNotEmpty(nonHarm)) {
|
||||
Map<String, List<AdNonHarmonicResult>> noHarmMap = nonHarm.stream()
|
||||
.collect(Collectors.groupingBy(x -> x.getMonitorId() + "_" + x.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.UTC_SIMPLE_MS_PATTERN)) + "_" + x.getSort()));
|
||||
@@ -116,7 +116,7 @@ public class MsgUtil {
|
||||
dataDTO = new DevData.SqlDataHarmDTO();
|
||||
dataDTO.setType(harmonicResult.getDataType());
|
||||
dataDTO.setDesc(harmonicResult.getAdType());
|
||||
dataDTO.setNum(49);
|
||||
dataDTO.setNum(50);
|
||||
DevData.SqlDataHarmDTO.ListDTO listDTO = new DevData.SqlDataHarmDTO.ListDTO();
|
||||
listDTO.setA(reflectHarmonicValue("a", harmonicResult));
|
||||
listDTO.setB(reflectHarmonicValue("b", harmonicResult));
|
||||
@@ -137,14 +137,14 @@ public class MsgUtil {
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
private static List<String> reflectHarmonicValue(String phase, AdHarmonicResult adHarmonicResult) {
|
||||
List<String> info = new ArrayList<>();
|
||||
for (int i = 2; i < 50; i++) {
|
||||
for (int i = 2; i <= 50; i++) {
|
||||
String fieldName = phase + "Value" + i;
|
||||
try {
|
||||
Field idField = AdHarmonicResult.class.getDeclaredField(fieldName);
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
@@ -36,6 +35,7 @@ import com.njcn.gather.script.util.ScriptDtlsDesc;
|
||||
import com.njcn.gather.storage.mapper.TableGenMapper;
|
||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
@@ -202,7 +202,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
dtlType.setIndex(index);
|
||||
dtlType.setScriptType(scriptDtlIndexList.get(0).getScriptType());
|
||||
ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree);
|
||||
dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList,false, isValueType).toString());
|
||||
dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, false, isValueType).toString());
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
dtlType.setFly(conform(finalResultMap.get(index)));
|
||||
}
|
||||
@@ -253,7 +253,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
if ("Freq".equals(subKey)) {
|
||||
freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType);
|
||||
}
|
||||
dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList,false, isValueType).toString());
|
||||
dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, false, isValueType).toString());
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
dtlType.setFly(conform(finalResultMap.get(index)));
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波");
|
||||
dlt.setIndex(dtls.getScriptIndex());
|
||||
dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType());
|
||||
dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList,false, isValueType).toString());
|
||||
dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, false, isValueType).toString());
|
||||
if (finalResultMap.containsKey(dtls.getScriptIndex())) {
|
||||
dlt.setFly(conform(finalResultMap.get(dtls.getScriptIndex())));
|
||||
}
|
||||
@@ -932,11 +932,11 @@ public class ResultServiceImpl implements IResultService {
|
||||
param.setCode(code);
|
||||
param.setErrorSysId(errorSysId);
|
||||
param.setDevIds(Arrays.asList(devId));
|
||||
param.setCode(code+"_temp");
|
||||
param.setCode(code + "_temp");
|
||||
|
||||
Map<String, String> devIdMapComm = new HashMap<>();
|
||||
PqDev dev = pqDevService.getById(devId);
|
||||
devIdMapComm.put(devId,devId);
|
||||
// PqDev dev = pqDevService.getById(devId);
|
||||
devIdMapComm.put(devId, devId);
|
||||
|
||||
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
||||
DictDataEnum dataRule;
|
||||
@@ -947,8 +947,11 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAll(code, devId);
|
||||
LinkedHashMap<Integer, List<AdNonHarmonicResult>> map = allNonHarmonicRawData.stream().sorted(Comparator.comparing(AdNonHarmonicResult::getSort))
|
||||
LinkedHashMap<Integer, List<AdNonHarmonicResult>> nonHarmonicMap = allNonHarmonicRawData.stream().sorted(Comparator.comparing(AdNonHarmonicResult::getSort))
|
||||
.collect(Collectors.groupingBy(AdNonHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||
List<AdHarmonicResult> allHarmonicRawData = adHarmonicService.lisAll(code, devId);
|
||||
LinkedHashMap<Integer, List<AdHarmonicResult>> harmonicMap = allHarmonicRawData.stream().sorted(Comparator.comparing(AdHarmonicResult::getSort))
|
||||
.collect(Collectors.groupingBy(AdHarmonicResult::getSort, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
||||
issueParam.setPlanId(planId);
|
||||
@@ -962,15 +965,29 @@ public class ResultServiceImpl implements IResultService {
|
||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||
|
||||
sourceIssues.forEach(sourceIssue -> {
|
||||
List<DevData> realDataXiList = MsgUtil.toList(map.get(sourceIssue.getIndex()), null);
|
||||
List<DevData> realDataXiList = MsgUtil.toList(nonHarmonicMap.get(sourceIssue.getIndex()), harmonicMap.get(sourceIssue.getIndex()));
|
||||
for (int i = 0; i < realDataXiList.size(); i++) {
|
||||
DevData devData = realDataXiList.get(i);
|
||||
List<DevData.SqlDataDTO> sqlData = devData.getSqlData();
|
||||
if(CollUtil.isNotEmpty(sqlData)){
|
||||
if (CollUtil.isNotEmpty(sqlData)) {
|
||||
for (int j = 0; j < sqlData.size(); j++) {
|
||||
DevData.SqlDataDTO sqlDataDTO = sqlData.get(j);
|
||||
String desc = sqlDataDTO.getDesc();
|
||||
if(StrUtil.isNotBlank(desc)){
|
||||
if (StrUtil.isNotBlank(desc)) {
|
||||
DictTree dictTree = dictTreeService.getById(desc);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
sqlDataDTO.setDesc(dictTree.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<DevData.SqlDataHarmDTO> sqlDataHarm = devData.getSqlDataHarm();
|
||||
if (CollUtil.isNotEmpty(sqlDataHarm)) {
|
||||
for (int j = 0; j < sqlDataHarm.size(); j++) {
|
||||
DevData.SqlDataHarmDTO sqlDataDTO = sqlDataHarm.get(j);
|
||||
String desc = sqlDataDTO.getDesc();
|
||||
if (StrUtil.isNotBlank(desc)) {
|
||||
DictTree dictTree = dictTreeService.getById(desc);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
sqlDataDTO.setDesc(dictTree.getCode());
|
||||
|
||||
@@ -7,5 +7,5 @@ package com.njcn.gather.script.pojo.constant;
|
||||
public interface PqScriptValidMessage {
|
||||
String INDEX_NOT_NULL = "index不能为空";
|
||||
|
||||
String VALUE_TYPE_NOT_NULL = "脚本值类型不能为空";
|
||||
String VALUE_TYPE_NOT_BLANK = "脚本值类型不能为空";
|
||||
}
|
||||
|
||||
@@ -39,8 +39,4 @@ public class PqScriptIssueParam {
|
||||
|
||||
@ApiModelProperty("脚本下发类型")
|
||||
private int type;
|
||||
|
||||
@ApiModelProperty("脚本值类型")
|
||||
private int valueType;
|
||||
|
||||
}
|
||||
|
||||
@@ -830,12 +830,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
queryWrapper.eq(PqScriptDtls::getScriptId, param.getScriptId());
|
||||
pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
|
||||
if (CollUtil.isNotEmpty(param.getDevIds()) || (ObjectUtil.isNotNull(param.getType()) && param.getType() == 1)) {
|
||||
Boolean isValueType;
|
||||
if (ObjectUtil.isNotNull(param.getValueType()) && param.getValueType() == 2) {
|
||||
isValueType = true; //相对值脚本
|
||||
} else {
|
||||
isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
}
|
||||
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
if (isValueType) {
|
||||
for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
|
||||
if (VOL.equals(pqScriptDtl.getValueType())) {
|
||||
|
||||
@@ -52,4 +52,13 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
||||
List<Integer> getIndex(StorageParam param,Boolean isExculdePhaseAngle);
|
||||
|
||||
AdHarmonicResult getSingleResult(SingleNonHarmParam singleNonHarmParam);
|
||||
|
||||
/**
|
||||
* 获取所有谐波原始数据
|
||||
*
|
||||
* @param code
|
||||
* @param devId 设备ID
|
||||
* @return
|
||||
*/
|
||||
List<AdHarmonicResult> lisAll(String code, String devId);
|
||||
}
|
||||
|
||||
@@ -234,6 +234,17 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdHarmonicResult> lisAll(String code, String devId) {
|
||||
String prefix = "ad_harmonic_" + code;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.likeRight(AdHarmonicResult::getMonitorId, devId);
|
||||
List<AdHarmonicResult> results = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return results;
|
||||
}
|
||||
|
||||
private Integer setResultFlag(List<RawResultDataVO.DetectionData> numbers) {
|
||||
List<Integer> isData = numbers.stream().filter(Objects::nonNull).filter(x -> ObjectUtil.isNotNull(x.getData())).filter(x -> 4 != x.getIsData()).map(RawResultDataVO.DetectionData::getIsData).distinct().collect(Collectors.toList());
|
||||
return getInteger(isData);
|
||||
|
||||
@@ -159,9 +159,9 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.likeRight(AdNonHarmonicResult::getMonitorId, devId);
|
||||
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||
List<AdNonHarmonicResult> results = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return adHarmonicResults;
|
||||
return results;
|
||||
}
|
||||
|
||||
private String unit(String code) {
|
||||
|
||||
Reference in New Issue
Block a user