1.增加检测结果信息入库
2.优化代码,三相不平衡,闪变,暂态业务逻辑提交
This commit is contained in:
@@ -209,6 +209,7 @@ public class DetectionServiceImpl {
|
||||
result.setMonitorId(devID + "_" + split[1]);
|
||||
result.setScriptId(sourceIssue.getScriptId());
|
||||
result.setIndex(sourceIssue.getIndex());
|
||||
result.setAdType(pqErrSysDtls.get(0).getScriptType());
|
||||
result.setDataType("avg");
|
||||
if (map.containsKey(TYPE_T)) {
|
||||
DetectionData t = rangeComparisonList(map.get(TYPE_T), pqErrSysDtls, fData, 1.0, dataRule);
|
||||
@@ -324,6 +325,7 @@ public class DetectionServiceImpl {
|
||||
result.setMonitorId(devID + "_" + split[1]);
|
||||
result.setScriptId(sourceIssue.getScriptId());
|
||||
result.setIndex(sourceIssue.getIndex());
|
||||
result.setAdType(pqErrSysDtls.get(0).getScriptType());
|
||||
result.setDataType("avg");
|
||||
//取出源所对应的相别信息
|
||||
List<PqScriptCheckData> channelTypeAList = checkData.stream()
|
||||
@@ -372,12 +374,14 @@ public class DetectionServiceImpl {
|
||||
//暂降时间处理数据
|
||||
Map<String, List<Double>> dur = devListMap(dev, dataRule, DUR);
|
||||
//理论上根据检测脚本,能知道误差体系,可以知道多个误差体系
|
||||
List<PqErrSysDtls> magErrList = pqErrSysDtls.stream().filter(x -> MAG.equals(x.getScriptType())).collect(Collectors.toList());
|
||||
List<PqErrSysDtls> durErrList = pqErrSysDtls.stream().filter(x -> DUR.equals(x.getScriptType())).collect(Collectors.toList());
|
||||
List<PqErrSysDtls> magErrList = pqErrSysDtls.stream().filter(x -> MAG.equals(x.getScriptCode())).collect(Collectors.toList());
|
||||
List<PqErrSysDtls> durErrList = pqErrSysDtls.stream().filter(x -> DUR.equals(x.getScriptCode())).collect(Collectors.toList());
|
||||
|
||||
AdNonHarmonicResult magResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, mag, magErrList, sourceIssue.getFUn(), MAG);
|
||||
magResult.setAdType(magErrList.get(0).getScriptType());
|
||||
AdNonHarmonicResult durResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, dur, durErrList, sourceIssue.getFFreq(), DUR);
|
||||
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult,magResult),code);
|
||||
durResult.setAdType(durErrList.get(0).getScriptType());
|
||||
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult,durResult),code);
|
||||
List<Integer> numbers = Arrays.asList(magResult.getResultFlag(), durResult.getResultFlag()).stream().distinct().collect(Collectors.toList());
|
||||
if (numbers.contains(4)) {
|
||||
return 4;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.device.err.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -33,6 +34,12 @@ public class PqErrSysDtls implements Serializable {
|
||||
*/
|
||||
private String scriptType;
|
||||
|
||||
/**
|
||||
* 脚本项类型Code
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String scriptCode;
|
||||
|
||||
/**
|
||||
* 误差判断起始值
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.njcn.gather.device.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,25 +71,18 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||
PqScriptCheckDataParam script = new PqScriptCheckDataParam();
|
||||
script.setScriptId(param.getScriptId());
|
||||
script.setIndex(param.getIndex());
|
||||
script.setIsValueTypeName(false);
|
||||
List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||
//根据检测脚本id和检测序号,查询出检测子项目
|
||||
return this.list(new MPJLambdaWrapper<PqErrSysDtls>()
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptType)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
.in(PqErrSysDtls::getId, Arrays.asList("ae86b657f37151d78b7c34ec64eefa10"))
|
||||
// .eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
// .in(PqErrSysDtls::getErrorSysId, param.getType())
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
.in(PqErrSysDtls::getScriptType, valueType)
|
||||
);
|
||||
// PqScriptCheckDataParam script = new PqScriptCheckDataParam();
|
||||
// script.setScriptId(param.getScriptId());
|
||||
// script.setIndex(param.getIndex());
|
||||
// script.setIsValueTypeName(false);
|
||||
// List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||
// //根据检测脚本id和检测序号,查询出检测子项目
|
||||
// return this.list(new MPJLambdaWrapper<PqErrSysDtls>()
|
||||
// .selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
// .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
// .eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
// .in(PqErrSysDtls::getScriptType, valueType)
|
||||
// );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package com.njcn.gather.storage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.db.mybatisplus.mapper.BatchBaseMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AdNonHarmonicMapper extends BaseMapper<AdNonHarmonicResult> {
|
||||
|
||||
|
||||
|
||||
|
||||
public interface AdNonHarmonicMapper extends BatchBaseMapper<AdNonHarmonicResult> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.njcn.gather.storage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.db.mybatisplus.mapper.BatchBaseMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DetectionDataDealMapper extends BaseMapper<AdHarmonicResult> {
|
||||
public interface DetectionDataDealMapper extends BatchBaseMapper<AdHarmonicResult> {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.storage.mapper.AdNonHarmonicMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.storage.mapper.DetectionDataDealMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.storage.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -36,7 +37,7 @@ public class AdHarmonicResult {
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
|
||||
@TableField("`INDEX`")
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.storage.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -36,6 +37,7 @@ public class AdNonHarmonicResult {
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
@TableField("`INDEX`")
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.njcn.gather.storage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.db.mybatisplus.service.IReplenishMybatisService;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
||||
public interface AdNonHarmonicService extends IReplenishMybatisService<AdNonHarmonicResult> {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.njcn.gather.storage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.db.mybatisplus.service.IReplenishMybatisService;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DetectionDataDealService extends IService<AdHarmonicResult> {
|
||||
public interface DetectionDataDealService extends IReplenishMybatisService<AdHarmonicResult> {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl;
|
||||
import com.njcn.gather.storage.mapper.AdNonHarmonicMapper;
|
||||
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, AdNonHarmonicResult> implements AdNonHarmonicService {
|
||||
public class AdNonHarmonicServiceImpl extends ReplenishMybatisServiceImpl<AdNonHarmonicMapper, AdNonHarmonicResult> implements AdNonHarmonicService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl;
|
||||
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DetectionDataServiceImpl extends ServiceImpl<DetectionDataDealMapper, AdHarmonicResult> implements DetectionDataDealService {
|
||||
public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<DetectionDataDealMapper, AdHarmonicResult> implements DetectionDataDealService {
|
||||
|
||||
private final AdNonHarmonicService adNonHarmonicService;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DetectionDataServiceImpl extends ServiceImpl<DetectionDataDealMappe
|
||||
|
||||
@Override
|
||||
public Boolean acceptAdNonResult(List<AdNonHarmonicResult> adNonHarmonicResultList,String code) {
|
||||
String adNonTableResult = "ad_non_harmonic_";
|
||||
String adNonTableResult = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adNonTableResult +code);
|
||||
adNonHarmonicService.saveBatch(adNonHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
@@ -52,7 +52,7 @@ public class DetectionDataServiceImpl extends ServiceImpl<DetectionDataDealMappe
|
||||
|
||||
@Override
|
||||
public Boolean acceptAdResult(List<AdHarmonicResult> adHarmonicResultList,String code) {
|
||||
String adTableResult = "ad_harmonic_";
|
||||
String adTableResult = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adTableResult +code);
|
||||
this.saveBatch(adHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
Reference in New Issue
Block a user