1.解决mysql index关键字
2.增加通讯脚本相关接口
This commit is contained in:
@@ -514,7 +514,7 @@ public class DetectionServiceImpl {
|
|||||||
DictDataEnum dataRule,
|
DictDataEnum dataRule,
|
||||||
String code) {
|
String code) {
|
||||||
List<PqScriptCheckData> checkData = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
List<PqScriptCheckData> checkData = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
.eq(PqScriptCheckData::getIndex, sourceIssue.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, sourceIssue.getIndex())
|
||||||
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
||||||
);
|
);
|
||||||
Map<String, List<Double>> map = devListMap(dev, dataRule, code);
|
Map<String, List<Double>> map = devListMap(dev, dataRule, code);
|
||||||
@@ -802,7 +802,7 @@ public class DetectionServiceImpl {
|
|||||||
Map<Double, Double> issueHarmMap;
|
Map<Double, Double> issueHarmMap;
|
||||||
if (P.equals(type)) {
|
if (P.equals(type)) {
|
||||||
List<PqScriptCheckData> checkData = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
List<PqScriptCheckData> checkData = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
.eq(PqScriptCheckData::getIndex, sourceIssue.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, sourceIssue.getIndex())
|
||||||
.eq(PqScriptCheckData::getPhase, phase)
|
.eq(PqScriptCheckData::getPhase, phase)
|
||||||
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
List<PqScriptDtls> scriptDtlsList = pqScriptDtlsService.listPqScriptDtlByScriptId(scriptId);
|
List<PqScriptDtls> scriptDtlsList = pqScriptDtlsService.listPqScriptDtlByScriptId(scriptId);
|
||||||
|
|
||||||
Map<String, List<PqScriptDtls>> collect = scriptDtlsList.stream()
|
Map<String, List<PqScriptDtls>> collect = scriptDtlsList.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|
||||||
collect.forEach((key, value) -> {
|
collect.forEach((key, value) -> {
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ public class ReportServiceImpl implements IReportService {
|
|||||||
queryWrapper.eq(PqScriptCheckData::getScriptId, scriptId)
|
queryWrapper.eq(PqScriptCheckData::getScriptId, scriptId)
|
||||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode())
|
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode())
|
||||||
.in(PqScriptCheckData::getPhase, phase)
|
.in(PqScriptCheckData::getPhase, phase)
|
||||||
.eq(PqScriptCheckData::getIndex, index);
|
.eq(PqScriptCheckData::getScriptIndex, index);
|
||||||
List<PqScriptCheckData> list = pqScriptCheckDataService.list(queryWrapper);
|
List<PqScriptCheckData> list = pqScriptCheckDataService.list(queryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
return list.get(0).getValueType();
|
return list.get(0).getValueType();
|
||||||
@@ -537,7 +537,7 @@ public class ReportServiceImpl implements IReportService {
|
|||||||
.eq(PqScriptDtls::getValue, value);
|
.eq(PqScriptDtls::getValue, value);
|
||||||
List<PqScriptDtls> pqScriptDtls = pqScriptDtlsService.list(queryWrapper);
|
List<PqScriptDtls> pqScriptDtls = pqScriptDtlsService.list(queryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(pqScriptDtls)) {
|
if (CollectionUtil.isNotEmpty(pqScriptDtls)) {
|
||||||
return pqScriptDtls.get(0).getIndex();
|
return pqScriptDtls.get(0).getScriptIndex();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
.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())
|
||||||
.ne(PqScriptDtls::getIndex, -1)
|
.ne(PqScriptDtls::getScriptIndex, -1)
|
||||||
.eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode())
|
.eq(StrUtil.isNotBlank(param.getDevId()),PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode())
|
||||||
);
|
);
|
||||||
Map<Integer, Set<Integer>> resultMap = new HashMap<>(5);
|
Map<Integer, Set<Integer>> resultMap = new HashMap<>(5);
|
||||||
if(StrUtil.isNotBlank(param.getDevId())){
|
if(StrUtil.isNotBlank(param.getDevId())){
|
||||||
@@ -144,7 +144,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<PqScriptDtls>> dtlsSortMap = dtlsList.stream()
|
Map<String, List<PqScriptDtls>> dtlsSortMap = dtlsList.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(dtlsSortMap.keySet()));
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(dtlsSortMap.keySet()));
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
infoVO.setScriptTypeCode(dictTree.getId());
|
infoVO.setScriptTypeCode(dictTree.getId());
|
||||||
//额定条件下频率准确度测试
|
//额定条件下频率准确度测试
|
||||||
LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream()
|
LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.filter(x -> "Base".equals(x.getScriptSubType()))
|
.filter(x -> "Base".equals(x.getScriptSubType()))
|
||||||
.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) -> {
|
||||||
@@ -179,8 +179,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
subType.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
subType.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
||||||
subType.setScriptTypeCode(subKey);
|
subType.setScriptTypeCode(subKey);
|
||||||
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptIndex, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<TreeDataVO> subTypeList = new ArrayList<>();
|
List<TreeDataVO> subTypeList = new ArrayList<>();
|
||||||
indexMap.forEach((index, scriptDtlIndexList) -> {
|
indexMap.forEach((index, scriptDtlIndexList) -> {
|
||||||
TreeDataVO dtlType = new TreeDataVO();
|
TreeDataVO dtlType = new TreeDataVO();
|
||||||
@@ -208,7 +208,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
//单影响量下频率准确度测试
|
//单影响量下频率准确度测试
|
||||||
LinkedHashMap<String, List<PqScriptDtls>> subSingleTypeMap = value.stream()
|
LinkedHashMap<String, List<PqScriptDtls>> subSingleTypeMap = value.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.filter(x -> !"Base".equals(x.getScriptSubType()))
|
.filter(x -> !"Base".equals(x.getScriptSubType()))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
|
||||||
if (CollUtil.isNotEmpty(subSingleTypeMap)) {
|
if (CollUtil.isNotEmpty(subSingleTypeMap)) {
|
||||||
@@ -224,8 +224,8 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
List<TreeDataVO> subTypeList = new ArrayList<>();
|
List<TreeDataVO> subTypeList = new ArrayList<>();
|
||||||
|
|
||||||
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptIndex, LinkedHashMap::new, Collectors.toList()));
|
||||||
indexMap.forEach((index, scriptDtlIndexList) -> {
|
indexMap.forEach((index, scriptDtlIndexList) -> {
|
||||||
TreeDataVO dtlType = new TreeDataVO();
|
TreeDataVO dtlType = new TreeDataVO();
|
||||||
dtlType.setIndex(index);
|
dtlType.setIndex(index);
|
||||||
@@ -268,21 +268,21 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
List<PqScriptDtls> dip = subValue.stream()
|
List<PqScriptDtls> dip = subValue.stream()
|
||||||
.filter(x -> "Dip".equals(x.getValueType()) && "A".equals(x.getPhase()))
|
.filter(x -> "Dip".equals(x.getValueType()) && "A".equals(x.getPhase()))
|
||||||
.filter(x -> x.getTransValue() >= start && x.getTransValue() <= end)
|
.filter(x -> x.getTransValue() >= start && x.getTransValue() <= end)
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
TreeDataVO vo = new TreeDataVO();
|
TreeDataVO vo = new TreeDataVO();
|
||||||
vo.setScriptTypeName(name);
|
vo.setScriptTypeName(name);
|
||||||
TreeDataVO dlt;
|
TreeDataVO dlt;
|
||||||
for (PqScriptDtls dtls : dip) {
|
for (PqScriptDtls dtls : dip) {
|
||||||
dlt = new TreeDataVO();
|
dlt = new TreeDataVO();
|
||||||
List<PqScriptDtls> scriptDtlIndexList = subValue.stream().filter(x -> dtls.getIndex().equals(x.getIndex())).collect(Collectors.toList());
|
List<PqScriptDtls> scriptDtlIndexList = subValue.stream().filter(x -> dtls.getScriptIndex().equals(x.getScriptIndex())).collect(Collectors.toList());
|
||||||
//特征幅值=20%Un,持续时间=1周波
|
//特征幅值=20%Un,持续时间=1周波
|
||||||
dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波");
|
dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波");
|
||||||
dlt.setIndex(dtls.getIndex());
|
dlt.setIndex(dtls.getScriptIndex());
|
||||||
dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType());
|
dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType());
|
||||||
dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString());
|
dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString());
|
||||||
if (finalResultMap.containsKey(dtls.getIndex())) {
|
if (finalResultMap.containsKey(dtls.getScriptIndex())) {
|
||||||
dlt.setFly(conform(finalResultMap.get(dtls.getIndex())));
|
dlt.setFly(conform(finalResultMap.get(dtls.getScriptIndex())));
|
||||||
}
|
}
|
||||||
info.add(dlt);
|
info.add(dlt);
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
case IMBV:
|
case IMBV:
|
||||||
List<PqScriptCheckData> list = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
List<PqScriptCheckData> list = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
||||||
.eq(PqScriptCheckData::getIndex, scriptDtlIndexList.get(0).getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, scriptDtlIndexList.get(0).getScriptIndex())
|
||||||
);
|
);
|
||||||
//三相负序电压不平衡度=0%
|
//三相负序电压不平衡度=0%
|
||||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + list.get(0).getValue() + ResultUnitEnum.IMBV.getUnit());
|
dtlType.setScriptTypeName(dictTree.getName() + "=" + list.get(0).getValue() + ResultUnitEnum.IMBV.getUnit());
|
||||||
@@ -409,7 +409,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
case IMBA:
|
case IMBA:
|
||||||
List<PqScriptCheckData> imba = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
List<PqScriptCheckData> imba = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
||||||
.eq(PqScriptCheckData::getIndex, scriptDtlIndexList.get(0).getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, scriptDtlIndexList.get(0).getScriptIndex())
|
||||||
);
|
);
|
||||||
//三相负序电流不平衡度=0%
|
//三相负序电流不平衡度=0%
|
||||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + imba.get(0).getValue() + ResultUnitEnum.IMBV.getUnit());
|
dtlType.setScriptTypeName(dictTree.getName() + "=" + imba.get(0).getValue() + ResultUnitEnum.IMBV.getUnit());
|
||||||
@@ -767,7 +767,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
.select(PqScriptCheckData::getHarmNum)
|
.select(PqScriptCheckData::getHarmNum)
|
||||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
.isNotNull(PqScriptCheckData::getHarmNum)
|
.isNotNull(PqScriptCheckData::getHarmNum)
|
||||||
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
);
|
);
|
||||||
harmNum = list.stream().sorted(Comparator.comparing(PqScriptCheckData::getHarmNum))
|
harmNum = list.stream().sorted(Comparator.comparing(PqScriptCheckData::getHarmNum))
|
||||||
.map(PqScriptCheckData::getHarmNum).distinct().collect(Collectors.toList());
|
.map(PqScriptCheckData::getHarmNum).distinct().collect(Collectors.toList());
|
||||||
@@ -800,7 +800,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
.select(PqScriptCheckData::getHarmNum)
|
.select(PqScriptCheckData::getHarmNum)
|
||||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
.isNotNull(PqScriptCheckData::getHarmNum)
|
.isNotNull(PqScriptCheckData::getHarmNum)
|
||||||
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
);
|
);
|
||||||
harmNum = list.stream().sorted(Comparator.comparing(PqScriptCheckData::getHarmNum))
|
harmNum = list.stream().sorted(Comparator.comparing(PqScriptCheckData::getHarmNum))
|
||||||
.map(PqScriptCheckData::getHarmNum).distinct().collect(Collectors.toList());
|
.map(PqScriptCheckData::getHarmNum).distinct().collect(Collectors.toList());
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import com.njcn.common.utils.LogUtil;
|
|||||||
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||||
|
import com.njcn.gather.script.pojo.param.ScriptParam;
|
||||||
import com.njcn.gather.script.pojo.po.PqScript;
|
import com.njcn.gather.script.pojo.po.PqScript;
|
||||||
|
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
@@ -130,7 +132,7 @@ public class PqScriptController extends BaseController {
|
|||||||
@ApiOperation("获取指定模式下的所有检测脚本")
|
@ApiOperation("获取指定模式下的所有检测脚本")
|
||||||
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
@ApiImplicitParam(name = "patternId", value = "模式Id", required = true)
|
||||||
public HttpResult<List<Map<String, Object>>> getAllPqScript(@RequestParam("patternId") String patternId) {
|
public HttpResult<List<Map<String, Object>>> getAllPqScript(@RequestParam("patternId") String patternId) {
|
||||||
String methodDescribe = getMethodDescribe("getAll");
|
String methodDescribe = getMethodDescribe("getAllPqScript");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, patternId);
|
||||||
List<Map<String, Object>> result = pqScriptService.listAllPqScript(patternId);
|
List<Map<String, Object>> result = pqScriptService.listAllPqScript(patternId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -140,8 +142,8 @@ public class PqScriptController extends BaseController {
|
|||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/dlsDetails")
|
@PostMapping("/dlsDetails")
|
||||||
@ApiOperation("根据脚本id查询检测脚本详情")
|
@ApiOperation("根据脚本id查询检测脚本详情")
|
||||||
@ApiImplicitParam(name = "id", value = "检测脚本id", required = true)
|
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||||
public HttpResult<List<SourceIssue>> dls(@RequestBody PqScriptIssueParam param) {
|
public HttpResult<List<SourceIssue>> dlsDetails(@RequestBody PqScriptIssueParam param) {
|
||||||
String methodDescribe = getMethodDescribe("dlsDetails");
|
String methodDescribe = getMethodDescribe("dlsDetails");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(param);
|
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(param);
|
||||||
@@ -152,12 +154,59 @@ public class PqScriptController extends BaseController {
|
|||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/addScriptDtls")
|
@PostMapping("/addScriptDtls")
|
||||||
@ApiOperation("添加检测脚本")
|
@ApiOperation("添加检测脚本")
|
||||||
@ApiImplicitParam(name = "id", value = "检测脚本id", required = true)
|
@ApiImplicitParam(name = "sourceIssue", value = "检测脚本", required = true)
|
||||||
public HttpResult<Boolean> addScriptDtls(@RequestBody PqScriptDtlsParam sourceIssue) {
|
public HttpResult<Boolean> addScriptDtls(@RequestBody PqScriptDtlsParam sourceIssue) {
|
||||||
String methodDescribe = getMethodDescribe("addScriptDtls");
|
String methodDescribe = getMethodDescribe("addScriptDtls");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
||||||
Boolean b = pqScriptDtlsService.saveScriptDtls(sourceIssue);
|
Boolean b = pqScriptDtlsService.saveScriptDtls(sourceIssue);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b , methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b , methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/scriptDtlsCheckDataList")
|
||||||
|
@ApiOperation("根据通讯参数生成装置下发原始数据公式")
|
||||||
|
@ApiImplicitParam(name = "sourceIssue", value = "检测脚本", required = true)
|
||||||
|
public HttpResult<List<PqScriptDtlsParam.CheckData>> scriptDtlsCheckDataList(@RequestBody PqScriptDtlsParam sourceIssue) {
|
||||||
|
String methodDescribe = getMethodDescribe("scriptDtlsCheckDataList");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
||||||
|
List<PqScriptDtlsParam.CheckData> checkData = pqScriptDtlsService.scriptDtlsCheckDataList(sourceIssue);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData , methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/deleteDtls")
|
||||||
|
@ApiOperation("删除脚本")
|
||||||
|
@ApiImplicitParam(name = "sourceIssue", value = "检测脚本", required = true)
|
||||||
|
public HttpResult<Boolean> deleteDtls(@RequestBody @Validated ScriptParam sourceIssue) {
|
||||||
|
String methodDescribe = getMethodDescribe("deleteDtls");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
||||||
|
Boolean b = pqScriptDtlsService.deleteDtls(sourceIssue);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b , methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/updateDtls")
|
||||||
|
@ApiOperation("启用关闭脚本")
|
||||||
|
@ApiImplicitParam(name = "sourceIssue", value = "检测脚本", required = true)
|
||||||
|
public HttpResult<Boolean> updateDtls(@RequestBody @Validated ScriptParam sourceIssue) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateDtls");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
||||||
|
Boolean b = pqScriptDtlsService.updateDtls(sourceIssue);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b , methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/checkDataList")
|
||||||
|
@ApiOperation("通讯脚本回显")
|
||||||
|
@ApiImplicitParam(name = "sourceIssue", value = "检测脚本", required = true)
|
||||||
|
public HttpResult<List<PqScriptCheckData>> checkDataList(@RequestBody @Validated ScriptParam sourceIssue) {
|
||||||
|
String methodDescribe = getMethodDescribe("checkDataList");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceIssue);
|
||||||
|
List<PqScriptCheckData> checkData = pqScriptDtlsService.checkDataList(sourceIssue);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<select id="selectMaxIndex" resultType="java.lang.Integer">
|
<select id="selectMaxIndex" resultType="java.lang.Integer">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL( max( t.INDEX ), -1 ) AS num
|
IFNULL( max( t.Script_Index ), -1 ) AS num
|
||||||
FROM
|
FROM
|
||||||
pq_script_dtls t
|
pq_script_dtls t
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.gather.script.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2024/11/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScriptParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("检测脚本id")
|
||||||
|
@NotBlank(message = DevValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String scriptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测脚本类型")
|
||||||
|
@NotBlank(message = DevValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String scriptType;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测脚本序号")
|
||||||
|
private Integer index;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否启用脚本(状态:0-不启用 1-启用)")
|
||||||
|
private Integer enable;
|
||||||
|
}
|
||||||
@@ -28,7 +28,8 @@ public class PqScriptCheckData implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 总检测脚本中的测试项序号
|
* 总检测脚本中的测试项序号
|
||||||
*/
|
*/
|
||||||
private Integer index;
|
@TableField("Script_Index")
|
||||||
|
private Integer scriptIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class PqScriptDtls implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 总检测脚本中的测试项序号
|
* 总检测脚本中的测试项序号
|
||||||
*/
|
*/
|
||||||
@TableField("`index`")
|
@TableField("Script_Index")
|
||||||
private Integer index;
|
private Integer scriptIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测脚本类型
|
* 检测脚本类型
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ public class SourceIssue {
|
|||||||
/**
|
/**
|
||||||
* 检测小项dtls Id
|
* 检测小项dtls Id
|
||||||
*/
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private Integer enable;
|
||||||
/**
|
/**
|
||||||
* 源ID
|
* 源ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.njcn.gather.script.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||||
|
import com.njcn.gather.script.pojo.param.ScriptParam;
|
||||||
|
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
|
|
||||||
@@ -79,10 +81,30 @@ public interface IPqScriptDtlsService extends IService<PqScriptDtls> {
|
|||||||
Boolean saveScriptDtls(PqScriptDtlsParam sourceIssue);
|
Boolean saveScriptDtls(PqScriptDtlsParam sourceIssue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前检测小项的信息
|
* 根据通讯参数生成装置下发原始数据公式
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PqScriptDtlsParam.CheckData> scriptDtlsList(PqScriptDtlsParam sourceIssue);
|
List<PqScriptDtlsParam.CheckData> scriptDtlsCheckDataList(PqScriptDtlsParam sourceIssue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除脚本
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteDtls(ScriptParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用关闭脚本
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateDtls(ScriptParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通讯脚本回显
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqScriptCheckData> checkDataList(ScriptParam param);
|
||||||
|
|
||||||
Boolean saveCheck();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
|
|||||||
queryWrapper.selectAll(PqScriptCheckData.class)
|
queryWrapper.selectAll(PqScriptCheckData.class)
|
||||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
||||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
.eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getIndex, param.getIndex())
|
.eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||||
if (param.getIsValueTypeName()) {
|
if (param.getIsValueTypeName()) {
|
||||||
queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType);
|
queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType);
|
||||||
@@ -101,7 +101,7 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
|
|||||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
||||||
.selectAs(DictTree::getCode, PqScriptCheckData::getValueTypeCode)
|
.selectAs(DictTree::getCode, PqScriptCheckData::getValueTypeCode)
|
||||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||||
return this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
return this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
@@ -12,11 +13,13 @@ import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
|||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||||
|
import com.njcn.gather.script.mapper.PqScriptCheckDataMapper;
|
||||||
import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
|
import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
|
||||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||||
|
import com.njcn.gather.script.pojo.param.ScriptParam;
|
||||||
import com.njcn.gather.script.pojo.po.PqScript;
|
import com.njcn.gather.script.pojo.po.PqScript;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||||
@@ -37,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,6 +80,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
private final IPqDevService pqDevService;
|
private final IPqDevService pqDevService;
|
||||||
private final PqScriptMapper pqScriptMapper;
|
private final PqScriptMapper pqScriptMapper;
|
||||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
|
private final PqScriptCheckDataMapper pqScriptCheckDataMapper;
|
||||||
private final IDevTypeService devTypeService;
|
private final IDevTypeService devTypeService;
|
||||||
private final IDictTreeService dictTreeService;
|
private final IDictTreeService dictTreeService;
|
||||||
|
|
||||||
@@ -120,9 +125,9 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
@Override
|
@Override
|
||||||
public List<SourceIssue> listSourceIssue(PqScriptIssueParam param) {
|
public List<SourceIssue> listSourceIssue(PqScriptIssueParam param) {
|
||||||
List<SourceIssue> sourceIssues = new ArrayList<>();
|
List<SourceIssue> sourceIssues = new ArrayList<>();
|
||||||
Set<Double> voltSet =new HashSet<>(1);
|
Set<Double> voltSet = new HashSet<>(1);
|
||||||
Set<Double> currSet =new HashSet<>(1);
|
Set<Double> currSet = new HashSet<>(1);
|
||||||
if(CollUtil.isNotEmpty(param.getDevIds())){
|
if (CollUtil.isNotEmpty(param.getDevIds())) {
|
||||||
//校验终端额定电压电流是否相同
|
//校验终端额定电压电流是否相同
|
||||||
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>()
|
List<PqDev> list = pqDevService.list(new LambdaQueryWrapper<PqDev>()
|
||||||
.eq(PqDev::getPlanId, param.getPlanId())
|
.eq(PqDev::getPlanId, param.getPlanId())
|
||||||
@@ -135,7 +140,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
voltSet = devTypes.stream().map(DevType::getDevVolt).collect(Collectors.toSet());
|
voltSet = devTypes.stream().map(DevType::getDevVolt).collect(Collectors.toSet());
|
||||||
//额定电流信息
|
//额定电流信息
|
||||||
currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet());
|
currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet());
|
||||||
}else{
|
} else {
|
||||||
voltSet.add(1.0);
|
voltSet.add(1.0);
|
||||||
currSet.add(1.0);
|
currSet.add(1.0);
|
||||||
param.setIsPhaseSequence("-1");
|
param.setIsPhaseSequence("-1");
|
||||||
@@ -155,8 +160,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
* 3.组装所有检测格式
|
* 3.组装所有检测格式
|
||||||
*/
|
*/
|
||||||
Map<Integer, List<PqScriptDtls>> scriptDtlsMap = pqScriptDtls.stream()
|
Map<Integer, List<PqScriptDtls>> scriptDtlsMap = pqScriptDtls.stream()
|
||||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
.collect(Collectors.groupingBy(PqScriptDtls::getScriptIndex, LinkedHashMap::new, Collectors.toList()));
|
||||||
scriptDtlsMap.forEach((key, value) -> {
|
scriptDtlsMap.forEach((key, value) -> {
|
||||||
/**
|
/**
|
||||||
* 分组获取有多少小类
|
* 分组获取有多少小类
|
||||||
@@ -169,14 +174,15 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
PqScriptDtls freqDtls = freq.get(0);
|
PqScriptDtls freqDtls = freq.get(0);
|
||||||
SourceIssue issue = new SourceIssue();
|
SourceIssue issue = new SourceIssue();
|
||||||
issue.setId(freqDtls.getId());
|
issue.setId(freqDtls.getId());
|
||||||
|
issue.setEnable(freqDtls.getEnable());
|
||||||
issue.setSourceId(param.getSourceId());
|
issue.setSourceId(param.getSourceId());
|
||||||
issue.setType(freqDtls.getScriptCode());
|
issue.setType(freqDtls.getScriptCode());
|
||||||
issue.setIndex(freqDtls.getIndex());
|
issue.setIndex(freqDtls.getScriptIndex());
|
||||||
String scriptSubType = freqDtls.getScriptSubType();
|
String scriptSubType = freqDtls.getScriptSubType();
|
||||||
issue.setSubType(StrUtil.isBlank(scriptSubType)&&CollUtil.isNotEmpty(param.getDevIds()) ? scriptSubType : scriptSubType.replace("Base", "NULL"));
|
issue.setSubType(CollUtil.isEmpty(param.getDevIds()) || StrUtil.isBlank(scriptSubType) ? scriptSubType : scriptSubType.replace("Base", "NULL"));
|
||||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||||
checkDataParam.setScriptId(freqDtls.getScriptId());
|
checkDataParam.setScriptId(freqDtls.getScriptId());
|
||||||
checkDataParam.setIndex(freqDtls.getIndex());
|
checkDataParam.setIndex(freqDtls.getScriptIndex());
|
||||||
checkDataParam.setIsValueTypeName(true);
|
checkDataParam.setIsValueTypeName(true);
|
||||||
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
||||||
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, isValueType).toString());
|
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, isValueType).toString());
|
||||||
@@ -227,11 +233,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
@Override
|
@Override
|
||||||
public List<Integer> getIndexList(String scriptType, String scriptId) {
|
public List<Integer> getIndexList(String scriptType, String scriptId) {
|
||||||
MPJLambdaWrapper<PqScriptDtls> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<PqScriptDtls> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.select(PqScriptDtls::getIndex)
|
wrapper.select(PqScriptDtls::getScriptIndex)
|
||||||
.distinct()
|
.distinct()
|
||||||
.eq(PqScriptDtls::getScriptType, scriptType)
|
.eq(PqScriptDtls::getScriptType, scriptType)
|
||||||
.eq(PqScriptDtls::getScriptId, scriptId);
|
.eq(PqScriptDtls::getScriptId, scriptId);
|
||||||
return this.getBaseMapper().selectJoinList(PqScriptDtls.class, wrapper).stream().map(PqScriptDtls::getIndex).collect(Collectors.toList());
|
return this.getBaseMapper().selectJoinList(PqScriptDtls.class, wrapper).stream().map(PqScriptDtls::getScriptIndex).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -241,13 +247,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
List<PqScriptCheckData> checkList = new ArrayList<>();
|
List<PqScriptCheckData> checkList = new ArrayList<>();
|
||||||
Integer i = sourceIssue.getIndex();
|
Integer i = sourceIssue.getIndex();
|
||||||
if (ObjectUtil.isNotNull(sourceIssue.getIndex())) {
|
if (ObjectUtil.isNotNull(sourceIssue.getIndex())) {
|
||||||
this.remove(new MPJLambdaWrapper<PqScriptDtls>()
|
this.remove(new LambdaQueryWrapper<PqScriptDtls>()
|
||||||
.eq(PqScriptDtls::getScriptId, sourceIssue.getScriptId())
|
.eq(PqScriptDtls::getScriptId, sourceIssue.getScriptId())
|
||||||
.eq(PqScriptDtls::getIndex, sourceIssue.getIndex())
|
.eq(PqScriptDtls::getScriptIndex, sourceIssue.getIndex())
|
||||||
);
|
);
|
||||||
pqScriptCheckDataService.remove(new MPJLambdaWrapper<PqScriptCheckData>()
|
pqScriptCheckDataService.remove(new LambdaQueryWrapper<PqScriptCheckData>()
|
||||||
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
.eq(PqScriptCheckData::getScriptId, sourceIssue.getScriptId())
|
||||||
.eq(PqScriptCheckData::getIndex, sourceIssue.getIndex())
|
.eq(PqScriptCheckData::getScriptIndex, sourceIssue.getIndex())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
i = this.baseMapper.selectMaxIndex(sourceIssue.getScriptId()) + 1;
|
i = this.baseMapper.selectMaxIndex(sourceIssue.getScriptId()) + 1;
|
||||||
@@ -258,7 +264,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
for (PqScriptDtlsParam.CheckData checkData : checkDataList) {
|
for (PqScriptDtlsParam.CheckData checkData : checkDataList) {
|
||||||
data = new PqScriptCheckData();
|
data = new PqScriptCheckData();
|
||||||
data.setScriptId(sourceIssue.getScriptId());
|
data.setScriptId(sourceIssue.getScriptId());
|
||||||
data.setIndex(i);
|
data.setScriptIndex(i);
|
||||||
data.setValueType(checkData.getValueType());
|
data.setValueType(checkData.getValueType());
|
||||||
data.setDataType(checkData.getDataType());
|
data.setDataType(checkData.getDataType());
|
||||||
data.setPhase(checkData.getPhase());
|
data.setPhase(checkData.getPhase());
|
||||||
@@ -298,37 +304,41 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
//谐波值
|
//谐波值
|
||||||
if (channelListDTO.getHarmFlag()) {
|
if (channelListDTO.getHarmFlag()) {
|
||||||
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmList = channelListDTO.getHarmList();
|
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmList = channelListDTO.getHarmList();
|
||||||
for (PqScriptDtlsParam.ChannelListDTO.HarmModel harmModel : harmList) {
|
if (CollUtil.isNotEmpty(harmList)) {
|
||||||
PqScriptDtls harm = setScriptDtls(sourceIssue, i);
|
for (PqScriptDtlsParam.ChannelListDTO.HarmModel harmModel : harmList) {
|
||||||
if (channelListDTO.getChannelType().contains("U")) {
|
PqScriptDtls harm = setScriptDtls(sourceIssue, i);
|
||||||
harm.setValueType(HARM_V);
|
if (channelListDTO.getChannelType().contains("U")) {
|
||||||
|
harm.setValueType(HARM_V);
|
||||||
|
}
|
||||||
|
if (channelListDTO.getChannelType().contains("I")) {
|
||||||
|
harm.setValueType(HARM_I);
|
||||||
|
}
|
||||||
|
harm.setPhase(phase);
|
||||||
|
harm.setHarmNum(harmModel.getHarm());
|
||||||
|
harm.setValue(harmModel.getFAmp());
|
||||||
|
harm.setAngle(harmModel.getFPhase());
|
||||||
|
info.add(harm);
|
||||||
}
|
}
|
||||||
if (channelListDTO.getChannelType().contains("I")) {
|
|
||||||
harm.setValueType(HARM_I);
|
|
||||||
}
|
|
||||||
harm.setPhase(phase);
|
|
||||||
harm.setHarmNum(harmModel.getHarm());
|
|
||||||
harm.setValue(harmModel.getFAmp());
|
|
||||||
harm.setAngle(harmModel.getFPhase());
|
|
||||||
info.add(harm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//间谐波
|
//间谐波
|
||||||
if (channelListDTO.getInHarmFlag()) {
|
if (channelListDTO.getInHarmFlag()) {
|
||||||
List<PqScriptDtlsParam.ChannelListDTO.InharmModel> inharmList = channelListDTO.getInharmList();
|
List<PqScriptDtlsParam.ChannelListDTO.InharmModel> inharmList = channelListDTO.getInharmList();
|
||||||
for (PqScriptDtlsParam.ChannelListDTO.InharmModel inharmModel : inharmList) {
|
if (CollUtil.isNotEmpty(inharmList)) {
|
||||||
PqScriptDtls inHarm = setScriptDtls(sourceIssue, i);
|
for (PqScriptDtlsParam.ChannelListDTO.InharmModel inharmModel : inharmList) {
|
||||||
if (channelListDTO.getChannelType().contains("U")) {
|
PqScriptDtls inHarm = setScriptDtls(sourceIssue, i);
|
||||||
inHarm.setValueType(INHARM_V);
|
if (channelListDTO.getChannelType().contains("U")) {
|
||||||
|
inHarm.setValueType(INHARM_V);
|
||||||
|
}
|
||||||
|
if (channelListDTO.getChannelType().contains("I")) {
|
||||||
|
inHarm.setValueType(INHARM_I);
|
||||||
|
}
|
||||||
|
inHarm.setPhase(phase);
|
||||||
|
inHarm.setHarmNum(inharmModel.getInharm());
|
||||||
|
inHarm.setValue(inharmModel.getFAmp());
|
||||||
|
inHarm.setAngle(inharmModel.getFPhase());
|
||||||
|
info.add(inHarm);
|
||||||
}
|
}
|
||||||
if (channelListDTO.getChannelType().contains("I")) {
|
|
||||||
inHarm.setValueType(INHARM_I);
|
|
||||||
}
|
|
||||||
inHarm.setPhase(phase);
|
|
||||||
inHarm.setHarmNum(inharmModel.getInharm());
|
|
||||||
inHarm.setValue(inharmModel.getFAmp());
|
|
||||||
inHarm.setAngle(inharmModel.getFPhase());
|
|
||||||
info.add(inHarm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//暂态
|
//暂态
|
||||||
@@ -364,24 +374,24 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PqScriptDtlsParam.CheckData> scriptDtlsList(PqScriptDtlsParam sourceIssue) {
|
public List<PqScriptDtlsParam.CheckData> scriptDtlsCheckDataList(PqScriptDtlsParam sourceIssue) {
|
||||||
List<PqScriptDtlsParam.CheckData> info=new ArrayList<>();
|
List<PqScriptDtlsParam.CheckData> info = new ArrayList<>();
|
||||||
//获取所有下拉值情况
|
//获取所有下拉值情况
|
||||||
List<PqScriptDtlsParam.CheckData> checkDataList = sourceIssue.getCheckDataList();
|
List<PqScriptDtlsParam.CheckData> checkDataList = sourceIssue.getCheckDataList();
|
||||||
if(CollUtil.isNotEmpty(checkDataList)){
|
if (CollUtil.isNotEmpty(checkDataList)) {
|
||||||
List<String> ids = checkDataList.stream().map(PqScriptDtlsParam.CheckData::getValueType).collect(Collectors.toList());
|
List<String> ids = checkDataList.stream().map(PqScriptDtlsParam.CheckData::getValueType).collect(Collectors.toList());
|
||||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(ids);
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(ids);
|
||||||
Map<String, String> dicTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getCode));
|
Map<String, String> dicTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getCode));
|
||||||
PqScriptDtlsParam.CheckData checkData;
|
PqScriptDtlsParam.CheckData checkData;
|
||||||
for (PqScriptDtlsParam.CheckData channelListDTO : checkDataList) {
|
for (PqScriptDtlsParam.CheckData channelListDTO : checkDataList) {
|
||||||
if(dicTreeMap.containsKey(channelListDTO.getValueType())){
|
if (dicTreeMap.containsKey(channelListDTO.getValueType())) {
|
||||||
String code = dicTreeMap.get(channelListDTO.getValueType());
|
String code = dicTreeMap.get(channelListDTO.getValueType());
|
||||||
DetectionCodeEnum codeEnum = DetectionCodeEnum.getDetectionCodeByCode(code);
|
DetectionCodeEnum codeEnum = DetectionCodeEnum.getDetectionCodeByCode(code);
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> channelList = sourceIssue.getChannelList();
|
List<PqScriptDtlsParam.ChannelListDTO> channelList = sourceIssue.getChannelList();
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> list;
|
List<PqScriptDtlsParam.ChannelListDTO> list;
|
||||||
switch (codeEnum){
|
switch (codeEnum) {
|
||||||
case FREQ:
|
case FREQ:
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(sourceIssue.getFFreq());
|
checkData.setValue(sourceIssue.getFFreq());
|
||||||
@@ -392,20 +402,20 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
break;
|
break;
|
||||||
case U1:
|
case U1:
|
||||||
case VRMS:
|
case VRMS:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
rmsCheck(info, channelListDTO, list);
|
rmsCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DELTA_V:
|
case DELTA_V:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(0.0);
|
checkData.setValue(0.0);
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
info.add(checkData);
|
info.add(checkData);
|
||||||
@@ -413,14 +423,14 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VA:
|
case VA:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(listDTO.getFPhase());
|
checkData.setValue(listDTO.getFPhase());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
info.add(checkData);
|
info.add(checkData);
|
||||||
@@ -428,39 +438,72 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case V2_50:
|
case V2_50:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
harmCheck(info, channelListDTO, list);
|
harmCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case I2_50:
|
case I2_50:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
harmCheck(info, channelListDTO, list);
|
harmCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P2_50:
|
case P2_50:
|
||||||
|
List<PqScriptDtlsParam.ChannelListDTO> channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(channelU)) {
|
||||||
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) {
|
||||||
|
//获取电流通道
|
||||||
|
List<PqScriptDtlsParam.ChannelListDTO> channelI = channelList.stream()
|
||||||
|
.filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(channelI)) {
|
||||||
|
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmI = channelI.stream()
|
||||||
|
.flatMap(x -> x.getHarmList().stream()).collect(Collectors.toList());
|
||||||
|
Map<Double, PqScriptDtlsParam.ChannelListDTO.HarmModel> harmIMap = harmI.stream()
|
||||||
|
.collect(Collectors.toMap(PqScriptDtlsParam.ChannelListDTO.HarmModel::getHarm, Function.identity()));
|
||||||
|
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmList = listDTO.getHarmList();
|
||||||
|
if (CollUtil.isNotEmpty(harmList)) {
|
||||||
|
for (PqScriptDtlsParam.ChannelListDTO.HarmModel harmModel : harmList) {
|
||||||
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
|
if (harmIMap.containsKey(harmModel.getHarm())) {
|
||||||
|
PqScriptDtlsParam.ChannelListDTO.HarmModel i = harmIMap.get(harmModel.getHarm());
|
||||||
|
//电压*电流*cos(电压角度-电流角度)
|
||||||
|
checkData.setValue(i.getFAmp() * harmModel.getFAmp() * Math.cos(harmModel.getFPhase() - i.getFPhase()));
|
||||||
|
}
|
||||||
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
|
info.add(checkData);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SV_1_49:
|
case SV_1_49:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
inHarmCheck(info, channelListDTO, list);
|
inHarmCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SI_1_49:
|
case SI_1_49:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list= channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
inHarmCheck(info, channelListDTO, list);
|
inHarmCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MAG:
|
case MAG:
|
||||||
list= channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(listDTO.getDipData().getFTransValue());
|
checkData.setValue(listDTO.getDipData().getFTransValue());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
info.add(checkData);
|
info.add(checkData);
|
||||||
@@ -469,11 +512,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
case DUR:
|
case DUR:
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(listDTO.getDipData().getRetainTime());
|
checkData.setValue(listDTO.getDipData().getRetainTime());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
info.add(checkData);
|
info.add(checkData);
|
||||||
@@ -481,7 +524,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
break;
|
break;
|
||||||
case IRMS:
|
case IRMS:
|
||||||
case IA:
|
case IA:
|
||||||
if(CollUtil.isNotEmpty(channelList)){
|
if (CollUtil.isNotEmpty(channelList)) {
|
||||||
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
list = channelList.stream().filter(x -> x.getChannelType().contains("I")).collect(Collectors.toList());
|
||||||
rmsCheck(info, channelListDTO, list);
|
rmsCheck(info, channelListDTO, list);
|
||||||
}
|
}
|
||||||
@@ -497,6 +540,10 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
case PST:
|
case PST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case I1:
|
||||||
|
break;
|
||||||
|
case UNKNOWN_ERROR:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -506,16 +553,56 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteDtls(ScriptParam param) {
|
||||||
|
this.remove(new LambdaQueryWrapper<PqScriptDtls>()
|
||||||
|
.eq(PqScriptDtls::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptDtls::getScriptIndex, param.getIndex())
|
||||||
|
);
|
||||||
|
return pqScriptCheckDataService.remove(new LambdaQueryWrapper<PqScriptCheckData>()
|
||||||
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptCheckData::getScriptIndex, param.getIndex())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateDtls(ScriptParam param) {
|
||||||
|
return this.update(new LambdaUpdateWrapper<PqScriptDtls>()
|
||||||
|
.set(PqScriptDtls::getEnable, param.getEnable())
|
||||||
|
.eq(PqScriptDtls::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptDtls::getScriptIndex, param.getIndex())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqScriptCheckData> checkDataList(ScriptParam param) {
|
||||||
|
List<PqScriptDtls> list = this.list(new LambdaQueryWrapper<PqScriptDtls>()
|
||||||
|
.eq(PqScriptDtls::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptDtls::getScriptType, param.getScriptType())
|
||||||
|
);
|
||||||
|
List<Integer> indexList = list.stream().map(PqScriptDtls::getScriptIndex).distinct().collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(indexList)){
|
||||||
|
return pqScriptCheckDataMapper.selectJoinList(PqScriptCheckData.class,new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
|
.select(PqScriptCheckData::getValueType, PqScriptCheckData::getEnable, PqScriptCheckData::getErrorFlag)
|
||||||
|
.distinct()
|
||||||
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptCheckData::getScriptId, indexList)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
private void unbanCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptDtlsParam.ChannelListDTO> channelList, List<PqScriptDtlsParam.ChannelListDTO> list) {
|
private void unbanCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptDtlsParam.ChannelListDTO> channelList, List<PqScriptDtlsParam.ChannelListDTO> list) {
|
||||||
PqScriptDtlsParam.CheckData checkData;
|
PqScriptDtlsParam.CheckData checkData;
|
||||||
if(CollUtil.isNotEmpty(list)){
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
PqScriptDtlsParam.ChannelListDTO a = channelList.stream().filter(x -> x.getChannelType().contains("a")).findFirst().get();
|
PqScriptDtlsParam.ChannelListDTO a = channelList.stream().filter(x -> x.getChannelType().contains("a")).findFirst().get();
|
||||||
PqScriptDtlsParam.ChannelListDTO b = channelList.stream().filter(x -> x.getChannelType().contains("b")).findFirst().get();
|
PqScriptDtlsParam.ChannelListDTO b = channelList.stream().filter(x -> x.getChannelType().contains("b")).findFirst().get();
|
||||||
PqScriptDtlsParam.ChannelListDTO c = channelList.stream().filter(x -> x.getChannelType().contains("c")).findFirst().get();
|
PqScriptDtlsParam.ChannelListDTO c = channelList.stream().filter(x -> x.getChannelType().contains("c")).findFirst().get();
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(UnbanUtil.calculateUnbalance(a.getFAmp(),a.getFPhase(),b.getFAmp(),b.getFPhase(),c.getFAmp(),c.getFPhase()));
|
checkData.setValue(UnbanUtil.calculateUnbalance(a.getFAmp(), a.getFPhase(), b.getFAmp(), b.getFPhase(), c.getFAmp(), c.getFPhase()));
|
||||||
checkData.setPhase("T");
|
checkData.setPhase("T");
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
@@ -526,11 +613,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
private void rmsCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptDtlsParam.ChannelListDTO> list) {
|
private void rmsCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptDtlsParam.ChannelListDTO> list) {
|
||||||
PqScriptDtlsParam.CheckData checkData;
|
PqScriptDtlsParam.CheckData checkData;
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : list) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(listDTO.getFAmp());
|
checkData.setValue(listDTO.getFAmp());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
info.add(checkData);
|
info.add(checkData);
|
||||||
@@ -541,13 +628,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
PqScriptDtlsParam.CheckData checkData;
|
PqScriptDtlsParam.CheckData checkData;
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : uList) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : uList) {
|
||||||
List<PqScriptDtlsParam.ChannelListDTO.InharmModel> inharmList = listDTO.getInharmList();
|
List<PqScriptDtlsParam.ChannelListDTO.InharmModel> inharmList = listDTO.getInharmList();
|
||||||
if(CollUtil.isNotEmpty(inharmList)){
|
if (CollUtil.isNotEmpty(inharmList)) {
|
||||||
for (PqScriptDtlsParam.ChannelListDTO.InharmModel inharmModel : inharmList) {
|
for (PqScriptDtlsParam.ChannelListDTO.InharmModel inharmModel : inharmList) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(inharmModel.getFAmp());
|
checkData.setValue(inharmModel.getFAmp());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setHarmNum(inharmModel.getInharm());
|
checkData.setHarmNum(inharmModel.getInharm());
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
@@ -561,13 +648,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
PqScriptDtlsParam.CheckData checkData;
|
PqScriptDtlsParam.CheckData checkData;
|
||||||
for (PqScriptDtlsParam.ChannelListDTO listDTO : uList) {
|
for (PqScriptDtlsParam.ChannelListDTO listDTO : uList) {
|
||||||
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmList = listDTO.getHarmList();
|
List<PqScriptDtlsParam.ChannelListDTO.HarmModel> harmList = listDTO.getHarmList();
|
||||||
if(CollUtil.isNotEmpty(harmList)){
|
if (CollUtil.isNotEmpty(harmList)) {
|
||||||
for (PqScriptDtlsParam.ChannelListDTO.HarmModel harmModel : harmList) {
|
for (PqScriptDtlsParam.ChannelListDTO.HarmModel harmModel : harmList) {
|
||||||
checkData=new PqScriptDtlsParam.CheckData();
|
checkData = new PqScriptDtlsParam.CheckData();
|
||||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||||
checkData.setEnable(channelListDTO.getEnable());
|
checkData.setEnable(channelListDTO.getEnable());
|
||||||
checkData.setValue(harmModel.getFAmp());
|
checkData.setValue(harmModel.getFAmp());
|
||||||
checkData.setPhase(listDTO.getChannelType().substring(1,2));
|
checkData.setPhase(listDTO.getChannelType().substring(1, 2));
|
||||||
checkData.setHarmNum(harmModel.getHarm());
|
checkData.setHarmNum(harmModel.getHarm());
|
||||||
checkData.setDataType(channelListDTO.getDataType());
|
checkData.setDataType(channelListDTO.getDataType());
|
||||||
checkData.setValueType(channelListDTO.getValueType());
|
checkData.setValueType(channelListDTO.getValueType());
|
||||||
@@ -578,15 +665,10 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean saveCheck() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PqScriptDtls setScriptDtls(PqScriptDtlsParam sourceIssue, Integer i) {
|
private PqScriptDtls setScriptDtls(PqScriptDtlsParam sourceIssue, Integer i) {
|
||||||
PqScriptDtls dtls = new PqScriptDtls();
|
PqScriptDtls dtls = new PqScriptDtls();
|
||||||
dtls.setScriptId(sourceIssue.getScriptId());
|
dtls.setScriptId(sourceIssue.getScriptId());
|
||||||
dtls.setIndex(i);
|
dtls.setScriptIndex(i);
|
||||||
dtls.setScriptType(sourceIssue.getScriptType());
|
dtls.setScriptType(sourceIssue.getScriptType());
|
||||||
dtls.setScriptSubType(sourceIssue.getSubType());
|
dtls.setScriptSubType(sourceIssue.getSubType());
|
||||||
dtls.setEnable(DataStateEnum.ENABLE.getCode());
|
dtls.setEnable(DataStateEnum.ENABLE.getCode());
|
||||||
@@ -605,17 +687,17 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
// .le(PqScriptDtls::getIndex, 30)
|
// .le(PqScriptDtls::getIndex, 30)
|
||||||
// .in(PqScriptDtls::getIndex, Arrays.asList(1,7))
|
// .in(PqScriptDtls::getIndex, Arrays.asList(1,7))
|
||||||
|
|
||||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode())
|
.eq(CollUtil.isNotEmpty(param.getDevIds()), PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode())
|
||||||
.orderByAsc(PqScriptCheckData::getIndex)
|
.orderByAsc(PqScriptCheckData::getScriptIndex)
|
||||||
;
|
;
|
||||||
if (param.getIsPhaseSequence().equals(CommonEnum.PHASE_TEST.getValue())) {
|
if (param.getIsPhaseSequence().equals(CommonEnum.PHASE_TEST.getValue())) {
|
||||||
//相序
|
//相序
|
||||||
queryWrapper.eq(PqScriptDtls::getIndex, -1)
|
queryWrapper.eq(PqScriptDtls::getScriptIndex, -1)
|
||||||
.eq(PqScriptDtls::getEnable, 1);
|
.eq(PqScriptDtls::getEnable, 1);
|
||||||
pqScriptDtls = this.list(queryWrapper);
|
pqScriptDtls = this.list(queryWrapper);
|
||||||
} else if (param.getIsPhaseSequence().equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
} else if (param.getIsPhaseSequence().equals(CommonEnum.COEFFICIENT_TEST.getValue())) {
|
||||||
//系数
|
//系数
|
||||||
queryWrapper.in(PqScriptDtls::getIndex, param.getIndexList())
|
queryWrapper.in(PqScriptDtls::getScriptIndex, param.getIndexList())
|
||||||
.eq(PqScriptDtls::getEnable, 1);
|
.eq(PqScriptDtls::getEnable, 1);
|
||||||
pqScriptDtls = this.list(queryWrapper);
|
pqScriptDtls = this.list(queryWrapper);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class ScriptDtlsDesc {
|
|||||||
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().intValue() + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") ");
|
+ ",暂态持续时间=" + (ObjectUtil.isNull(dtls.getRetainTime()) ? dtls.getRetainTime() : dtls.getRetainTime().intValue()) + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user