From cf96b8ed83e7f6d00a5c9b41705c63c12c937794 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 2 Jan 2025 19:08:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=AD=A3=E5=BC=8F=E6=A3=80=E6=B5=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detection/pojo/vo/DetectionData.java | 9 +- .../service/impl/DetectionServiceImpl.java | 25 ++-- .../result/controller/ResultController.java | 6 +- .../gather/result/pojo/param/ResultParam.java | 6 +- .../result/pojo/vo/DetectionInfoVO.java | 35 ----- .../njcn/gather/result/pojo/vo/ResultVO.java | 96 +++++++++++++ .../gather/result/pojo/vo/TreeDataVO.java | 28 +++- .../gather/result/service/IResultService.java | 11 +- .../service/impl/ResultServiceImpl.java | 132 ++++++++++-------- .../storage/pojo/param/StorageParam.java | 37 +++++ .../gather/storage/pojo/vo/RawDataVO.java | 40 ++++++ 11 files changed, 304 insertions(+), 121 deletions(-) delete mode 100644 detection/src/main/java/com/njcn/gather/result/pojo/vo/DetectionInfoVO.java create mode 100644 detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java create mode 100644 storage/src/main/java/com/njcn/gather/storage/pojo/param/StorageParam.java create mode 100644 storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java b/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java index 8f7af969..9cbb1236 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java @@ -23,7 +23,14 @@ public class DetectionData { private Integer isData; /** - * 原始数据 + * 装置原始数据 */ private Double data; + + /** + * 检测源定值 + */ + private Double resultData; + + } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index d9cc45d5..de297afa 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -213,7 +213,7 @@ public class DetectionServiceImpl { result.setDataType("avg"); if (map.containsKey(TYPE_T)) { 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()); } else { //取出源所对应的相别信息 @@ -221,19 +221,19 @@ public class DetectionServiceImpl { .filter(x -> (type + "a").equals(x.getChannelType())) .collect(Collectors.toList()); 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 channelTypeBList = sourceIssue.getChannelList().stream() .filter(x -> (type + "b").equals(x.getChannelType())) .collect(Collectors.toList()); 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 channelTypeCList = sourceIssue.getChannelList().stream() .filter(x -> (type + "c").equals(x.getChannelType())) .collect(Collectors.toList()); 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 numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()).stream().distinct().collect(Collectors.toList()); return getAdNonHarmonicResult(result, numbers); @@ -332,19 +332,19 @@ public class DetectionServiceImpl { .filter(x -> TYPE_A.equals(x.getPhase())) .collect(Collectors.toList()); 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 channelTypeBList = checkData.stream() .filter(x -> TYPE_B.equals(x.getPhase())) .collect(Collectors.toList()); 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 channelTypeCList = checkData.stream() .filter(x -> TYPE_C.equals(x.getPhase())) .collect(Collectors.toList()); 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 numbers = Arrays.asList(a.getIsData(), b.getIsData(), a.getIsData()); return getAdNonHarmonicResult(result, numbers); @@ -431,7 +431,7 @@ public class DetectionServiceImpl { retainATime = channelTypeAList.get(0).getFAmp(); } 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 channelTypeBList = sourceIssue.getChannelList().stream() .filter(x -> ("Ub").equals(x.getChannelType())) @@ -443,7 +443,7 @@ public class DetectionServiceImpl { retainBTime = channelTypeBList.get(0).getFAmp(); } 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 channelTypeCList = sourceIssue.getChannelList().stream() .filter(x -> ("Uc").equals(x.getChannelType())) @@ -455,7 +455,7 @@ public class DetectionServiceImpl { retainCTime = channelTypeCList.get(0).getFAmp(); } 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 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())) { idField.set(harmonicResult, value.getData()); } else { - idField.set(harmonicResult, value.getData() + "_" + value.getIsData()); + idField.set(harmonicResult, value.getData() + "_" + value.getIsData()+"_"+value.getResultData()); } } catch (IllegalAccessException e) { throw new RuntimeException(e); @@ -645,6 +645,7 @@ public class DetectionServiceImpl { errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), fData, 0)); } Double v = issueHarmMap.get(harm); + data.setResultData(v); setDetection(dataRule, harmDataList, errSysDtl, data, v); } 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()))) ).collect(Collectors.toList()); + detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue()); if (CollUtil.isNotEmpty(qualifiedList)) { detectionData.setData(qualifiedList.get(0)); switch (dataRule) { @@ -798,6 +800,7 @@ public class DetectionServiceImpl { if (0 == errSysDtl.getErrorValueType()) { errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0)); } + detectionData.setResultData(errSysDtl.getMaxErrorValue()); setDetection(dataRule, list, errSysDtl, detectionData, channelData); } } diff --git a/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java b/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java index bcf6b8db..a281c0eb 100644 --- a/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java +++ b/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java @@ -5,8 +5,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.LogUtil; 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.TreeDataVO; import com.njcn.gather.result.service.IResultService; import com.njcn.web.controller.BaseController; import com.njcn.web.utils.HttpResultUtil; @@ -50,9 +50,9 @@ public class ResultController extends BaseController { @PostMapping("/treeData") @ApiOperation("查询检测结果-树形结构的具体检测项") @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) - public HttpResult> treeData(@RequestBody @Validated ResultParam queryParam) { + public HttpResult> treeData(@RequestBody @Validated ResultParam queryParam) { String methodDescribe = getMethodDescribe("treeData"); - List infoVOS = resultService.treeData(queryParam); + List infoVOS = resultService.treeData(queryParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe); } } diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java index 012bea48..84e5f900 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java @@ -28,17 +28,17 @@ public class ResultParam { /** * 装置id */ - private String devId="5eaba83670ff4d9daf892a62a5e13ea3"; + private String devId; /** * 装置通道 */ - private String devNum="1"; + private String devNum; /** * 自动生成,用于生成数据表后缀 */ - private Integer code=1; + private Integer code; @Data public static class QueryParam { diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/DetectionInfoVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/DetectionInfoVO.java deleted file mode 100644 index 2ff4dcb0..00000000 --- a/detection/src/main/java/com/njcn/gather/result/pojo/vo/DetectionInfoVO.java +++ /dev/null @@ -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 children; - - -} diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java new file mode 100644 index 00000000..2ec9e331 --- /dev/null +++ b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java @@ -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; + + + /** + * 原始数据 + */ + private List 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; + + } +} diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/TreeDataVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/TreeDataVO.java index c459a4b1..b0af84da 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/vo/TreeDataVO.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/vo/TreeDataVO.java @@ -2,15 +2,33 @@ package com.njcn.gather.result.pojo.vo; import lombok.Data; +import java.util.List; + /** - * @author caozehui - * @data 2024-12-31 + * @author wr + * @description + * @date 2024/12/31 15:00 */ @Data public class TreeDataVO { - private String id; - private String scriptName; + /** + * 检测项目名称 + */ + private String scriptTypeName; + /** + * 测试相 + */ + private Integer index; + /** + * 是否检测合格 + */ + private Integer fly; + + /** + * 检测信息集合 + */ + private List children; + - private TreeDataVO[] children; } diff --git a/detection/src/main/java/com/njcn/gather/result/service/IResultService.java b/detection/src/main/java/com/njcn/gather/result/service/IResultService.java index 5ca2b418..b809855a 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/IResultService.java +++ b/detection/src/main/java/com/njcn/gather/result/service/IResultService.java @@ -1,8 +1,9 @@ package com.njcn.gather.result.service; 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.ResultVO; +import com.njcn.gather.result.pojo.vo.TreeDataVO; import java.util.List; @@ -26,7 +27,13 @@ public interface IResultService { * @Author: wr * @Date: 2024/12/31 15:14 */ - List treeData(ResultParam param); + List treeData(ResultParam param); + /** + * 展示结果数据 + * @param param + * @return + */ + ResultVO resultData(ResultParam param); } diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index 4b3a0bfa..7f5c4a81 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -14,8 +14,9 @@ import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.result.pojo.enums.ResultUnitEnum; 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.ResultVO; +import com.njcn.gather.result.pojo.vo.TreeDataVO; import com.njcn.gather.result.service.IResultService; import com.njcn.gather.storage.pojo.po.AdBaseResult; import com.njcn.gather.storage.service.AdHarmonicService; @@ -107,13 +108,12 @@ public class ResultServiceImpl implements IResultService { } @Override - public List treeData(ResultParam param) { + public List treeData(ResultParam param) { //根据所有的检测脚本查询出检测信息 List dtlsList = pqScriptDtlsService.list(new MPJLambdaWrapper() .selectAll(PqScriptDtls.class) .eq(StrUtil.isNotBlank(param.getScriptId()), PqScriptDtls::getScriptId, param.getScriptId()) .eq(StrUtil.isNotBlank(param.getScriptType()), PqScriptDtls::getScriptType, param.getScriptType()) - .eq(PqScriptDtls::getIndex, 81) .ne(PqScriptDtls::getIndex, -1) .eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode())); List allResultList = new ArrayList<>(); @@ -142,18 +142,18 @@ public class ResultServiceImpl implements IResultService { Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId()); PqDevVO dev = pqDevService.getPqDevById(param.getDevId()); - List infoVOS = new ArrayList<>(); + List infoVOS = new ArrayList<>(); Map> finalResultMap = resultMap; dtlsSortMap.forEach((key, value) -> { DictTree dictTree = dictTreeMap.get(key); if (ObjectUtil.isNotNull(dictTree)) { - List scriptSubList=new ArrayList<>(); + List scriptSubList = new ArrayList<>(); LinkedHashMap> subTypeMap = value.stream() .sorted(Comparator.comparing(PqScriptDtls::getIndex)) .collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList())); subTypeMap.forEach((subKey, subValue) -> { - List scriptDlsList=new ArrayList<>(); + List scriptDlsList = new ArrayList<>(); //根据index进行分组统计小相检测信息 LinkedHashMap> indexMap = subValue.stream() .sorted(Comparator.comparing(PqScriptDtls::getIndex)) @@ -162,54 +162,59 @@ public class ResultServiceImpl implements IResultService { if (finalResultMap.containsKey(index)) { Set nums = finalResultMap.get(index); - DetectionInfoVO childInfo = new DetectionInfoVO(); - StringBuffer buffer = new StringBuffer(); - buffer.append("输入:"); - List freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(freq)) { - buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + " "); + TreeDataVO childInfo = new TreeDataVO(); + StringBuffer buffer = new StringBuffer(); + buffer.append("输入:"); + List freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(freq)) { + buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + " "); + } + List 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 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 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 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(); - } - for (PqScriptDtls dtls : vol) { - buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue()*0.01*unit + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit() + " "); - } + for (PqScriptDtls dtls : cur) { + 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("I" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit() + + ",相角=" + dtls.getAngle() + "° "); } - dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "次谐波电压幅值", ResultUnitEnum.HV_UNIT.getUnit(), true); - dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "次谐波电流幅值", ResultUnitEnum.HI_UNIT.getUnit(), true); - dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "次间谐波电压幅值", ResultUnitEnum.HSV_UNIT.getUnit(), false); - dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "次间谐波电流幅值", ResultUnitEnum.HSI_UNIT.getUnit(), false); - dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit()); - dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变"); - childInfo.setIndex(index); + } + dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true); + dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "h", ResultUnitEnum.HI_UNIT.getUnit(), true); + dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false); + dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "i", ResultUnitEnum.HSI_UNIT.getUnit(), false); + dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit()); + dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变"); + childInfo.setIndex(index); childInfo.setFly(conform(nums)); - childInfo.setScriptTypeName(buffer.toString()); - scriptDlsList.add(childInfo); + childInfo.setScriptTypeName(buffer.toString()); + scriptDlsList.add(childInfo); } }); if (CollUtil.isNotEmpty(scriptDlsList)) { - DetectionInfoVO sub=new DetectionInfoVO(); + TreeDataVO sub = new TreeDataVO(); sub.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName())); sub.setChildren(scriptDlsList); scriptSubList.add(sub); @@ -217,7 +222,7 @@ public class ResultServiceImpl implements IResultService { }); if (CollUtil.isNotEmpty(scriptSubList)) { //大相检测信息 - DetectionInfoVO infoVO = new DetectionInfoVO(); + TreeDataVO infoVO = new TreeDataVO(); infoVO.setScriptTypeName(dictTree.getName()); infoVO.setChildren(scriptSubList); infoVOS.add(infoVO); @@ -227,23 +232,28 @@ public class ResultServiceImpl implements IResultService { return infoVOS; } + @Override + public ResultVO resultData(ResultParam param) { + + + + + return null; + } + private static void dtlsSetBuffer(List scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) { LinkedHashMap> harmNumMap = scriptDtlIndex.stream() .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())); harmNumMap.forEach((harmNum, value) -> { if (fly) { - buffer.append(String.format("%.0f", harmNum) + name + "("); + buffer.append(name + String.format("%.0f", harmNum) + "("); } else { - buffer.append(harmNum + name + "("); + buffer.append(name + harmNum + "("); } - - List list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) - .sorted(Comparator.comparing(PqScriptDtls::getPhase)) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(list)) { - for (PqScriptDtls dtls : list) { + if (CollUtil.isNotEmpty(value)) { + for (PqScriptDtls dtls : value) { buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " "); } buffer.append(") "); @@ -254,7 +264,7 @@ public class ResultServiceImpl implements IResultService { } - private static void dtlsSetBufferDip(List scriptDtlIndex,StringBuffer buffer, String valueType, String name, String unit) { + private static void dtlsSetBufferDip(List scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit) { List list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) .sorted(Comparator.comparing(PqScriptDtls::getPhase)) .collect(Collectors.toList()); @@ -262,21 +272,21 @@ public class ResultServiceImpl implements IResultService { buffer.append(name + " "); for (PqScriptDtls dtls : list) { 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 scriptDtlIndex,StringBuffer buffer, String valueType, String name) { + private static void dtlsSetBufferFlicker(List scriptDtlIndex, StringBuffer buffer, String valueType, String name) { List list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) .sorted(Comparator.comparing(PqScriptDtls::getPhase)) .collect(Collectors.toList()); if (CollUtil.isNotEmpty(list)) { buffer.append(name + " "); for (PqScriptDtls dtls : list) { - buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getTransValue() - + "次/min 变动量=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") "); + buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre() + + "次/min 变动量=" + dtls.getChagValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") "); } } diff --git a/storage/src/main/java/com/njcn/gather/storage/pojo/param/StorageParam.java b/storage/src/main/java/com/njcn/gather/storage/pojo/param/StorageParam.java new file mode 100644 index 00000000..7d1d645d --- /dev/null +++ b/storage/src/main/java/com/njcn/gather/storage/pojo/param/StorageParam.java @@ -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; +} diff --git a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java new file mode 100644 index 00000000..0ae6f61c --- /dev/null +++ b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java @@ -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; +}