diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java index 0f3ed73d3..60a38545f 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java @@ -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; - } diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaLineInfoVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaLineInfoVO.java index cebdb665b..5c5253d96 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaLineInfoVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaLineInfoVO.java @@ -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 userList; @Data diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/PowerQualityIndicatorsVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/PowerQualityIndicatorsVO.java index e1da386a2..16d940e84 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/PowerQualityIndicatorsVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/PowerQualityIndicatorsVO.java @@ -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; } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java index 477b58d69..345eca2a5 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java @@ -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 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 ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList()); List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null); Map areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity())); - + List deptLines = deptLineService.selectDeptLine(ids); + Map deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId)); // List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); // List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); // Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); @@ -1033,6 +1026,9 @@ public class DataVerifyServiceImpl extends ServiceImpl sumVerify = pqDataVerifyCountService.getSumVerify(onlineRateParam); - //超标率 - // List 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 sumVerify, List lineIds, List devIds) { + //异常率 + List verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList()); + List verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList()); + List 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 sumVerify, List lineIds) { //异常率 List 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); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java index aa874f0f8..4efd50388 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java @@ -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 ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList()); List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null); Map areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity())); - + List deptLines = deptLineService.selectDeptLine(ids); + Map deptName = deptLines.stream().collect(Collectors.toMap(DeptLine::getLineId, DeptLine::getId)); // List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); // List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); // Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); @@ -151,6 +148,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl { * 根据Pid获取所有子节点 */ List getSubIdByPid(@Param("pid") String pid); + + + /** + * 根据监测点id获取终端id + * + * @param ids 监测点集合 + * @return 结果 + */ + List getDevIdsLine(@Param("ids") List ids); } diff --git a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/mapper/mapping/LineMapper.xml b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/mapper/mapping/LineMapper.xml index 1ca1f76d4..c1f71647b 100644 --- a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/mapper/mapping/LineMapper.xml +++ b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/mapper/mapping/LineMapper.xml @@ -1935,5 +1935,19 @@ AND t2.Monitor_Flag = 0 + diff --git a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/DeptLineService.java b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/DeptLineService.java index 8164d6b22..2c4f35710 100644 --- a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/DeptLineService.java +++ b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/DeptLineService.java @@ -44,6 +44,13 @@ public interface DeptLineService extends IService { List selectDeptBindLines(List ids); + /** + * 根据监测点id获取部门信息 + * @param ids + * @return + */ + List selectDeptLine(List ids); + /** * 根据部门ids集合查询所有监测点id * @param ids 部门ids diff --git a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/impl/DeptLineServiceImpl.java b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/impl/DeptLineServiceImpl.java index 7dd1ae8f6..884749014 100644 --- a/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/impl/DeptLineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-com/src/main/java/com/njcn/device/line/service/impl/DeptLineServiceImpl.java @@ -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 i return this.lambdaQuery().in(DeptLine::getId, ids).list(); } + @Override + public List selectDeptLine(List ids) { + List list = this.lambdaQuery().in(DeptLine::getLineId, ids).list(); + if (CollUtil.isNotEmpty(list)) { + List data = deptFeignClient.getAllDept().getData(); + Map 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 getLineByDeptIds(List ids,String manufacturer, List runFlag, List dataType, String objType) { return this.baseMapper.getLineIdByDeptIds(ids, manufacturer ,runFlag, dataType, objType); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/RmpEventDetailServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/RmpEventDetailServiceImpl.java index ec7159d16..1e5239a07 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/RmpEventDetailServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/RmpEventDetailServiceImpl.java @@ -490,7 +490,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl getEventByLineIdsCount(EventBaseParam.Info param) { Page pageResult = new Page<>(); param.setLineOrDevice(0); - param.setDeptIndex("0d52f9f6e43ec0ee83013cd32da93f66"); + param.setDeptIndex(param.getDeptIndex()); param.setStatisticalType(new SimpleDTO()); //获取终端台账类信息 List deviceInfo = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData(); @@ -500,6 +500,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList()); if(CollUtil.isNotEmpty(tempLineIds)){