国网上送接口调整
This commit is contained in:
@@ -48,7 +48,7 @@ public class MonitorSendController extends BaseController {
|
||||
|
||||
@PostMapping("/exportSend")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value ="国网上送台账", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@ApiOperation(value ="国网上送台账导出", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
public HttpResult<Boolean> tractionStationSend(HttpServletResponse response) throws IOException {
|
||||
String methodDescribe = getMethodDescribe("tractionStationSend");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("国网上送台账", "UTF-8") + ".xlsx");
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
//package com.njcn.device.pms.controller.ledgerManger;
|
||||
//
|
||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//import com.njcn.common.utils.HttpResultUtil;
|
||||
//import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
//import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
//import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
//import com.njcn.web.controller.BaseController;
|
||||
//import io.swagger.annotations.Api;
|
||||
//import io.swagger.annotations.ApiImplicitParam;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//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 java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author wr
|
||||
// * @description
|
||||
// * @date 2023/4/26 10:00
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("/commTerminal")
|
||||
//@RequiredArgsConstructor
|
||||
//@Slf4j
|
||||
//@Api(tags = "通用台账-所有子孙部门以及监测点")
|
||||
//public class DeptMonitorController extends BaseController {
|
||||
//
|
||||
// private final IMonitorService monitorService;
|
||||
//
|
||||
// /**
|
||||
// * 通过部门获取所有子集部门所拥有的监测点
|
||||
// *
|
||||
// * @author wr
|
||||
// * @date 2023/4/26
|
||||
// */
|
||||
// @PostMapping("/deptGetLineIds")
|
||||
// @ApiImplicitParam(name = "param", value = "请求参数", required = true)
|
||||
// public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam param) {
|
||||
// String methodDescribe = getMethodDescribe("deptGetLineList");
|
||||
// List<DeptGetChildrenDTO> monitor = monitorService.deptMonitor(param);
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.device.pms.service.ledgerManger.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
@@ -31,7 +30,6 @@ import com.njcn.device.pq.pojo.po.LineBak;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.Dic;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.njcn.harmonic.service.dim.DimGlobalDealService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.Dic;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//package com.njcn.prepare.harmonic.controller.line;
|
||||
//
|
||||
//
|
||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//import com.njcn.common.utils.HttpResultUtil;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//
|
||||
//import com.njcn.web.controller.BaseController;
|
||||
//import io.swagger.annotations.Api;
|
||||
//import io.swagger.annotations.ApiImplicitParam;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * 前端控制器
|
||||
// * </p>
|
||||
// *
|
||||
// * @author lxp
|
||||
// * @since 2023-03-16
|
||||
// */
|
||||
//@Api(tags = "预警-告警技术监督")
|
||||
//@RestController
|
||||
//@RequestMapping("/thsSupervise")
|
||||
//public class ThsSuperviseController extends BaseController {
|
||||
// @Autowired
|
||||
// private ThsSuperviseService thsSuperviseService;
|
||||
//
|
||||
// @ApiOperation("预警/告警事务手动初始化")
|
||||
// @ApiImplicitParam(name = "superviseParam", value = "新建技术监督参数", required = true)
|
||||
// @PostMapping("/initSupervise")
|
||||
// @ResponseBody
|
||||
// public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
// return thsSuperviseService.initSupervise(superviseParam);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @ApiOperation("预警/告警事务自动生成")
|
||||
// @ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
// @PostMapping("/creatSupervise")
|
||||
// @ResponseBody
|
||||
// public HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
// String methodDescribe = getMethodDescribe("creatSupervise");
|
||||
// thsSuperviseService.creatSupervise(superviseParam);
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -26,7 +26,7 @@
|
||||
select
|
||||
`time`,
|
||||
line_id,
|
||||
max(rms) rms
|
||||
avg(rms) rms
|
||||
from
|
||||
r_stat_data_v_d
|
||||
where
|
||||
@@ -46,38 +46,38 @@
|
||||
select
|
||||
`time`,
|
||||
line_id,
|
||||
max(v_thd) vThd,
|
||||
max(v_1) v1,max(v_2) v2,
|
||||
max(v_3) v3,max(v_4) v4,
|
||||
max(v_5) v5,max(v_6) v6,
|
||||
max(v_7) v7,max(v_8) v8,
|
||||
max(v_9) v9,max(v_10) v10,
|
||||
max(v_11) v11,max(v_12) v12,
|
||||
max(v_13) v13,max(v_14) v14,
|
||||
max(v_15) v15,max(v_16) v16,
|
||||
max(v_17) v17,max(v_18) v18,
|
||||
max(v_19) v19,max(v_20) v20,
|
||||
max(v_21) v21,max(v_22) v22,
|
||||
max(v_23) v23,max(v_24) v24,
|
||||
max(v_25) v25,max(v_26) v26,
|
||||
max(v_27) v27,max(v_28) v28,
|
||||
max(v_29) v29,max(v_30) v30,
|
||||
max(v_31) v31,max(v_32) v32,
|
||||
max(v_33) v33,max(v_34) v34,
|
||||
max(v_35) v35,max(v_36) v36,
|
||||
max(v_37) v37,max(v_38) v38,
|
||||
max(v_39) v39,max(v_40) v40,
|
||||
max(v_41) v41,max(v_42) v42,
|
||||
max(v_43) v43,max(v_44) v44,
|
||||
max(v_45) v45,max(v_46) v46,
|
||||
max(v_47) v47,max(v_48) v48,
|
||||
max(v_49) v49,max(v_50) v50
|
||||
avg(v_thd) vThd,
|
||||
avg(v_1) v1,avg(v_2) v2,
|
||||
avg(v_3) v3,avg(v_4) v4,
|
||||
avg(v_5) v5,avg(v_6) v6,
|
||||
avg(v_7) v7,avg(v_8) v8,
|
||||
avg(v_9) v9,avg(v_10) v10,
|
||||
avg(v_11) v11,avg(v_12) v12,
|
||||
avg(v_13) v13,avg(v_14) v14,
|
||||
avg(v_15) v15,avg(v_16) v16,
|
||||
avg(v_17) v17,avg(v_18) v18,
|
||||
avg(v_19) v19,avg(v_20) v20,
|
||||
avg(v_21) v21,avg(v_22) v22,
|
||||
avg(v_23) v23,avg(v_24) v24,
|
||||
avg(v_25) v25,avg(v_26) v26,
|
||||
avg(v_27) v27,avg(v_28) v28,
|
||||
avg(v_29) v29,avg(v_30) v30,
|
||||
avg(v_31) v31,avg(v_32) v32,
|
||||
avg(v_33) v33,avg(v_34) v34,
|
||||
avg(v_35) v35,avg(v_36) v36,
|
||||
avg(v_37) v37,avg(v_38) v38,
|
||||
avg(v_39) v39,avg(v_40) v40,
|
||||
avg(v_41) v41,avg(v_42) v42,
|
||||
avg(v_43) v43,avg(v_44) v44,
|
||||
avg(v_45) v45,avg(v_46) v46,
|
||||
avg(v_47) v47,avg(v_48) v48,
|
||||
avg(v_49) v49,avg(v_50) v50
|
||||
from
|
||||
r_stat_data_v_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and phasic_type in ('A', 'B', 'C')
|
||||
and value_type in ('CP95')
|
||||
and value_type in ('AVG')
|
||||
<if test="collection != null and collection.size() > 0">
|
||||
and line_id in
|
||||
<foreach collection="collection" item="item" open="(" close=")" separator=",">
|
||||
@@ -92,13 +92,13 @@
|
||||
select
|
||||
`time`,
|
||||
line_id,
|
||||
max(v_unbalance) vUnbalance
|
||||
avg(v_unbalance) vUnbalance
|
||||
from
|
||||
r_stat_data_v_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and phasic_type = 'T'
|
||||
and value_type in ('CP95')
|
||||
and value_type in ('AVG')
|
||||
<if test="collection != null and collection.size() > 0">
|
||||
and line_id in
|
||||
<foreach collection="collection" item="item" open="(" close=")" separator=",">
|
||||
@@ -113,13 +113,13 @@
|
||||
select
|
||||
`time`,
|
||||
line_id,
|
||||
max(pst) pst
|
||||
avg(pst) pst
|
||||
from
|
||||
r_stat_data_flicker_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and phasic_type in ('A', 'B', 'C')
|
||||
and value_type in ('MAX')
|
||||
and value_type in ('AVG')
|
||||
<if test="collection != null and collection.size() > 0">
|
||||
and line_id in
|
||||
<foreach collection="collection" item="item" open="(" close=")" separator=",">
|
||||
@@ -134,13 +134,13 @@
|
||||
select
|
||||
`time`,
|
||||
line_id,
|
||||
max(i_neg) iNeg
|
||||
avg(i_neg) iNeg
|
||||
from
|
||||
r_stat_data_i_d
|
||||
where
|
||||
`time` between #{startTime} and #{endTime}
|
||||
and phasic_type = 'T'
|
||||
and value_type in ('CP95')
|
||||
and value_type in ('AVG')
|
||||
<if test="collection != null and collection.size() > 0">
|
||||
and line_id in
|
||||
<foreach collection="collection" item="item" open="(" close=")" separator=",">
|
||||
|
||||
@@ -10,15 +10,11 @@
|
||||
city_name cityName,
|
||||
county_id countyId,
|
||||
county_name countyName,
|
||||
round(max(run_terminal_num)) runTerminalNum,
|
||||
round(max(online_monitor_num)) onlineMonitorNum,
|
||||
round(max(run_monitor_num)) runMonitorNum,
|
||||
case when max(run_monitor_num) = 0 then 0 else round(max(online_monitor_num)/max(run_monitor_num)*100,8) end onlineMonitorRate,
|
||||
sum(expect_collect_num) expectCollectNum,
|
||||
sum(actual_collect_num) actualCollectNum,
|
||||
case when sum(expect_collect_num) = 0 then 0 else round(sum(actual_collect_num)/sum(expect_collect_num)*100,8) end dataFullRate,
|
||||
station_type stationType,
|
||||
round(max(station_monitor_num)) stationMonitorNum,
|
||||
#{monthDate} statisticalDate,
|
||||
statistical_level statisticalLevel,
|
||||
#{type} statisticalType,
|
||||
|
||||
@@ -5,17 +5,23 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetBusBarDTO;
|
||||
import com.njcn.device.pms.pojo.po.GeneratrixWire;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.harmonic.pojo.po.dim.RDimVoltageD;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.PmsMonitorPOMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatIntegrityDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.dim.GeneratrixWireMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimVoltageDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.harmonic.pojo.dto.LineDataDto;
|
||||
import com.njcn.prepare.harmonic.service.mysql.dim.IRDimVoltageDService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -23,6 +29,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -42,6 +49,10 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
|
||||
private final GeneratrixWireMapper generatrixWireMapper;
|
||||
|
||||
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public void busbarVoltageD(CalculatedParam<DeptGetBusBarDTO> calculatedParam) {
|
||||
List<RDimVoltageD> result = new ArrayList<>();
|
||||
@@ -50,6 +61,11 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
Set<String> lineList = new HashSet<>();
|
||||
Set<String> busBarList = new HashSet<>();
|
||||
|
||||
//接线方式
|
||||
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String,DictData> dictDataMap = dictData.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
|
||||
//获取监测点集合
|
||||
deptList.forEach(item->{
|
||||
lineList.addAll(item.getBusBarAndMonitorIDs());
|
||||
@@ -60,6 +76,13 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
List<Monitor> list1 = getMonitorInfo(lineList);
|
||||
//获取监测点数据
|
||||
List<LineDataDto> list2 = getLineData(beginDay,endDay,lineList);
|
||||
//获取数据完整性
|
||||
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("time_id","line_index","real_time/due_time as integrityData","real_time","due_time").
|
||||
eq("time_id",beginDay);
|
||||
List<RStatIntegrityD> rStatIntegrityDList = rStatIntegrityDMapper.selectList(queryWrapper);
|
||||
|
||||
|
||||
//获取母线信息
|
||||
List<GeneratrixWire> list3 = getBusBarInfo(busBarList);
|
||||
//循环区域信息,筛选符合条件的数据,做统计
|
||||
@@ -75,7 +98,7 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
Map<String, List<GeneratrixWire>> map1 = list4.stream().collect(Collectors.groupingBy(GeneratrixWire::getScale));
|
||||
//循环分组数据,获取母线下监测点数据
|
||||
map1.forEach((k, v) -> {
|
||||
RDimVoltageD dto = assignment(k,rDimVoltageD,v,list1,list2);
|
||||
RDimVoltageD dto = assignment(k,rDimVoltageD,v,list1,list2,rStatIntegrityDList,dictDataMap);
|
||||
result.add(dto);
|
||||
});
|
||||
}
|
||||
@@ -123,7 +146,7 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
* 给实体赋值
|
||||
* @param rDimVoltageD 对象
|
||||
*/
|
||||
public RDimVoltageD assignment(String voltage, RDimVoltageD rDimVoltageD, List<GeneratrixWire> list1, List<Monitor> list2, List<LineDataDto> list3) {
|
||||
public RDimVoltageD assignment(String voltage, RDimVoltageD rDimVoltageD, List<GeneratrixWire> list1, List<Monitor> list2, List<LineDataDto> list3,List<RStatIntegrityD> rStatIntegrityDList,Map<String,DictData> dictDataMap) {
|
||||
RDimVoltageD result = new RDimVoltageD();
|
||||
BeanUtils.copyProperties(rDimVoltageD,result);
|
||||
result.setVoltageType(voltage);
|
||||
@@ -131,65 +154,85 @@ public class RDimVoltageDServiceImpl extends MppServiceImpl<RDimVoltageDMapper,
|
||||
List<String> l1 = list1.stream().map(GeneratrixWire::getId).collect(Collectors.toList());
|
||||
//获取这些母线下的监测点
|
||||
List<Monitor> l2 = list2.stream().filter(obj -> l1.contains(obj.getLineId())).collect(Collectors.toList());
|
||||
//获取监测点数据
|
||||
List<LineDataDto> l3 = list3.stream().filter(vo->l2.stream().map(Monitor::getId).collect(Collectors.toList()).contains(vo.getLineId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(l3)){
|
||||
result.setV(l3.stream().mapToDouble(LineDataDto::getRms).average().orElse(0d));
|
||||
result.setVUnbalance(l3.stream().mapToDouble(LineDataDto::getVUnbalance).average().orElse(0d));
|
||||
result.setPst(l3.stream().mapToDouble(LineDataDto::getPst).average().orElse(0d));
|
||||
result.setVThd(l3.stream().mapToDouble(LineDataDto::getVThd).average().orElse(0d));
|
||||
result.setV1(l3.stream().mapToDouble(LineDataDto::getV1).average().orElse(0d));
|
||||
result.setV2(l3.stream().mapToDouble(LineDataDto::getV2).average().orElse(0d));
|
||||
result.setV3(l3.stream().mapToDouble(LineDataDto::getV3).average().orElse(0d));
|
||||
result.setV4(l3.stream().mapToDouble(LineDataDto::getV4).average().orElse(0d));
|
||||
result.setV5(l3.stream().mapToDouble(LineDataDto::getV5).average().orElse(0d));
|
||||
result.setV6(l3.stream().mapToDouble(LineDataDto::getV6).average().orElse(0d));
|
||||
result.setV7(l3.stream().mapToDouble(LineDataDto::getV7).average().orElse(0d));
|
||||
result.setV8(l3.stream().mapToDouble(LineDataDto::getV8).average().orElse(0d));
|
||||
result.setV9(l3.stream().mapToDouble(LineDataDto::getV9).average().orElse(0d));
|
||||
result.setV10(l3.stream().mapToDouble(LineDataDto::getV10).average().orElse(0d));
|
||||
result.setV11(l3.stream().mapToDouble(LineDataDto::getV11).average().orElse(0d));
|
||||
result.setV12(l3.stream().mapToDouble(LineDataDto::getV12).average().orElse(0d));
|
||||
result.setV13(l3.stream().mapToDouble(LineDataDto::getV13).average().orElse(0d));
|
||||
result.setV14(l3.stream().mapToDouble(LineDataDto::getV14).average().orElse(0d));
|
||||
result.setV15(l3.stream().mapToDouble(LineDataDto::getV15).average().orElse(0d));
|
||||
result.setV16(l3.stream().mapToDouble(LineDataDto::getV16).average().orElse(0d));
|
||||
result.setV17(l3.stream().mapToDouble(LineDataDto::getV17).average().orElse(0d));
|
||||
result.setV18(l3.stream().mapToDouble(LineDataDto::getV18).average().orElse(0d));
|
||||
result.setV19(l3.stream().mapToDouble(LineDataDto::getV19).average().orElse(0d));
|
||||
result.setV20(l3.stream().mapToDouble(LineDataDto::getV20).average().orElse(0d));
|
||||
result.setV21(l3.stream().mapToDouble(LineDataDto::getV21).average().orElse(0d));
|
||||
result.setV22(l3.stream().mapToDouble(LineDataDto::getV22).average().orElse(0d));
|
||||
result.setV23(l3.stream().mapToDouble(LineDataDto::getV23).average().orElse(0d));
|
||||
result.setV24(l3.stream().mapToDouble(LineDataDto::getV24).average().orElse(0d));
|
||||
result.setV25(l3.stream().mapToDouble(LineDataDto::getV25).average().orElse(0d));
|
||||
result.setV26(l3.stream().mapToDouble(LineDataDto::getV26).average().orElse(0d));
|
||||
result.setV27(l3.stream().mapToDouble(LineDataDto::getV27).average().orElse(0d));
|
||||
result.setV28(l3.stream().mapToDouble(LineDataDto::getV28).average().orElse(0d));
|
||||
result.setV29(l3.stream().mapToDouble(LineDataDto::getV29).average().orElse(0d));
|
||||
result.setV30(l3.stream().mapToDouble(LineDataDto::getV30).average().orElse(0d));
|
||||
result.setV31(l3.stream().mapToDouble(LineDataDto::getV31).average().orElse(0d));
|
||||
result.setV32(l3.stream().mapToDouble(LineDataDto::getV32).average().orElse(0d));
|
||||
result.setV33(l3.stream().mapToDouble(LineDataDto::getV33).average().orElse(0d));
|
||||
result.setV34(l3.stream().mapToDouble(LineDataDto::getV34).average().orElse(0d));
|
||||
result.setV35(l3.stream().mapToDouble(LineDataDto::getV35).average().orElse(0d));
|
||||
result.setV36(l3.stream().mapToDouble(LineDataDto::getV36).average().orElse(0d));
|
||||
result.setV37(l3.stream().mapToDouble(LineDataDto::getV37).average().orElse(0d));
|
||||
result.setV38(l3.stream().mapToDouble(LineDataDto::getV38).average().orElse(0d));
|
||||
result.setV39(l3.stream().mapToDouble(LineDataDto::getV39).average().orElse(0d));
|
||||
result.setV40(l3.stream().mapToDouble(LineDataDto::getV40).average().orElse(0d));
|
||||
result.setV41(l3.stream().mapToDouble(LineDataDto::getV41).average().orElse(0d));
|
||||
result.setV42(l3.stream().mapToDouble(LineDataDto::getV42).average().orElse(0d));
|
||||
result.setV43(l3.stream().mapToDouble(LineDataDto::getV43).average().orElse(0d));
|
||||
result.setV44(l3.stream().mapToDouble(LineDataDto::getV44).average().orElse(0d));
|
||||
result.setV45(l3.stream().mapToDouble(LineDataDto::getV45).average().orElse(0d));
|
||||
result.setV46(l3.stream().mapToDouble(LineDataDto::getV46).average().orElse(0d));
|
||||
result.setV47(l3.stream().mapToDouble(LineDataDto::getV47).average().orElse(0d));
|
||||
result.setV48(l3.stream().mapToDouble(LineDataDto::getV48).average().orElse(0d));
|
||||
result.setV49(l3.stream().mapToDouble(LineDataDto::getV49).average().orElse(0d));
|
||||
result.setV50(l3.stream().mapToDouble(LineDataDto::getV50).average().orElse(0d));
|
||||
result.setINeg(l3.stream().mapToDouble(LineDataDto::getINeg).average().orElse(0d));
|
||||
}
|
||||
|
||||
List<RStatIntegrityD> rStatIntegrityDS = rStatIntegrityDList.stream().filter(it->l2.stream().map(Monitor::getId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
|
||||
|
||||
Map<String,List<Monitor>> mapMonitor = l2.stream().collect(Collectors.groupingBy(Monitor::getLineId));
|
||||
mapMonitor.forEach((busId,list)->{
|
||||
RStatIntegrityD rStatIntegrityD = rStatIntegrityDS.stream().filter(i->list.stream().map(Monitor::getId).collect(Collectors.toList()).contains(i.getLineIndex())).max(Comparator.comparing(RStatIntegrityD::getIntegrityData)).orElse(null);
|
||||
if(Objects.nonNull(rStatIntegrityD)) {
|
||||
//获取监测点数据
|
||||
List<LineDataDto> l3 = list3.stream().filter(vo -> vo.getLineId().equals(rStatIntegrityD.getLineIndex())).collect(Collectors.toList());
|
||||
Monitor monitor = list.stream().filter(it->it.getId().equals(rStatIntegrityD.getLineIndex())).findFirst().orElse(null);
|
||||
String method = monitor.getTerminalWiringMethod();
|
||||
Double lv;
|
||||
if(dictDataMap.get(method).getCode().equals("star")){
|
||||
lv = Math.sqrt(3);
|
||||
}else {
|
||||
lv = 1.00;
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(l3)) {
|
||||
result.setV(l3.stream().mapToDouble(it->it.getRms()*lv).average().orElse(0d));
|
||||
result.setVUnbalance(l3.stream().mapToDouble(LineDataDto::getVUnbalance).average().orElse(0d));
|
||||
result.setPst(l3.stream().mapToDouble(LineDataDto::getPst).average().orElse(0d));
|
||||
result.setVThd(l3.stream().mapToDouble(LineDataDto::getVThd).average().orElse(0d));
|
||||
result.setV1(l3.stream().mapToDouble(LineDataDto::getV1).average().orElse(0d));
|
||||
result.setV2(l3.stream().mapToDouble(LineDataDto::getV2).average().orElse(0d));
|
||||
result.setV3(l3.stream().mapToDouble(LineDataDto::getV3).average().orElse(0d));
|
||||
result.setV4(l3.stream().mapToDouble(LineDataDto::getV4).average().orElse(0d));
|
||||
result.setV5(l3.stream().mapToDouble(LineDataDto::getV5).average().orElse(0d));
|
||||
result.setV6(l3.stream().mapToDouble(LineDataDto::getV6).average().orElse(0d));
|
||||
result.setV7(l3.stream().mapToDouble(LineDataDto::getV7).average().orElse(0d));
|
||||
result.setV8(l3.stream().mapToDouble(LineDataDto::getV8).average().orElse(0d));
|
||||
result.setV9(l3.stream().mapToDouble(LineDataDto::getV9).average().orElse(0d));
|
||||
result.setV10(l3.stream().mapToDouble(LineDataDto::getV10).average().orElse(0d));
|
||||
result.setV11(l3.stream().mapToDouble(LineDataDto::getV11).average().orElse(0d));
|
||||
result.setV12(l3.stream().mapToDouble(LineDataDto::getV12).average().orElse(0d));
|
||||
result.setV13(l3.stream().mapToDouble(LineDataDto::getV13).average().orElse(0d));
|
||||
result.setV14(l3.stream().mapToDouble(LineDataDto::getV14).average().orElse(0d));
|
||||
result.setV15(l3.stream().mapToDouble(LineDataDto::getV15).average().orElse(0d));
|
||||
result.setV16(l3.stream().mapToDouble(LineDataDto::getV16).average().orElse(0d));
|
||||
result.setV17(l3.stream().mapToDouble(LineDataDto::getV17).average().orElse(0d));
|
||||
result.setV18(l3.stream().mapToDouble(LineDataDto::getV18).average().orElse(0d));
|
||||
result.setV19(l3.stream().mapToDouble(LineDataDto::getV19).average().orElse(0d));
|
||||
result.setV20(l3.stream().mapToDouble(LineDataDto::getV20).average().orElse(0d));
|
||||
result.setV21(l3.stream().mapToDouble(LineDataDto::getV21).average().orElse(0d));
|
||||
result.setV22(l3.stream().mapToDouble(LineDataDto::getV22).average().orElse(0d));
|
||||
result.setV23(l3.stream().mapToDouble(LineDataDto::getV23).average().orElse(0d));
|
||||
result.setV24(l3.stream().mapToDouble(LineDataDto::getV24).average().orElse(0d));
|
||||
result.setV25(l3.stream().mapToDouble(LineDataDto::getV25).average().orElse(0d));
|
||||
result.setV26(l3.stream().mapToDouble(LineDataDto::getV26).average().orElse(0d));
|
||||
result.setV27(l3.stream().mapToDouble(LineDataDto::getV27).average().orElse(0d));
|
||||
result.setV28(l3.stream().mapToDouble(LineDataDto::getV28).average().orElse(0d));
|
||||
result.setV29(l3.stream().mapToDouble(LineDataDto::getV29).average().orElse(0d));
|
||||
result.setV30(l3.stream().mapToDouble(LineDataDto::getV30).average().orElse(0d));
|
||||
result.setV31(l3.stream().mapToDouble(LineDataDto::getV31).average().orElse(0d));
|
||||
result.setV32(l3.stream().mapToDouble(LineDataDto::getV32).average().orElse(0d));
|
||||
result.setV33(l3.stream().mapToDouble(LineDataDto::getV33).average().orElse(0d));
|
||||
result.setV34(l3.stream().mapToDouble(LineDataDto::getV34).average().orElse(0d));
|
||||
result.setV35(l3.stream().mapToDouble(LineDataDto::getV35).average().orElse(0d));
|
||||
result.setV36(l3.stream().mapToDouble(LineDataDto::getV36).average().orElse(0d));
|
||||
result.setV37(l3.stream().mapToDouble(LineDataDto::getV37).average().orElse(0d));
|
||||
result.setV38(l3.stream().mapToDouble(LineDataDto::getV38).average().orElse(0d));
|
||||
result.setV39(l3.stream().mapToDouble(LineDataDto::getV39).average().orElse(0d));
|
||||
result.setV40(l3.stream().mapToDouble(LineDataDto::getV40).average().orElse(0d));
|
||||
result.setV41(l3.stream().mapToDouble(LineDataDto::getV41).average().orElse(0d));
|
||||
result.setV42(l3.stream().mapToDouble(LineDataDto::getV42).average().orElse(0d));
|
||||
result.setV43(l3.stream().mapToDouble(LineDataDto::getV43).average().orElse(0d));
|
||||
result.setV44(l3.stream().mapToDouble(LineDataDto::getV44).average().orElse(0d));
|
||||
result.setV45(l3.stream().mapToDouble(LineDataDto::getV45).average().orElse(0d));
|
||||
result.setV46(l3.stream().mapToDouble(LineDataDto::getV46).average().orElse(0d));
|
||||
result.setV47(l3.stream().mapToDouble(LineDataDto::getV47).average().orElse(0d));
|
||||
result.setV48(l3.stream().mapToDouble(LineDataDto::getV48).average().orElse(0d));
|
||||
result.setV49(l3.stream().mapToDouble(LineDataDto::getV49).average().orElse(0d));
|
||||
result.setV50(l3.stream().mapToDouble(LineDataDto::getV50).average().orElse(0d));
|
||||
result.setINeg(l3.stream().mapToDouble(LineDataDto::getINeg).average().orElse(0d));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,9 +120,6 @@ public class PmsRunStatisticServiceImpl extends MppServiceImpl<PmsRunStatisticDM
|
||||
List<String> childrenDept = dto.getUnitChildrenList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> temPointIds = dto.getLineBaseList().stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<String> onlinePointIds = temPointIds.stream().filter(rStatIntegrityIds::contains).collect(Collectors.toList());
|
||||
@@ -169,10 +166,12 @@ public class PmsRunStatisticServiceImpl extends MppServiceImpl<PmsRunStatisticDM
|
||||
*/
|
||||
public List<PmsMidLedger> getBusBarAndStationInfo(Integer type) {
|
||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
DictData RunStatus = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.RUN.getCode(),DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
||||
List<String> list = dicDataList.stream().map(DictData::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PmsMidLedger::getLevel,type)
|
||||
.eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode())
|
||||
.eq(PmsMidLedger::getRunStatus,RunStatus.getId())
|
||||
.in(PmsMidLedger::getVoltageLevel, list);
|
||||
return pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
List<PmsRunStatisticD> pmsRunStatisticsListD = runStatisticDMapper.selectList(new LambdaQueryWrapper<PmsRunStatisticD>().eq(PmsRunStatisticD::getStatisticDate, calculatedParam.getDataDate()));
|
||||
|
||||
//获取中台母线信息
|
||||
List<PmsMidLedger> list2 = this.getBusBarInfo();
|
||||
//获取灿能母线信息
|
||||
List<GeneratrixWire> list3;
|
||||
List<PmsMidLedger> allMidBusBarList = this.getBusBarInfo();
|
||||
//获取监测母线
|
||||
List<GeneratrixWire> superviseBusList;
|
||||
if (CollUtil.isNotEmpty(pmsRunStatisticsListD)) {
|
||||
List<String> wireIds = pmsRunStatisticsListD.stream()
|
||||
.filter(x -> StrUtil.isNotBlank(x.getOnlineBusIds()))
|
||||
@@ -93,25 +93,27 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
LambdaQueryWrapper<GeneratrixWire> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(GeneratrixWire::getStatus, DataStateEnum.ENABLE.getCode())
|
||||
.in(GeneratrixWire::getId, wireIds);
|
||||
list3 = generatrixWireMapper.selectList(lambdaQueryWrapper);
|
||||
superviseBusList = generatrixWireMapper.selectList(lambdaQueryWrapper);
|
||||
}else{
|
||||
List<Monitor> list1 = this.getPmsMonitor();
|
||||
list3 = this.getCnBusBarInfo(list1);
|
||||
superviseBusList = this.getCnBusBarInfo(list1);
|
||||
}
|
||||
} else {
|
||||
//获取监测点信息
|
||||
List<Monitor> list1 = this.getPmsMonitor();
|
||||
list3 = this.getCnBusBarInfo(list1);
|
||||
superviseBusList = this.getCnBusBarInfo(list1);
|
||||
}
|
||||
//获取单位下各电压等级数据
|
||||
|
||||
Dept rootDept = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
deptGetLineParam.setDeptId(rootDept.getId());
|
||||
List<DeptGetBusBarDTO> barDto = commTerminalGeneralClient.deptBusBar(deptGetLineParam).getData();
|
||||
List<BusBarDto> busBarList = this.getBusBarNum(list3, list2, barDto);
|
||||
|
||||
List<BusBarDto> busBarList = this.getBusBarNum(superviseBusList, allMidBusBarList, barDto);
|
||||
List<BusBarDto> allDept = this.getAllDeptLineNum(busBarList, deptGetLineParam);
|
||||
//获取省级单位id
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(rootDept.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
@@ -119,13 +121,16 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
|
||||
List<DeptGetChildrenMoreDTO> list = calculatedParam.getIdList();
|
||||
list.forEach(item -> {
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())
|
||||
//市数据
|
||||
//|| Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_3.getCode()),item.getDeptLevel())
|
||||
//县数据
|
||||
|| Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()), item.getDeptLevel())) {
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())) {
|
||||
return;
|
||||
}
|
||||
|
||||
BusBarDto busBarDto = allDept.stream().filter(o -> Objects.equals(o.getOrgId(), item.getUnitId())).findFirst().orElse(null);
|
||||
|
||||
if(Objects.isNull(busBarDto) || busBarDto.getAllOnlineBusNum()==0){
|
||||
return;
|
||||
}
|
||||
|
||||
RUploadEvaluationDataD rUploadEvaluationDataD = new RUploadEvaluationDataD();
|
||||
rUploadEvaluationDataD.setProvinceId(dept.getCode());
|
||||
rUploadEvaluationDataD.setProvinceName(dept.getName());
|
||||
@@ -136,7 +141,7 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
rUploadEvaluationDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
this.judgeLevel(item.getDeptLevel(), rUploadEvaluationDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
BusBarDto busBarDto = allDept.stream().filter(o -> Objects.equals(o.getOrgId(), item.getUnitId())).findFirst().orElse(null);
|
||||
|
||||
/*** 计算无电压等级的数据*/
|
||||
RUploadEvaluationDataD dto = this.getLineNum(busBarDto, "0");
|
||||
//电压
|
||||
@@ -163,7 +168,7 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
|
||||
RUploadEvaluationDataD dto0 = this.getLineNum(busBarDto, item2.getVoltageLevel());
|
||||
//电压
|
||||
double sd1 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getV(), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_01.getCode(), null);
|
||||
double sd1 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getV()*Math.sqrt(3), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_01.getCode(), null);
|
||||
RUploadEvaluationDataD dto11 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getV(), sd1, UploadEnum.INDEX_TYPE_01.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto11);
|
||||
//长时间闪变
|
||||
@@ -200,6 +205,139 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* @Override
|
||||
public void insertEvaluationDataDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
List<RUploadEvaluationDataD> result = new ArrayList<>();
|
||||
final Double defaultValue = 3.1415926;
|
||||
//首先获取pms_run_statistic表是否存在执行日期的数据
|
||||
List<PmsRunStatisticD> pmsRunStatisticsListD = runStatisticDMapper.selectList(new LambdaQueryWrapper<PmsRunStatisticD>().eq(PmsRunStatisticD::getStatisticDate, calculatedParam.getDataDate()));
|
||||
|
||||
//获取中台母线信息
|
||||
List<PmsMidLedger> allMidBusBarList = this.getBusBarInfo();
|
||||
//获取监测母线
|
||||
List<GeneratrixWire> superviseBusList;
|
||||
if (CollUtil.isNotEmpty(pmsRunStatisticsListD)) {
|
||||
List<String> wireIds = pmsRunStatisticsListD.stream()
|
||||
.filter(x -> StrUtil.isNotBlank(x.getOnlineBusIds()))
|
||||
.flatMap(x -> CollectionUtil.toList(x.getOnlineBusIds().split(StrUtil.COMMA)).stream()).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(wireIds)){
|
||||
LambdaQueryWrapper<GeneratrixWire> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(GeneratrixWire::getStatus, DataStateEnum.ENABLE.getCode())
|
||||
.in(GeneratrixWire::getId, wireIds);
|
||||
superviseBusList = generatrixWireMapper.selectList(lambdaQueryWrapper);
|
||||
}else{
|
||||
List<Monitor> list1 = this.getPmsMonitor();
|
||||
superviseBusList = this.getCnBusBarInfo(list1);
|
||||
}
|
||||
} else {
|
||||
//获取监测点信息
|
||||
List<Monitor> list1 = this.getPmsMonitor();
|
||||
superviseBusList = this.getCnBusBarInfo(list1);
|
||||
}
|
||||
//获取单位下各电压等级数据
|
||||
|
||||
Dept rootDept = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(rootDept.getId());
|
||||
List<DeptGetBusBarDTO> barDto = commTerminalGeneralClient.deptBusBar(deptGetLineParam).getData();
|
||||
|
||||
List<BusBarDto> busBarList = this.getBusBarNum(superviseBusList, allMidBusBarList, barDto);
|
||||
List<BusBarDto> allDept = this.getAllDeptLineNum(busBarList, deptGetLineParam);
|
||||
//获取省级单位id
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(rootDept.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
|
||||
List<DeptGetChildrenMoreDTO> list = calculatedParam.getIdList();
|
||||
list.forEach(item -> {
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())) {
|
||||
return;
|
||||
}
|
||||
|
||||
BusBarDto busBarDto = allDept.stream().filter(o -> Objects.equals(o.getOrgId(), item.getUnitId())).findFirst().orElse(null);
|
||||
|
||||
if(Objects.isNull(busBarDto) || busBarDto.getAllOnlineBusNum()==0){
|
||||
return;
|
||||
}
|
||||
|
||||
RUploadEvaluationDataD rUploadEvaluationDataD = new RUploadEvaluationDataD();
|
||||
rUploadEvaluationDataD.setProvinceId(dept.getCode());
|
||||
rUploadEvaluationDataD.setProvinceName(dept.getName());
|
||||
rUploadEvaluationDataD.setDataSources(UploadEnum.DATA_SOURCES_01.getCode());
|
||||
rUploadEvaluationDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadEvaluationDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadEvaluationDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
rUploadEvaluationDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
this.judgeLevel(item.getDeptLevel(), rUploadEvaluationDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
|
||||
*//*** 计算无电压等级的数据*//*
|
||||
RUploadEvaluationDataD dto = this.getLineNum(busBarDto, "0");
|
||||
//电压
|
||||
RUploadEvaluationDataD dto1 = this.channelData(rUploadEvaluationDataD, defaultValue, defaultValue, UploadEnum.INDEX_TYPE_01.getCode(), 0, "0", dto);
|
||||
result.add(dto1);
|
||||
//长时间闪变
|
||||
RUploadEvaluationDataD dto2 = this.channelData(rUploadEvaluationDataD, defaultValue, defaultValue, UploadEnum.INDEX_TYPE_02.getCode(), 0, "0", dto);
|
||||
result.add(dto2);
|
||||
//三相电压不平衡
|
||||
RUploadEvaluationDataD dto3 = this.channelData(rUploadEvaluationDataD, defaultValue, defaultValue, UploadEnum.INDEX_TYPE_03.getCode(), 0, "0", dto);
|
||||
result.add(dto3);
|
||||
//电压总谐波畸变率
|
||||
RUploadEvaluationDataD dto4 = this.channelData(rUploadEvaluationDataD, defaultValue, defaultValue, UploadEnum.INDEX_TYPE_04.getCode(), 0, "0", dto);
|
||||
result.add(dto4);
|
||||
//各次谐波电压
|
||||
this.channelHarmonicData(rUploadEvaluationDataD, result, null, UploadEnum.INDEX_TYPE_05.getCode(), "0", dto, null);
|
||||
//负序电流
|
||||
RUploadEvaluationDataD dto6 = this.channelData(rUploadEvaluationDataD, defaultValue, defaultValue, UploadEnum.INDEX_TYPE_06.getCode(), 0, "0", dto);
|
||||
result.add(dto6);
|
||||
*//*** 计算分电压等级的数据*//*
|
||||
if (CollUtil.isNotEmpty(busBarDto.getVoltageChild())) {
|
||||
busBarDto.getVoltageChild().forEach(item2 -> {
|
||||
RDimVoltageD rDimVoltageD = this.getDimVoltageData(item.getUnitId(), calculatedParam.getDataDate(), item2.getVoltageLevel());
|
||||
|
||||
RUploadEvaluationDataD dto0 = this.getLineNum(busBarDto, item2.getVoltageLevel());
|
||||
//电压
|
||||
double sd1 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getV()*Math.sqrt(3), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_01.getCode(), null);
|
||||
RUploadEvaluationDataD dto11 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getV(), sd1, UploadEnum.INDEX_TYPE_01.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto11);
|
||||
//长时间闪变
|
||||
double sd2 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getPst(), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_02.getCode(), null);
|
||||
RUploadEvaluationDataD dto22 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getPst(), sd2, UploadEnum.INDEX_TYPE_02.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto22);
|
||||
//三相电压不平衡
|
||||
double sd3 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getVUnbalance(), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_03.getCode(), null);
|
||||
RUploadEvaluationDataD dto33 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getVUnbalance(), sd3, UploadEnum.INDEX_TYPE_03.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto33);
|
||||
//电压总谐波畸变率
|
||||
double sd4 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getVThd(), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_04.getCode(), null);
|
||||
RUploadEvaluationDataD dto44 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getVThd(), sd4, UploadEnum.INDEX_TYPE_04.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto44);
|
||||
//各次谐波电压
|
||||
List<Double> valueList = new ArrayList<>();
|
||||
if (!Objects.isNull(rDimVoltageD)) {
|
||||
valueList = Arrays.asList(rDimVoltageD.getV2(), rDimVoltageD.getV3(), rDimVoltageD.getV4(), rDimVoltageD.getV5(), rDimVoltageD.getV6(), rDimVoltageD.getV7(), rDimVoltageD.getV8(), rDimVoltageD.getV9(), rDimVoltageD.getV10()
|
||||
, rDimVoltageD.getV11(), rDimVoltageD.getV12(), rDimVoltageD.getV13(), rDimVoltageD.getV14(), rDimVoltageD.getV15(), rDimVoltageD.getV16(), rDimVoltageD.getV17(), rDimVoltageD.getV18(), rDimVoltageD.getV19(), rDimVoltageD.getV20()
|
||||
, rDimVoltageD.getV21(), rDimVoltageD.getV22(), rDimVoltageD.getV23(), rDimVoltageD.getV24(), rDimVoltageD.getV25(), rDimVoltageD.getV26(), rDimVoltageD.getV27(), rDimVoltageD.getV28(), rDimVoltageD.getV29(), rDimVoltageD.getV30()
|
||||
, rDimVoltageD.getV31(), rDimVoltageD.getV32(), rDimVoltageD.getV33(), rDimVoltageD.getV34(), rDimVoltageD.getV35(), rDimVoltageD.getV36(), rDimVoltageD.getV37(), rDimVoltageD.getV38(), rDimVoltageD.getV39(), rDimVoltageD.getV40()
|
||||
, rDimVoltageD.getV41(), rDimVoltageD.getV42(), rDimVoltageD.getV43(), rDimVoltageD.getV44(), rDimVoltageD.getV45(), rDimVoltageD.getV46(), rDimVoltageD.getV47(), rDimVoltageD.getV48(), rDimVoltageD.getV49(), rDimVoltageD.getV50());
|
||||
}
|
||||
this.channelHarmonicData(rUploadEvaluationDataD, result, valueList, UploadEnum.INDEX_TYPE_05.getCode(), item2.getVoltageLevel(), dto0, item.getLineBaseList());
|
||||
//负序电流
|
||||
double sd6 = this.getDimVoltageDataSd(item2.getVoltageLevel(), Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getINeg(), calculatedParam.getDataDate(), item.getLineBaseList(), UploadEnum.INDEX_TYPE_06.getCode(), null);
|
||||
RUploadEvaluationDataD dto66 = this.channelData(rUploadEvaluationDataD, Objects.isNull(rDimVoltageD) ? defaultValue : rDimVoltageD.getINeg(), sd6, UploadEnum.INDEX_TYPE_06.getCode(), 0, item2.getVoltageLevel(), dto0);
|
||||
result.add(dto66);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
this.saveOrUpdateBatchByMultiId(result, 1000);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 通过日表取平均值,作为月表数据
|
||||
*
|
||||
@@ -416,12 +554,13 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
* 筛选系统已有的电压等级母线
|
||||
*/
|
||||
public List<PmsMidLedger> getBusBarInfo() {
|
||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
List<String> list = dicDataList.stream().map(DictData::getId).collect(Collectors.toList());
|
||||
DictData RunStatus = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.RUN.getCode(),DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
||||
/* List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
List<String> list = dicDataList.stream().map(DictData::getId).collect(Collectors.toList());*/
|
||||
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PmsMidLedger::getLevel, DataStateEnum.ENABLE.getCode())
|
||||
.eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode())
|
||||
.in(PmsMidLedger::getVoltageLevel, list);
|
||||
.eq(PmsMidLedger::getRunStatus,RunStatus.getId())
|
||||
.eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode());
|
||||
return pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
@@ -35,6 +36,7 @@ import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -87,132 +89,150 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
|
||||
//查询所有一级树字典
|
||||
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
|
||||
|
||||
|
||||
//获取所有需要统计的对象类型字典
|
||||
List<SysDicTreePO> temTreeList = sysDicTreePOList.stream().filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Trans_Sub.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Converter.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Ele_Railways.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Wind_Farms.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Power_Station.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Smelting_Load.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Imp_Users.getCode())
|
||||
).collect(toList());
|
||||
|
||||
//用于存放不同对象类型的测点id集合
|
||||
Map<String, List<String>> mapKey = new HashMap<>();
|
||||
List<String> otherIds = new ArrayList<>();
|
||||
for (SysDicTreePO sysDicTreePO : temTreeList) {
|
||||
List<SysDicTreePO> temList;
|
||||
if (Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())) {
|
||||
temList = sysDicTreePOList.stream()
|
||||
.filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
||||
)
|
||||
.collect(toList());
|
||||
} else {
|
||||
temList = sysDicTreePOList.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId()) ||
|
||||
item.getId().equals(sysDicTreePO.getId())
|
||||
).collect(toList());
|
||||
}
|
||||
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(toList());
|
||||
mapKey.put(sysDicTreePO.getCode(), ids);
|
||||
otherIds.addAll(ids);
|
||||
}
|
||||
|
||||
this.classifyObj(mapKey);
|
||||
|
||||
//所属场站与对象类型存在联系
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
||||
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
|
||||
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String,PvTerminalTreeVO> deptMap = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode,Function.identity()));
|
||||
|
||||
//获取数据完整性相关数据
|
||||
List<RStatIntegrityD> dataList = getStatIntegrityData(calculatedParam.getDataDate());
|
||||
|
||||
List<RStatIntegrityD> integrityDataList = getStatIntegrityData(calculatedParam.getDataDate());
|
||||
|
||||
//下面先从表里获取在运测点相关数据,当表里没数据时候再从接口获取
|
||||
//首先获取pms_run_statistic表是否存在执行日期的数据
|
||||
List<PmsRunStatisticD> pmsRunStatisticsListD = runStatisticDMapper.selectList(new LambdaQueryWrapper<PmsRunStatisticD>().eq(PmsRunStatisticD::getStatisticDate, calculatedParam.getDataDate()));
|
||||
|
||||
//筛选国网上送监测点
|
||||
List<DeptGetChildrenMoreDTO> deptAll = calculatedParam.getIdList();
|
||||
|
||||
Map<String, PmsRunStatisticD> pmsRunStatisticMap = pmsRunStatisticsListD.stream().collect(Collectors.toMap(PmsRunStatisticD::getDeptId, Function.identity()));
|
||||
List<LineDTO> lineDTOList;
|
||||
|
||||
List<LineDTO> lineDTOList = new ArrayList<>();
|
||||
if (pmsRunStatisticMap.containsKey(dept.getCode())) {
|
||||
String runMonitorIds = pmsRunStatisticMap.get(dept.getCode()).getRunMonitorIds();
|
||||
if(StrUtil.isNotBlank(runMonitorIds)){
|
||||
List<String> monitorIds = CollectionUtil.toList(runMonitorIds.split(StrUtil.COMMA));
|
||||
lineDTOList = commLineClient.getLineDetailBatch(monitorIds).getData();
|
||||
}else {
|
||||
lineDTOList = new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
lineDTOList = new ArrayList<>();
|
||||
}
|
||||
//过滤出在线的监测点
|
||||
List<LineDTO> finalLineDTOList = lineDTOList;
|
||||
|
||||
//筛选国网上送监测点
|
||||
List<DeptGetChildrenMoreDTO> deptAll = calculatedParam.getIdList();
|
||||
deptAll.forEach(item -> {
|
||||
|
||||
//筛选出国网
|
||||
List<LineDevGetDTO> newBaseList;
|
||||
|
||||
//调过全国这个单位
|
||||
//跳过全国这个单位
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), item.getDeptLevel())) {
|
||||
return;
|
||||
}
|
||||
List<String> upDevIds =new ArrayList<>();
|
||||
List<String> onMonitorIds=new ArrayList<>();
|
||||
|
||||
|
||||
//筛选出国网
|
||||
|
||||
//存放在运监测点的集合
|
||||
List<LineDevGetDTO> newBaseList;
|
||||
|
||||
//存放在线监测点的集合
|
||||
List<LineDevGetDTO> newOnlineBaseList;
|
||||
|
||||
//存放在运监测点集合
|
||||
List<String> runMonitorIds;
|
||||
|
||||
//存放在线监测点集合
|
||||
List<String> onlineMonitorIds;
|
||||
|
||||
//存放在运装置的集合
|
||||
List<String> upDevIds;
|
||||
|
||||
|
||||
if (CollectionUtil.isEmpty(pmsRunStatisticsListD)) {
|
||||
//正常流程
|
||||
//非正常流程
|
||||
newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(toList());
|
||||
runMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(toList());
|
||||
upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(toList());
|
||||
} else {
|
||||
if(pmsRunStatisticMap.containsKey(item.getUnitId())){
|
||||
PmsRunStatisticD pmsRunStatisticD = pmsRunStatisticMap.get(item.getUnitId());
|
||||
if(StrUtil.isNotBlank(pmsRunStatisticD.getRunMonitorIds())){
|
||||
List<String> temIds = Arrays.stream(pmsRunStatisticD.getRunMonitorIds().split(StrUtil.COMMA)).collect(toList());
|
||||
List<LineDevGetDTO> collect = lineDTOList.stream().filter(o -> temIds.contains(o.getLineId())).map(it -> {
|
||||
newBaseList = finalLineDTOList.stream().filter(o -> temIds.contains(o.getLineId())).map(it -> {
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(it.getLineId());
|
||||
lineDevGetDTO.setDevId(it.getDevId());
|
||||
lineDevGetDTO.setObjType(it.getObjType());
|
||||
return lineDevGetDTO;
|
||||
}).collect(toList());
|
||||
if(CollUtil.isEmpty(collect)){
|
||||
newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
|
||||
upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(toList());
|
||||
}else {
|
||||
newBaseList = collect;
|
||||
if(StrUtil.isNotBlank(pmsRunStatisticD.getRunDevIds())){
|
||||
upDevIds = Arrays.stream(pmsRunStatisticD.getRunDevIds().split(StrUtil.COMMA)).collect(toList());
|
||||
}
|
||||
if(StrUtil.isNotBlank(pmsRunStatisticD.getOnlineMonitorIds())){
|
||||
onMonitorIds.addAll(Arrays.stream(pmsRunStatisticD.getOnlineMonitorIds().split(StrUtil.COMMA)).collect(toList()));
|
||||
}
|
||||
}
|
||||
runMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(toList());
|
||||
upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(toList());
|
||||
}else{
|
||||
newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(toList());
|
||||
upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(toList());
|
||||
runMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(toList());
|
||||
}
|
||||
}else{
|
||||
newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(toList());
|
||||
upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(toList());
|
||||
runMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<String> upMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(toList());
|
||||
|
||||
List<LineDevGetDTO> finalNewBaseList = newBaseList;
|
||||
List<RStatIntegrityD> runMonitorIntegrity = integrityDataList.stream().filter(it -> newBaseList.stream().map(LineDevGetDTO::getPointId).collect(toList()).contains(it.getLineIndex())).collect(toList());
|
||||
//获取在线监测点
|
||||
List<RStatIntegrityD> rStatIntegrityDList = runMonitorIntegrity.stream().filter(me -> me.getRealTime() > 0).collect(Collectors.toList());
|
||||
onlineMonitorIds = rStatIntegrityDList.stream().map(RStatIntegrityD::getLineIndex).distinct().collect(Collectors.toList());
|
||||
List<String> finalOnlineMonitorIds = onlineMonitorIds;
|
||||
newOnlineBaseList = newBaseList.stream().filter(i-> finalOnlineMonitorIds.contains(i.getPointId())).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<String> finalUpDevIds = upDevIds;
|
||||
List<String> finalRunMonitorIds = runMonitorIds;
|
||||
mapKey.forEach((key, val) -> {
|
||||
List<LineDevGetDTO> keyItem = finalNewBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(toList());
|
||||
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
||||
|
||||
int due = runMonitorIntegrity.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
||||
int real = runMonitorIntegrity.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
||||
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
||||
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(finalUpDevIds.size());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(finalRunMonitorIds.size());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum(onlineMonitorIds.size());
|
||||
double rate = runMonitorIntegrity.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(rate>100 ? 100:rate);
|
||||
if (due == 0 || real == 0) {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
double inVal = BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setDataFullRate(inVal>100?100:inVal);
|
||||
}
|
||||
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(dept.getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(dept.getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
rUploadPointStatisticalDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
|
||||
|
||||
List<LineDevGetDTO> keyItem;
|
||||
if(key.equals("9999")){
|
||||
//其他
|
||||
keyItem = newOnlineBaseList.stream().filter(o -> !val.contains(o.getObjType())).collect(toList());
|
||||
}else {
|
||||
keyItem = newOnlineBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(toList());
|
||||
}
|
||||
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
|
||||
switch (key) {
|
||||
case "2100":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId());
|
||||
@@ -235,93 +255,13 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
case "2400":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId());
|
||||
break;
|
||||
case "9999":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(dept.getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(dept.getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
rUploadPointStatisticalDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
||||
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(finalUpDevIds.size());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
|
||||
List<RStatIntegrityD> l3;
|
||||
if(CollUtil.isNotEmpty(onMonitorIds)){
|
||||
l3 = dataList.stream().filter(it -> onMonitorIds.contains(it.getLineIndex())).collect(toList());
|
||||
}else{
|
||||
l3 = dataList.stream().filter(it -> upMonitorIds.contains(it.getLineIndex())).collect(toList());
|
||||
}
|
||||
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
||||
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
||||
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
||||
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
||||
|
||||
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum(onMonitorIds.size() == 0 ? (int) onlineCount : onMonitorIds.size());
|
||||
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
if (due == 0 || real == 0) {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
|
||||
result.add(rUploadPointStatisticalDataD);
|
||||
});
|
||||
|
||||
|
||||
//其他
|
||||
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
|
||||
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(dept.getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(dept.getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
rUploadPointStatisticalDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
List<LineDevGetDTO> otherMonitor = newBaseList.stream().filter(me -> !otherIds.contains(me.getObjType())).collect(toList());
|
||||
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(upDevIds.size());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
|
||||
|
||||
|
||||
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> newBaseList.stream().map(LineDevGetDTO::getPointId).collect(toList()).contains(it.getLineIndex())).collect(toList());
|
||||
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
||||
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
||||
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
||||
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
||||
|
||||
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) onlineCount);
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
if (due == 0 || real == 0) {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
|
||||
result.add(rUploadPointStatisticalDataD);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -337,7 +277,133 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void insertPointStatisticalDataMonth(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
//开始月份
|
||||
String beginMonth = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN);
|
||||
//起始时间
|
||||
String startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
|
||||
//结束时间
|
||||
String endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
|
||||
List<PmsRunStatisticM> pmsRunStatistic = runStatisticMService.selectListByDate(startTime, endTime,calculatedParam.getDataDate());
|
||||
Map<String, PmsRunStatisticM> pmsRunStatisticMap = pmsRunStatistic.stream().collect(Collectors.toMap(PmsRunStatisticM::getDeptId, Function.identity()));
|
||||
|
||||
//所属场站与对象类型存在联系
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
||||
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
|
||||
//用于存放不同对象类型的测点id集合
|
||||
Map<String, List<String>> mapKey = new HashMap<>();
|
||||
this.classifyObj(mapKey);
|
||||
|
||||
//获取所有单位
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String, PvTerminalTreeVO> deptMap = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode,Function.identity()));
|
||||
|
||||
|
||||
List<PvTerminalTreeVO> pvTerminalTreeVOList = deptList.stream().filter(it->it.getLevel() == 2).collect(toList());
|
||||
|
||||
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("line_index,sum(due_time) due_time,sum(real_time) real_time,(sum(real_time)/sum(due_time)) as integrityData")
|
||||
.between("time_id",startTime,endTime).groupBy("line_index");
|
||||
List<RStatIntegrityD> rStatIntegrityDList = rStatIntegrityDMapper.selectList(queryWrapper);
|
||||
|
||||
|
||||
List<RUploadPointStatisticalDataD> resultPO = new ArrayList<>();
|
||||
pmsRunStatisticMap.forEach((deptId,item)->{
|
||||
PvTerminalTreeVO dept = deptMap.get(deptId);
|
||||
//跳过全国这个单位
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), dept.getLevel())) {
|
||||
return;
|
||||
}
|
||||
List<String> runMonitorIds = Arrays.stream(StrUtil.isNotBlank(item.getRunMonitorIds())?item.getRunMonitorIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<String> onlineMonitorIds = Arrays.stream(StrUtil.isNotBlank(item.getOnlineMonitorIds())?item.getOnlineMonitorIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<String> runDevIds = Arrays.stream(StrUtil.isNotBlank(item.getRunDevIds())?item.getRunDevIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(onlineMonitorIds).getData();
|
||||
|
||||
List<RStatIntegrityD> deptRStatIntegrityDList = rStatIntegrityDList.stream().filter(it->runMonitorIds.contains(it.getLineIndex())).collect(toList());
|
||||
|
||||
|
||||
mapKey.forEach((key, val) -> {
|
||||
|
||||
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
||||
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(pvTerminalTreeVOList.get(0).getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(pvTerminalTreeVOList.get(0).getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(beginMonth);
|
||||
rUploadPointStatisticalDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_02.getCode());
|
||||
rUploadPointStatisticalDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
judgeLevel(dept.getLevel(), rUploadPointStatisticalDataD, dept.getCode(), dept.getName(), deptList, deptMap);
|
||||
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(runDevIds.size());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(runMonitorIds.size());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum(onlineMonitorIds.size());
|
||||
int due = deptRStatIntegrityDList.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
||||
int real = deptRStatIntegrityDList.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
||||
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
||||
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
||||
double rate = deptRStatIntegrityDList.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(rate>100 ? 100:rate);
|
||||
if (due == 0 || real == 0) {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
double inVal = BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setDataFullRate(inVal>100?100:inVal);
|
||||
}
|
||||
|
||||
List<LineDTO> keyItem;
|
||||
if(key.equals("9999")){
|
||||
//其他
|
||||
keyItem = lineDTOList.stream().filter(o -> !val.contains(o.getObjType())).collect(toList());
|
||||
}else {
|
||||
keyItem = lineDTOList.stream().filter(o -> val.contains(o.getObjType())).collect(toList());
|
||||
}
|
||||
long pointCount = keyItem.stream().map(LineDTO::getLineId).distinct().count();
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
switch (key) {
|
||||
case "2100":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId());
|
||||
break;
|
||||
case "1200":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Converter.getCode()).getId());
|
||||
break;
|
||||
case "1300":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Ele_Railways.getCode()).getId());
|
||||
break;
|
||||
case "1401":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Wind_Farms.getCode()).getId());
|
||||
break;
|
||||
case "1402":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId());
|
||||
break;
|
||||
case "2300":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId());
|
||||
break;
|
||||
case "2400":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId());
|
||||
break;
|
||||
case "9999":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
|
||||
break;
|
||||
}
|
||||
resultPO.add(rUploadPointStatisticalDataD);
|
||||
});
|
||||
});
|
||||
|
||||
this.saveOrUpdateBatchByMultiId(resultPO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* @Override
|
||||
public void insertPointStatisticalDataMonth(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
//开始月份
|
||||
String beginMonth = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN);
|
||||
@@ -350,7 +416,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
//数据集
|
||||
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth, startTime, endTime, "02");
|
||||
dataProcessing(calculatedParam, list, pmsRunStatisticMap, BizParamConstant.STAT_BIZ_MONTH);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void insertPointStatisticalDataYear(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
@@ -363,10 +429,119 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
List<PmsRunStatisticY> pmsRunStatistic = runStatisticYService.selectListByDate(startTime, endTime,calculatedParam.getDataDate());
|
||||
Map<String, PmsRunStatisticY> pmsRunStatisticMap = pmsRunStatistic.stream().collect(Collectors.toMap(PmsRunStatisticY::getDeptId, Function.identity()));
|
||||
//数据集
|
||||
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth, startTime, endTime, "01");
|
||||
dataProcessing(calculatedParam, list, pmsRunStatisticMap, BizParamConstant.STAT_BIZ_YEAR);
|
||||
|
||||
//所属场站与对象类型存在联系
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
||||
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
|
||||
//用于存放不同对象类型的测点id集合
|
||||
Map<String, List<String>> mapKey = new HashMap<>();
|
||||
this.classifyObj(mapKey);
|
||||
|
||||
//获取所有单位
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String, PvTerminalTreeVO> deptMap = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode,Function.identity()));
|
||||
|
||||
|
||||
List<PvTerminalTreeVO> pvTerminalTreeVOList = deptList.stream().filter(it->it.getLevel() == 2).collect(toList());
|
||||
|
||||
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("line_index,sum(due_time) due_time,sum(real_time) real_time,(sum(real_time)/sum(due_time)) as integrityData")
|
||||
.between("time_id",startTime,endTime).groupBy("line_index");
|
||||
List<RStatIntegrityD> rStatIntegrityDList = rStatIntegrityDMapper.selectList(queryWrapper);
|
||||
|
||||
|
||||
List<RUploadPointStatisticalDataD> resultPO = new ArrayList<>();
|
||||
pmsRunStatisticMap.forEach((deptId,item)->{
|
||||
PvTerminalTreeVO dept = deptMap.get(deptId);
|
||||
//跳过全国这个单位
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()), dept.getLevel())) {
|
||||
return;
|
||||
}
|
||||
List<String> runMonitorIds = Arrays.stream(StrUtil.isNotBlank(item.getRunMonitorIds())?item.getRunMonitorIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<String> onlineMonitorIds = Arrays.stream(StrUtil.isNotBlank(item.getOnlineMonitorIds())?item.getOnlineMonitorIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<String> runDevIds = Arrays.stream(StrUtil.isNotBlank(item.getRunDevIds())?item.getRunDevIds().split(StrUtil.COMMA):new String[]{}).collect(toList());
|
||||
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(onlineMonitorIds).getData();
|
||||
|
||||
List<RStatIntegrityD> deptRStatIntegrityDList = rStatIntegrityDList.stream().filter(it->runMonitorIds.contains(it.getLineIndex())).collect(toList());
|
||||
int due = deptRStatIntegrityDList.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
||||
int real = deptRStatIntegrityDList.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
||||
|
||||
mapKey.forEach((key, val) -> {
|
||||
|
||||
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
||||
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(pvTerminalTreeVOList.get(0).getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(pvTerminalTreeVOList.get(0).getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(beginMonth);
|
||||
rUploadPointStatisticalDataD.setComputeDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_01.getCode());
|
||||
rUploadPointStatisticalDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
judgeLevel(dept.getLevel(), rUploadPointStatisticalDataD, dept.getCode(), dept.getName(), deptList, deptMap);
|
||||
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(runDevIds.size());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(runMonitorIds.size());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum(onlineMonitorIds.size());
|
||||
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
||||
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
||||
double rate = deptRStatIntegrityDList.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(rate>100 ? 100:rate);
|
||||
if (due == 0 || real == 0) {
|
||||
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
} else {
|
||||
double inVal = BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue();
|
||||
rUploadPointStatisticalDataD.setDataFullRate(inVal>100?100:inVal);
|
||||
}
|
||||
|
||||
List<LineDTO> keyItem;
|
||||
if(key.equals("9999")){
|
||||
//其他
|
||||
keyItem = lineDTOList.stream().filter(o -> !val.contains(o.getObjType())).collect(toList());
|
||||
}else {
|
||||
keyItem = lineDTOList.stream().filter(o -> val.contains(o.getObjType())).collect(toList());
|
||||
}
|
||||
long pointCount = keyItem.stream().map(LineDTO::getLineId).distinct().count();
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
switch (key) {
|
||||
case "2100":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId());
|
||||
break;
|
||||
case "1200":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Converter.getCode()).getId());
|
||||
break;
|
||||
case "1300":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Ele_Railways.getCode()).getId());
|
||||
break;
|
||||
case "1401":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Wind_Farms.getCode()).getId());
|
||||
break;
|
||||
case "1402":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId());
|
||||
break;
|
||||
case "2300":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId());
|
||||
break;
|
||||
case "2400":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId());
|
||||
break;
|
||||
case "9999":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
|
||||
break;
|
||||
}
|
||||
resultPO.add(rUploadPointStatisticalDataD);
|
||||
});
|
||||
});
|
||||
|
||||
this.saveOrUpdateBatchByMultiId(resultPO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param calculatedParam
|
||||
* @param list 数据处理
|
||||
@@ -380,42 +555,16 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String,PvTerminalTreeVO> deptMap = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode,Function.identity()));
|
||||
|
||||
//查询所有一级树字典
|
||||
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
|
||||
List<SysDicTreePO> temTreeList = sysDicTreePOList.stream().filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Trans_Sub.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Converter.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Ele_Railways.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Wind_Farms.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Power_Station.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Smelting_Load.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Imp_Users.getCode())
|
||||
).collect(Collectors.toList());
|
||||
//站别大类
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
||||
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
//获取对象类型下字类型
|
||||
Map<String, List<String>> mapKey = new HashMap<>();
|
||||
List<String> otherIds = new ArrayList<>();
|
||||
for (SysDicTreePO sysDicTreePO : temTreeList) {
|
||||
List<SysDicTreePO> temList;
|
||||
if (Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())) {
|
||||
temList = sysDicTreePOList.stream()
|
||||
.filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
temList = sysDicTreePOList.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId()) ||
|
||||
item.getId().equals(sysDicTreePO.getId())
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(Collectors.toList());
|
||||
mapKey.put(sysDicTreePO.getCode(), ids);
|
||||
otherIds.addAll(ids);
|
||||
}
|
||||
classifyObj(mapKey);
|
||||
|
||||
List<LineDTO> lineDTOList=new ArrayList<>();
|
||||
if (pmsRunStatisticMap.containsKey(dept.getCode())) {
|
||||
List<String> monitorIds;
|
||||
@@ -530,7 +679,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
|
||||
});
|
||||
|
||||
//其他类型
|
||||
/* //其他类型
|
||||
if (stationTypeMap.containsKey(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId())) {
|
||||
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me -> !otherIds.contains(me.getObjType())).collect(Collectors.toList());
|
||||
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
||||
@@ -540,7 +689,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
|
||||
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(monitorCount == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
@@ -571,7 +720,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
/**
|
||||
* 判断单位层级
|
||||
*/
|
||||
public void judgeLevel(Integer level, RUploadPointStatisticalDataD rUploadPointStatisticalDataD, String id, String name, List<Dept> deptList, Map<String, List<Dept>> map) {
|
||||
public void judgeLevel(Integer level, RUploadPointStatisticalDataD rUploadPointStatisticalDataD, String id, String name, List<PvTerminalTreeVO> deptList, Map<String,PvTerminalTreeVO> map) {
|
||||
String result = "";
|
||||
if (Objects.equals(level, Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_2.getCode()))) {
|
||||
result = UploadEnum.STATISTICAL_LEVEL_3.getCode();
|
||||
@@ -584,14 +733,55 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
rUploadPointStatisticalDataD.setCountyId("");
|
||||
} else if (Objects.equals(level, Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()))) {
|
||||
result = UploadEnum.STATISTICAL_LEVEL_5.getCode();
|
||||
List<String> list = Arrays.stream(map.get(id).get(0).getPids().split(",")).map(String::trim).collect(toList());
|
||||
String[] tem = map.get(id).getPids().split(",");
|
||||
List<String> list = Arrays.stream(tem).map(String::trim).collect(toList());
|
||||
String parentCode = deptList.stream().filter(o -> Objects.equals(o.getId(), list.get(3))).findFirst().orElse(null).getCode();
|
||||
rUploadPointStatisticalDataD.setCityId(parentCode);
|
||||
rUploadPointStatisticalDataD.setCityName(map.get(parentCode).get(0).getName());
|
||||
rUploadPointStatisticalDataD.setCityName(map.get(parentCode).getName());
|
||||
rUploadPointStatisticalDataD.setCountyId(id);
|
||||
rUploadPointStatisticalDataD.setCountyName(name);
|
||||
}
|
||||
rUploadPointStatisticalDataD.setStatisticalLevel(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分类所属场站
|
||||
* @author cdf
|
||||
* @date 2024/5/27
|
||||
*/
|
||||
private void classifyObj(Map<String, List<String>> mapKey){
|
||||
List<String> noOtherIds = new ArrayList<>();
|
||||
//查询所有一级树字典
|
||||
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
|
||||
|
||||
//获取所有需要统计的对象类型字典
|
||||
List<SysDicTreePO> temTreeList = sysDicTreePOList.stream().filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Trans_Sub.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Converter.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Ele_Railways.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Wind_Farms.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Power_Station.getCode())
|
||||
|| Objects.equals(item.getCode(), DicTreeEnum.Smelting_Load.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Imp_Users.getCode())
|
||||
).collect(toList());
|
||||
|
||||
for (SysDicTreePO sysDicTreePO : temTreeList) {
|
||||
List<SysDicTreePO> temList;
|
||||
if (Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())) {
|
||||
temList = sysDicTreePOList.stream()
|
||||
.filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode()) ||
|
||||
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
||||
)
|
||||
.collect(toList());
|
||||
} else {
|
||||
temList = sysDicTreePOList.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId()) ||
|
||||
item.getId().equals(sysDicTreePO.getId())
|
||||
).collect(toList());
|
||||
}
|
||||
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(toList());
|
||||
mapKey.put(sysDicTreePO.getCode(), ids);
|
||||
noOtherIds.addAll(ids);
|
||||
}
|
||||
mapKey.put("9999", noOtherIds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user