调整异常数据界面业务
This commit is contained in:
@@ -52,17 +52,5 @@ public class PqDataVerifyCount implements Serializable {
|
||||
@TableField(value = "total_all")
|
||||
private Integer totalAll ;
|
||||
|
||||
/**
|
||||
* 异常短时闪变数量
|
||||
*/
|
||||
@TableField(value = "flicker")
|
||||
private Integer flicker ;
|
||||
|
||||
/**
|
||||
* 短时闪变总数量
|
||||
*/
|
||||
@TableField(value = "flicker_all")
|
||||
private Integer flickerAll;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -136,8 +136,10 @@ public class AreaLineInfoVO implements Serializable {
|
||||
@ApiModelProperty(name = "objId",value = "对象id")
|
||||
private String objId;
|
||||
|
||||
private Double vHarmonicValue; ;
|
||||
@ApiModelProperty(name = "vHarmonicValue",value = "污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
@ApiModelProperty(name = "userList",value = "敏感用户信息")
|
||||
private List<User> userList;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -13,10 +13,10 @@ public class PowerQualityIndicatorsVO {
|
||||
|
||||
@ApiModelProperty(name = "monitorId",value = "监测点id")
|
||||
private String monitorId;
|
||||
//监测点名称
|
||||
|
||||
@ApiModelProperty(name = "monitorName",value = "监测点名称")
|
||||
private String monitorName;
|
||||
//所属终端名称
|
||||
|
||||
@ApiModelProperty(name = "devName",value = "所属终端名称")
|
||||
private String devName;
|
||||
|
||||
@@ -25,23 +25,25 @@ public class PowerQualityIndicatorsVO {
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "所属厂商")
|
||||
private String manufacturer;
|
||||
//所属电站
|
||||
|
||||
@ApiModelProperty(name = "stationName",value = "所属电站")
|
||||
private String stationName;
|
||||
//监测对象类型
|
||||
|
||||
@ApiModelProperty(name = "objType",value = "监测对象类型")
|
||||
private String objType;
|
||||
//监测对象名称
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "监测对象名称")
|
||||
private String objName;
|
||||
//电压等级
|
||||
|
||||
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
||||
private String voltageLevel;
|
||||
//异常天数
|
||||
|
||||
@ApiModelProperty(name = "abnormalDay",value = "异常天数")
|
||||
private Integer abnormalDay;
|
||||
//严重度
|
||||
|
||||
@ApiModelProperty(name = "severity",value = "严重度")
|
||||
private Integer severity;
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
}
|
||||
|
||||
@@ -20,30 +20,27 @@ import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.overlimit.service.IOverLimitService;
|
||||
import com.njcn.device.pq.mapper.DataVerifyMapper;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IDataVerifyService;
|
||||
import com.njcn.harmonic.pojo.po.RStatDataVD;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -51,7 +48,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -73,28 +69,21 @@ import java.util.stream.Collectors;
|
||||
public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVerify> implements IDataVerifyService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataVerifyServiceImpl.class);
|
||||
|
||||
private static final String SEPARATOR = "&";
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
|
||||
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
||||
|
||||
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||
|
||||
private final DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final IOverLimitService overLimitService;
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
@@ -545,7 +534,10 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}else{
|
||||
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
|
||||
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
|
||||
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
|
||||
}
|
||||
//谐波电流
|
||||
if (CollUtil.isNotEmpty(iharm)) {
|
||||
@@ -1023,7 +1015,8 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
|
||||
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
|
||||
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
|
||||
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
|
||||
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
@@ -1033,6 +1026,9 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
|
||||
it.setMonitorName(lineDetail.getLineName());
|
||||
it.setStationName(lineDetail.getSubName());
|
||||
if(deptName.containsKey(lineDetail.getLineId())){
|
||||
it.setCity(deptName.get(lineDetail.getLineId()));
|
||||
}
|
||||
it.setDevName(lineDetail.getDeviceName());
|
||||
it.setVoltageLevel(lineDetail.getVoltageScale());
|
||||
it.setIp(Base64.encode(lineDetail.getIp()));
|
||||
|
||||
@@ -384,8 +384,6 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
onlineRateParam.setIds(lineIds);
|
||||
List<PqDataVerifyCount> sumVerify = pqDataVerifyCountService.getSumVerify(onlineRateParam);
|
||||
|
||||
//超标率
|
||||
// List<RStatLimitRateDPO> limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData();
|
||||
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
detail = new DeviceRunEvaluateVO.Detail();
|
||||
@@ -393,7 +391,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
detail.setCount(dto.getDeviceIndexes().size());
|
||||
detail.setOnline(onLineRate(onlineRateByDev, dto.getDeviceIndexes()));
|
||||
detail.setIntegrity(integrity(integrityList, dto.getLineIndexes()));
|
||||
detail.setQualified(verify(sumVerify, dto.getLineIndexes()));
|
||||
detail.setQualified(verifyDev(sumVerify, dto.getLineIndexes(), dto.getDeviceIndexes()));
|
||||
detail.setScore(ONINTEGRITY.multiply(detail.getIntegrity())
|
||||
.add(ONLINERATE.multiply(detail.getOnline())
|
||||
.add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP));
|
||||
@@ -436,18 +434,28 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
return info;
|
||||
}
|
||||
|
||||
private BigDecimal verifyDev(List<PqDataVerifyCount> sumVerify, List<String> lineIds, List<String> devIds) {
|
||||
//异常率
|
||||
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<String> verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList());
|
||||
List<String> devIdsLine = lineMapper.getDevIdsLine(verifyLine);
|
||||
if (CollUtil.isNotEmpty(devIdsLine)) {
|
||||
return NumberUtil.round(Math.min(devIdsLine.size() * 100 / devIds.size(), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal verify(List<PqDataVerifyCount> sumVerify, List<String> lineIds) {
|
||||
//异常率
|
||||
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(verifyList)) {
|
||||
double total = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotal).sum();
|
||||
double totalAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotalAll).sum();
|
||||
double flicker = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlicker).sum();
|
||||
double flickerAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlickerAll).sum();
|
||||
if (totalAll + flickerAll == 0) {
|
||||
if (totalAll == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min((total + flicker) * 100 / (totalAll + flickerAll), 100), 2);
|
||||
return NumberUtil.round(Math.min((total ) * 100 / (totalAll), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
@@ -62,19 +64,13 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
private static final String SEPARATOR = "-";
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
@@ -140,7 +136,8 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null);
|
||||
Map<String, PowerQualityIndicatorsVO> areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity()));
|
||||
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptLine(ids);
|
||||
Map<String, String> deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId));
|
||||
// List<String> objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList());
|
||||
// List<NewUserReportVO> userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
// Map<String, NewUserReportVO> userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
@@ -151,6 +148,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
it.setMonitorName(lineDetail.getLineName());
|
||||
it.setStationName(lineDetail.getSubName());
|
||||
it.setDevName(lineDetail.getDeviceName());
|
||||
if(deptName.containsKey(lineDetail.getLineId())){
|
||||
it.setCity(deptName.get(lineDetail.getLineId()));
|
||||
}
|
||||
it.setVoltageLevel(lineDetail.getVoltageScale());
|
||||
it.setIp(Base64.encode(lineDetail.getIp()));
|
||||
it.setManufacturer(lineDetail.getManufacturer());
|
||||
|
||||
@@ -579,4 +579,13 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
* 根据Pid获取所有子节点
|
||||
*/
|
||||
List<String> getSubIdByPid(@Param("pid") String pid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id获取终端id
|
||||
*
|
||||
* @param ids 监测点集合
|
||||
* @return 结果
|
||||
*/
|
||||
List<String> getDevIdsLine(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
@@ -1935,5 +1935,19 @@
|
||||
AND t2.Monitor_Flag = 0
|
||||
</if>
|
||||
</select>
|
||||
<select id="getDevIdsLine" resultType="java.lang.String">
|
||||
SELECT
|
||||
DISTINCT d.id
|
||||
FROM
|
||||
pq_line a
|
||||
INNER JOIN pq_line v ON a.pid = v.id
|
||||
INNER JOIN pq_line d ON v.pid = d.id
|
||||
where
|
||||
a.id in
|
||||
<foreach collection="ids" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -44,6 +44,13 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
List<DeptLine> selectDeptBindLines(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id获取部门信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<DeptLine> selectDeptLine(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据部门ids集合查询所有监测点id
|
||||
* @param ids 部门ids
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -34,10 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -111,6 +109,22 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
return this.lambdaQuery().in(DeptLine::getId, ids).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptLine> selectDeptLine(List<String> ids) {
|
||||
List<DeptLine> list = this.lambdaQuery().in(DeptLine::getLineId, ids).list();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<Dept> data = deptFeignClient.getAllDept().getData();
|
||||
Map<String, String> deptName = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
for (DeptLine deptLine : list) {
|
||||
if (deptName.containsKey(deptLine.getId())) {
|
||||
deptLine.setId(deptName.get(deptLine.getId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLineByDeptIds(List<String> ids,String manufacturer, List<Integer> runFlag, List<Integer> dataType, String objType) {
|
||||
return this.baseMapper.getLineIdByDeptIds(ids, manufacturer ,runFlag, dataType, objType);
|
||||
|
||||
@@ -490,7 +490,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
public Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param) {
|
||||
Page<AdvanceEventDetailVO> pageResult = new Page<>();
|
||||
param.setLineOrDevice(0);
|
||||
param.setDeptIndex("0d52f9f6e43ec0ee83013cd32da93f66");
|
||||
param.setDeptIndex(param.getDeptIndex());
|
||||
param.setStatisticalType(new SimpleDTO());
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
@@ -500,6 +500,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
.eq(StrUtil.isNotBlank(param.getDicData()), RmpEventDetailPO::getEventType, param.getDicData())
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
||||
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||
);
|
||||
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(tempLineIds)){
|
||||
|
||||
Reference in New Issue
Block a user