Compare commits
11 Commits
614647d36d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f2ed06a35 | |||
| 277400670d | |||
| a1031109c4 | |||
| eeb27c519b | |||
|
|
670eaf7d38 | ||
| 2b79cefad6 | |||
| 212db18835 | |||
|
|
e9a1c34160 | ||
|
|
fb7a2b7084 | ||
|
|
4b3ec39a11 | ||
|
|
2d255a5dd3 |
@@ -565,7 +565,7 @@ public class SecondaryEvaluationServiceImpl implements SecondaryEvaluationServic
|
||||
unblance.add(evaluationResult);
|
||||
|
||||
evaluationResult = new AssessResultVO.EvaluationResult();
|
||||
evaluationResult.setData(result.getApproUnblance().multiply(BigDecimal.valueOf(200)));
|
||||
evaluationResult.setData(result.getApproUnblance());
|
||||
evaluationResult.setLimitData(overLimit.getUnblance());
|
||||
evaluationResult.setIsQualified(NumberUtil.isLess(evaluationResult.getData(), evaluationResult.getLimitData()));
|
||||
unblance.add(evaluationResult);
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
SELECT DISTINCT
|
||||
monitor.Org_Id AS orgId,
|
||||
monitor.Org_Name AS orgName,
|
||||
monitor.`Powerr_Id` AS powerId,
|
||||
monitor.`Powerr_Name` AS powerName,
|
||||
monitor.Powerr_Id AS powerId,
|
||||
monitor.Powerr_Name AS powerName,
|
||||
monitor.id AS monitorId,
|
||||
monitor.`Name` AS monitorName,
|
||||
monitor.Name AS monitorName,
|
||||
monitor.Line_Id,
|
||||
monitor.Line_Name,
|
||||
pdm.Monitor_Sort AS monitorSort,
|
||||
@@ -29,8 +29,8 @@
|
||||
(
|
||||
SELECT
|
||||
pm.id,
|
||||
pm.`Name`,
|
||||
pm.`Status`,
|
||||
pm.Name,
|
||||
pm.Status,
|
||||
pm.Org_Id,
|
||||
pm.Org_Name,
|
||||
pm.Powerr_Id,
|
||||
@@ -51,8 +51,8 @@
|
||||
) AS monitor
|
||||
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
|
||||
WHERE
|
||||
monitor.`Status` = 1
|
||||
AND pdm.`Status` = 1
|
||||
monitor.Status = 1
|
||||
AND pdm.Status = 1
|
||||
AND monitor.Org_Id IN
|
||||
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
|
||||
#{orgId}
|
||||
@@ -85,7 +85,7 @@
|
||||
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
|
||||
</if>
|
||||
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
|
||||
AND monitor.`Name` LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
||||
AND monitor.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -41,4 +41,6 @@ public class MonitorBaseParam extends BaseParam {
|
||||
@ApiModelProperty(value = "监测点运行状态")
|
||||
private Integer lineRunFlag;
|
||||
|
||||
@ApiModelProperty(value = "异常天数时间")
|
||||
private List<String> time;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,6 +17,8 @@ public class DetailAbnormalVO {
|
||||
|
||||
private String date;
|
||||
|
||||
private List<String> dateList;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private String bdName;
|
||||
@@ -58,6 +60,15 @@ public class DetailAbnormalVO {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DetailAbnormalCountVO {
|
||||
|
||||
private Integer timeSum;
|
||||
private Integer errCount;
|
||||
private List<DetailAbnormalInnerVO> time;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class DetailLimitInnerVO{
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorAbnormalTableDetail")
|
||||
@ApiOperation("弹框-获取异常监测点列表详情")
|
||||
public HttpResult<List<DetailAbnormalVO.DetailAbnormalInnerVO>> monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<DetailAbnormalVO.DetailAbnormalCountVO> monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("monitorAbnormalTableDetail");
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam);
|
||||
DetailAbnormalVO.DetailAbnormalCountVO list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
SELECT
|
||||
line_id AS lineId,
|
||||
SUM(total) AS total,
|
||||
SUM(total_all) AS totalAll,
|
||||
SUM(flicker) AS flicker,
|
||||
SUM(flicker_all) AS flickerAll
|
||||
SUM(total_all) AS totalAll
|
||||
FROM
|
||||
pq_data_verify_count
|
||||
<where>
|
||||
@@ -32,12 +30,12 @@
|
||||
|
||||
<select id="getAnomalousData" resultType="OnlineMonitorVo">
|
||||
SELECT DISTINCT
|
||||
t6.`Name` gdName,
|
||||
t5.`Name` subName,
|
||||
t4.`Name` deviceName,
|
||||
t6.Name gdName,
|
||||
t5.Name subName,
|
||||
t4.Name deviceName,
|
||||
t1.Line_Id lineId,
|
||||
t2.`Name` lineName,
|
||||
t8.`Name` monitorObjType,
|
||||
t2.Name lineName,
|
||||
t8.Name monitorObjType,
|
||||
t7.Obj_Name monitorObj,
|
||||
"异常数据" as target,
|
||||
count(t1.time_id) lastDay
|
||||
@@ -51,7 +49,7 @@
|
||||
left join pq_line_detail t7 on t1.Line_Id = t7.Id
|
||||
left join sys_dict_data t8 on t7.Load_Type = t8.Id
|
||||
WHERE
|
||||
(t1.total + t1.flicker) > 0
|
||||
t1.total > 0
|
||||
<if test="lineIds!=null and lineIds.size > 0">
|
||||
and Line_Id in
|
||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||
@@ -69,4 +67,4 @@
|
||||
order by lastDay desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
line.LEVEL,
|
||||
line.sort,
|
||||
line.pids,
|
||||
CONCAT(voltage.name, '_', line.name, '(',device.`Name`,')') name,
|
||||
CONCAT(voltage.name, '_', line.name, '(',device.Name,')') name,
|
||||
comFlag.Com_Flag,
|
||||
detail.pt_type,
|
||||
detail.obj_id
|
||||
|
||||
@@ -27,8 +27,7 @@ public interface IPqDataVerifyBakService extends IService<PqDataVerifyBak> {
|
||||
List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
@@ -672,6 +664,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.HARMONIC_CURRENT.getCode(), "iharm", 2, 25, result);
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.INTERHARMONIC_VOLTAGE.getCode(), "inuharm", 1, 16, result);
|
||||
}
|
||||
|
||||
private void processStandardTarget(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
|
||||
String targetCode, String data,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
@@ -976,7 +969,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<LocalDate> dateList = list.stream().map(it -> it.getTime().toLocalDate()).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -988,7 +981,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
List<LocalDate> dateList = list.stream().map(DataLimitTargetDto::getTime).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1015,34 +1008,44 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
}
|
||||
}
|
||||
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
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()));
|
||||
result.forEach(it -> {
|
||||
if (areaMap.containsKey(it.getMonitorId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
|
||||
it.setMonitorName(areaLineInfoVO.getLineName());
|
||||
it.setStationName(areaLineInfoVO.getSubName());
|
||||
it.setDevName(areaLineInfoVO.getDeviceName());
|
||||
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
|
||||
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
|
||||
it.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
}
|
||||
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
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()));
|
||||
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
|
||||
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
|
||||
if (areaMap.containsKey(lineDetail.getLineId())) {
|
||||
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()));
|
||||
it.setManufacturer(lineDetail.getManufacturer());
|
||||
it.setObjType(lineDetail.getLoadType());
|
||||
it.setObjName(lineDetail.getObjName());
|
||||
info.add(it);
|
||||
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
// }
|
||||
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
result.clear();
|
||||
result.addAll(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.0 / 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.0 / totalAll, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
@@ -462,7 +470,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (dueTime == 0) {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
return NumberUtil.round(Math.min(realTime * 100 / dueTime, 100), 2);
|
||||
return NumberUtil.round(Math.min(realTime * 100.0 / dueTime, 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;
|
||||
@@ -33,10 +35,7 @@ import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -65,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) {
|
||||
@@ -94,7 +87,6 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
} else {
|
||||
verifyMonitorVO.setRunNum(0);
|
||||
verifyMonitorVO.setAbnormalNum(0);
|
||||
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, new ArrayList<>()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>()));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam));
|
||||
@@ -111,7 +103,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
List<LocalDate> dateList = list.stream().map(PqDataVerifyBak::getTimeId).sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
dealTableResult(result, monitorBaseParam.getSearchValue());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -137,34 +129,44 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
}
|
||||
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result, String searchValue) {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
// List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
// Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
List<String> ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
|
||||
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()));
|
||||
result.forEach(it -> {
|
||||
if (areaMap.containsKey(it.getMonitorId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId());
|
||||
it.setMonitorName(areaLineInfoVO.getLineName());
|
||||
it.setStationName(areaLineInfoVO.getSubName());
|
||||
it.setDevName(areaLineInfoVO.getDeviceName());
|
||||
it.setVoltageLevel(areaLineInfoVO.getVoltageScale());
|
||||
it.setIp(Base64.encode(areaLineInfoVO.getIp()));
|
||||
it.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
}
|
||||
if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
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()));
|
||||
List<PowerQualityIndicatorsVO> info = new ArrayList<>();
|
||||
for (AreaLineInfoVO lineDetail : areaLineInfoVOList) {
|
||||
if (areaMap.containsKey(lineDetail.getLineId())) {
|
||||
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
|
||||
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());
|
||||
it.setObjType(lineDetail.getLoadType());
|
||||
it.setObjName(lineDetail.getObjName());
|
||||
info.add(it);
|
||||
// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) {
|
||||
// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName());
|
||||
// }
|
||||
// if (userMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
result.clear();
|
||||
result.addAll(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,97 +269,29 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
}
|
||||
List<PqDataVerifyBak> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
for (PqDataVerifyBak pqDataVerifyBak : dataVerifyList) {
|
||||
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(pqDataVerifyBak.getLineId());
|
||||
Map<String, List<PqDataVerifyBak>> VerifyMap = dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId));
|
||||
VerifyMap.forEach((key, value) -> {
|
||||
LineDetailDataVO lineDevGetDTO = lineDetailMap.get(key);
|
||||
String temBgName = "";
|
||||
if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())) {
|
||||
temBgName = lineDevGetDTO.getBdName();
|
||||
} else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) {
|
||||
temBgName = lineDevGetDTO.getObjName();
|
||||
}
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
String[] errorTimeCount = {"0"};
|
||||
Long[] errAllCount = {0L};
|
||||
jsonArray.forEach(it -> {
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
JSONArray innerJson = targetJson.getJSONArray(monitorBaseParam.getTargetKey());
|
||||
PqReasonableRangeDto dto = rangeMap.get(monitorBaseParam.getTargetKey());
|
||||
if (Objects.nonNull(dto.getHarmStart()) && Objects.nonNull(dto.getHarmEnd())) {
|
||||
errorTimeCount[0] = targetJson.get("errorTimes").toString();
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
errorTimeCount[0] = jsonObjectTem.get("errorTimes").toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rangeMap.forEach((rangeKey, val) -> {
|
||||
if (targetJson.containsKey(rangeKey)) {
|
||||
JSONArray innerJson = targetJson.getJSONArray(rangeKey);
|
||||
for (Object oJson : innerJson) {
|
||||
JSONObject jsonObjectTem = (JSONObject) oJson;
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
list.forEach(listItem -> {
|
||||
JSONObject object = (JSONObject) listItem;
|
||||
long errCount = Long.parseLong(object.get("errorCounts").toString());
|
||||
errAllCount[0] += errCount;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
errorTimeCount[0] = targetJson.get("lineErrorTimes").toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setTimeSum(errorTimeCount[0]);
|
||||
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
detailAbnormalVO.setErrCount(errAllCount[0].toString());
|
||||
result.add(detailAbnormalVO);
|
||||
} catch (BusinessException b) {
|
||||
//文件为空时候的特殊处理
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setTimeSum("/");
|
||||
detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常");
|
||||
}
|
||||
}
|
||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
||||
detailAbnormalVO.setDateList(value.stream().map(x -> x.getTimeId().format(DatePattern.NORM_DATE_FORMATTER)).collect(Collectors.toList()));
|
||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
|
||||
detailAbnormalVO.setBdName(temBgName);
|
||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
|
||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
||||
result.add(detailAbnormalVO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
public DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (!dtoMap.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
@@ -366,44 +300,50 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
}
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<PqDataVerifyBak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(PqDataVerifyBak::getTimeId);
|
||||
lambdaQueryWrapper.in(PqDataVerifyBak::getTimeId, monitorBaseParam.getTime())
|
||||
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds());
|
||||
|
||||
PqDataVerifyBak pqDataVerifyBak = this.getOne(lambdaQueryWrapper);
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
for (Object it : jsonArray) {
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
String tarKey = "";
|
||||
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (targetJson.containsKey(key)) {
|
||||
tarKey = key;
|
||||
break;
|
||||
List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper);
|
||||
Integer[] errorTimeCount = {0};
|
||||
Integer[] errAllCount = {0};
|
||||
for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) {
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
jsonArray.forEach(it->{
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
errorTimeCount[0] += Integer.valueOf(targetJson.get("lineErrorTimes").toString());
|
||||
}else{
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount);
|
||||
}
|
||||
} else {
|
||||
String tarKey = "";
|
||||
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (targetJson.containsKey(key)) {
|
||||
tarKey = key;
|
||||
}
|
||||
}
|
||||
resultDeal(dtoMap, tarKey, targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount);
|
||||
}
|
||||
}
|
||||
resultDeal(dtoMap, tarKey, targetJson, result);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常" + e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("数据异常");
|
||||
}
|
||||
// 排序实现
|
||||
result = result.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime)
|
||||
DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO();
|
||||
info.setTimeSum(errorTimeCount[0]);
|
||||
info.setErrCount(errAllCount[0]);
|
||||
info.setTime(result.stream()
|
||||
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName)
|
||||
.thenComparing(vo -> extractHarmonicOrder(vo.getTargetName()))
|
||||
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName))
|
||||
.collect(Collectors.toList());
|
||||
return result;
|
||||
.thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime))
|
||||
.collect(Collectors.toList()));
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,12 +371,13 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
* 处理json对象中list数组
|
||||
*/
|
||||
|
||||
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result) {
|
||||
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result, String date, Integer[] errorCounts) {
|
||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey);
|
||||
JSONArray innerJson = targetJson.getJSONArray(targetKey);
|
||||
innerJson.forEach(oo -> {
|
||||
JSONObject jsonObjectTem = (JSONObject) oo;
|
||||
String targetName = jsonObjectTem.get("targetName").toString();
|
||||
errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString());
|
||||
JSONArray list = jsonObjectTem.getJSONArray("list");
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>();
|
||||
list.forEach(listItem -> {
|
||||
@@ -447,7 +388,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
String valueType = object.get("valueType").toString();
|
||||
for (int i = 0; i < timeArr.size(); i++) {
|
||||
DetailAbnormalVO.DetailLimitInnerVO temData = new DetailAbnormalVO.DetailLimitInnerVO();
|
||||
temData.setTime(timeArr.get(i).toString());
|
||||
temData.setTime(date + " " + timeArr.get(i).toString());
|
||||
temData.setVal(valueArr.get(i).toString());
|
||||
temData.setTargetName(targetName);
|
||||
temData.setTargetKey(targetKey);
|
||||
@@ -475,11 +416,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
vo.setTargetKey(targetKey);
|
||||
vo.setPhaseType(phaseKey);
|
||||
|
||||
if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
} else {
|
||||
// if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
// vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
}
|
||||
// }
|
||||
valueList.forEach(ites -> {
|
||||
switch (ites.getType()) {
|
||||
case "AVG":
|
||||
@@ -686,12 +627,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
if (StrUtil.isNotBlank(dto.getUnit())) {
|
||||
unit = dto.getUnit();
|
||||
}
|
||||
if (temStr.equals(Param.rms_i)) {
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
|
||||
} else {
|
||||
// if (temStr.equals(Param.rms_i)) {
|
||||
// verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
|
||||
}
|
||||
|
||||
// }
|
||||
result.add(verifyTargetVO);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1542,7 +1542,7 @@
|
||||
<select id="selectByIds" resultType="com.njcn.device.pq.pojo.vo.LineDetailVO$Detail">
|
||||
SELECT DISTINCT
|
||||
line.id as lineId,
|
||||
dept.`Name` deptName,
|
||||
dept.Name deptName,
|
||||
area.name as areaId,
|
||||
gd.NAME gdName,
|
||||
substation.NAME subName,
|
||||
@@ -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);
|
||||
|
||||
@@ -112,12 +112,12 @@
|
||||
|
||||
<select id="getNoData" resultType="OnlineMonitorVo">
|
||||
SELECT DISTINCT
|
||||
t6.`Name` gdName,
|
||||
t5.`Name` subName,
|
||||
t4.`Name` deviceName,
|
||||
t6.Name gdName,
|
||||
t5.Name subName,
|
||||
t4.Name deviceName,
|
||||
t1.line_index lineId,
|
||||
t2.`Name` lineName,
|
||||
t8.`Name` monitorObjType,
|
||||
t2.Name lineName,
|
||||
t8.Name monitorObjType,
|
||||
t7.Obj_Name monitorObj,
|
||||
"完整性为0" as target,
|
||||
count(t1.time_id) lastDay
|
||||
|
||||
@@ -259,12 +259,10 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
|
||||
private List<AreaAnalysisVO.Children> assReasonPQ(Map<String, List<String>> stringListMap, List<RmpEventDetailPO> info, String typeId){
|
||||
List<AreaAnalysisVO.Children> reasonList = new ArrayList<>();
|
||||
|
||||
List<RmpEventDetailPO> reasons = info.stream().filter(x -> typeId.equals(x.getAdvanceReason())).collect(Collectors.toList());
|
||||
Integer allCount = 0;
|
||||
for (Map.Entry<String, List<String>> stringListEntry : stringListMap.entrySet()) {
|
||||
List<String> value = stringListEntry.getValue();
|
||||
Integer count = reasons.stream().filter(x -> value.contains(x.getAdvanceType())).mapToInt(RmpEventDetailPO::getCount).sum();
|
||||
Integer count = info.stream().filter(x -> value.contains(x.getAdvanceType())).mapToInt(RmpEventDetailPO::getCount).sum();
|
||||
AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children();
|
||||
allType.setName(stringListEntry.getKey());
|
||||
allType.setValue(count);
|
||||
|
||||
@@ -22,10 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -67,7 +64,7 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
if (1 == deviceInfoParam.getIsPollution()) {
|
||||
if (Objects.equals(1,deviceInfoParam.getIsPollution())) {
|
||||
OnlineRateParam.Info param = new OnlineRateParam.Info();
|
||||
param.setIds(resList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList()));
|
||||
param.setDicData(deviceInfoParam.getDicData());
|
||||
|
||||
@@ -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)){
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
p1.id id,
|
||||
p2.Org_Name dept,
|
||||
p2.Powerr_Name substation,
|
||||
p3.`Name` deviceName,
|
||||
p2.`Name` lineName,
|
||||
p3.Name deviceName,
|
||||
p2.Name lineName,
|
||||
p1.line_id lineId,
|
||||
p4.`Name` businessType,
|
||||
p4.Name businessType,
|
||||
p2.Monitor_Object_Name objectName,
|
||||
p1.target_type targetType,
|
||||
p1.over_limit_day overLimitDay,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
line_index id,
|
||||
LEAST(ROUND(SUM(real_time) / SUM(due_time), 2) * 100,100) integrityData
|
||||
FROM
|
||||
`r_stat_integrity_d`
|
||||
r_stat_integrity_d
|
||||
WHERE time_id between #{startTime} and #{endTime}
|
||||
GROUP BY line_index
|
||||
</select>
|
||||
@@ -35,9 +35,9 @@
|
||||
100
|
||||
) integrityData
|
||||
FROM
|
||||
`r_stat_onlinerate_d`
|
||||
r_stat_onlinerate_d
|
||||
WHERE time_id between #{startTime} and #{endTime}
|
||||
GROUP BY dev_index
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -82,4 +82,7 @@ public class OnlineVo implements Serializable {
|
||||
@ApiModelProperty("最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("数据类型 0:无数据 1:超标告警 2:异常数据")
|
||||
private Integer dataType;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,11 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
}
|
||||
}
|
||||
queryWrapper.orderBy(true, true, "D.Name", "p4.Name", "p3.Name");
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
Page<OnlineVo> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
page.getRecords().forEach(item -> {
|
||||
item.setDataType(param.getDataType());
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,6 +348,8 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
}
|
||||
});
|
||||
dataMap.put("${noData}", CollUtil.isEmpty(dataList1) ? "0" : String.valueOf(dataList1.size()));
|
||||
} else {
|
||||
dataMap.put("${noData}", "0");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(list2)) {
|
||||
list2.forEach(item -> {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
Id, page_name, thumbnail, remark, container_config, sort, `state`, Create_By, Create_Time,
|
||||
Id, page_name, thumbnail, remark, container_config, sort, "state", Create_By, Create_Time,
|
||||
Update_By, Update_Time
|
||||
</sql>
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -40,7 +40,8 @@ public class PqDashboardPageServiceImpl extends ServiceImpl<PqDashboardPageMappe
|
||||
// checkName(pqDashboardPageParam,false);
|
||||
|
||||
BeanUtils.copyProperties(pqDashboardPageParam,pqDashboardPage);
|
||||
pqDashboardPage.setState(0);
|
||||
//根据前端传递状态赋值
|
||||
//pqDashboardPage.setState(0);
|
||||
pqDashboardPage.setUserId(RequestUtil.getUserIndex());
|
||||
this.save(pqDashboardPage);
|
||||
return true;
|
||||
|
||||
@@ -26,10 +26,7 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -110,6 +107,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
ComponentVO componentVO = new ComponentVO();
|
||||
componentVO.setId(dictData.getId());
|
||||
componentVO.setName(dictData.getName());
|
||||
componentVO.setSort(dictData.getSort());
|
||||
componentVO.setChildren(
|
||||
v.stream()
|
||||
.filter(fun -> Objects.equals(ComponentState.FATHER_PID, fun.getPid()))
|
||||
@@ -117,6 +115,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
.collect(Collectors.toList()));
|
||||
result.add(componentVO);
|
||||
});
|
||||
result.sort(Comparator.comparing(ComponentVO::getSort));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -182,7 +181,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
*/
|
||||
private List<ComponentVO> getChildCategoryList(ComponentVO currMenu, List<ComponentVO> categories) {
|
||||
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId()))
|
||||
.peek(o -> o.setChildren(getChildCategoryList(o, categories)))
|
||||
.peek(o -> o.setChildren(getChildCategoryList(o, categories))).sorted(Comparator.comparing(ComponentVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -495,10 +495,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
List<User> users1 = this.listByIds(collect);
|
||||
if (CollectionUtil.isNotEmpty(users1)) {
|
||||
users1.forEach(item->{
|
||||
UserVO userVO = new UserVO();
|
||||
userVO.setId(item.getId());
|
||||
userVO.setName(item.getName());
|
||||
users.add(userVO);
|
||||
if (item.getState() == 1) {
|
||||
UserVO userVO = new UserVO();
|
||||
userVO.setId(item.getId());
|
||||
userVO.setName(item.getName());
|
||||
users.add(userVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
return users;
|
||||
|
||||
Reference in New Issue
Block a user