代码调整

This commit is contained in:
2025-01-06 21:02:37 +08:00
parent a5e4baeb16
commit ed69e53d69
22 changed files with 1008 additions and 162 deletions

View File

@@ -13,6 +13,8 @@
<result column="Series" property="devCode" />
<result column="Dev_Key" property="devKey" />
<result column="icdType" property="icdType" />
<result column="Dev_Volt" property="devVolt" />
<result column="Dev_Curr" property="devCurr" />
<collection
property="monitorList"
@@ -31,6 +33,8 @@
d.Dev_Chns as devChns,
d.Series,
d.Dev_Key,
d.Dev_Volt,
d.Dev_Curr,
p.name icdType
FROM
pq_dev d

View File

@@ -69,6 +69,10 @@ public class PreDetection {
@JSONField(serialize = false)
private Integer devChns;
private Double devVolt;
private Double devCurr;
/**
* 监测点信息
*/

View File

@@ -12,6 +12,13 @@ public enum CommonEnum {
NO("0", ""),
YES("1", ""),
COEFFICIENT_TEST("0","系数校验"),
PRE_TEST("1","预检测"),
FORMAL_TEST("2","正式检测"),
TIME_TEST("3","守时检测"),
PHASE_TEST("4","相序检测"),
;
private String value;

View File

@@ -23,8 +23,8 @@ public class PqScriptIssueParam {
@ApiModelProperty("终端id集合")
private List<String> devIds;
@ApiModelProperty("是否是相序校验")
private Boolean isPhaseSequence;
@ApiModelProperty()
private String isPhaseSequence;
@ApiModelProperty("源id")
private String sourceId;

View File

@@ -3,8 +3,11 @@ package com.njcn.gather.device.script.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
import com.njcn.gather.device.script.pojo.vo.PqScriptCheckDataVO;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import java.util.List;
import java.util.Map;
/**
@@ -22,4 +25,7 @@ public interface IPqScriptCheckDataService extends IService<PqScriptCheckData> {
*/
List<String> getValueType(PqScriptCheckDataParam param);
Map<String,String> getValueTypeMap(String scriptId);
}

View File

@@ -1,20 +1,26 @@
package com.njcn.gather.device.script.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.device.script.mapper.PqScriptCheckDataMapper;
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
import com.njcn.gather.device.script.pojo.vo.PqScriptCheckDataVO;
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -31,6 +37,8 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
private final String V="real$V2-50";
private final String SV="real$SV_1-49";
private final DictTreeMapper dictTreeMapper;
@Override
public List<String> getValueType(PqScriptCheckDataParam param) {
MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>();
@@ -56,4 +64,21 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
}
return new ArrayList<>();
}
@Override
public Map<String,String> getValueTypeMap(String scriptId) {
LambdaQueryWrapper<PqScriptCheckData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(PqScriptCheckData::getValueType)
.eq(PqScriptCheckData::getScriptId, scriptId)
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
List<PqScriptCheckData> pqScriptCheckData = this.baseMapper.selectList(queryWrapper);
LambdaQueryWrapper<DictTree> dictTreeLambdaQueryWrapper = new LambdaQueryWrapper<>();
dictTreeLambdaQueryWrapper.in(DictTree::getId,pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()));
List<DictTree> dictTreeList = dictTreeMapper.selectList(dictTreeLambdaQueryWrapper);
Map<String,String> map = dictTreeList.stream().collect(Collectors.toMap(DictTree::getCode,DictTree::getId));
return map;
}
}

View File

@@ -9,6 +9,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.device.device.pojo.po.PqDev;
import com.njcn.gather.device.device.service.IPqDevService;
import com.njcn.gather.device.pojo.enums.CommonEnum;
import com.njcn.gather.device.script.mapper.PqScriptDtlsMapper;
import com.njcn.gather.device.script.mapper.PqScriptMapper;
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
@@ -28,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author caozehui
@@ -207,17 +209,23 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
return this.getBaseMapper().selectJoinList(PqScriptDtls.class, wrapper).stream().map(PqScriptDtls::getIndex).collect(Collectors.toList());
}
private List<PqScriptDtls> pqScriptDtls(String scriptId, Boolean isPhaseSequence, Double volt, Double curr) {
private List<PqScriptDtls> pqScriptDtls(String scriptId, String isPhaseSequence, Double volt, Double curr) {
List<PqScriptDtls> pqScriptDtls;
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(PqScriptDtls.class)
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
.eq(PqScriptDtls::getEnable, 1);;
if (isPhaseSequence) {
if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) {
//相序
queryWrapper.eq(PqScriptDtls::getIndex, -1)
.eq(PqScriptDtls::getEnable, 1);
pqScriptDtls = this.list(queryWrapper);
}else if(isPhaseSequence.equals(CommonEnum.COEFFICIENT_TEST.getValue())){
//系数
queryWrapper.in(PqScriptDtls::getIndex, Stream.of(-2,-3).collect(Collectors.toList()))
.eq(PqScriptDtls::getEnable, 1);
pqScriptDtls = this.list(queryWrapper);
} else {
//先获取检测脚本类型是否相对值 true相对值 false绝对值相对值要乘额定值,绝对值不需要处理)
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(scriptId);