合并代码
This commit is contained in:
@@ -54,7 +54,7 @@ public class PwRStatEventOrgController extends BaseController {
|
||||
switch (string) {
|
||||
//查询超标监测点数-年数据
|
||||
case BizParamConstant.STAT_BIZ_YEAR:
|
||||
rStatHarmonicOrgAll = rStatEventOrgYService.getPwRStatEventOrgYAll(param);
|
||||
rStatHarmonicOrgAll = rStatEventOrgYService.getRStatEventOrgOldYAll(param,2);
|
||||
break;
|
||||
//查询超标监测点数-季数据
|
||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RStatEventOrgController extends BaseController {
|
||||
switch (string) {
|
||||
//查询超标监测点数-年数据
|
||||
case BizParamConstant.STAT_BIZ_YEAR:
|
||||
rStatHarmonicOrgAll = rStatEventOrgYService.getRStatEventOrgYAll(param);
|
||||
rStatHarmonicOrgAll = rStatEventOrgYService.getRStatEventOrgOldYAll(param,1);
|
||||
break;
|
||||
//查询超标监测点数-季数据
|
||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RStatSubstationController extends BaseController {
|
||||
@GetMapping("/getStatSubstationIconDistributed")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("变电站暂态分布(按发生频次)")
|
||||
public HttpResult<RSubstationIconVO> getAllRStatSubstation(StatisticsBizBaseParam param) {
|
||||
public HttpResult<RSubstationIconVO> getStatSubstationIconDistributed(StatisticsBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getStatSubstationIconDistributed");
|
||||
RSubstationIconVO statSubstationIcon = rStatSubstationMService.getStatSubstationIcon(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
|
||||
@@ -58,7 +58,7 @@ public class RStatSubstationController extends BaseController {
|
||||
@GetMapping("/getStatSubstationIconVoltage")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("变电站暂态分布(按电压等级)")
|
||||
public HttpResult<List<RVoltageIconVO>> getAllRStatSubstationIcon2(StatisticsBizBaseParam param) {
|
||||
public HttpResult<List<RVoltageIconVO>> getStatSubstationIconVoltage(StatisticsBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getStatSubstationIconVoltage");
|
||||
List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMService.getStatSubstationIcon(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
|
||||
@@ -71,7 +71,7 @@ public class RStatSubstationController extends BaseController {
|
||||
@GetMapping("/getStatSubstationIconIndex")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("变电站暂态指标发生频次")
|
||||
public HttpResult<List<RSubstationIcon2VO>> getAllRStatSubstationIcon3(StatisticsBizBaseParam param) {
|
||||
public HttpResult<List<RSubstationIcon2VO>> getStatSubstationIconIndex(StatisticsBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getStatSubstationIconIndex");
|
||||
List<RSubstationIcon2VO> statSubstationIcon = rStatSubstationMService.getStatSubstationIcon2(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.event.mapper.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
import com.njcn.event.pojo.vo.RStatEventVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +18,14 @@ import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
*/
|
||||
public interface RStatEventOrgMMapper extends BaseMapper<RStatEventOrgM> {
|
||||
|
||||
/**
|
||||
* 各单位监测点查询
|
||||
* @param param
|
||||
* @param ids
|
||||
* @param dataType
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventVO> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
|
||||
@Param("ids") List<String> ids,
|
||||
@Param("dataType") String dataType);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.event.mapper.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgQ;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.vo.RStatEventVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +18,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface RStatEventOrgQMapper extends BaseMapper<RStatEventOrgQ> {
|
||||
|
||||
/**
|
||||
* 各单位监测点查询
|
||||
* @param param
|
||||
* @param ids
|
||||
* @param dataType
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventVO> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
|
||||
@Param("ids") List<String> ids,
|
||||
@Param("dataType") String dataType);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.event.mapper.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgY;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.vo.RStatEventVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -12,5 +17,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @since 2022-10-17
|
||||
*/
|
||||
public interface RStatEventOrgYMapper extends BaseMapper<RStatEventOrgY> {
|
||||
|
||||
/**
|
||||
* 各单位监测点查询
|
||||
* @param param
|
||||
* @param dataType
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventVO> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
|
||||
@Param("ids") List<String> ids,
|
||||
@Param("dataType") String dataType);
|
||||
}
|
||||
|
||||
@@ -15,5 +15,40 @@
|
||||
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
|
||||
<result column="data_type" property="dataType" />
|
||||
</resultMap>
|
||||
<select id="selectInfoList" resultType="com.njcn.event.pojo.vo.RStatEventVO">
|
||||
SELECT
|
||||
event_type,
|
||||
sum( event_measurement_average )/ count(*) AS eventMeasurementAverage,
|
||||
sum( event_measurement_accrued ) AS eventMeasurementAccrued,
|
||||
sum( event_freq )/ count(*) AS eventFreq,
|
||||
sum( event_count ) AS eventCount,
|
||||
sum( event_measurement_ratio_average )/ count(*) AS eventMeasurementRatioAverage,
|
||||
sum( event_measurement_ratio_accrued ) AS eventMeasurementRatioAccrued
|
||||
FROM
|
||||
r_stat_event_org_m
|
||||
<where>
|
||||
and data_Type=#{dataType}
|
||||
<if test="param != null and param.ids != null and param.ids.size > 0">
|
||||
AND org_no IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND event_type IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
||||
AND data_date >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
||||
AND data_date <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
event_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -15,5 +15,40 @@
|
||||
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
|
||||
<result column="data_type" property="dataType" />
|
||||
</resultMap>
|
||||
<select id="selectInfoList" resultType="com.njcn.event.pojo.vo.RStatEventVO">
|
||||
SELECT
|
||||
event_type,
|
||||
sum( event_measurement_average )/ count(*) AS eventMeasurementAverage,
|
||||
sum( event_measurement_accrued ) AS eventMeasurementAccrued,
|
||||
sum( event_freq )/ count(*) AS eventFreq,
|
||||
sum( event_count ) AS eventCount,
|
||||
sum( event_measurement_ratio_average )/ count(*) AS eventMeasurementRatioAverage,
|
||||
sum( event_measurement_ratio_accrued ) AS eventMeasurementRatioAccrued
|
||||
FROM
|
||||
r_stat_event_org_q
|
||||
<where>
|
||||
and data_Type=#{dataType}
|
||||
<if test="param != null and param.ids != null and param.ids.size > 0">
|
||||
AND org_no IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND event_type IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
||||
AND data_date >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
||||
AND data_date <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
event_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -15,5 +15,40 @@
|
||||
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
|
||||
<result column="data_type" property="dataType" />
|
||||
</resultMap>
|
||||
<select id="selectInfoList" resultType="com.njcn.event.pojo.vo.RStatEventVO">
|
||||
SELECT
|
||||
event_type,
|
||||
sum( event_measurement_average )/ count(*) AS eventMeasurementAverage,
|
||||
sum( event_measurement_accrued ) AS eventMeasurementAccrued,
|
||||
sum( event_freq )/ count(*) AS eventFreq,
|
||||
sum( event_count ) AS eventCount,
|
||||
sum( event_measurement_ratio_average )/ count(*) AS eventMeasurementRatioAverage,
|
||||
sum( event_measurement_ratio_accrued ) AS eventMeasurementRatioAccrued
|
||||
FROM
|
||||
r_stat_event_org_y
|
||||
<where>
|
||||
and data_Type=#{dataType}
|
||||
<if test="param != null and param.ids != null and param.ids.size > 0">
|
||||
AND org_no IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND event_type IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
||||
AND data_date >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
||||
AND data_date <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
event_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgMService;
|
||||
import com.njcn.event.utils.DeptUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -48,7 +49,9 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgMAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
@@ -133,8 +136,10 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
@@ -281,8 +286,10 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgQService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.utils.DeptUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -47,7 +48,9 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgQAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
@@ -132,8 +135,10 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
@@ -281,8 +286,10 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
|
||||
@@ -3,17 +3,26 @@ package com.njcn.event.service.majornetwork.Impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgQMapper;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgQ;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgY;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgYMapper;
|
||||
import com.njcn.event.pojo.vo.DeptLevelVO;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgYService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.utils.DeptUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -43,97 +52,121 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final RStatEventOrgYMapper statEventOrgYMapper;
|
||||
private final RStatEventOrgQMapper statEventOrgQMapper;
|
||||
private final RStatEventOrgMMapper statEventOrgMMapper;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgYAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得指标类型
|
||||
List<DictData> steadyData = dicDataFeignClient.getDicDataByTypeCode
|
||||
(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
List<String> steadyDataIds = steadyData.stream().map(DictData::getId).collect(Collectors.toList());
|
||||
Map<String, DictData> lineTypeMap = steadyData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取子部门(按照code改变数据结构)
|
||||
List<DeptLevelVO> deptLevelVOList = DeptUtil.getDeptLevelVOList(deptDTOList, param.getId());
|
||||
Map<String, DeptLevelVO> deptMap = deptLevelVOList.stream().collect(Collectors.toMap(DeptLevelVO::getCode, Function.identity()));
|
||||
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgY::getDataDate, param.getEndTime()));
|
||||
|
||||
StatSubstationBizBaseParam baseParam;
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DeptDTO deptDTO : deptDTOList) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(deptDTO.getName());
|
||||
r.setSort(deptDTO.getSort());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
List<RStatEventVO> newList=new ArrayList<>();
|
||||
for (DeptLevelVO deptLevelVO : deptLevelVOList) {
|
||||
//数据库查询
|
||||
baseParam=BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
|
||||
//没有子部门说明就是最底层部门
|
||||
if(CollUtil.isNotEmpty(deptLevelVO.getDeptList())){
|
||||
List<String> deptCodeS = deptLevelVO.getDeptList().stream().map(DeptLevelVO::getCode).collect(Collectors.toList());
|
||||
baseParam.setIds(deptCodeS);
|
||||
}else{
|
||||
baseParam.setIds(Arrays.asList(deptLevelVO.getCode()));
|
||||
}
|
||||
//区分 年 季 月
|
||||
String string = param.getType().toString();
|
||||
List<RStatEventVO> list = new ArrayList<>();
|
||||
switch (string) {
|
||||
//查询各单位累计超标监测点数-年数据
|
||||
case BizParamConstant.STAT_BIZ_YEAR:
|
||||
list = statEventOrgYMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
|
||||
break;
|
||||
//查询各单位累计超标监测点数-季数据
|
||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
||||
list = statEventOrgQMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
|
||||
break;
|
||||
//查询各单位累计超标监测点数-月数据
|
||||
case BizParamConstant.STAT_BIZ_MONTH:
|
||||
list = statEventOrgMMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//获取数据库数据
|
||||
Map<String, RStatEventVO> orgMap = list.stream()
|
||||
.collect(Collectors.toMap(RStatEventVO::getEventType, Function.identity()));
|
||||
|
||||
List<DictData> notMeasurementList = steadyData.stream().filter(r -> !orgMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (RStatEventVO org : list) {
|
||||
org.setOrgNo(deptLevelVO.getCode());
|
||||
}
|
||||
RStatEventVO org;
|
||||
for (DictData notData : notMeasurementList) {
|
||||
org=new RStatEventVO();
|
||||
org.setOrgNo(deptLevelVO.getCode());
|
||||
org.setEventType(notData.getId());
|
||||
org.setEventMeasurementAverage(0);
|
||||
org.setEventMeasurementAccrued(0);
|
||||
org.setEventFreq(0.0F);
|
||||
org.setEventCount(0);
|
||||
org.setEventMeasurementRatioAverage(0.0F);
|
||||
org.setEventMeasurementRatioAccrued(0.0F);
|
||||
list.add(org);
|
||||
}
|
||||
newList.addAll(list);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
|
||||
Map<String, List<RStatEventVO>> harmonicMap =
|
||||
newList.stream().collect(Collectors.groupingBy(RStatEventVO::getEventType));
|
||||
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
harmonicMap.forEach((key, value) -> {
|
||||
if(lineTypeMap.containsKey(key)){
|
||||
RArrayVO arrayVO=new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventOrgY orgY : value) {
|
||||
if (deptMap.containsKey(orgY.getOrgNo())) {
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
DeptDTO data1 = deptMap.get(orgY.getOrgNo());
|
||||
List<RStatEventMVO> b=new ArrayList<>();
|
||||
for (RStatEventVO orgY : value) {
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
DeptLevelVO data1 = deptMap.get(orgY.getOrgNo());
|
||||
if (ObjectUtil.isNotNull(data1)){
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVO.setColumns(aa);
|
||||
b.sort(Comparator.comparing(rStatHarmonicMVO -> rStatHarmonicMVO.getSort()));
|
||||
arrayVO.setColumns(b);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
@@ -281,8 +314,11 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//各单位
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
@@ -354,6 +390,88 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgOldYAll(StatisticsBizBaseParam param, Integer type) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());
|
||||
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
|
||||
DictData dictData ;
|
||||
if(type==1){
|
||||
//获取主网信息
|
||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
}else{
|
||||
//获取配网信息
|
||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
}
|
||||
//数据库查询
|
||||
List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, dictData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgY::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (eventMap.containsKey(key)) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventOrgY org : value) {
|
||||
if(deptMap.containsKey(org.getOrgNo())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
|
||||
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
|
||||
r.setEventName(deptDTO.getName());
|
||||
r.setSort(deptDTO.getSort());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventOrgY>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDept(notDeptList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDept(deptDTOList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
|
||||
@@ -21,7 +21,9 @@ import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -78,21 +80,24 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
if (CollUtil.isEmpty(monitorIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取暂态事件明细
|
||||
List<RmpEventDetailPO> detailsOfTransientEvents = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIds, param.getEventType(), param.getStartTime(), param.getEndTime());
|
||||
if (CollectionUtil.isEmpty(detailsOfTransientEvents)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 查询监测点信息
|
||||
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
|
||||
if (!StringUtils.isEmpty(param.getMonitorName())){
|
||||
pmsMonitorParam.setMonitorName(param.getMonitorName());
|
||||
}
|
||||
pmsMonitorParam.setMonitorIds(monitorIds);
|
||||
List<PmsMonitorDTO> monitorInfo = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData();
|
||||
if (CollectionUtil.isEmpty(monitorInfo)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 蒋单位信息转成map集合
|
||||
Map<String, List<PmsGeneralDeviceDTO>> deptMap = data.stream().collect(Collectors.groupingBy(PmsGeneralDeviceDTO::getIndex));
|
||||
// 取出所有监测点
|
||||
List<String> monitorList = monitorInfo.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList());
|
||||
// 获取暂态事件明细
|
||||
List<RmpEventDetailPO> detailsOfTransientEvents = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorList, param.getEventType(), param.getStartTime(), param.getEndTime());
|
||||
if (CollectionUtil.isEmpty(detailsOfTransientEvents)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 蒋监测点信息转换成map集合
|
||||
Map<String, String> monitorInfoMap = monitorInfo.stream().collect(Collectors.toMap(PmsMonitorDTO::getId, PmsMonitorDTO::getName));
|
||||
// 将事件类型转换成map集合
|
||||
@@ -102,16 +107,9 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
return detailsOfTransientEvents.stream().map(po -> {
|
||||
RmpEventDetailVO vo = new RmpEventDetailVO();
|
||||
for (PmsGeneralDeviceDTO dto : data) {
|
||||
if (dto.getMonitorIdList().contains(po.getMeasurementPointId())){
|
||||
if (dto.getMonitorIdList().contains(po.getMeasurementPointId())) {
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
vo.setDeptName(dto.getName());
|
||||
vo.setEventId(po.getEventId());
|
||||
vo.setMeasurementPointId(po.getMeasurementPointId());
|
||||
vo.setEventType(po.getEventType());
|
||||
vo.setPhase(po.getPhase());
|
||||
vo.setStartTime(po.getStartTime());
|
||||
vo.setDuration(po.getDuration());
|
||||
vo.setFeatureAmplitude(po.getFeatureAmplitude());
|
||||
vo.setWavePath(po.getWavePath());
|
||||
vo.setMonitorSort(monitorSort);
|
||||
vo.setMeasurementPointName(monitorInfoMap.get(po.getMeasurementPointId()));
|
||||
vo.setEventType(eventStatisDataMap.get(po.getEventType()));
|
||||
|
||||
@@ -252,7 +252,7 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
|
||||
// 查询变电站信息
|
||||
PmsStatationStatInfoParam pmsStatationStatInfoParam = new PmsStatationStatInfoParam();
|
||||
pmsStatationStatInfoParam.setOrgIds(deptCode);
|
||||
if (StringUtils.isEmpty(param.getSubName())) {
|
||||
if (!StringUtils.isEmpty(param.getSubName())) {
|
||||
pmsStatationStatInfoParam.setPowerName(param.getSubName());
|
||||
}
|
||||
List<StatationStat> powerInfo = statationStatClient.getPowerInfo(pmsStatationStatInfoParam).getData();
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
public interface RStatEventOrgYService extends IService<RStatEventOrgY> {
|
||||
|
||||
/**
|
||||
* 主网查询查询各单位暂态指标 日/月点数(年)
|
||||
* 主网查询查询各单位暂态指标 日/月点数(年)(暂不使用,递归子部门统计)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
@@ -50,4 +50,13 @@ public interface RStatEventOrgYService extends IService<RStatEventOrgY> {
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param);
|
||||
|
||||
/**
|
||||
* 主网查询查询各单位暂态指标 日/月点数(年)
|
||||
* @param param
|
||||
* @param type 区分主配网
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventOrgOldYAll(StatisticsBizBaseParam param, Integer type);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user