1.解决变电站数量不统一问题

2.替换最新污染值
3.解决终端数量不一致问题
This commit is contained in:
wr
2025-12-10 16:19:35 +08:00
parent 6d833678a6
commit 0fdc3edb89
37 changed files with 358 additions and 94 deletions

View File

@@ -13,6 +13,8 @@ public class PollutionLineInfoDTO {
/** /**
* 所属变电站 * 所属变电站
*/ */
private String subStationId;
private String subStationName; private String subStationName;
/** /**

View File

@@ -32,7 +32,6 @@ public class DeptGetLineParam {
private Boolean monitorStateRunning=true; private Boolean monitorStateRunning=true;
@ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的") @ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的")
private Integer isUpToGrid; private Integer isUpToGrid;
/** /**
* 0-电网侧 * 0-电网侧

View File

@@ -70,6 +70,16 @@ public interface GeneralDeviceInfoClient {
HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam); HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
/**
* 获取变电站分类的所有终端综合信息
*
* @param deviceInfoParam 查询终端条件
* @return 获取变电站分类的所有终端综合信息
*/
@PostMapping("/getPracticalAllDeviceInfoAsSubstation")
HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
/** /**
* 获取实际运行终端综合信息 * 获取实际运行终端综合信息
* *

View File

@@ -59,6 +59,12 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam) {
log.error("{}异常,降级处理,异常为:{}", "获取变电站分类的所有终端综合信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(DeviceInfoParam deviceInfoParam) { public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(DeviceInfoParam deviceInfoParam) {
log.error("{}异常,降级处理,异常为:{}", "获取实际运行终端综合信息", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "获取实际运行终端综合信息", throwable.toString());

View File

@@ -105,6 +105,14 @@ public class DeviceInfoParam implements Serializable {
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR) @Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
private Integer lineRunFlag; private Integer lineRunFlag;
@ApiModelProperty("0按照监测点搜索 1按照装置搜索")
private Integer lineOrDevice;
/**
* 搜索值
*/
@ApiModelProperty("搜索值")
private String searchValue;
/** /**
* 默认全部监测点 * 默认全部监测点
* *
@@ -207,6 +215,9 @@ public class DeviceInfoParam implements Serializable {
@ApiModelProperty("是否是冀北电网一张图树 0:否 1:是") @ApiModelProperty("是否是冀北电网一张图树 0:否 1:是")
private Integer type = 0; private Integer type = 0;
@ApiModelProperty("指标")
private List<String> dicData;
} }
public Boolean isUserLedger() { public Boolean isUserLedger() {

View File

@@ -13,7 +13,6 @@ import java.util.List;
* @createTime: 2023-04-03 * @createTime: 2023-04-03
*/ */
@Data @Data
@ApiModel
public class OnlineRateParam { public class OnlineRateParam {
@ApiModelProperty(name = "ids", value = "设备id") @ApiModelProperty(name = "ids", value = "设备id")
@@ -27,4 +26,10 @@ public class OnlineRateParam {
@ApiModelProperty(name = "type", value = "区分类型0topid搜索 1devid搜索") @ApiModelProperty(name = "type", value = "区分类型0topid搜索 1devid搜索")
private Integer type; private Integer type;
@Data
public static class Info extends OnlineRateParam {
@ApiModelProperty(name = "dicData", value = "字典id")
private List<String> dicData;
}
} }

View File

@@ -5,6 +5,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
* 监测点详细信息 * 监测点详细信息
@@ -131,4 +132,17 @@ public class AreaLineInfoVO implements Serializable {
@ApiModelProperty(name = "objId",value = "对象id") @ApiModelProperty(name = "objId",value = "对象id")
private String objId; private String objId;
private Double vHarmonicValue; ;
private List<User> userList;
@Data
public static class User{
private String id;
private String projectName;
private String stationId;
private String lineId;
private String city;
}
} }

View File

@@ -81,6 +81,7 @@ public class DeviceRunEvaluateController extends BaseController {
@ApiOperation("终端评价列表(冀北)") @ApiOperation("终端评价列表(冀北)")
public HttpResult<List<DeviceRunEvaluateVO.Detail>> getRunEvaluateInfo(@RequestBody DeviceInfoParam.BusinessParam businessParam) { public HttpResult<List<DeviceRunEvaluateVO.Detail>> getRunEvaluateInfo(@RequestBody DeviceInfoParam.BusinessParam businessParam) {
String methodDescribe = getMethodDescribe("getRunEvaluateInfo"); String methodDescribe = getMethodDescribe("getRunEvaluateInfo");
businessParam.setLineOrDevice(1);
List<DeviceRunEvaluateVO.Detail> runEvaluate = deviceRunEvaluateService.getRunEvaluate(businessParam); List<DeviceRunEvaluateVO.Detail> runEvaluate = deviceRunEvaluateService.getRunEvaluate(businessParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, runEvaluate, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, runEvaluate, methodDescribe);
} }

View File

@@ -136,6 +136,22 @@ public class GeneralDeviceInfoController extends BaseController {
} }
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getPracticalAllDeviceInfoAsSubstation")
@ApiOperation("获取按变电站分类的所有终端综合信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "deviceInfoParam", value = "查询终端条件", required = true)
})
public HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("getPracticalAllDeviceInfoAsSubstation");
List<GeneralDeviceDTO> substationDeviceInfos = generalDeviceService.getDeviceInfoAsSubstation(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(substationDeviceInfos)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDeviceInfos, methodDescribe);
}
}
/** /**
* 获取实际运行终端综合信息 * 获取实际运行终端综合信息
*/ */

View File

@@ -56,7 +56,6 @@ public class GridDiagramController extends BaseController {
@ApiOperation("变电站趋势分析") @ApiOperation("变电站趋势分析")
public HttpResult<Map<String, Long>> getGridDiagramSubTendency(@RequestBody GridDiagramParam param){ public HttpResult<Map<String, Long>> getGridDiagramSubTendency(@RequestBody GridDiagramParam param){
String methodDescribe = getMethodDescribe("getGridDiagramSubTendency"); String methodDescribe = getMethodDescribe("getGridDiagramSubTendency");
param.getDeviceInfoParam().setPowerFlag(0);
Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,3); Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,3);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe);
} }
@@ -91,6 +90,7 @@ public class GridDiagramController extends BaseController {
@ApiOperation("监测点趋势分析") @ApiOperation("监测点趋势分析")
public HttpResult<Map<String, Long>> getGridDiagramLineTendency(@RequestBody GridDiagramParam param){ public HttpResult<Map<String, Long>> getGridDiagramLineTendency(@RequestBody GridDiagramParam param){
String methodDescribe = getMethodDescribe("getGridDiagramLineTendency"); String methodDescribe = getMethodDescribe("getGridDiagramLineTendency");
param.getDeviceInfoParam().setLineRunFlag(0);
Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,6); Map<String, Long> gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,6);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe);
} }

View File

@@ -153,6 +153,7 @@ public class LineIntegrityDataController extends BaseController {
@ApiOperation("监测点数据完整性(冀北)") @ApiOperation("监测点数据完整性(冀北)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true) @ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) { public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) {
param.setLineOrDevice(0);
String methodDescribe = getMethodDescribe("getData"); String methodDescribe = getMethodDescribe("getData");
DeviceOnlineRate rate = irStatIntegrityDService.getData(param); DeviceOnlineRate rate = irStatIntegrityDService.getData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);

View File

@@ -227,7 +227,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) { public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) {
List<DeptGetSubStationDTO.Info> result = new ArrayList<>(); List<DeptGetSubStationDTO.Info> result = new ArrayList<>();
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam); List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()),deptGetLineParam.getPowerFlag(),deptGetLineParam.getLineRunFlag()); List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()),deptGetLineParam.getPowerFlag(),deptGetLineParam.getLineRunFlag(),deptGetLineParam.getIsUpToGrid());
Map<String, List<TerminalGetBase.Extend>> orgSub = anExtends.stream().collect(Collectors.groupingBy(TerminalGetBase::getUnitId)); Map<String, List<TerminalGetBase.Extend>> orgSub = anExtends.stream().collect(Collectors.groupingBy(TerminalGetBase::getUnitId));
Map<String, String> deptNameMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName)); Map<String, String> deptNameMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
temDept.forEach(item -> { temDept.forEach(item -> {

View File

@@ -74,15 +74,14 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<DictData> v = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PANORAMIC_VOLTAGE.getCode()).getData(); List<DictData> v = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PANORAMIC_VOLTAGE.getCode()).getData();
List<String> voltageIds; List<String> voltageIds;
//获取电压等级550 220 110 35 //获取电压等级550 220 110 35
if(CollUtil.isNotEmpty(v)){ if (CollUtil.isNotEmpty(v)) {
List<String> vName = v.stream().map(DictData::getName).collect(Collectors.toList()); List<String> vName = v.stream().map(DictData::getName).collect(Collectors.toList());
voltageIds = dictDataList.stream().filter(item -> vName.contains(item.getName())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList()); voltageIds = dictDataList.stream().filter(item -> vName.contains(item.getName())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
}else{ } else {
voltageIds = dictDataList.stream().filter(item -> Objects.equals(DicDataEnum.DY_500KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_220KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_110KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_35KV.getCode(), item.getCode())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList()); voltageIds = dictDataList.stream().filter(item -> Objects.equals(DicDataEnum.DY_500KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_220KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_110KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_35KV.getCode(), item.getCode())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
} }
GridDiagramVO gridDiagramVO = new GridDiagramVO(); GridDiagramVO gridDiagramVO = new GridDiagramVO();
List<GridDiagramVO.LineStatistics> info = new ArrayList<>(); List<GridDiagramVO.LineStatistics> info = new ArrayList<>();
List<GridDiagramVO.LineStatistics> gwInfo = new ArrayList<>(); List<GridDiagramVO.LineStatistics> gwInfo = new ArrayList<>();
@@ -295,11 +294,11 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override @Override
public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) { public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) {
param.getDeviceInfoParam().setLineRunFlag(0); List<Integer> runFlag = new ArrayList<>();
if (type == 3) { if (3 != type) {
param.getDeviceInfoParam().setPowerFlag(0); runFlag.add(0);
} }
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), runFlag, Stream.of(1).collect(Collectors.toList()));
Map<String, Long> map = new LinkedHashMap<>(); Map<String, Long> map = new LinkedHashMap<>();
DateField dateField; DateField dateField;
DateTime parse; DateTime parse;
@@ -359,7 +358,6 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override @Override
public List<GridDiagramVO.DeviceData> getGridDiagramDevData(GridDiagramParam param) { public List<GridDiagramVO.DeviceData> getGridDiagramDevData(GridDiagramParam param) {
param.getDeviceInfoParam().setLineRunFlag(0);
// 获取所有数据 // 获取所有数据
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
List<String> devIDs = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList()); List<String> devIDs = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
@@ -399,9 +397,8 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override @Override
public List<GridDiagramVO.DevData> getGridDiagramDevDataList(GridDiagramParam param) { public List<GridDiagramVO.DevData> getGridDiagramDevDataList(GridDiagramParam param) {
param.getDeviceInfoParam().setLineRunFlag(0);
List<GridDiagramVO.DevData> info = new ArrayList<>(); List<GridDiagramVO.DevData> info = new ArrayList<>();
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(param.getDeviceInfoParam(), null, Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(param.getDeviceInfoParam(), Arrays.asList(0), Stream.of(1).collect(Collectors.toList()));
List<String> devIds = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList()); List<String> devIds = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList());
//终端信息 //终端信息
List<Device> devList = new ArrayList<>(); List<Device> devList = new ArrayList<>();

View File

@@ -428,7 +428,7 @@ public class GeneralDeviceService {
//2.筛选出终端id理论上监测点的pids中第五个id为终端id //2.筛选出终端id理论上监测点的pids中第五个id为终端id
List<String> devIds = voltages.stream().map(Line::getPid).distinct().collect(Collectors.toList()); List<String> devIds = voltages.stream().map(Line::getPid).distinct().collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2 // 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer()); List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam);
//3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2 //3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds = devices.stream().map(Line::getPid).distinct().collect(Collectors.toList()); List<String> subIds = devices.stream().map(Line::getPid).distinct().collect(Collectors.toList());

View File

@@ -129,7 +129,7 @@ public interface TerminalBaseService {
* @param deviceType 终端筛选条件 * @param deviceType 终端筛选条件
* @param manufacturer 终端厂家 * @param manufacturer 终端厂家
*/ */
List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, List<SimpleDTO> manufacturer); List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, DeviceInfoParam manufacturer);
/** /**
* 查询母线信息 * 查询母线信息

View File

@@ -1627,7 +1627,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
@Override @Override
public List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, List<SimpleDTO> manufacturer) { public List<Line> getDeviceByCondition(List<String> devIds, DeviceType deviceType, DeviceInfoParam manufacturer) {
return this.baseMapper.getDeviceByCondition(devIds, deviceType, manufacturer); return this.baseMapper.getDeviceByCondition(devIds, deviceType, manufacturer);
} }

View File

@@ -41,6 +41,7 @@ public class OnLineRateController extends BaseController {
@ApiOperation("终端在线率列表(冀北)") @ApiOperation("终端在线率列表(冀北)")
public HttpResult<DeviceOnlineRate> deviceOnlineRateInfo(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam) { public HttpResult<DeviceOnlineRate> deviceOnlineRateInfo(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("deviceOnlineRateInfo"); String methodDescribe = getMethodDescribe("deviceOnlineRateInfo");
deviceInfoParam.setLineOrDevice(1);
DeviceOnlineRate rate = onLineRateService.deviceOnlineRateInfo(deviceInfoParam); DeviceOnlineRate rate = onLineRateService.deviceOnlineRateInfo(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
} }

View File

@@ -355,6 +355,7 @@
line.id lineId, line.id lineId,
line.name lineName, line.name lineName,
gdinfo.NAME AS gdName, gdinfo.NAME AS gdName,
substation.id AS subStationId,
substation.NAME AS subStationName, substation.NAME AS subStationName,
device.NAME AS devName, device.NAME AS devName,
deviceDetail.Com_Flag AS comFlag, deviceDetail.Com_Flag AS comFlag,

View File

@@ -76,9 +76,17 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType); List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType,@Param("powerFlag")Integer powerFlag,@Param("lineRunFlag") Integer lineRunFlag); List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType,
@Param("powerFlag")Integer powerFlag,
@Param("lineRunFlag") Integer lineRunFlag,
@Param("monitorFlag") Integer monitorFlag
);
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("manufacturer")String manufacturer,@Param("runFlag")List<Integer> runFlag,@Param("dataType")List<Integer> dataType,@Param("objType")String objType); List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,
@Param("manufacturer")String manufacturer,
@Param("runFlag")List<Integer> runFlag,
@Param("dataType")List<Integer> dataType,
@Param("objType")String objType);
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam); List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);

View File

@@ -155,7 +155,7 @@ public interface LineMapper extends BaseMapper<Line> {
* @param deviceType 终端筛选条件 * @param deviceType 终端筛选条件
* @param manufacturer 终端厂家 * @param manufacturer 终端厂家
*/ */
List<Line> getDeviceByCondition(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType, @Param("manufacturer") List<SimpleDTO> manufacturer); List<Line> getDeviceByCondition(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType, @Param("deviceInfoParam") DeviceInfoParam manufacturer);
/** /**
* 查询母线信息 * 查询母线信息

View File

@@ -124,7 +124,10 @@
and lineDetail.Power_Flag = #{powerFlag} and lineDetail.Power_Flag = #{powerFlag}
</if> </if>
<if test="lineRunFlag!=null "> <if test="lineRunFlag!=null ">
and device.Run_Flag = 0 and lineDetail.Run_Flag = #{lineRunFlag} and lineDetail.Run_Flag = #{lineRunFlag}
</if>
<if test="monitorFlag!=null ">
and lineDetail.Monitor_Flag = #{monitorFlag}
</if> </if>
</select> </select>
<select id="getLineIdByDeptIds" resultType="string"> <select id="getLineIdByDeptIds" resultType="string">
@@ -142,8 +145,8 @@
<foreach collection="dataType" item="item" open="(" close=")" separator=","> <foreach collection="dataType" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
<if test="runFlag!=null and runFlag!=''"> <if test="runFlag!=null and runFlag.size() > 0">
and device.run_flag in and lineDetail.run_flag in
<foreach collection="runFlag" item="item" open="(" close=")" separator=","> <foreach collection="runFlag" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>

View File

@@ -294,6 +294,9 @@
#{item.id} #{item.id}
</foreach> </foreach>
</if> </if>
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.lineOrDevice==0">
AND t1.name like CONCAT(CONCAT('%', #{deviceInfoParam.searchValue}), '%')
</if>
<!-- xy --> <!-- xy -->
<choose> <choose>
<when test="deviceInfoParam.statFlag"> <when test="deviceInfoParam.statFlag">
@@ -335,12 +338,15 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="manufacturer!=null and manufacturer.size()!=0"> <if test="deviceInfoParam.manufacturer!=null and deviceInfoParam.manufacturer.size()!=0">
AND t2.manufacturer in AND t2.manufacturer in
<foreach collection="manufacturer" open="(" close=")" item="item" separator=","> <foreach collection="deviceInfoParam.manufacturer" open="(" close=")" item="item" separator=",">
#{item.id} #{item.id}
</foreach> </foreach>
</if> </if>
<if test="deviceInfoParam.searchValue!=null and deviceInfoParam.lineOrDevice==1">
AND t1.name like CONCAT(CONCAT('%', #{deviceInfoParam.searchValue}), '%')
</if>
<if test="devIds!=null and devIds.size()!=0"> <if test="devIds!=null and devIds.size()!=0">
AND t1.id IN AND t1.id IN
<foreach collection="devIds" open="(" close=")" item="item" separator=","> <foreach collection="devIds" open="(" close=")" item="item" separator=",">

View File

@@ -115,7 +115,7 @@ public interface DeptLineService extends IService<DeptLine> {
Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devType); Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devType);
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,Integer powerFlag,Integer lineRunFlag); List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType,Integer powerFlag,Integer lineRunFlag,Integer monitorFlag);
List<SubGetBase> getSubStationList(SubstationParam substationParam); List<SubGetBase> getSubStationList(SubstationParam substationParam);

View File

@@ -176,8 +176,8 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
} }
@Override @Override
public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType, Integer powerFlag, Integer lineRunFlag) { public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType, Integer powerFlag, Integer lineRunFlag,Integer monitorFlag) {
return deptLineMapper.orgSubStationInfoGet(devType, powerFlag, lineRunFlag); return deptLineMapper.orgSubStationInfoGet(devType, powerFlag, lineRunFlag,monitorFlag);
} }
@Override @Override

View File

@@ -8,18 +8,22 @@ import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO; import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.AreaSubLineVO; import com.njcn.event.pojo.vo.AreaSubLineVO;
import com.njcn.event.service.majornetwork.AreaInfoService; import com.njcn.event.service.majornetwork.AreaInfoService;
import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.harmonic.api.PollutionSubstationClient;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@@ -41,11 +45,12 @@ public class AreaInfoServiceImpl implements AreaInfoService {
private final GeneralDeviceInfoClient generalDeviceInfoClient; private final GeneralDeviceInfoClient generalDeviceInfoClient;
private final LineFeignClient lineFeignClient; private final LineFeignClient lineFeignClient;
private final EventDetailService eventDetailService; private final EventDetailService eventDetailService;
private final PollutionSubstationClient pollutionSubstationClient;
@Override @Override
public List<AreaSubLineVO> getAreaLineInfo(DeviceInfoParam.GridDiagram deviceInfoParam) { public List<AreaSubLineVO> getAreaLineInfo(DeviceInfoParam.GridDiagram deviceInfoParam) {
List<AreaSubLineVO> resultVOList = new ArrayList<>(); List<AreaSubLineVO> resultVOList = new ArrayList<>();
List<String> lineIds =new ArrayList<>(); List<String> lineIds =new ArrayList<>();
Map<String, UserLinePollution> userMap = new HashMap<>();
if(1==deviceInfoParam.getType()){ if(1==deviceInfoParam.getType()){
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){ if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
lineIds.addAll(deviceInfoParam.getCoutList()); lineIds.addAll(deviceInfoParam.getCoutList());
@@ -61,6 +66,15 @@ public class AreaInfoServiceImpl implements AreaInfoService {
if (CollectionUtil.isNotEmpty(lineIds)) { if (CollectionUtil.isNotEmpty(lineIds)) {
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
if(1==deviceInfoParam.getType()){
OnlineRateParam.Info param=new OnlineRateParam.Info();
param.setIds(resList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList()));
param.setDicData(deviceInfoParam.getDicData());
param.setStartTime(deviceInfoParam.getSearchBeginTime());
param.setEndTime(deviceInfoParam.getSearchEndTime());
userMap = pollutionSubstationClient.getSumList(param).getData();
}
//设置冀北告警监测点类型 //设置冀北告警监测点类型
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){ if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
resList.stream().filter(x->deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x->x.setType(0)); resList.stream().filter(x->deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x->x.setType(0));
@@ -86,6 +100,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong)); areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong));
} }
} }
if(userMap.containsKey(areaLineInfoVO.getLineId())){
UserLinePollution userLinePollution = userMap.get(areaLineInfoVO.getLineId());
areaLineInfoVO.setVHarmonicValue(userLinePollution.getVHarmonicValue());
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(),AreaLineInfoVO.User.class));
}
} }
//组装成变电站 //组装成变电站

View File

@@ -458,13 +458,11 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
long count90 = list.stream() long count90 = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getSeverity())) .filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId())) .filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
.filter(x -> 0.9 > x.getFeatureAmplitude()) .filter(x -> 0.9 > x.getSeverity()).count();
.map(RmpEventDetailPO::getFeatureAmplitude).count();
long count50 = list.stream() long count50 = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getSeverity())) .filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId())) .filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
.filter(x -> 0.5 > x.getFeatureAmplitude()) .filter(x -> 0.5 > x.getSeverity()).count();
.map(RmpEventDetailPO::getFeatureAmplitude).count();
if(count90>0){ if(count90>0){
info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue()); info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue());
}else { }else {

View File

@@ -0,0 +1,24 @@
package com.njcn.harmonic.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
@FeignClient(
value = ServerInfo.HARMONIC,
path = "/PollutionSubstation",
fallbackFactory = RStatLimitRateDFeignClientFallbackFactory.class,
contextId = "PollutionSubstation")
public interface PollutionSubstationClient {
@PostMapping(value ="/getSumList")
HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param);
}

View File

@@ -0,0 +1,43 @@
package com.njcn.harmonic.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.harmonic.api.PollutionSubstationClient;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author hongawen
* @version 1.0.0
* @date 2023年07月21日 14:31
*/
@Slf4j
@Component
public class PollutionSubstationClientFactory implements FallbackFactory<PollutionSubstationClient> {
@Override
public PollutionSubstationClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new PollutionSubstationClient() {
@Override
public HttpResult<Map<String, UserLinePollution>> getSumList(OnlineRateParam.Info param) {
log.error("{}异常,降级处理,异常为:{}", "国网上送-典型源荷指标统计数据", throwable.toString());
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
}
};
}
}

View File

@@ -24,6 +24,8 @@ public class LinePollution implements Serializable {
@ApiModelProperty("变电站") @ApiModelProperty("变电站")
private String subStationName; private String subStationName;
private String subStationId;
/** /**
* 终端名称 * 终端名称
*/ */

View File

@@ -0,0 +1,27 @@
package com.njcn.harmonic.pojo.excel.pollution;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2025/12/9 21:12
*/
@Data
public class UserLinePollution {
private String lineId;
private Double vHarmonicValue;
private List<User> userList;
@Data
public static class User{
private String id;
private String projectName;
private String stationId;
private String lineId;
private String city;
}
}

View File

@@ -9,8 +9,10 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.harmonic.pojo.excel.pollution.LinePollution; import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution; import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import com.njcn.harmonic.pojo.param.HarmonicPublicParam; import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam; import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
@@ -30,6 +32,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* Description: * Description:
@@ -157,4 +162,16 @@ public class PollutionSubstationController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gdPollutions, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gdPollutions, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation(value = "监测点和敏感用户谐波污染值列表")
@PostMapping(value = "/getSumList")
public HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param) {
String methodDescribe = getMethodDescribe("getSumList");
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
List<UserLinePollution> sumList = pollutionSubstationService.getSumList(param);
Map<String, UserLinePollution> sumMap = sumList.stream().collect(Collectors.toMap(UserLinePollution::getLineId, Function.identity()));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sumMap, methodDescribe);
}
} }

View File

@@ -6,9 +6,11 @@ import com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.GridDiagramParam; import com.njcn.device.pq.pojo.param.GridDiagramParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.GridDiagramVO; import com.njcn.device.pq.pojo.vo.GridDiagramVO;
import com.njcn.harmonic.pojo.excel.pollution.LinePollution; import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution; import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
import com.njcn.harmonic.pojo.param.HarmonicPublicParam; import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam; import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
@@ -110,4 +112,7 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
* @param param * @param param
*/ */
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param); List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
List<UserLinePollution> getSumList(OnlineRateParam.Info param);
} }

View File

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.config.GeneralInfo; import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.constant.BizParamConstant; import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
@@ -34,6 +35,7 @@ import com.njcn.device.pq.api.SubstationFeignClient;
import com.njcn.device.pq.enums.LineBaseEnum; import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.enums.PowerFlagEnum; import com.njcn.device.pq.enums.PowerFlagEnum;
import com.njcn.device.pq.pojo.dto.*; import com.njcn.device.pq.pojo.dto.*;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.GridDiagramParam; import com.njcn.device.pq.pojo.param.GridDiagramParam;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam; import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam; import com.njcn.device.pq.pojo.param.OnlineRateParam;
@@ -128,7 +130,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
private final RmpEventDetailFeignClient detailFeignClient; private final RmpEventDetailFeignClient detailFeignClient;
private final CommLineClient commLineClient; private final CommLineClient commLineClient;
/** /**
* @param pollutionSubstationQuryParam * @param pollutionSubstationQuryParam
* @Description: getPollutionSubstationData * @Description: getPollutionSubstationData
@@ -758,8 +759,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
public GridDiagramVO getPollutionAlarmData(StatSubstationBizBaseParam param) { public GridDiagramVO getPollutionAlarmData(StatSubstationBizBaseParam param) {
DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(param.getId()); deptGetLineParam.setDeptId(param.getId());
deptGetLineParam.setPowerFlag(0); deptGetLineParam.setIsUpToGrid(param.getIsUpToGrid());
deptGetLineParam.setLineRunFlag(0);
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
//获取全部变电站信息 //获取全部变电站信息
List<SubGetBase> collect = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList()); List<SubGetBase> collect = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList());
@@ -880,25 +880,27 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public List<List<String>> getPollutionAlarmList(GridDiagramParam param) { public List<List<String>> getPollutionAlarmList(GridDiagramParam param) {
List<List<String>> info = new ArrayList<>(); List<List<String>> info = new ArrayList<>();
param.getDeviceInfoParam().setPowerFlag(0); DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
param.getDeviceInfoParam().setLineRunFlag(0); deptGetLineParam.setDeptId(param.getOrgId());
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData(); deptGetLineParam.setIsUpToGrid(param.getDeviceInfoParam().getMonitorFlag());
List<String> subIds = data.stream().flatMap(x -> x.getSubIndexes().stream()).collect(Collectors.toList()); List<DeptGetSubStationDTO.Info> deptSub = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>() List<String> lineIdList = deptSub.stream()
.select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue) .flatMap(x -> x.getStationIds().stream().flatMap(d -> d.getUnitChildrenList().stream()))
.in(CollUtil.isNotEmpty(subIds), RStatPollutionSubstationM::getSubstationId, subIds) .distinct()
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds()) .collect(Collectors.toList());
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))) List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList,
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatPollutionSubstationM::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()))) Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
); DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
List<String> dept; List<String> dept;
for (GeneralDeviceDTO datum : data) { for (DeptGetSubStationDTO.Info datum : deptSub) {
List<RStatPollutionSubstationM> collect = substationMlist.stream().filter(x -> datum.getSubIndexes().contains(x.getSubstationId())).collect(Collectors.toList()); if(!datum.getUnitId().equals(param.getOrgId())){
dept = new ArrayList<>(); dept = new ArrayList<>();
dept.add(datum.getName()); dept.add(datum.getUnitName());
dept.add(String.valueOf(datum.getSubIndexes().size())); dept.add(String.valueOf(datum.getStationIds().size()));
dept.addAll(addList(collect)); dept.addAll(addList(rMpPollutionDPOS, datum.getStationIds()));
info.add(dept); info.add(dept);
}
} }
return info; return info;
} }
@@ -966,23 +968,26 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param) { public List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param) {
List<LinePollution> finalLinePollutionList = pollutionCalcList(param); DeviceInfoParam deviceInfoParam=new DeviceInfoParam();
deviceInfoParam.setLineRunFlag(0);
deviceInfoParam.setDeptIndex(param.getId());
deviceInfoParam.setStatisticalType(new SimpleDTO());
List<GeneralDeviceDTO> data1 = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
List<String> lineIdList = data1.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
List<LinePollution> finalLinePollutionList = pollutionCalcList(param,lineIdList);
// 全部监测点计算完毕后根据污染值从大到小进行排序 // 全部监测点计算完毕后根据污染值从大到小进行排序
finalLinePollutionList = finalLinePollutionList.stream() finalLinePollutionList = finalLinePollutionList.stream()
.sorted(Comparator.comparing(LinePollution::getHarmonicValue).reversed()) .sorted(Comparator.comparing(LinePollution::getHarmonicValue).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
return finalLinePollutionList; return finalLinePollutionList;
} }
private List<LinePollution> pollutionCalcList(StatSubstationBizBaseParam param,List<String> lineIdList) {
private List<LinePollution> pollutionCalcList(StatSubstationBizBaseParam param) {
String startDate = param.getStartTime(); String startDate = param.getStartTime();
String endDate = param.getEndTime(); String endDate = param.getEndTime();
List<LinePollution> linePollutionList = new ArrayList<>(); List<LinePollution> linePollutionList = new ArrayList<>();
GridDiagramParam eventParam = new GridDiagramParam(); GridDiagramParam eventParam = new GridDiagramParam();
List<String> lineIdList = generalDeviceInfoClient.deptGetRunLine(param.getId()).getData();
eventParam.setIds(lineIdList); eventParam.setIds(lineIdList);
eventParam.setSearchBeginTime(param.getStartTime()); eventParam.setSearchBeginTime(param.getStartTime());
@@ -1015,8 +1020,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
} }
if (CollUtil.isNotEmpty(lineIdList)) { if (CollUtil.isNotEmpty(lineIdList)) {
// 获取谐波电压数据&总畸变率&越限限值计算基础污染值 // 获取谐波电压数据&总畸变率&越限限值计算基础污染值
for (String lineId: lineIdList) { for (String lineId : lineIdList) {
if(lineMap.containsKey(lineId)){ if (lineMap.containsKey(lineId)) {
PollutionLineInfoDTO data = lineMap.get(lineId); PollutionLineInfoDTO data = lineMap.get(lineId);
LinePollution linePollution = new LinePollution(); LinePollution linePollution = new LinePollution();
// 获取暂态数据 // 获取暂态数据
@@ -1026,9 +1031,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
BigDecimal vo2 = onlineRateMap.get(data.getDeviceId()); BigDecimal vo2 = onlineRateMap.get(data.getDeviceId());
linePollution.setOnlineRate(Objects.isNull(vo2) ? 0.0f : vo2.floatValue()); linePollution.setOnlineRate(Objects.isNull(vo2) ? 0.0f : vo2.floatValue());
//获取监测点数据完整性 //获取监测点数据完整性
linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId).doubleValue()>100?100.0:integrityMap.get(lineId).doubleValue()); linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId).doubleValue() > 100 ? 100.0 : integrityMap.get(lineId).doubleValue());
// 计算谐波的污染值 // 计算谐波的污染值
linePollution.setHarmonicValue(calcMap.containsKey(lineId)?calcMap.get(lineId)>100?100.0:integrityMap.get(lineId).doubleValue():0.0); linePollution.setHarmonicValue(calcMap.containsKey(lineId) ? calcMap.get(lineId).doubleValue() : 0.0);
linePollution.setInterval(data.getTimeInterval()); linePollution.setInterval(data.getTimeInterval());
linePollutionList.add(linePollution); linePollutionList.add(linePollution);
} }
@@ -1040,7 +1045,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public void downPollutionUserCalc(StatSubstationBizBaseParam param) { public void downPollutionUserCalc(StatSubstationBizBaseParam param) {
// 处理干扰源用户的报告 // 处理干扰源用户的报告
List<LinePollution> loadTypeLineList = pollutionCalcList(param); List<LinePollution> loadTypeLineList = pollutionCalcList(param,null);
/** /**
* 1、首先过滤重要变电站、一类变电站、跨省计量关点 todo...待优化 * 1、首先过滤重要变电站、一类变电站、跨省计量关点 todo...待优化
* 2、过滤后以监测对象分组统计数据有多个测点的需要出结果 * 2、过滤后以监测对象分组统计数据有多个测点的需要出结果
@@ -1064,7 +1069,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
objPollution.setObjVValue(PubUtils.doubleRound(2, objVValue) + ""); objPollution.setObjVValue(PubUtils.doubleRound(2, objVValue) + "");
// 处理该监测对象下面监测点的信息 // 处理该监测对象下面监测点的信息
List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>(); List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>();
for (LinePollution linePollution : linePollutions) { for (LinePollution linePollution : linePollutions) {
@@ -1076,7 +1080,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
objPollutions.add(objPollution); objPollutions.add(objPollution);
} }
// 排序 // 排序
objPollutions= objPollutions.stream() objPollutions = objPollutions.stream()
.sorted(Comparator.comparing(ObjPollution::getObjVValue).reversed()) .sorted(Comparator.comparing(ObjPollution::getObjVValue).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
ExcelUtil.exportExcel("用户谐波电压污染值" + param.getEndTime() + ".xlsx", ObjPollution.class, objPollutions); ExcelUtil.exportExcel("用户谐波电压污染值" + param.getEndTime() + ".xlsx", ObjPollution.class, objPollutions);
@@ -1084,27 +1088,33 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override @Override
public List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param) { public List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param) {
DeviceInfoParam deviceInfoParam=new DeviceInfoParam();
deviceInfoParam.setDeptIndex(param.getId());
deviceInfoParam.setStatisticalType(new SimpleDTO());
List<GeneralDeviceDTO> data1 = generalDeviceInfoClient.getPracticalAllDeviceInfoAsSubstation(deviceInfoParam).getData();
List<String> lineIdList = data1.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
List<SubstationPollution> substationPollutions = new ArrayList<>(); List<SubstationPollution> substationPollutions = new ArrayList<>();
// 处理干扰源用户的报告 // 处理干扰源用户的报告
List<LinePollution> linePollutionList = pollutionCalcList(param); List<LinePollution> linePollutionList = pollutionCalcList(param,lineIdList);
// 以变电站分组 // 以变电站分组
Map<String, List<LinePollution>> subMap = linePollutionList.stream() Map<String, List<LinePollution>> subMap = linePollutionList.stream()
.collect(Collectors.groupingBy(x->x.getGdName()+"_"+x.getSubStationName()+"_"+x.getSubVoltage())); .collect(Collectors.groupingBy(x -> x.getSubStationId()+"_"+ x.getGdName() + "_" +x.getSubStationName() + "_" + x.getSubVoltage()));
subMap.forEach((key,value)->{ subMap.forEach((key, value) -> {
String[] name = key.split("_"); String[] name = key.split("_");
SubstationPollution substationPollution = new SubstationPollution(); SubstationPollution substationPollution = new SubstationPollution();
substationPollution.setGdName(name[0]); substationPollution.setGdName(name[1]);
substationPollution.setSubStationName(name[1]); substationPollution.setSubStationName(name[2]);
substationPollution.setSubVoltage(name[2]); substationPollution.setSubVoltage(name[3]);
double subVValue = value.stream() double subVValue = value.stream()
.mapToDouble(o -> o.getHarmonicValue()) .mapToDouble(o -> o.getHarmonicValue())
.average() .sum();
.orElse(0.0);
substationPollution.setSubVStationValue(PubUtils.doubleRound(2, subVValue) + ""); substationPollution.setSubVStationValue(PubUtils.doubleRound(2, subVValue) + "");
List<PowerFlagPollution> lineItemPollutionList = new ArrayList<>(); List<PowerFlagPollution> lineItemPollutionList = new ArrayList<>();
for (LinePollution linePollution : value) { for (LinePollution linePollution : value) {
PowerFlagPollution lineItemPollution = new PowerFlagPollution(); PowerFlagPollution lineItemPollution = new PowerFlagPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true); BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollution.setVHarmonicValue(linePollution.getHarmonicValue());
lineItemPollutionList.add(lineItemPollution); lineItemPollutionList.add(lineItemPollution);
} }
substationPollution.setPowerFlagPollutionList(lineItemPollutionList); substationPollution.setPowerFlagPollutionList(lineItemPollutionList);
@@ -1112,30 +1122,65 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
}); });
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue()))); substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue())));
Collections.reverse(substationPollutions); Collections.reverse(substationPollutions);
return substationPollutions; return substationPollutions;
}
@Override
public List<UserLinePollution> getSumList(OnlineRateParam.Info param) {
List<UserLinePollution> info = new ArrayList<>();
UserReportParam userReportParam = new UserReportParam();
userReportParam.setUserType(6);
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
Map<String, List<UserLedgerVO>> userMap = userLedgerVOList.stream().filter(x -> StrUtil.isNotBlank(x.getLineId())).collect(Collectors.groupingBy(UserLedgerVO::getLineId));
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(param.getIds(), param.getDicData(), param.getStartTime(), param.getEndTime());
Map<String, Double> pollutionMap = rMpPollutionDPOS.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId, RMpPollutionDPO::getValue));
UserLinePollution user;
for (String id : param.getIds()) {
user = new UserLinePollution();
user.setLineId(id);
if (pollutionMap.containsKey(id)) {
user.setVHarmonicValue(pollutionMap.get(id));
} else {
user.setVHarmonicValue(0.0);
}
List<UserLinePollution.User> userList = new ArrayList<>();
if (userMap.containsKey(id)) {
List<UserLedgerVO> userLedgerVOS = userMap.get(id);
userList.addAll(BeanUtil.copyToList(userLedgerVOS, UserLinePollution.User.class));
}
user.setUserList(userList);
info.add(user);
}
return info;
} }
private List<String> addList(List<RStatPollutionSubstationM> substationMlist) { private List<String> addList(List<RMpPollutionDPO> pollLinelist, List<SubGetBase> notNum) {
List<String> info = new ArrayList<>(); List<String> info = new ArrayList<>();
Integer num1 = 0; Integer num1 = 0;
Integer num2 = 0; Integer num2 = 0;
Integer num3 = 0; Integer num3 = 0;
Integer num4 = 0; Integer num4 = 0;
Integer num5 = 0; Integer num5 = 0;
for (RStatPollutionSubstationM x : substationMlist) { Integer num6 = 0;
Double value = x.getValue(); for (SubGetBase subGetBase : notNum) {
//无污染 轻微污染 轻度污染 中度污染 重度污染 List<RMpPollutionDPO> linePoll = pollLinelist.stream().filter(x -> subGetBase.getUnitChildrenList().contains(x.getLineId())).collect(Collectors.toList());
if (0 <= value && value < 1) { if(CollUtil.isNotEmpty(linePoll)){
num1++; Double value = linePoll.stream().mapToDouble(RMpPollutionDPO::getValue).sum();
} else if (1 <= value && value < 1.2) { //无污染 轻微污染0-100 轻度污染100-1000 中度污染1000-10000 重度污染10000
num2++; if (0 == value) {
} else if (1.2 <= value && value < 1.6) { num1++;
num3++; } else if (0 < value && value < 100) {
} else if (1.6 <= value && value < 2) { num2++;
num4++; } else if (100 <= value && value < 1000) {
} else if (2 <= value) { num3++;
num5++; } else if (1000 <= value && value < 10000) {
num4++;
} else if (10000 <= value) {
num5++;
}
}else{
num6++;
} }
} }
info.add(String.valueOf(num1)); info.add(String.valueOf(num1));
@@ -1143,6 +1188,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
info.add(String.valueOf(num3)); info.add(String.valueOf(num3));
info.add(String.valueOf(num4)); info.add(String.valueOf(num4));
info.add(String.valueOf(num5)); info.add(String.valueOf(num5));
info.add(String.valueOf(num6));
return info; return info;
} }
} }

View File

@@ -72,8 +72,6 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
List<Dept> data = deptFeignClient.getDirectSonSelf(param.getId()).getData(); List<Dept> data = deptFeignClient.getDirectSonSelf(param.getId()).getData();
DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(param.getId()); deptGetLineParam.setDeptId(param.getId());
deptGetLineParam.setPowerFlag(0);
deptGetLineParam.setLineRunFlag(0);
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
List<String> lineIDS = deptGetChildrenMoreDTOS.stream() List<String> lineIDS = deptGetChildrenMoreDTOS.stream()

View File

@@ -167,7 +167,6 @@ public class RStatLimitServiceImpl implements RStatLimitService {
//监测点总数 //监测点总数
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData(); List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
//在线 //在线
param.setComFlagStatus(1);
List<GeneralDeviceDTO> onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData(); List<GeneralDeviceDTO> onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
List<String> onLine = onData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList()); List<String> onLine = onData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());

View File

@@ -19,6 +19,8 @@ public class UserLedgerVO implements Serializable {
private String stationId; private String stationId;
private String lineId;
private String city; private String city;
} }

View File

@@ -1165,6 +1165,9 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
if(StrUtil.isNotBlank(userReportParam.getStationId())){ if(StrUtil.isNotBlank(userReportParam.getStationId())){
lambdaQueryWrapper.eq(UserReportPO::getStationId,userReportParam.getStationId()); lambdaQueryWrapper.eq(UserReportPO::getStationId,userReportParam.getStationId());
} }
if (ObjectUtil.isNotNull(userReportParam.getUserType())) {
lambdaQueryWrapper.eq(UserReportPO::getUserType, userReportParam.getUserType());
}
lambdaQueryWrapper.eq(UserReportPO::getState,DataStateEnum.ENABLE.getCode()); lambdaQueryWrapper.eq(UserReportPO::getState,DataStateEnum.ENABLE.getCode());