辽宁功能调整
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());
|
||||
}
|
||||
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());
|
||||
targetData.forEach(lineAdministrationTree -> {
|
||||
List<LineIntegrityDataVO> temList = new ArrayList<>();
|
||||
if(groupLine.containsKey(lineAdministrationTree.getId())){
|
||||
temList.addAll(groupLine.get(lineAdministrationTree.getId()));
|
||||
}
|
||||
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,11 +100,12 @@ 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)){
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return new LineDetailDataVO();
|
||||
}else {
|
||||
} else {
|
||||
//根据id查询当前信息的pids
|
||||
List<String> pids = Arrays.asList(this.baseMapper.selectById(id).getPids().split(","));
|
||||
List<String> list = new ArrayList(pids);
|
||||
@@ -158,7 +159,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
lineDetailDataVO.setDevCapacity(lineDetail.getDevCapacity());
|
||||
lineDetailDataVO.setShortCapacity(lineDetail.getShortCapacity());
|
||||
lineDetailDataVO.setStandardCapacity(lineDetail.getStandardCapacity());
|
||||
lineDetailDataVO.setTimeInterval (lineDetail.getTimeInterval ());
|
||||
lineDetailDataVO.setTimeInterval(lineDetail.getTimeInterval());
|
||||
lineDetailDataVO.setOwner(lineDetail.getOwner());
|
||||
lineDetailDataVO.setOwnerDuty(lineDetail.getOwnerDuty());
|
||||
lineDetailDataVO.setOwnerTel(lineDetail.getOwnerTel());
|
||||
@@ -198,28 +199,28 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<String> updateTime = new ArrayList<>();
|
||||
List<Integer> comType = new ArrayList<>();
|
||||
//开始时间
|
||||
Boolean beginFly =false;
|
||||
if(CollUtil.isNotEmpty(communicateList)){
|
||||
if(!communicateList.get(0).getTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){
|
||||
beginFly =true;
|
||||
Boolean beginFly = false;
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
if (!communicateList.get(0).getTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())) {
|
||||
beginFly = true;
|
||||
}
|
||||
}else{
|
||||
beginFly =true;
|
||||
} else {
|
||||
beginFly = true;
|
||||
}
|
||||
|
||||
if(beginFly){
|
||||
if (beginFly) {
|
||||
Instant instant = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant();
|
||||
Long time = instant.toEpochMilli();
|
||||
String timeText = df.format(time);
|
||||
updateTime.add(timeText);
|
||||
//取反(正常来时,有变动才会有数据)
|
||||
if(CollUtil.isNotEmpty(communicateList)){
|
||||
if(communicateList.get(0).getType()==0){
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
if (communicateList.get(0).getType() == 0) {
|
||||
comType.add(1);
|
||||
}else{
|
||||
} else {
|
||||
comType.add(0);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
comType.add(device.getComFlag());
|
||||
}
|
||||
|
||||
@@ -238,21 +239,21 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
String format = times.format(date);
|
||||
Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant();
|
||||
|
||||
Boolean endFly =false;
|
||||
if(CollUtil.isNotEmpty(communicateList)){
|
||||
if(!communicateList.get(communicateList.size()-1).getTime().equals(endTime)){
|
||||
endFly =true;
|
||||
Boolean endFly = false;
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
if (!communicateList.get(communicateList.size() - 1).getTime().equals(endTime)) {
|
||||
endFly = true;
|
||||
}
|
||||
}else{
|
||||
endFly =true;
|
||||
} else {
|
||||
endFly = true;
|
||||
}
|
||||
if(endFly){
|
||||
if (endFly) {
|
||||
Long time = endTime.toEpochMilli();
|
||||
String timeText = df.format(time);
|
||||
updateTime.add(timeText);
|
||||
if(CollUtil.isNotEmpty(communicateList)){
|
||||
comType.add(communicateList.get(communicateList.size()-1).getType());
|
||||
}else{
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
comType.add(communicateList.get(communicateList.size() - 1).getType());
|
||||
} else {
|
||||
comType.add(device.getComFlag());
|
||||
}
|
||||
}
|
||||
@@ -351,15 +352,14 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
lineDistributionVO.setValue(generalDeviceDTO.getLineIndexes().size());
|
||||
lineDistributionVOList.add(lineDistributionVO);
|
||||
}
|
||||
return lineDistributionVOList;
|
||||
return lineDistributionVOList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<LineStatisticsDetailVO> getLineStatisticsDetail(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<LineStatisticsDetailVO> lineStatisticsDetailList = new ArrayList<>();
|
||||
int deviceAddNumTail=0,deviceNumTail = 0, lineTail = 0, lineSaveTail = 0, normalStateTail = 0, suspendStateTail = 0, offStreamStateTail = 0, hotSpareStateTail = 0;
|
||||
int deviceAddNumTail = 0, deviceNumTail = 0, lineTail = 0, lineSaveTail = 0, normalStateTail = 0, suspendStateTail = 0, offStreamStateTail = 0, hotSpareStateTail = 0;
|
||||
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
@@ -490,15 +490,15 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
@Override
|
||||
public Page<HalfReportVO> halfReport(TerminalMainQueryParam param) {
|
||||
List<String> ids=new ArrayList<>();
|
||||
if(StrUtil.isNotBlank(param.getOrgId())){
|
||||
List<String> ids = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(param.getOrgId())) {
|
||||
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getOrgId(), WebUtil.filterDeptType()).getData();
|
||||
ids.addAll(data.stream().map(DeptDTO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
Page<LineMarkVO> page = new Page<>(param.getPageNum(), param.getPageSize());
|
||||
param.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
|
||||
param.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
return this.baseMapper.selectHalfReport(page,param,ids);
|
||||
return this.baseMapper.selectHalfReport(page, param, ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -506,8 +506,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
LineDTO lineDTO = this.baseMapper.selectLineDetail(id);
|
||||
if(lineDTO != null){
|
||||
if(dicMap.containsKey(lineDTO.getVoltageLevel())){
|
||||
if (lineDTO != null) {
|
||||
if (dicMap.containsKey(lineDTO.getVoltageLevel())) {
|
||||
lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel()));
|
||||
return lineDTO;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
*/
|
||||
@Override
|
||||
public List<LineDTO> getLineDetailBatch(List<String> ids) {
|
||||
if(CollectionUtil.isEmpty(ids)){
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return null;
|
||||
}
|
||||
List<LineDTO> lineDTOS = this.baseMapper.selectLineDetailBatch(ids);
|
||||
@@ -528,8 +528,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
Map<String, List<LineDTO>> lineVoltageMap = lineDTOS.stream().collect(Collectors.groupingBy(LineDTO::getVoltageLevel));
|
||||
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
lineVoltageMap.forEach((key,lineData) -> {
|
||||
String voltage= voltageMap.get(key);
|
||||
lineVoltageMap.forEach((key, lineData) -> {
|
||||
String voltage = voltageMap.get(key);
|
||||
lineData = lineData.stream().peek(line -> line.setVoltageLevel(voltage)).collect(Collectors.toList());
|
||||
});
|
||||
return lineDTOS;
|
||||
@@ -538,7 +538,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public List<LineDetailVO.Detail> getLineDetailByIds(List<String> ids) {
|
||||
List<LineDetailVO.Detail> details = this.baseMapper.selectByIds(ids);
|
||||
if(CollUtil.isNotEmpty(details)){
|
||||
if (CollUtil.isNotEmpty(details)) {
|
||||
List<String> devIds = details.stream().map(LineDetailVO.Detail::getDevId).distinct().collect(Collectors.toList());
|
||||
//获取终端流量信息
|
||||
List<LineFlowMealDetailVO> flow = terminalMaintainMapper.getMonthFlow(devIds, DateUtil.beginOfMonth(DateUtil.date()), DateUtil.endOfMonth(DateUtil.date()));
|
||||
@@ -556,23 +556,23 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
for (LineDetailVO.Detail detail : details) {
|
||||
//获取行政区域名称
|
||||
if(areaMap.containsKey(detail.getAreaId())){
|
||||
if (areaMap.containsKey(detail.getAreaId())) {
|
||||
detail.setAreaName(areaMap.get(detail.getAreaId()));
|
||||
}
|
||||
//电压
|
||||
if(dictMap.containsKey(detail.getVoltageLevel())){
|
||||
if (dictMap.containsKey(detail.getVoltageLevel())) {
|
||||
detail.setVoltageLevel(dictMap.get(detail.getVoltageLevel()));
|
||||
}
|
||||
//终端等级
|
||||
if(gradeMap.containsKey(detail.getLineGrade())){
|
||||
if (gradeMap.containsKey(detail.getLineGrade())) {
|
||||
detail.setLineGrade(String.valueOf(gradeMap.get(detail.getLineGrade())));
|
||||
}
|
||||
//终端等级
|
||||
if(flowMap.containsKey(detail.getDevId())){
|
||||
if (flowMap.containsKey(detail.getDevId())) {
|
||||
LineFlowMealDetailVO flowVo = flowMap.get(detail.getDevId());
|
||||
detail.setFlowMeal(flowVo.getFlowMeal());
|
||||
detail.setStatisValue(flowVo.getStatisValue());
|
||||
detail.setFlowProportion(flowVo.getFlowProportion()*100);
|
||||
detail.setFlowProportion(flowVo.getFlowProportion() * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,8 +589,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<LineDataVO> lineDataVOList = this.baseMapper.getLineDetail(list);
|
||||
LineDetailDataVO lineDetailDataVO = new LineDetailDataVO();
|
||||
|
||||
String areaId = "",gdId="",subStationId = "", devId = "", voId = "",lineId="",
|
||||
areaName = "",gdName="",subStationName = "", devName = "", voName = "",lineName="";
|
||||
String areaId = "", gdId = "", subStationId = "", devId = "", voId = "", lineId = "",
|
||||
areaName = "", gdName = "", subStationName = "", devName = "", voName = "", lineName = "";
|
||||
for (LineDataVO lineDataVO : lineDataVOList) {
|
||||
switch (lineDataVO.getLevel()) {
|
||||
case 1:
|
||||
@@ -665,8 +665,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public List<Line> getSubIndexLineDetail(String id) {
|
||||
return this.lambdaQuery()
|
||||
.eq(Line::getLevel,6)
|
||||
.like(Line::getPids,id)
|
||||
.eq(Line::getLevel, 6)
|
||||
.like(Line::getPids, id)
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -681,8 +681,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(param.getOrgId()).getData();
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
|
||||
List<String> lineIDs = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(lineIDs)){
|
||||
return this.baseMapper.getDeptDeviceDetailData(lineIDs, param.getSearchValue(),param.getType());
|
||||
if (CollUtil.isNotEmpty(lineIDs)) {
|
||||
return this.baseMapper.getDeptDeviceDetailData(lineIDs, param.getSearchValue(), param.getType());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -705,20 +705,20 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
@Override
|
||||
public List<DevAndLine> getByDeptDevLine(String id) {
|
||||
List<DevAndLine> info=new ArrayList<>();
|
||||
List<DevAndLine> info = new ArrayList<>();
|
||||
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(id).getData();
|
||||
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
|
||||
List<String> lineIDs = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(lineIDs)){
|
||||
if (CollUtil.isNotEmpty(lineIDs)) {
|
||||
List<LineDetailVO.Detail> deptDeviceDetailData = this.baseMapper.getDeptDeviceDetailData(lineIDs, null, 3);
|
||||
if(CollUtil.isNotEmpty(deptDeviceDetailData)){
|
||||
if (CollUtil.isNotEmpty(deptDeviceDetailData)) {
|
||||
Map<String, List<LineDetailVO.Detail>> collect = deptDeviceDetailData.stream().collect(Collectors.groupingBy(LineDetailVO.Detail::getDevId));
|
||||
collect.forEach((k,v)->{
|
||||
DevAndLine devAndLine = new DevAndLine();
|
||||
List<DevAndLine.Line> lineList=new ArrayList<>();
|
||||
collect.forEach((k, v) -> {
|
||||
DevAndLine devAndLine = new DevAndLine();
|
||||
List<DevAndLine.Line> lineList = new ArrayList<>();
|
||||
devAndLine.setDevId(k);
|
||||
devAndLine.setDevName(v.get(0).getDevName());
|
||||
v.stream().distinct().forEach(v1->{
|
||||
v.stream().distinct().forEach(v1 -> {
|
||||
DevAndLine.Line line = new DevAndLine.Line();
|
||||
line.setLineId(v1.getLineId());
|
||||
line.setLineName(v1.getLineName());
|
||||
@@ -735,8 +735,21 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public List<String> getLevelMonitorByDept(String level, String deptId) {
|
||||
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(deptId).getData();
|
||||
List<String> lineIds = deptLineService.list(new LambdaQueryWrapper<DeptLine>().in(DeptLine::getId,deptIds)).stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList());
|
||||
List<String> result = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().select(LineDetail::getId).in(LineDetail::getId,lineIds).eq(LineDetail::getLineGrade,level)).stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = deptLineService.list(new LambdaQueryWrapper<DeptLine>().in(DeptLine::getId, deptIds)).stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList());
|
||||
List<String> result = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().select(LineDetail::getId).in(LineDetail::getId, lineIds).eq(LineDetail::getLineGrade, level)).stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
@@ -824,8 +836,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
public List<PqsCommunicate> getCommunicate(String devId, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(),DateUtil.endOfDay(DateUtil.parse(endTime)).toString())
|
||||
.eq(PqsCommunicate::getDevId,devId);
|
||||
influxQueryWrapper.between(InfluxDbSqlConstant.TIME, DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(), DateUtil.endOfDay(DateUtil.parse(endTime)).toString())
|
||||
.eq(PqsCommunicate::getDevId, devId);
|
||||
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -850,16 +862,16 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
* @Date: 2022/10/10
|
||||
*/
|
||||
@Override
|
||||
public List<DeptLineCountVO> getDeptLineCount(DeviceInfoParam deviceInfoParam) {
|
||||
List<DeptLineCountVO> deptLineCountVOList = new ArrayList<> ();
|
||||
public List<DeptLineCountVO> getDeptLineCount(DeviceInfoParam deviceInfoParam) {
|
||||
List<DeptLineCountVO> deptLineCountVOList = new ArrayList<>();
|
||||
//获取所有监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
//根据部门id去获取省份信息
|
||||
DeptLineCountVO deptLineCountVO = new DeptLineCountVO();
|
||||
deptLineCountVO.setIndex (generalDeviceDTO.getIndex ());
|
||||
deptLineCountVO.setIndex(generalDeviceDTO.getIndex());
|
||||
deptLineCountVO.setName(generalDeviceDTO.getName());
|
||||
deptLineCountVO.setNumber (generalDeviceDTO.getLineIndexes().size());
|
||||
deptLineCountVO.setNumber(generalDeviceDTO.getLineIndexes().size());
|
||||
deptLineCountVOList.add(deptLineCountVO);
|
||||
}
|
||||
|
||||
@@ -872,7 +884,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
deptLineCountVO.setNumber (entry.getValue());
|
||||
result.add(deptLineCountVO);
|
||||
}*/
|
||||
deptLineCountVOList = deptLineCountVOList.stream ().sorted (Comparator.comparing (DeptLineCountVO::getNumber,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
deptLineCountVOList = deptLineCountVOList.stream().sorted(Comparator.comparing(DeptLineCountVO::getNumber, Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
return deptLineCountVOList;
|
||||
}
|
||||
|
||||
@@ -887,21 +899,21 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public Map<String, List<String>> getLineBySubstationRelation(Integer devDataType) {
|
||||
|
||||
Map<String, List<String>> map = new HashMap<> ();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
|
||||
List<Line> deptLines = lineMapper.getLineBySubstationRelation(devDataType);
|
||||
Map<String, List<String>> collect = deptLines.stream ( ).collect (Collectors.groupingBy (Line::getPids, Collectors.mapping (Line::getId,Collectors.toList ())));
|
||||
Map<String, List<String>> collect = deptLines.stream().collect(Collectors.groupingBy(Line::getPids, Collectors.mapping(Line::getId, Collectors.toList())));
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineDetailDataVO> getLineDetailList(List<String> lineIds){
|
||||
public List<LineDetailDataVO> getLineDetailList(List<String> lineIds) {
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
List<LineDetailDataVO> lineDetailInfo = lineDetailMapper.getLineDetailInfo(lineIds);
|
||||
lineDetailInfo.forEach(item->{
|
||||
if(dicMap.containsKey(item.getScale())){
|
||||
lineDetailInfo.forEach(item -> {
|
||||
if (dicMap.containsKey(item.getScale())) {
|
||||
item.setScale(dicMap.get(item.getScale()));
|
||||
}
|
||||
});
|
||||
@@ -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());
|
||||
}
|
||||
@@ -158,11 +203,11 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
}
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<HarmonicDeptVO> collect = list.stream().filter(x->x.getRatio()!=3.14159&&x.getOnlineCount()!=0&&x.getOverLineCount()!=0)
|
||||
List<HarmonicDeptVO> collect = list.stream().filter(x -> x.getRatio() != 3.14159 && x.getOnlineCount() != 0 && x.getOverLineCount() != 0)
|
||||
.sorted(Comparator.comparing(HarmonicDeptVO::getRatio).reversed().thenComparing(HarmonicDeptVO::getOnlineCount).thenComparing(HarmonicDeptVO::getOverLineCount)).collect(Collectors.toList());
|
||||
List<String> ids = collect.stream().map(HarmonicDeptVO::getId).collect(Collectors.toList());
|
||||
collect.addAll(list.stream().filter(x->!ids.contains(x.getId()))
|
||||
.collect(Collectors.toList()));
|
||||
collect.addAll(list.stream().filter(x -> !ids.contains(x.getId()))
|
||||
.collect(Collectors.toList()));
|
||||
return collect;
|
||||
}
|
||||
return list;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -400,18 +433,18 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
|
||||
}
|
||||
|
||||
public AreaDTO handleDataNew(List<RStatLimitTargetDPO> list, List<RStatLimitTargetDPO> sumList,String type) {
|
||||
int onlineCount = 0,overLineCount = 0,overCountByDay = 0;
|
||||
double avgOverDay = 0.0,ratio = 0.0;
|
||||
public AreaDTO handleDataNew(List<RStatLimitTargetDPO> list, List<RStatLimitTargetDPO> sumList, String type) {
|
||||
int onlineCount = 0, overLineCount = 0, overCountByDay = 0;
|
||||
double avgOverDay = 0.0, ratio = 0.0;
|
||||
AreaDTO areaDTO = new AreaDTO();
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
List<RStatLimitTargetDPO> data=sumList;
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<RStatLimitTargetDPO> data = sumList;
|
||||
if (!CollectionUtils.isEmpty(sumList)) {
|
||||
onlineCount = data.size();
|
||||
//在线监测点个数
|
||||
areaDTO.setOnlineCount(onlineCount);
|
||||
for (RStatLimitTargetDPO pojo : data) {
|
||||
if (pojo.getAllTime()>0){
|
||||
if (pojo.getAllTime() > 0) {
|
||||
overLineCount = overLineCount + 1;
|
||||
}
|
||||
}
|
||||
@@ -437,21 +470,21 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
ratio = ratio + overDay * 1.0 / l.size();
|
||||
}
|
||||
//平均超标天数
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
avgOverDay = 0;
|
||||
} else {
|
||||
avgOverDay = overLineCount == 0?0.0:BigDecimal.valueOf(overCountByDay*1.0/overLineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
avgOverDay = overLineCount == 0 ? 0.0 : BigDecimal.valueOf(overCountByDay * 1.0 / overLineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
//月监测点符合性超标占比
|
||||
ratio = map.size() == 0?0:BigDecimal.valueOf(ratio*100.0/map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
ratio = map.size() == 0 ? 0 : BigDecimal.valueOf(ratio * 100.0 / map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
areaDTO.setOnlineCount(onlineCount);
|
||||
areaDTO.setOverLineCount(overLineCount);
|
||||
//平均超标天数
|
||||
areaDTO.setAverageOverDay(avgOverDay);
|
||||
areaDTO.setRatio(Math.min(ratio,100.0));
|
||||
areaDTO.setRatio(Math.min(ratio, 100.0));
|
||||
//月监测点超标占比
|
||||
double lineRatio = onlineCount==0?0:BigDecimal.valueOf(overLineCount*100.0/onlineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
areaDTO.setLineRatio(Math.min(lineRatio,100.0));
|
||||
double lineRatio = onlineCount == 0 ? 0 : BigDecimal.valueOf(overLineCount * 100.0 / onlineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
areaDTO.setLineRatio(Math.min(lineRatio, 100.0));
|
||||
return areaDTO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user