Merge remote-tracking branch 'origin/liaoning' into liaoning
This commit is contained in:
@@ -18,6 +18,16 @@ public class PollutionLineDTO {
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
private String pid;
|
||||
|
||||
private String pids;
|
||||
|
||||
@ApiModelProperty("监测对象id")
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty("电网标志 0电网侧 1用户侧")
|
||||
private Integer powerFlag;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -361,4 +361,7 @@ import java.util.Map;
|
||||
@GetMapping("/getLevelMonitorIdByDept")
|
||||
HttpResult<List<String>> getLevelMonitorIdByDept(@RequestParam("level") String level,@RequestParam("deptId")String deptId);
|
||||
|
||||
@GetMapping("/getMonitorByObjId")
|
||||
HttpResult<List<LineDetail>> getMonitorByObjId(@RequestParam("objId") String objId);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.SubstationFeignClientFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -28,4 +30,8 @@ public interface SubstationFeignClient {
|
||||
*/
|
||||
@PostMapping("getSubstationById")
|
||||
HttpResult<List<SubstationDTO>> getSubstationById(@RequestBody List<String> subId);
|
||||
|
||||
|
||||
@GetMapping("getMonitorByStationId")
|
||||
HttpResult<List<LineDetail>> getMonitorByStationId(@RequestParam("stationId") String stationId, @RequestParam("powerFlag") Integer powerFlag);
|
||||
}
|
||||
|
||||
@@ -294,6 +294,12 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据部门查询重要测点id: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<LineDetail>> getMonitorByObjId(String objId) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据监测对象id查测点集合信息: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -35,6 +36,12 @@ public class SubstationFeignClientFallbackFactory implements FallbackFactory<Sub
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据变电站ID获取变电站信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<LineDetail>> getMonitorByStationId(String stationId, Integer powerFlag) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据变电站ID获取监测到信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ public class LineDetail{
|
||||
*/
|
||||
private String id;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String monitorName;
|
||||
|
||||
/**
|
||||
* 线路号(在同一台设备中的监测点号)
|
||||
*/
|
||||
|
||||
@@ -64,6 +64,12 @@ public class LineIntegrityDataVO implements Serializable {
|
||||
@ApiModelProperty(name = "pids",value = "全部父id字符串")
|
||||
private String pids;
|
||||
|
||||
@ApiModelProperty(name = "objId",value = "监测到对象id")
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志")
|
||||
private Integer powerFlag;
|
||||
|
||||
|
||||
/**
|
||||
* 设备通讯状态
|
||||
|
||||
@@ -555,4 +555,13 @@ public class LineController extends BaseController {
|
||||
List<String> list = lineService.getLevelMonitorByDept(level,deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据对象名称获取监测到信息")
|
||||
@GetMapping("/getMonitorByObjId")
|
||||
public HttpResult<List<LineDetail>> getMonitorByObjId(@RequestParam("objId") String objId){
|
||||
String methodDescribe = getMethodDescribe("getMonitorByObjId");
|
||||
List<LineDetail> list = lineService.getMonitorByObjId(objId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-04-29
|
||||
* @Description: 异常告警数据指标范围
|
||||
*/
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/pqReasonableRange")
|
||||
@Api(tags = "数据清洗标准库")
|
||||
public class ReasonableRangeController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ReasonableRangeService pqReasonableRangeService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getData")
|
||||
@ApiOperation("按条件获取数据合理范围")
|
||||
public HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param) {
|
||||
String methodDescribe = getMethodDescribe("getData");
|
||||
List<PqReasonableRangeDto> list = pqReasonableRangeService.getReasonableRangeList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
@@ -58,4 +59,13 @@ public class SubstationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据电站下面的电网侧测点")
|
||||
@GetMapping("getMonitorByStationId")
|
||||
HttpResult<List<LineDetail>> getMonitorByStationId(@RequestParam("stationId") String stationId,@RequestParam("powerFlag") Integer powerFlag){
|
||||
String methodDescribe = getMethodDescribe("getMonitorByStationId");
|
||||
List<LineDetail> lineDetailList = substationService.getPowerByStationId(stationId,powerFlag);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineDetailList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface ReasonableRangeMapper extends BaseMapper<PqReasonableRange> {
|
||||
}
|
||||
@@ -82,7 +82,8 @@
|
||||
pldsdd.Name AS lineGradeName,
|
||||
pldsdd.id AS lineGrade,
|
||||
pldsdd.Algo_Describe AS algoDescribe,
|
||||
pld.Load_Type AS loadType
|
||||
pld.Load_Type AS loadType,
|
||||
pld.obj_id as objId
|
||||
FROM
|
||||
pq_line AS line
|
||||
LEFT JOIN pq_line AS voltage ON line.Pid = voltage.Id
|
||||
|
||||
@@ -668,6 +668,10 @@
|
||||
<select id="getLineInfo" resultType="com.njcn.device.biz.pojo.dto.PollutionLineDTO">
|
||||
SELECT
|
||||
A.Id,
|
||||
A.pid,
|
||||
A.pids,
|
||||
detail.obj_id,
|
||||
detail.power_flag,
|
||||
A.Name,
|
||||
A1.Name busBar,
|
||||
A3.Name substation,
|
||||
@@ -675,6 +679,7 @@
|
||||
A4.Name powerCompany
|
||||
FROM
|
||||
pq_line A,
|
||||
pq_line_detail detail,
|
||||
pq_line A1,
|
||||
pq_line A2,
|
||||
pq_line A3,
|
||||
@@ -685,6 +690,7 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
AND A.Pid = A1.Id
|
||||
AND A.id = detail.Id
|
||||
AND A.State = 1
|
||||
AND A1.Pid = A2.Id
|
||||
AND A2.Pid = A3.Id
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.device.pq.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,4 +24,6 @@ public interface ISubstationService extends IService<Substation> {
|
||||
List<SubstationDTO> getSubstationById(List<String> subId);
|
||||
|
||||
List<Line> getSubstationSelect();
|
||||
|
||||
List<LineDetail> getPowerByStationId(String stationId,Integer powerFlag);
|
||||
}
|
||||
|
||||
@@ -235,6 +235,9 @@ public interface LineService extends IService<Line> {
|
||||
|
||||
List<String> getLevelMonitorByDept(@RequestParam("level") String level, @RequestParam("deptId")String deptId);
|
||||
|
||||
|
||||
List<LineDetail> getMonitorByObjId(String objId);
|
||||
|
||||
/**
|
||||
* 获取污区值监测点相关信息
|
||||
* @author hongawen
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface ReasonableRangeService extends IService<PqReasonableRange> {
|
||||
|
||||
/**
|
||||
* 根据条件获取稳态指标正常范围数据
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
@@ -7,10 +8,13 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineIntegrityDataMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -24,7 +28,12 @@ import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -37,6 +46,7 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.Collator;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -64,6 +74,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
/**
|
||||
* 监测点数据完整性
|
||||
*
|
||||
@@ -71,15 +83,22 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
*/
|
||||
@Override
|
||||
public List<LineIntegrityDataVO> getIntegrityDataOfLine(LineIntegrityDataParam lineIntegrityDataParam) {
|
||||
|
||||
// 创建集合返回数据
|
||||
List<LineIntegrityDataVO> pro = new ArrayList<>();
|
||||
// 获取所有数据
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(lineIntegrityDataParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(lineIntegrityDataParam, Stream.of(RunFlagEnum.RUNNING.getStatus()).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
|
||||
// 判断所有数据集合状态
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
|
||||
// 创建集合返回数据
|
||||
List<LineIntegrityDataVO> pro = new ArrayList<>();
|
||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||
if (Objects.isNull(lineIntegrityDataParam.getPowerFlag()) || !PowerFlagEnum.GRID_SIDE.getCode().equals(lineIntegrityDataParam.getPowerFlag())) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
} else {
|
||||
userLedgerVOMap = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
// 获取告警策略列表
|
||||
List<AlarmStrategyVO> alarmStrategyVos = alarmClient.getAlarmStrategyData().getData();
|
||||
@@ -101,11 +120,38 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 创建实体类
|
||||
LineIntegrityDataVO lineIntegrityDataVO = new LineIntegrityDataVO();
|
||||
|
||||
// 通过监测点索引查询监测点信息
|
||||
List<LineIntegrityDataVO> lineList = lineIntegrityDataMapper.getDetailedParametersForLine(generalDeviceDTO.getLineIndexes(), lineIntegrityDataParam.getLineGrade());
|
||||
List<LineDataIntegrity> percentageOfCompleteDatas = rStatIntegrityDMapper.getLineIntegrityRate(generalDeviceDTO.getLineIndexes(), lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime());
|
||||
dealMonitorData(lineList,percentageOfCompleteDatas,mapA);
|
||||
|
||||
List<LineIntegrityDataVO> userLedgerList = lineList.stream().filter(item -> StrUtil.isNotBlank(item.getObjId())).collect(Collectors.toList());
|
||||
List<LineIntegrityDataVO> powerLedgerList = lineList.stream().filter(item -> StrUtil.isBlank(item.getObjId())).collect(Collectors.toList());
|
||||
|
||||
List<LineIntegrityDataVO> childrenList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
Map<String, List<LineIntegrityDataVO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getObjId));
|
||||
objMap.forEach((obj, mList) -> {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.getOrDefault(obj, new UserLedgerVO());
|
||||
LineIntegrityDataVO children = new LineIntegrityDataVO();
|
||||
children.setId(obj);
|
||||
children.setPid(userLedgerVO.getStationId());
|
||||
children.setName(userLedgerVO.getProjectName());
|
||||
children.setPowerFlag(PowerFlagEnum.NO_GRID_SIDE.getCode());
|
||||
children.setChildren(mList);
|
||||
dealDataJinDu(mList,children);
|
||||
childrenList.add(children);
|
||||
});
|
||||
}
|
||||
Map<String,List<LineIntegrityDataVO>> userStationMap = childrenList.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid));
|
||||
|
||||
|
||||
|
||||
List<String> lineIds = lineList.stream().map(LineIntegrityDataVO::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
// 通过供电站索引查询供电站信息
|
||||
@@ -118,53 +164,16 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
// 通过供电公司索引查询省会
|
||||
List<LineIntegrityDataVO> proList = lineIntegrityDataMapper.getProvinceList(gdIds);
|
||||
|
||||
// 查询监测点数据完整性
|
||||
List<LineDataIntegrity> percentageOfCompleteDatas = rStatIntegrityDMapper.getLineIntegrityRate(generalDeviceDTO.getLineIndexes(), lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime());
|
||||
|
||||
for (LineIntegrityDataVO lineDataIntegrity : lineList) {
|
||||
boolean flag = false;
|
||||
for (LineDataIntegrity lineData : percentageOfCompleteDatas) {
|
||||
if (lineDataIntegrity.getId().equals(lineData.getLineId())) {
|
||||
flag = true;
|
||||
Double temValue = lineData.getIntegrityData();
|
||||
lineDataIntegrity.setIntegrityData(DataStatisticsUtil.dataLimits(temValue));
|
||||
//根据等级判断是否越限
|
||||
if (StrUtil.isNotBlank(lineDataIntegrity.getLineGrade())) {
|
||||
if (mapA.containsKey(lineDataIntegrity.getLineGrade())) {
|
||||
if (temValue > mapA.get(lineDataIntegrity.getLineGrade())) {
|
||||
lineDataIntegrity.setValueOver(1);
|
||||
} else {
|
||||
lineDataIntegrity.setValueOver(0);
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DeviceResponseEnum.LINE_GRADE_LESS);
|
||||
}
|
||||
} else {
|
||||
//默认没有设置等级的监测点标志为1 0.不合格 1.合格
|
||||
lineDataIntegrity.setValueOver(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
//表示未匹配到数据完整性
|
||||
lineDataIntegrity.setIntegrityData(3.14159);
|
||||
lineDataIntegrity.setValueOver(0);
|
||||
}
|
||||
}
|
||||
|
||||
//处理变电站
|
||||
dealChildrenData(subList, lineList, true,3);
|
||||
dealChildrenData(subList, powerLedgerList,userStationMap, true);
|
||||
//处理供电公司
|
||||
dealChildrenData(gdList, subList, false,2);
|
||||
|
||||
//double areaDataIntegrity = DataStatisticsUtil.getAreaDataIntegrity(percentageOfCompleteDatas);
|
||||
dealChildrenData(gdList, subList, null,false);
|
||||
|
||||
if (lineIntegrityDataParam.getStatisticalType().getCode().equalsIgnoreCase(StatisticsEnum.POWER_NETWORK.getCode())) {
|
||||
lineIntegrityDataVO.setChildren(gdList);
|
||||
} else {
|
||||
//还需要额外处理省会
|
||||
dealChildrenData(proList, gdList, false);
|
||||
dealChildrenData(proList, gdList, null,false);
|
||||
lineIntegrityDataVO.setChildren(proList);
|
||||
}
|
||||
|
||||
@@ -180,13 +189,55 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
|
||||
}
|
||||
|
||||
getAreaIntegrityData(mapAlarm, pro);
|
||||
// getAreaIntegrityData(mapAlarm, pro);
|
||||
return pro;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void dealDataJinDu(List<LineIntegrityDataVO> mList,LineIntegrityDataVO children){
|
||||
double temValue = mList.stream().filter(it->it.getIntegrityData()!=3.14159).mapToDouble(LineIntegrityDataVO::getIntegrityData).average().orElse(3.14159);
|
||||
if(temValue!=3.14159){
|
||||
children.setIntegrityData(new BigDecimal(temValue).setScale(2,RoundingMode.HALF_UP).doubleValue());
|
||||
}else {
|
||||
children.setIntegrityData(temValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void dealMonitorData(List<LineIntegrityDataVO> lineList,List<LineDataIntegrity> percentageOfCompleteDatas,Map<String, Integer> mapA){
|
||||
// 查询监测点数据完整性
|
||||
Map<String,LineDataIntegrity> dataIntegrityMap = percentageOfCompleteDatas.stream().collect(Collectors.toMap(LineDataIntegrity::getLineId,Function.identity()));
|
||||
for (LineIntegrityDataVO monitor : lineList) {
|
||||
boolean flag = false;
|
||||
if(dataIntegrityMap.containsKey(monitor.getId())){
|
||||
flag = true;
|
||||
LineDataIntegrity integrity = dataIntegrityMap.get(monitor.getId());
|
||||
monitor.setIntegrityData(DataStatisticsUtil.dataLimits(integrity.getIntegrityData()));
|
||||
if (StrUtil.isNotBlank(monitor.getLineGrade())) {
|
||||
if (mapA.containsKey(monitor.getLineGrade())) {
|
||||
if (integrity.getIntegrityData() > mapA.get(monitor.getLineGrade())) {
|
||||
monitor.setValueOver(1);
|
||||
} else {
|
||||
monitor.setValueOver(0);
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(DeviceResponseEnum.LINE_GRADE_LESS);
|
||||
}
|
||||
} else {
|
||||
//默认没有设置等级的监测点标志为1 0.不合格 1.合格
|
||||
monitor.setValueOver(1);
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
//表示未匹配到数据完整性
|
||||
monitor.setIntegrityData(3.14159);
|
||||
monitor.setValueOver(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IntegrityIconVO> getIntegrityIcon(DeviceInfoParam.CompareBusinessParam integrityIconParam) {
|
||||
integrityIconParam.setServerName(generalInfo.getMicroServiceName());
|
||||
@@ -438,6 +489,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
* @param childrenData 子集合
|
||||
* @param isLine 处理策略
|
||||
*/
|
||||
/*
|
||||
private void dealChildrenData(List<LineIntegrityDataVO> targetData, List<LineIntegrityDataVO> childrenData, boolean isLine) {
|
||||
// 创建一个map集合,用于封装对象
|
||||
Map<String, List<LineIntegrityDataVO>> groupLine;
|
||||
@@ -467,60 +519,44 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 处理子集
|
||||
*
|
||||
* @param targetData 父集合
|
||||
* @param childrenData 子集合
|
||||
* @param powerChildren 子集合
|
||||
* @param isLine 处理策略
|
||||
*/
|
||||
private void dealChildrenData(List<LineIntegrityDataVO> targetData, List<LineIntegrityDataVO> childrenData, boolean isLine, int level) {
|
||||
private void dealChildrenData(List<LineIntegrityDataVO> targetData, List<LineIntegrityDataVO> powerChildren,Map<String,List<LineIntegrityDataVO>> userStationMap, boolean isLine) {
|
||||
// 创建一个map集合,用于封装对象
|
||||
Map<String, List<LineIntegrityDataVO>> groupLine;
|
||||
if (isLine) {
|
||||
// 通过stream流分组
|
||||
groupLine = childrenData.stream().collect(Collectors.groupingBy(lineAdministrationTree -> {
|
||||
groupLine = powerChildren.stream().collect(Collectors.groupingBy(lineAdministrationTree -> {
|
||||
// 获取父id字符串,通过 逗号 分割 成一个数组
|
||||
String[] pid = lineAdministrationTree.getPids().split(",");
|
||||
String[] pid = lineAdministrationTree.getPids().split(StrUtil.COMMA);
|
||||
// 判断集合索引为3的元素
|
||||
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
||||
}));
|
||||
} else {
|
||||
groupLine = childrenData.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid));
|
||||
groupLine = powerChildren.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid));
|
||||
}
|
||||
targetData.stream().peek(lineAdministrationTree -> {
|
||||
List<Double> data = new ArrayList<>();
|
||||
List<LineIntegrityDataVO> childList = new ArrayList<>();
|
||||
Set<String> pids = groupLine.keySet();
|
||||
for (String pid : pids) {
|
||||
if (lineAdministrationTree.getId().equals(pid)) {
|
||||
List<LineIntegrityDataVO> lineIntegrityDataVOList = groupLine.get(pid);
|
||||
lineAdministrationTree.setChildren(lineIntegrityDataVOList);
|
||||
if (Objects.equals(level,2)){
|
||||
for (LineIntegrityDataVO item : lineIntegrityDataVOList) {
|
||||
childList.addAll(item.getChildren());
|
||||
targetData.forEach(lineAdministrationTree -> {
|
||||
List<LineIntegrityDataVO> temList = new ArrayList<>();
|
||||
if(groupLine.containsKey(lineAdministrationTree.getId())){
|
||||
temList.addAll(groupLine.get(lineAdministrationTree.getId()));
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(childList)){
|
||||
data = childList.stream().map(LineIntegrityDataVO::getIntegrityData).collect(Collectors.toList());
|
||||
}
|
||||
} else if (Objects.equals(level,3)){
|
||||
data = lineIntegrityDataVOList.stream().map(LineIntegrityDataVO::getIntegrityData).collect(Collectors.toList());
|
||||
}
|
||||
LineIntegrityDataVO temp = lineIntegrityDataVOList.stream().filter(t -> t.getAlgoDescribe() != null).min(Comparator.comparing(LineIntegrityDataVO::getAlgoDescribe)).orElse(new LineIntegrityDataVO());
|
||||
lineAdministrationTree.setAlgoDescribe(temp.getAlgoDescribe());
|
||||
if(isLine){
|
||||
if(userStationMap.containsKey(lineAdministrationTree.getId())){
|
||||
temList.addAll(userStationMap.get(lineAdministrationTree.getId()));
|
||||
}
|
||||
}
|
||||
//父级完整性匹配
|
||||
if (CollectionUtil.isNotEmpty(data)){
|
||||
BigDecimal reduce = data.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
double avg = reduce.divide(new BigDecimal(data.size()),6,RoundingMode.HALF_UP).doubleValue();
|
||||
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(avg));
|
||||
} else {
|
||||
lineAdministrationTree.setIntegrityData(3.14159);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
lineAdministrationTree.setChildren(temList);
|
||||
dealDataJinDu(temList,lineAdministrationTree);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
private final TerminalMaintainMapper terminalMaintainMapper;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
@Override
|
||||
public LineDetailDataVO getLineDetailData(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
@@ -355,7 +356,6 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<LineStatisticsDetailVO> getLineStatisticsDetail(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<LineStatisticsDetailVO> lineStatisticsDetailList = new ArrayList<>();
|
||||
@@ -740,6 +740,19 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineDetail> getMonitorByObjId(String objId) {
|
||||
List<LineDetail> result;
|
||||
result = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().eq(LineDetail::getObjId, objId));
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<String> ids = result.stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
|
||||
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId, ids).eq(Line::getState, DataStateEnum.ENABLE.getCode()));
|
||||
Map<String, Line> lineMap = lineList.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
||||
result.forEach(item->item.setMonitorName(lineMap.getOrDefault(item.getId(),new Line()).getName()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> lineId) {
|
||||
List<PollutionLineInfoDTO> pollutionLineInfoDTOList;
|
||||
@@ -774,7 +787,6 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
|
||||
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());
|
||||
@@ -941,7 +953,6 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户选择的时间区间返回月份日期
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
||||
import com.njcn.device.pq.mapper.ReasonableRangeMapper;
|
||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Service
|
||||
public class ReasonableRangeServiceImpl extends ServiceImpl<ReasonableRangeMapper, PqReasonableRange> implements ReasonableRangeService {
|
||||
|
||||
@Override
|
||||
public List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param) {
|
||||
List<PqReasonableRangeDto> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<PqReasonableRange> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PqReasonableRange::getBelongingSystem,param.getSystemType());
|
||||
if(StrUtil.isNotBlank(param.getDataSource())){
|
||||
queryWrapper.eq(PqReasonableRange::getDataSource,param.getDataSource());
|
||||
}
|
||||
if(StrUtil.isNotBlank(param.getTableName())){
|
||||
queryWrapper.eq(PqReasonableRange::getInfluxdbTableName,param.getTableName());
|
||||
}
|
||||
queryWrapper.eq(PqReasonableRange::getState,1);
|
||||
List<PqReasonableRange> list = this.list(queryWrapper);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item->{
|
||||
PqReasonableRangeDto dto = new PqReasonableRangeDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
result.add(dto);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,26 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -27,6 +33,8 @@ public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substat
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
|
||||
@Override
|
||||
public List<SubstationDTO> getSubstationById(List<String> subId) {
|
||||
return this.baseMapper.getSubstationById(subId);
|
||||
@@ -39,4 +47,26 @@ public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substat
|
||||
.eq(Line::getState, DataStateEnum.ENABLE.getCode()).orderByAsc(Line::getCreateTime);
|
||||
return lineMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineDetail> getPowerByStationId(String stationId, Integer powerFlag) {
|
||||
List<LineDetail> lineDetailList = new ArrayList<>();
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(Line::getId,Line::getName).like(Line::getPids,stationId).eq(Line::getLevel,LineBaseEnum.LINE_LEVEL.getCode()).eq(Line::getState,DataStateEnum.ENABLE.getCode());
|
||||
List<Line> lineList = lineMapper.selectList(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(lineList)){
|
||||
List<String> ids = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<LineDetail> detailQuery = new LambdaQueryWrapper<>();
|
||||
if(Objects.nonNull(powerFlag)){
|
||||
detailQuery.eq(LineDetail::getPowerFlag,powerFlag);
|
||||
}
|
||||
detailQuery.in(LineDetail::getId,ids);
|
||||
lineDetailList = lineDetailMapper.selectList(detailQuery);
|
||||
if(CollUtil.isNotEmpty(lineDetailList)){
|
||||
Map<String,Line> lineMap = lineList.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
||||
lineDetailList.forEach(item->item.setMonitorName(lineMap.getOrDefault(item.getId(),new Line()).getName()));
|
||||
}
|
||||
}
|
||||
return lineDetailList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
FROM
|
||||
r_stat_limit_rate_d
|
||||
<where>
|
||||
phasic_type = "T"
|
||||
phasic_type = 'T'
|
||||
<if test=" ids != null and ids.size > 0">
|
||||
AND my_index IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
|
||||
@@ -10,9 +10,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.harmonic.constant.Param;
|
||||
import com.njcn.harmonic.mapper.RStatLimitTargetDMapper;
|
||||
@@ -20,11 +25,11 @@ import com.njcn.harmonic.pojo.dto.AreaDTO;
|
||||
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
|
||||
import com.njcn.harmonic.pojo.po.LimitTarget;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.HarmonicDeptVO;
|
||||
import com.njcn.harmonic.pojo.vo.HarmonicLineVO;
|
||||
import com.njcn.harmonic.pojo.vo.HarmonicSubstationVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.*;
|
||||
import com.njcn.harmonic.service.IHarmonicService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -36,6 +41,7 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.*;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -58,57 +64,96 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
|
||||
private final RStatLimitTargetDMapper targetDMapper;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
private final SubstationFeignClient substationFeignClient;
|
||||
|
||||
@Override
|
||||
public List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam harmonicPublicParam) {
|
||||
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
|
||||
List<PollutionVO> list = new ArrayList<>();
|
||||
List<String> lineList = new ArrayList<>();
|
||||
List<PollutionLineDTO> lineInfo = new ArrayList<>();
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
|
||||
return list;
|
||||
}
|
||||
List<GeneralDeviceDTO> deptList = generalDeviceInfoClient.getPracticalRunDeviceInfo(harmonicPublicParam).getData();
|
||||
deptList.forEach(dept -> {
|
||||
lineList.addAll(dept.getLineIndexes());
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
paramDTO.setLineList(lineList);
|
||||
lineInfo = lineFeignClient.getLineInfo(paramDTO).getData();
|
||||
|
||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||
if (Objects.isNull(harmonicPublicParam.getPowerFlag()) || !PowerFlagEnum.GRID_SIDE.getCode().equals(harmonicPublicParam.getPowerFlag())) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
} else {
|
||||
userLedgerVOMap = new HashMap<>();
|
||||
}
|
||||
Map<String, List<PollutionLineDTO>> map = lineInfo.stream().collect(Collectors.groupingBy(PollutionLineDTO::getSubstationId));
|
||||
|
||||
|
||||
List<GeneralDeviceDTO> deptList = generalDeviceInfoClient.getPracticalRunDeviceInfo(harmonicPublicParam).getData();
|
||||
deptList.forEach(dept -> lineList.addAll(dept.getLineIndexes()));
|
||||
//获取所有的数据信息
|
||||
List<RStatLimitTargetDPO> limitTargetNew = getLimitTargetNew(lineList, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
|
||||
//聚合查询
|
||||
List<RStatLimitTargetDPO> allData = new ArrayList<>();
|
||||
List<RStatLimitTargetDPO> finalAllData;
|
||||
if (Objects.equals(harmonicPublicParam.getStatisticalType().getCode(), DicDataEnum.XBDY_ENUM.getCode())) {
|
||||
allData = getAllDataV(lineList, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
|
||||
finalAllData = getAllDataV(lineList, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
|
||||
} else if (Objects.equals(harmonicPublicParam.getStatisticalType().getCode(), DicDataEnum.XBDL_ENUM.getCode())) {
|
||||
allData = getAllDataI(lineList, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
|
||||
|
||||
finalAllData = getAllDataI(lineList, harmonicPublicParam.getSearchBeginTime(), harmonicPublicParam.getSearchEndTime());
|
||||
} else {
|
||||
finalAllData = new ArrayList<>();
|
||||
}
|
||||
|
||||
List<RStatLimitTargetDPO> finalAllData = allData;
|
||||
deptList.forEach(dept -> {
|
||||
for (GeneralDeviceDTO dept : deptList) {
|
||||
if (CollUtil.isEmpty(dept.getLineIndexes())) {
|
||||
continue;
|
||||
}
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
paramDTO.setLineList(dept.getLineIndexes());
|
||||
List<PollutionLineDTO> pollutionLineDTOList = lineFeignClient.getLineInfo(paramDTO).getData();
|
||||
List<PollutionLineDTO> userLedgerList = pollutionLineDTOList.stream().filter(item -> StrUtil.isNotBlank(item.getObjId())).collect(Collectors.toList());
|
||||
List<PollutionLineDTO> powerLedgerList = pollutionLineDTOList.stream().filter(item -> StrUtil.isBlank(item.getObjId())).collect(Collectors.toList());
|
||||
|
||||
List<PollutionVO> childrenList = new ArrayList<>();
|
||||
Map<String, List<PollutionLineDTO>> powerSubMap;
|
||||
if (CollUtil.isNotEmpty(powerLedgerList)) {
|
||||
powerSubMap = powerLedgerList.stream().collect(Collectors.groupingBy(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]));
|
||||
} else {
|
||||
powerSubMap = new HashMap<>();
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(dept.getSubIndexes())) {
|
||||
List<PollutionVO> childrenList = new ArrayList<>();
|
||||
PollutionVO pollutionVO = new PollutionVO();
|
||||
pollutionVO.setId(dept.getIndex());
|
||||
pollutionVO.setName(dept.getName() + "\n(" + dept.getLineIndexes().size() + ")");
|
||||
dept.getSubIndexes().forEach(sub -> {
|
||||
List<PollutionLineDTO> l1 = map.get(sub);
|
||||
powerSubMap.forEach((sub, monitList) -> {
|
||||
PollutionVO children = new PollutionVO();
|
||||
children.setId(sub);
|
||||
children.setPid(dept.getIndex());
|
||||
children.setName(l1.get(0).getSubstation());
|
||||
children.setPowerFlag(PowerFlagEnum.GRID_SIDE.getCode());
|
||||
children.setName(monitList.get(0).getSubstation());
|
||||
//监测点id
|
||||
List<String> lineIds = l1.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
|
||||
List<String> lineIds = monitList.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
|
||||
List<RStatLimitTargetDPO> collect = limitTargetNew.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<RStatLimitTargetDPO> sumList = finalAllData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
children.setData(handleDataNew(collect, sumList, harmonicPublicParam.getStatisticalType().getCode()).getRatio());
|
||||
childrenList.add(children);
|
||||
});
|
||||
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
Map<String, List<PollutionLineDTO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(PollutionLineDTO::getObjId));
|
||||
objMap.forEach((obj, mList) -> {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.getOrDefault(obj, new UserLedgerVO());
|
||||
PollutionVO children = new PollutionVO();
|
||||
children.setId(obj);
|
||||
children.setPid(userLedgerVO.getStationId());
|
||||
children.setName(StrUtil.isNotBlank(userLedgerVO.getProjectName()) ? userLedgerVO.getProjectName() : "异常数据");
|
||||
children.setPowerFlag(PowerFlagEnum.NO_GRID_SIDE.getCode());
|
||||
//监测点id
|
||||
List<String> lineIds = mList.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
|
||||
List<RStatLimitTargetDPO> collect = limitTargetNew.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
List<RStatLimitTargetDPO> sumList = finalAllData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
children.setData(handleDataNew(collect, sumList, harmonicPublicParam.getStatisticalType().getCode()).getRatio());
|
||||
childrenList.add(children);
|
||||
});
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(childrenList)) {
|
||||
pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList()));
|
||||
}
|
||||
@@ -118,7 +163,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
}
|
||||
list.add(pollutionVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return list.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList());
|
||||
}
|
||||
@@ -206,37 +251,25 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
|
||||
@Override
|
||||
public List<HarmonicLineVO> getLineInfoById(HarmonicPublicParam param) {
|
||||
param.setServerName(generalInfo.getMicroServiceName());
|
||||
|
||||
List<HarmonicLineVO> list = new ArrayList<>();
|
||||
List<String> line = new ArrayList<>();
|
||||
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
|
||||
return list;
|
||||
List<LineDetail> lineDetailList = new ArrayList<>();
|
||||
if(PowerFlagEnum.GRID_SIDE.getCode().equals(param.getPowerFlag())){
|
||||
lineDetailList = substationFeignClient.getMonitorByStationId(param.getId(),PowerFlagEnum.GRID_SIDE.getCode()).getData();
|
||||
}else if(PowerFlagEnum.NO_GRID_SIDE.getCode().equals(param.getPowerFlag())){
|
||||
lineDetailList = lineFeignClient.getMonitorByObjId(param.getId()).getData();
|
||||
}
|
||||
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(param).getData();
|
||||
sub.forEach(item -> {
|
||||
if (Objects.equals(param.getId(), item.getIndex())) {
|
||||
if (!CollectionUtils.isEmpty(item.getLineIndexes())) {
|
||||
line.addAll(item.getLineIndexes());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(line)) {
|
||||
List<LimitTarget> limitTargetList = getLineOverDays(line, param.getSearchBeginTime(), param.getSearchEndTime(), param.getStatisticalType().getCode());
|
||||
List<String> lineIds = lineDetailList.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
Map<String,LineDetail> map = lineDetailList.stream().collect(Collectors.toMap(LineDetail::getId,Function.identity()));
|
||||
if (!CollectionUtils.isEmpty(lineIds)) {
|
||||
List<LimitTarget> limitTargetList = getLineOverDays(lineIds, param.getSearchBeginTime(), param.getSearchEndTime(), param.getStatisticalType().getCode());
|
||||
if (!CollectionUtils.isEmpty(limitTargetList)) {
|
||||
buildData(list, limitTargetList, param.getStatisticalType().getCode());
|
||||
}
|
||||
}
|
||||
//获取监测点名称
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<String> lineList = list.stream().map(HarmonicLineVO::getId).collect(Collectors.toList());
|
||||
List<LineDeviceStateVO> lineDeviceStateVOList = lineFeignClient.getAllLine(lineList).getData();
|
||||
list.stream().map(item1 -> lineDeviceStateVOList.stream().filter(item2 -> Objects.equals(item1.getId(), item2.getId())).findAny().map(item3 -> {
|
||||
item1.setName(item3.getName());
|
||||
return list;
|
||||
})).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return list.stream().sorted(Comparator.comparing(HarmonicLineVO::getOverDays).reversed()).collect(Collectors.toList());
|
||||
list.stream().sorted(Comparator.comparing(HarmonicLineVO::getOverDays).reversed()).forEach(item -> item.setName(map.getOrDefault(item.getId(),new LineDetail()).getMonitorName()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user