1.正式检测详情代码提交

This commit is contained in:
wr
2025-01-02 19:08:26 +08:00
parent 3213bc9f84
commit cf96b8ed83
11 changed files with 304 additions and 121 deletions

View File

@@ -23,7 +23,14 @@ public class DetectionData {
private Integer isData; private Integer isData;
/** /**
* 原始数据 * 装置原始数据
*/ */
private Double data; private Double data;
/**
* 检测源定值
*/
private Double resultData;
} }

View File

@@ -213,7 +213,7 @@ public class DetectionServiceImpl {
result.setDataType("avg"); result.setDataType("avg");
if (map.containsKey(TYPE_T)) { if (map.containsKey(TYPE_T)) {
DetectionData t = rangeComparisonList(map.get(TYPE_T), pqErrSysDtls, fData, 1.0, dataRule); DetectionData t = rangeComparisonList(map.get(TYPE_T), pqErrSysDtls, fData, 1.0, dataRule);
result.setTValue(t.getData() + "_" + t.getIsData()); result.setTValue(t.getData() + "_" + t.getIsData()+"_"+t.getResultData());
result.setResultFlag(t.getIsData()); result.setResultFlag(t.getIsData());
} else { } else {
//取出源所对应的相别信息 //取出源所对应的相别信息
@@ -221,19 +221,19 @@ public class DetectionServiceImpl {
.filter(x -> (type + "a").equals(x.getChannelType())) .filter(x -> (type + "a").equals(x.getChannelType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getFAmp(), dataRule); DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getFAmp(), dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()); result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
.filter(x -> (type + "b").equals(x.getChannelType())) .filter(x -> (type + "b").equals(x.getChannelType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getFAmp(), dataRule); DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getFAmp(), dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()); result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream()
.filter(x -> (type + "c").equals(x.getChannelType())) .filter(x -> (type + "c").equals(x.getChannelType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getFAmp(), dataRule); DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getFAmp(), dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()); result.setCValue(c.getData() + "_" + c.getIsData()+"_"+c.getResultData());
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()).stream().distinct().collect(Collectors.toList()); List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()).stream().distinct().collect(Collectors.toList());
return getAdNonHarmonicResult(result, numbers); return getAdNonHarmonicResult(result, numbers);
@@ -332,19 +332,19 @@ public class DetectionServiceImpl {
.filter(x -> TYPE_A.equals(x.getPhase())) .filter(x -> TYPE_A.equals(x.getPhase()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getValue(), dataRule); DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getValue(), dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()); result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
List<PqScriptCheckData> channelTypeBList = checkData.stream() List<PqScriptCheckData> channelTypeBList = checkData.stream()
.filter(x -> TYPE_B.equals(x.getPhase())) .filter(x -> TYPE_B.equals(x.getPhase()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getValue(), dataRule); DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getValue(), dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()); result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
List<PqScriptCheckData> channelTypeCList = checkData.stream() List<PqScriptCheckData> channelTypeCList = checkData.stream()
.filter(x -> TYPE_C.equals(x.getPhase())) .filter(x -> TYPE_C.equals(x.getPhase()))
.collect(Collectors.toList()); .collect(Collectors.toList());
DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getValue(), dataRule); DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getValue(), dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()); result.setCValue(c.getData() + "_" + c.getIsData()+"_"+b.getResultData());
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()); List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData());
return getAdNonHarmonicResult(result, numbers); return getAdNonHarmonicResult(result, numbers);
@@ -431,7 +431,7 @@ public class DetectionServiceImpl {
retainATime = channelTypeAList.get(0).getFAmp(); retainATime = channelTypeAList.get(0).getFAmp();
} }
DetectionData a = rangeComparisonList(mag.get(TYPE_A), magErrList, fData, retainATime, dataRule); DetectionData a = rangeComparisonList(mag.get(TYPE_A), magErrList, fData, retainATime, dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()); result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
.filter(x -> ("Ub").equals(x.getChannelType())) .filter(x -> ("Ub").equals(x.getChannelType()))
@@ -443,7 +443,7 @@ public class DetectionServiceImpl {
retainBTime = channelTypeBList.get(0).getFAmp(); retainBTime = channelTypeBList.get(0).getFAmp();
} }
DetectionData b = rangeComparisonList(mag.get(TYPE_B), magErrList, fData, retainBTime, dataRule); DetectionData b = rangeComparisonList(mag.get(TYPE_B), magErrList, fData, retainBTime, dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()); result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream()
.filter(x -> ("Uc").equals(x.getChannelType())) .filter(x -> ("Uc").equals(x.getChannelType()))
@@ -455,7 +455,7 @@ public class DetectionServiceImpl {
retainCTime = channelTypeCList.get(0).getFAmp(); retainCTime = channelTypeCList.get(0).getFAmp();
} }
DetectionData c = rangeComparisonList(mag.get(TYPE_C), magErrList, fData, retainCTime, dataRule); DetectionData c = rangeComparisonList(mag.get(TYPE_C), magErrList, fData, retainCTime, dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()); result.setCValue(c.getData() + "_" + c.getIsData()+"_"+c.getResultData());
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()).stream().distinct().collect(Collectors.toList()); List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()).stream().distinct().collect(Collectors.toList());
@@ -568,7 +568,7 @@ public class DetectionServiceImpl {
if (ObjectUtil.isNull(value.getIsData())) { if (ObjectUtil.isNull(value.getIsData())) {
idField.set(harmonicResult, value.getData()); idField.set(harmonicResult, value.getData());
} else { } else {
idField.set(harmonicResult, value.getData() + "_" + value.getIsData()); idField.set(harmonicResult, value.getData() + "_" + value.getIsData()+"_"+value.getResultData());
} }
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -645,6 +645,7 @@ public class DetectionServiceImpl {
errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), fData, 0)); errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), fData, 0));
} }
Double v = issueHarmMap.get(harm); Double v = issueHarmMap.get(harm);
data.setResultData(v);
setDetection(dataRule, harmDataList, errSysDtl, data, v); setDetection(dataRule, harmDataList, errSysDtl, data, v);
} }
info.add(data); info.add(data);
@@ -770,6 +771,7 @@ public class DetectionServiceImpl {
BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())), BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())),
BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))) BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())))
).collect(Collectors.toList()); ).collect(Collectors.toList());
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue());
if (CollUtil.isNotEmpty(qualifiedList)) { if (CollUtil.isNotEmpty(qualifiedList)) {
detectionData.setData(qualifiedList.get(0)); detectionData.setData(qualifiedList.get(0));
switch (dataRule) { switch (dataRule) {
@@ -798,6 +800,7 @@ public class DetectionServiceImpl {
if (0 == errSysDtl.getErrorValueType()) { if (0 == errSysDtl.getErrorValueType()) {
errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0)); errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0));
} }
detectionData.setResultData(errSysDtl.getMaxErrorValue());
setDetection(dataRule, list, errSysDtl, detectionData, channelData); setDetection(dataRule, list, errSysDtl, detectionData, channelData);
} }
} }

View File

@@ -5,8 +5,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.gather.result.pojo.param.ResultParam; import com.njcn.gather.result.pojo.param.ResultParam;
import com.njcn.gather.result.pojo.vo.DetectionInfoVO;
import com.njcn.gather.result.pojo.vo.FormContentVO; import com.njcn.gather.result.pojo.vo.FormContentVO;
import com.njcn.gather.result.pojo.vo.TreeDataVO;
import com.njcn.gather.result.service.IResultService; import com.njcn.gather.result.service.IResultService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil; import com.njcn.web.utils.HttpResultUtil;
@@ -50,9 +50,9 @@ public class ResultController extends BaseController {
@PostMapping("/treeData") @PostMapping("/treeData")
@ApiOperation("查询检测结果-树形结构的具体检测项") @ApiOperation("查询检测结果-树形结构的具体检测项")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<List<DetectionInfoVO>> treeData(@RequestBody @Validated ResultParam queryParam) { public HttpResult<List<TreeDataVO>> treeData(@RequestBody @Validated ResultParam queryParam) {
String methodDescribe = getMethodDescribe("treeData"); String methodDescribe = getMethodDescribe("treeData");
List<DetectionInfoVO> infoVOS = resultService.treeData(queryParam); List<TreeDataVO> infoVOS = resultService.treeData(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe);
} }
} }

View File

@@ -28,17 +28,17 @@ public class ResultParam {
/** /**
* 装置id * 装置id
*/ */
private String devId="5eaba83670ff4d9daf892a62a5e13ea3"; private String devId;
/** /**
* 装置通道 * 装置通道
*/ */
private String devNum="1"; private String devNum;
/** /**
* 自动生成,用于生成数据表后缀 * 自动生成,用于生成数据表后缀
*/ */
private Integer code=1; private Integer code;
@Data @Data
public static class QueryParam { public static class QueryParam {

View File

@@ -1,35 +0,0 @@
package com.njcn.gather.result.pojo.vo;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @author wr
* @description
* @date 2024/12/31 15:00
*/
@Data
public class DetectionInfoVO {
/**
* 检测项目名称
*/
private String scriptTypeName;
/**
* 测试相
*/
private Integer index;
/**
* 是否检测合格
*/
private Integer fly;
/**
* 检测信息集合
*/
private List<DetectionInfoVO> children;
}

View File

@@ -0,0 +1,96 @@
package com.njcn.gather.result.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @author caozehui
* @data 2024-12-31
*/
@Data
public class ResultVO {
/**
* 结果数据
*/
private List<ResultData> resultData;
/**
* 原始数据
*/
private List<RawData> rawData;
@Data
public static class RawData {
/**
* 时间
*/
private String time;
/**
* (间)谐波次数
*/
private Double harmNum;
/**
* A相数据
*/
private BigDecimal dataA;
/**
* B相数据
*/
private BigDecimal dataB;
/**
* C相数据
*/
private BigDecimal dataC;
}
@Data
public static class ResultData {
/**
* 类别
*/
private String type;
/**
* (间)谐波次数
*/
private Double harmNum;
/**
* A相数据
*/
private BigDecimal DevDataA;
private BigDecimal SourceDataA;
/**
* B相数据
*/
private BigDecimal DevDataB;
private BigDecimal SourceDataB;
/**
* C相数据
*/
private BigDecimal DevDataC;
private BigDecimal SourceDataC;
/**
* T相数据
*/
private BigDecimal DevDataT;
private BigDecimal SourceDataT;
}
}

View File

@@ -2,15 +2,33 @@ package com.njcn.gather.result.pojo.vo;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author caozehui * @author wr
* @data 2024-12-31 * @description
* @date 2024/12/31 15:00
*/ */
@Data @Data
public class TreeDataVO { public class TreeDataVO {
private String id;
private String scriptName; /**
* 检测项目名称
*/
private String scriptTypeName;
/**
* 测试相
*/
private Integer index;
/**
* 是否检测合格
*/
private Integer fly;
/**
* 检测信息集合
*/
private List<TreeDataVO> children;
private TreeDataVO[] children;
} }

View File

@@ -1,8 +1,9 @@
package com.njcn.gather.result.service; package com.njcn.gather.result.service;
import com.njcn.gather.result.pojo.param.ResultParam; import com.njcn.gather.result.pojo.param.ResultParam;
import com.njcn.gather.result.pojo.vo.DetectionInfoVO;
import com.njcn.gather.result.pojo.vo.FormContentVO; import com.njcn.gather.result.pojo.vo.FormContentVO;
import com.njcn.gather.result.pojo.vo.ResultVO;
import com.njcn.gather.result.pojo.vo.TreeDataVO;
import java.util.List; import java.util.List;
@@ -26,7 +27,13 @@ public interface IResultService {
* @Author: wr * @Author: wr
* @Date: 2024/12/31 15:14 * @Date: 2024/12/31 15:14
*/ */
List<DetectionInfoVO> treeData(ResultParam param); List<TreeDataVO> treeData(ResultParam param);
/**
* 展示结果数据
* @param param
* @return
*/
ResultVO resultData(ResultParam param);
} }

View File

@@ -14,8 +14,9 @@ import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.result.pojo.enums.ResultUnitEnum; import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
import com.njcn.gather.result.pojo.param.ResultParam; import com.njcn.gather.result.pojo.param.ResultParam;
import com.njcn.gather.result.pojo.vo.DetectionInfoVO;
import com.njcn.gather.result.pojo.vo.FormContentVO; import com.njcn.gather.result.pojo.vo.FormContentVO;
import com.njcn.gather.result.pojo.vo.ResultVO;
import com.njcn.gather.result.pojo.vo.TreeDataVO;
import com.njcn.gather.result.service.IResultService; import com.njcn.gather.result.service.IResultService;
import com.njcn.gather.storage.pojo.po.AdBaseResult; import com.njcn.gather.storage.pojo.po.AdBaseResult;
import com.njcn.gather.storage.service.AdHarmonicService; import com.njcn.gather.storage.service.AdHarmonicService;
@@ -107,13 +108,12 @@ public class ResultServiceImpl implements IResultService {
} }
@Override @Override
public List<DetectionInfoVO> treeData(ResultParam param) { public List<TreeDataVO> treeData(ResultParam param) {
//根据所有的检测脚本查询出检测信息 //根据所有的检测脚本查询出检测信息
List<PqScriptDtls> dtlsList = pqScriptDtlsService.list(new MPJLambdaWrapper<PqScriptDtls>() List<PqScriptDtls> dtlsList = pqScriptDtlsService.list(new MPJLambdaWrapper<PqScriptDtls>()
.selectAll(PqScriptDtls.class) .selectAll(PqScriptDtls.class)
.eq(StrUtil.isNotBlank(param.getScriptId()), PqScriptDtls::getScriptId, param.getScriptId()) .eq(StrUtil.isNotBlank(param.getScriptId()), PqScriptDtls::getScriptId, param.getScriptId())
.eq(StrUtil.isNotBlank(param.getScriptType()), PqScriptDtls::getScriptType, param.getScriptType()) .eq(StrUtil.isNotBlank(param.getScriptType()), PqScriptDtls::getScriptType, param.getScriptType())
.eq(PqScriptDtls::getIndex, 81)
.ne(PqScriptDtls::getIndex, -1) .ne(PqScriptDtls::getIndex, -1)
.eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode())); .eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode()));
List<AdBaseResult> allResultList = new ArrayList<>(); List<AdBaseResult> allResultList = new ArrayList<>();
@@ -142,18 +142,18 @@ public class ResultServiceImpl implements IResultService {
Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId()); Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId());
PqDevVO dev = pqDevService.getPqDevById(param.getDevId()); PqDevVO dev = pqDevService.getPqDevById(param.getDevId());
List<DetectionInfoVO> infoVOS = new ArrayList<>(); List<TreeDataVO> infoVOS = new ArrayList<>();
Map<Integer, Set<Integer>> finalResultMap = resultMap; Map<Integer, Set<Integer>> finalResultMap = resultMap;
dtlsSortMap.forEach((key, value) -> { dtlsSortMap.forEach((key, value) -> {
DictTree dictTree = dictTreeMap.get(key); DictTree dictTree = dictTreeMap.get(key);
if (ObjectUtil.isNotNull(dictTree)) { if (ObjectUtil.isNotNull(dictTree)) {
List<DetectionInfoVO> scriptSubList=new ArrayList<>(); List<TreeDataVO> scriptSubList = new ArrayList<>();
LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream() LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream()
.sorted(Comparator.comparing(PqScriptDtls::getIndex)) .sorted(Comparator.comparing(PqScriptDtls::getIndex))
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList())); .collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
subTypeMap.forEach((subKey, subValue) -> { subTypeMap.forEach((subKey, subValue) -> {
List<DetectionInfoVO> scriptDlsList=new ArrayList<>(); List<TreeDataVO> scriptDlsList = new ArrayList<>();
//根据index进行分组统计小相检测信息 //根据index进行分组统计小相检测信息
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream() LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
.sorted(Comparator.comparing(PqScriptDtls::getIndex)) .sorted(Comparator.comparing(PqScriptDtls::getIndex))
@@ -162,54 +162,59 @@ public class ResultServiceImpl implements IResultService {
if (finalResultMap.containsKey(index)) { if (finalResultMap.containsKey(index)) {
Set<Integer> nums = finalResultMap.get(index); Set<Integer> nums = finalResultMap.get(index);
DetectionInfoVO childInfo = new DetectionInfoVO(); TreeDataVO childInfo = new TreeDataVO();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("输入:"); buffer.append("输入:");
List<PqScriptDtls> freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList()); List<PqScriptDtls> freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(freq)) { if (CollUtil.isNotEmpty(freq)) {
buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + " "); buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + " ");
}
List<PqScriptDtls> vol = scriptDtlIndex.stream().filter(x -> "VOL".equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(vol)) {
Float unit = 1f;
if (isValueType) {
unit = dev.getDevVolt();
}
for (PqScriptDtls dtls : vol) {
BigDecimal volValue = new BigDecimal(dtls.getValue());
BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(unit.toString()));
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit()
+ ",相角=" + dtls.getAngle() + "° ");
} }
List<PqScriptDtls> vol = scriptDtlIndex.stream().filter(x -> "VOL".equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(vol)) {
Float unit = 1f;
if (isValueType) {
unit = dev.getDevVolt();
}
for (PqScriptDtls dtls : vol) {
BigDecimal volValue = new BigDecimal(dtls.getValue());
BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(unit.toString()));
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit() + " ");
}
}
List<PqScriptDtls> cur = scriptDtlIndex.stream().filter(x -> "CUR".equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(cur)) {
Float unit = 1f;
if (isValueType) {
unit = dev.getDevCurr();
} }
List<PqScriptDtls> cur = scriptDtlIndex.stream().filter(x -> "CUR".equals(x.getValueType())) for (PqScriptDtls dtls : cur) {
.sorted(Comparator.comparing(PqScriptDtls::getPhase)) BigDecimal volValue = new BigDecimal(dtls.getValue());
.collect(Collectors.toList()); BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
if (CollUtil.isNotEmpty(cur)) { .multiply(new BigDecimal(unit.toString()));
Float unit = 1f; buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit()
if (isValueType) { + ",相角=" + dtls.getAngle() + "° ");
unit = dev.getDevCurr();
}
for (PqScriptDtls dtls : vol) {
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue()*0.01*unit + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit() + " ");
}
} }
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "次谐波电压幅值", ResultUnitEnum.HV_UNIT.getUnit(), true); }
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "次谐波电流幅值", ResultUnitEnum.HI_UNIT.getUnit(), true); dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true);
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "次间谐波电压幅值", ResultUnitEnum.HSV_UNIT.getUnit(), false); dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "h", ResultUnitEnum.HI_UNIT.getUnit(), true);
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "次间谐波电流幅值", ResultUnitEnum.HSI_UNIT.getUnit(), false); dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false);
dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit()); dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "i", ResultUnitEnum.HSI_UNIT.getUnit(), false);
dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变"); dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
childInfo.setIndex(index); dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变");
childInfo.setIndex(index);
childInfo.setFly(conform(nums)); childInfo.setFly(conform(nums));
childInfo.setScriptTypeName(buffer.toString()); childInfo.setScriptTypeName(buffer.toString());
scriptDlsList.add(childInfo); scriptDlsList.add(childInfo);
} }
}); });
if (CollUtil.isNotEmpty(scriptDlsList)) { if (CollUtil.isNotEmpty(scriptDlsList)) {
DetectionInfoVO sub=new DetectionInfoVO(); TreeDataVO sub = new TreeDataVO();
sub.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName())); sub.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
sub.setChildren(scriptDlsList); sub.setChildren(scriptDlsList);
scriptSubList.add(sub); scriptSubList.add(sub);
@@ -217,7 +222,7 @@ public class ResultServiceImpl implements IResultService {
}); });
if (CollUtil.isNotEmpty(scriptSubList)) { if (CollUtil.isNotEmpty(scriptSubList)) {
//大相检测信息 //大相检测信息
DetectionInfoVO infoVO = new DetectionInfoVO(); TreeDataVO infoVO = new TreeDataVO();
infoVO.setScriptTypeName(dictTree.getName()); infoVO.setScriptTypeName(dictTree.getName());
infoVO.setChildren(scriptSubList); infoVO.setChildren(scriptSubList);
infoVOS.add(infoVO); infoVOS.add(infoVO);
@@ -227,23 +232,28 @@ public class ResultServiceImpl implements IResultService {
return infoVOS; return infoVOS;
} }
@Override
public ResultVO resultData(ResultParam param) {
return null;
}
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) { private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream() LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream()
.filter(x -> valueType.equals(x.getValueType())) .filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getIndex)) .sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList())); .collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
harmNumMap.forEach((harmNum, value) -> { harmNumMap.forEach((harmNum, value) -> {
if (fly) { if (fly) {
buffer.append(String.format("%.0f", harmNum) + name + "("); buffer.append(name + String.format("%.0f", harmNum) + "(");
} else { } else {
buffer.append(harmNum + name + "("); buffer.append(name + harmNum + "(");
} }
if (CollUtil.isNotEmpty(value)) {
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) for (PqScriptDtls dtls : value) {
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) {
for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " "); buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " ");
} }
buffer.append(") "); buffer.append(") ");
@@ -254,7 +264,7 @@ public class ResultServiceImpl implements IResultService {
} }
private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex,StringBuffer buffer, String valueType, String name, String unit) { private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit) {
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)) .sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -262,21 +272,21 @@ public class ResultServiceImpl implements IResultService {
buffer.append(name + " "); buffer.append(name + " ");
for (PqScriptDtls dtls : list) { for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit()
+ " 暂态持续时间=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") "); + " 暂态持续时间=" + dtls.getRetainTime().intValue() + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") ");
} }
} }
} }
private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex,StringBuffer buffer, String valueType, String name) { private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)) .sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
buffer.append(name + " "); buffer.append(name + " ");
for (PqScriptDtls dtls : list) { for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getTransValue() buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre()
+ "次/min 变动量=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") "); + "次/min 变动量=" + dtls.getChagValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
} }
} }

View File

@@ -0,0 +1,37 @@
package com.njcn.gather.storage.pojo.param;
import lombok.Data;
/**
* @author wr
* @description
* @date 2025/1/2 16:01
*/
@Data
public class StorageParam {
/**
* 检测大相信息
*/
private Integer index;
/**
* 检测脚本id
*/
private String scriptId;
/**
* 装置id
*/
private String devId;
/**
* 装置通道
*/
private String devNum;
/**
* 自动生成,用于生成数据表后缀
*/
private Integer code;
}

View File

@@ -0,0 +1,40 @@
package com.njcn.gather.storage.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author wr
* @description
* @date 2025/1/2 15:53
*/
@Data
public class RawDataVO {
/**
* 时间
*/
private String time;
/**
* (间)谐波次数
*/
private Double harmNum;
/**
* A相数据
*/
private BigDecimal dataA;
/**
* B相数据
*/
private BigDecimal dataB;
/**
* C相数据
*/
private BigDecimal dataC;
}