1.正式检测-检测树
This commit is contained in:
@@ -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,12 +50,9 @@ public class ResultController extends BaseController {
|
||||
@PostMapping("/treeData")
|
||||
@ApiOperation("查询检测结果-树形结构的具体检测项")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<TreeDataVO>> treeData(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
||||
public HttpResult<List<DetectionInfoVO>> treeData(@RequestBody @Validated ResultParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("treeData");
|
||||
|
||||
|
||||
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
List<DetectionInfoVO> infoVOS = resultService.treeData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.gather.result.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024/11/9
|
||||
*/
|
||||
@Getter
|
||||
public enum ResultUnitEnum {
|
||||
|
||||
FREQ_UNIT("Hz", "频率"),
|
||||
V_RELATIVE_UNIT("%Un", "电压"),
|
||||
V_ABSOLUTELY_UNIT("V", "电压"),
|
||||
I_RELATIVE_UNIT("%In", "电流"),
|
||||
I_ABSOLUTELY_UNIT("A", "电流"),
|
||||
HV_UNIT("%", "谐波电压"),
|
||||
HI_UNIT("%", "谐波电流"),
|
||||
HP_UNIT("W", "谐波有功功率"),
|
||||
HSV_UNIT("%", "间谐波电压"),
|
||||
HSI_UNIT("%", "间谐波电流"),
|
||||
VOLTAGE_MAG_UNIT("周波", "暂态持续时间"),
|
||||
VOLTAGE_DUR_UNIT("%", "暂态深度"),
|
||||
IMBV_UNIT("%", "电压不平衡度"),
|
||||
IMBA_UNIT("%", "电流不平衡度"),
|
||||
|
||||
;
|
||||
|
||||
private String unit;
|
||||
private String name;
|
||||
|
||||
ResultUnitEnum(String unit, String name) {
|
||||
this.unit = unit;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,31 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class ResultParam {
|
||||
|
||||
/**
|
||||
* 检测大相信息
|
||||
*/
|
||||
private String scriptType;
|
||||
|
||||
/**
|
||||
* 检测脚本id
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String devId="5eaba83670ff4d9daf892a62a5e13ea3";
|
||||
|
||||
/**
|
||||
* 装置通道
|
||||
*/
|
||||
private String devNum="1";
|
||||
|
||||
/**
|
||||
* 自动生成,用于生成数据表后缀
|
||||
*/
|
||||
private Integer code=1;
|
||||
|
||||
@Data
|
||||
public static class QueryParam {
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,30 @@
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-30
|
||||
*/
|
||||
public interface IResultService {
|
||||
/**
|
||||
* 检测详情表单头
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
FormContentVO getFormContent(ResultParam.QueryParam queryParam);
|
||||
|
||||
|
||||
/**
|
||||
* 获取检测详情信息
|
||||
* @param param
|
||||
* @return: java.util.List<com.njcn.gather.result.pojo.vo.DetectionInfoVO>
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/31 15:14
|
||||
*/
|
||||
List<DetectionInfoVO> treeData(ResultParam param);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.njcn.gather.result.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
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.service.IResultService;
|
||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||
@@ -20,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -37,9 +45,12 @@ public class ResultServiceImpl implements IResultService {
|
||||
private final AdNonHarmonicService adNonHarmonicService;
|
||||
private final AdHarmonicService adHarmonicService;
|
||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||
private final PqScriptMapper scriptMapper;
|
||||
private final IDictTreeService dictTreeService;
|
||||
|
||||
// 谐波类code,取树形字典表中的code
|
||||
/**
|
||||
* 谐波类code,取树形字典表中的code
|
||||
*/
|
||||
private final List<String> HARMONIC_TYPE_CODE = Arrays.asList("HV", "HI", "HP", "HSV", "HSI");
|
||||
|
||||
|
||||
@@ -60,35 +71,22 @@ public class ResultServiceImpl implements IResultService {
|
||||
List<Map<String, String>> chnList = new ArrayList<>();
|
||||
|
||||
List<AdBaseResult> allResultList = new ArrayList<>();
|
||||
|
||||
if (ObjectUtil.isNotNull(queryParam.getScriptType())) { //只查询指定的脚本类型
|
||||
//只查询指定的脚本类型
|
||||
if (ObjectUtil.isNotNull(queryParam.getScriptType())) {
|
||||
List<Integer> indexList = pqScriptDtlsService.getIndexList(queryParam.getScriptType(), scriptId);
|
||||
DictTree dictTree = dictTreeService.getById(queryParam.getScriptType());
|
||||
|
||||
if (HARMONIC_TYPE_CODE.contains(dictTree.getCode())) {
|
||||
String prefix = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + plan.getCode());
|
||||
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum()));
|
||||
DynamicTableNameHandler.remove();
|
||||
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
|
||||
} else {
|
||||
String prefix = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + plan.getCode());
|
||||
allResultList.addAll(adNonHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum()));
|
||||
DynamicTableNameHandler.remove();
|
||||
allResultList.addAll(adNonHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
|
||||
}
|
||||
} else { //查询所有的脚本类型
|
||||
String prefix = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + plan.getCode());
|
||||
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum()));
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
prefix = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + plan.getCode());
|
||||
allResultList.addAll(adNonHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum()));
|
||||
DynamicTableNameHandler.remove();
|
||||
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
|
||||
allResultList.addAll(adNonHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(allResultList)){
|
||||
if (ObjectUtil.isNotEmpty(allResultList)) {
|
||||
Map<String, List<AdBaseResult>> chnMap = allResultList.stream().collect(
|
||||
Collectors.groupingBy(obj -> obj.getMonitorId().substring(obj.getMonitorId().lastIndexOf("_") + 1))
|
||||
);
|
||||
@@ -102,8 +100,198 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
chnList.sort(Comparator.comparingInt(o -> Integer.parseInt(o.get("value"))));
|
||||
|
||||
formContentVO.setChnList(chnList);
|
||||
return formContentVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetectionInfoVO> treeData(ResultParam param) {
|
||||
//根据所有的检测脚本查询出检测信息
|
||||
List<PqScriptDtls> dtlsList = pqScriptDtlsService.list(new MPJLambdaWrapper<PqScriptDtls>()
|
||||
.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<AdBaseResult> allResultList = new ArrayList<>();
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(param.getScriptType())) {
|
||||
indexList = pqScriptDtlsService.getIndexList(param.getScriptType(), param.getScriptId());
|
||||
}
|
||||
allResultList.addAll(adNonHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
||||
allResultList.addAll(adHarmonicService.get(param.getScriptId(), indexList, param.getDevId(), param.getDevNum(), param.getCode()));
|
||||
Map<Integer, Set<Integer>> resultMap = new HashMap<>(5);
|
||||
if (CollUtil.isNotEmpty(allResultList)) {
|
||||
resultMap = allResultList.stream().collect(Collectors.groupingBy(AdBaseResult::getIndex, Collectors.mapping(AdBaseResult::getResultFlag, Collectors.toSet())));
|
||||
}
|
||||
|
||||
Map<String, List<PqScriptDtls>> dtlsSortMap = dtlsList.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(dtlsSortMap.keySet()));
|
||||
|
||||
Map<String, DictTree> dictTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||
Map<String, String> subName = new LinkedHashMap<>();
|
||||
subName.put("Base", "额定工作条件下的测量");
|
||||
subName.put("VOL", "电压对XX测量的影响");
|
||||
subName.put("Freq", "频率对XX测量的影响");
|
||||
subName.put("Harm", "谐波对XX测量的影响");
|
||||
Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
|
||||
|
||||
List<DetectionInfoVO> infoVOS = new ArrayList<>();
|
||||
Map<Integer, Set<Integer>> finalResultMap = resultMap;
|
||||
dtlsSortMap.forEach((key, value) -> {
|
||||
DictTree dictTree = dictTreeMap.get(key);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
List<DetectionInfoVO> scriptSubList=new ArrayList<>();
|
||||
|
||||
LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
|
||||
subTypeMap.forEach((subKey, subValue) -> {
|
||||
List<DetectionInfoVO> scriptDlsList=new ArrayList<>();
|
||||
//根据index进行分组统计小相检测信息
|
||||
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
||||
indexMap.forEach((index, scriptDtlIndex) -> {
|
||||
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
Set<Integer> nums = finalResultMap.get(index);
|
||||
DetectionInfoVO childInfo = new DetectionInfoVO();
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("输入:");
|
||||
List<PqScriptDtls> 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<PqScriptDtls> vol = scriptDtlIndex.stream().filter(x -> "VOL".equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(vol)) {
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + " ");
|
||||
}
|
||||
|
||||
}
|
||||
List<PqScriptDtls> cur = scriptDtlIndex.stream().filter(x -> "CUR".equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(cur)) {
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.I_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + " ");
|
||||
}
|
||||
}
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "Harm_V", "次谐波电压幅值", ResultUnitEnum.HV_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "Harm_I", "次谐波电流幅值", ResultUnitEnum.HI_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "InHarm_V", "次间谐波电压幅值", ResultUnitEnum.HSV_UNIT.getUnit(), false);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "InHarm_I", "次间谐波电流幅值", ResultUnitEnum.HSI_UNIT.getUnit(), false);
|
||||
dtlsSetBufferDip(scriptDtlIndex, vol, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
|
||||
dtlsSetBufferFlicker(scriptDtlIndex, vol, buffer, "Flicker", "闪变");
|
||||
childInfo.setIndex(index);
|
||||
childInfo.setFly(conform(nums));
|
||||
childInfo.setScriptTypeName(buffer.toString());
|
||||
scriptDlsList.add(childInfo);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(scriptDlsList)) {
|
||||
DetectionInfoVO sub=new DetectionInfoVO();
|
||||
sub.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
||||
sub.setChildren(scriptDlsList);
|
||||
scriptSubList.add(sub);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(scriptSubList)) {
|
||||
//大相检测信息
|
||||
DetectionInfoVO infoVO = new DetectionInfoVO();
|
||||
infoVO.setScriptTypeName(dictTree.getName());
|
||||
infoVO.setChildren(scriptSubList);
|
||||
infoVOS.add(infoVO);
|
||||
}
|
||||
}
|
||||
});
|
||||
return infoVOS;
|
||||
}
|
||||
|
||||
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
|
||||
LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream()
|
||||
.filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
harmNumMap.forEach((harmNum, value) -> {
|
||||
if (fly) {
|
||||
buffer.append(String.format("%.0f", harmNum) + name + "(");
|
||||
} else {
|
||||
buffer.append(harmNum + name + "(");
|
||||
}
|
||||
|
||||
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " ");
|
||||
}
|
||||
buffer.append(") ");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, StringBuffer buffer, String valueType, String name, String unit) {
|
||||
List<PqScriptDtls> 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 : vol) {
|
||||
buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit()
|
||||
+ " 暂态持续时间=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, StringBuffer buffer, String valueType, String name) {
|
||||
List<PqScriptDtls> 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 : vol) {
|
||||
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getTransValue()
|
||||
+ "次/min 变动量=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Integer conform(Set<Integer> numbers) {
|
||||
if (numbers.size() > 2) {
|
||||
return 4;
|
||||
} else if (numbers.size() > 1) {
|
||||
if (numbers.contains(4)) {
|
||||
return 4;
|
||||
} else if (numbers.contains(2)) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(numbers).get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||
//根据检测脚本id和检测序号,查询出检测子项目
|
||||
return this.list(new MPJLambdaWrapper<PqErrSysDtls>()
|
||||
.selectAll(PqErrSysDtls.class)
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface PqScriptMapper extends MPJBaseMapper<PqScript> {
|
||||
|
||||
/**
|
||||
* 获取检测脚本信息
|
||||
* 获取检测脚本信息(先获取检测脚本类型是否相对值 true相对值 false绝对值(相对值要乘额定值,绝对值不需要处理))
|
||||
* @param scriptId
|
||||
* @return: com.njcn.gather.device.script.pojo.po.PqScript
|
||||
* @Author: wr
|
||||
|
||||
@@ -178,9 +178,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
.collect(Collectors.toList());
|
||||
//谐波电流,间谐波电流
|
||||
List<PqScriptDtls> dtlsIList = value.stream().filter(x -> HARM_I.equals(x.getValueType()) ||
|
||||
INHARM_I.equals(x.getValueType()) ||
|
||||
DIP.equals(x.getValueType()) ||
|
||||
FLICKER.equals(x.getValueType())
|
||||
INHARM_I.equals(x.getValueType())
|
||||
)
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -19,7 +19,8 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
||||
* @param index 序号列表
|
||||
* @param deviceId 设备ID
|
||||
* @param chnNum 通道号,从1开始
|
||||
* @param code 计划code
|
||||
* @return 谐波结果
|
||||
*/
|
||||
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum);
|
||||
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum,Integer code);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
||||
* @param chnNum 通道号,从1开始
|
||||
* @return 非谐波结果
|
||||
*/
|
||||
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum);
|
||||
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum,Integer code);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.storage.mapper.AdHarmonicMappper;
|
||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
@@ -19,7 +21,9 @@ import java.util.List;
|
||||
@Service
|
||||
public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarmonicResult> implements AdHarmonicService {
|
||||
@Override
|
||||
public List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum) {
|
||||
public List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum,Integer code ) {
|
||||
String prefix = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix +code);
|
||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
String monitorId = deviceId + "_" + chnNum;
|
||||
if ("-1".equals(chnNum)) {
|
||||
@@ -27,8 +31,9 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
}
|
||||
wrapper.like(AdHarmonicResult::getMonitorId, monitorId)
|
||||
.eq(ObjectUtil.isNotNull(scriptId), AdHarmonicResult::getScriptId, scriptId)
|
||||
.in(ObjectUtil.isNotEmpty(index), AdHarmonicResult::getIndex, index);
|
||||
.in(CollUtil.isNotEmpty(index), AdHarmonicResult::getIndex, index);
|
||||
List<AdHarmonicResult> list = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return BeanUtil.copyToList(list, AdBaseResult.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.storage.mapper.AdNonHarmonicMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
@@ -19,7 +21,10 @@ import java.util.List;
|
||||
public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, AdNonHarmonicResult> implements AdNonHarmonicService {
|
||||
|
||||
@Override
|
||||
public List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum) {
|
||||
public List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum, Integer code) {
|
||||
String prefix = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + code);
|
||||
|
||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
String monitorId = deviceId + "_" + chnNum;
|
||||
if ("-1".equals(chnNum)) {
|
||||
@@ -27,8 +32,9 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
}
|
||||
wrapper.like(AdNonHarmonicResult::getMonitorId, monitorId)
|
||||
.eq(ObjectUtil.isNotNull(scriptId), AdNonHarmonicResult::getScriptId, scriptId)
|
||||
.in(ObjectUtil.isNotEmpty(index), AdNonHarmonicResult::getIndex, index);
|
||||
.in(CollUtil.isNotEmpty(index), AdNonHarmonicResult::getIndex, index);
|
||||
List<AdNonHarmonicResult> list = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||
DynamicTableNameHandler.remove();
|
||||
return BeanUtil.copyToList(list, AdBaseResult.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,4 +64,11 @@ public interface IDictTreeService extends IService<DictTree> {
|
||||
* @date 2023/12/18
|
||||
*/
|
||||
//List<DictTree> queryAllByType(Integer type);
|
||||
|
||||
/**
|
||||
* 根据字典树
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<DictTree> getDictTreeById(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -155,6 +155,13 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
}).sorted(Comparator.comparingInt(DictTree::getSort)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictTree> getDictTreeById(List<String> ids) {
|
||||
return this.list(new LambdaQueryWrapper<DictTree>()
|
||||
.in(DictTree::getId,ids)
|
||||
);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<DictTree> queryAll() {
|
||||
// LambdaQueryWrapper<DictTree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user