合并代码

This commit is contained in:
2022-11-23 19:05:16 +08:00
parent dce2972202
commit 9b2759f71e
44 changed files with 969 additions and 975 deletions

View File

@@ -15,7 +15,7 @@ import java.util.Date;
*/
@Data
@ApiModel("监测点暂态指标数据统计表")
@ApiModel("主网-监测点暂态指标数据统计表")
public class RStatEventOrgVO implements Serializable {
private static final long serialVersionUID = -15971491825708754L;
@@ -41,12 +41,6 @@ public class RStatEventOrgVO implements Serializable {
@ApiModelProperty(name = "dataDate", value = "生成数据的时间,每年统计一次")
private Date dataDate;
/**
* 监测点类别
*/
@ApiModelProperty(name = "measurementTypeClass",value = "监测点类别")
private String measurementTypeClass;
/**
* 日均有效接入监测点数
*/
@@ -83,17 +77,6 @@ public class RStatEventOrgVO implements Serializable {
@ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比")
private Double eventMeasurementRatioAccrued;
/**
* 暂态指标发生次数
*/
@ApiModelProperty(name = "eventCount",value = "暂态指标发生次数")
private Integer eventCount;
/**
* 暂态指标发生频次
*/
@ApiModelProperty(name = "eventFreq",value = "暂态指标发生频次")
private Double eventFreq;
/**
* 日均短时中断
*/
@@ -114,18 +97,6 @@ public class RStatEventOrgVO implements Serializable {
*/
@ApiModelProperty(name = "cumulativeShortInterruptionsProportion", value = "累计暂态指标占比")
private Double cumulativeShortInterruptionsProportion;
/**
* 短时中断频次
*/
@ApiModelProperty(name = "shortInterruptionsFreq",value = "短时中断频次")
private Double shortInterruptionsFreq;
/**
* 短时中断次数
*/
@ApiModelProperty(name = "shortInterruptionsCount",value = "短时中断次数")
private Integer shortInterruptionsCount;
/**
@@ -148,19 +119,6 @@ public class RStatEventOrgVO implements Serializable {
*/
@ApiModelProperty(name = "cumulativeVoltageRiseProportion", value = "累计电压暂升占比")
private Double cumulativeVoltageRiseProportion;
/**
* 电压暂升频次
*/
@ApiModelProperty(name = "voltageRiseFreq",value = "电压暂升频次")
private Double voltageRiseFreq;
/**
* 电压暂升次数
*/
@ApiModelProperty(name = "voltageRiseCount",value = "电压暂升次数")
private Integer voltageRiseCount;
/**
@@ -183,16 +141,6 @@ public class RStatEventOrgVO implements Serializable {
*/
@ApiModelProperty(name = "cumulativeVoltageDipProportion", value = "累计电压暂降占比")
private Double cumulativeVoltageDipProportion;
/**
* 电压暂降频次
*/
@ApiModelProperty(name = "voltageDipFreq",value = "电压暂降频次")
private Double voltageDipFreq;
/**
* 电压暂降次数
*/
@ApiModelProperty(name = "voltageDipCount",value = "电压暂降次数")
private Integer voltageDipCount;
/**

View File

@@ -77,19 +77,19 @@ public class RStatOrgVO implements Serializable {
* 日均暂态超标监测点数占比
*/
@ApiModelProperty(name = "eventMeasurementRatioAverage", value = "日均暂态超标监测点数占比")
private Double eventMeasurementRatioAverage;
private String eventMeasurementRatioAverage;
/**
* 累计暂态超标监测点数占比
*/
@ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比")
private Double eventMeasurementRatioAccrued;
private String eventMeasurementRatioAccrued;
/**
* 暂态指标发生频次
*/
@ApiModelProperty(name = "eventFreq", value = "暂态指标发生频次")
private Double eventFreq;
private String eventFreq;
/**
* 暂态指标发生次数

View File

@@ -20,7 +20,7 @@ public class RVoltageIconVO {
@ApiModelProperty(value = "变电站数量")
private Integer substationCount;
@ApiModelProperty(value = "态超标变电站数量")
@ApiModelProperty(value = "态超标变电站数量")
private Integer harmonicCount;
}

View File

@@ -6,7 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.PwRStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.web.controller.BaseController;
@@ -61,9 +61,9 @@ public class PwRStatOrgController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网区域暂态事件分类统计")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatEventOrgVO>> getPwRStatOrgClassified(@RequestBody PwUniversalFrontEndParam param) {
public HttpResult<List<PwRStatEventOrgVO>> getPwRStatOrgClassified(@RequestBody PwUniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getPwRStatOrgClassified");
List<RStatEventOrgVO> list = pwRStatOrgService.getPwRStatOrgClassified(param);
List<PwRStatEventOrgVO> list = pwRStatOrgService.getPwRStatOrgClassified(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}

View File

@@ -1,101 +0,0 @@
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RStatEventMService;
import com.njcn.event.service.majornetwork.RStatEventQService;
import com.njcn.event.service.majornetwork.RStatEventYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-09
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-监测点分类总览")
@RequestMapping("/event/rStatHarmonic")
public class RStatEventMController extends BaseController {
private final RStatEventYService rStatEventYService;
private final RStatEventQService rStatEventQService;
private final RStatEventMService rStatEventMService;
/**
* 查询查询监测点稳态指标 日/月点数
*/
@GetMapping("/getAllRStatEvent")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态累计超标监测点数")
public HttpResult<List<RArrayVO>> getAllRStatEventM(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatHarmonic");
List<RArrayVO> rStatHarmonicMAll = null;
String string = param.getType().toString();
switch (string) {
//查询超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicMAll = rStatEventYService.getRStatEventYAll(param);
break;
//查询超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicMAll = rStatEventQService.getRStatEventQAll(param);
break;
//查询超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicMAll = rStatEventMService.getRStatEventMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicMAll, methodDescribe);
}
/**
* 暂态按电压等级统计图
*/
@GetMapping("/getRStatHarmonicIconVoltage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态电铁-频率偏差-电压统计图")
public HttpResult<List<RStatEventMVO>> getRStatEventIcon1(REventMParam param) {
String methodDescribe = getMethodDescribe("getRStatHarmonicIconVoltage");
List<RStatEventMVO> rStatHarmonicIcon = rStatEventMService.getRStatHarmonicIcon(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
}
/**
* 暂态电铁-频率偏差-电压统计图
*/
@GetMapping("/getRStatHarmonicIconDate")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态电铁-频率偏差-越线日期统计图")
public HttpResult<List<REventPolylineVO>> getRStatEventIcon2(REventMParam param) {
String methodDescribe = getMethodDescribe("getRStatHarmonicIconDate");
List<REventPolylineVO> rStatHarmonicIcon = rStatEventMService.getRStatHarmonicIcon2(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
}
}

View File

@@ -1,106 +0,0 @@
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.REventMParam;
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.service.majornetwork.RStatEventOrgQService;
import com.njcn.event.service.majornetwork.RStatEventOrgYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-09
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-各单位分类总览")
@RequestMapping("/event/rStatHarmonic")
public class RStatEventOrgMController extends BaseController {
private final RStatEventOrgYService rStatEventOrgYService;
private final RStatEventOrgQService rStatEventOrgQService;
private final RStatEventOrgMService rStatEventOrgMService;
/**
* 查询查询监测点暂态指标 日/月点数
*/
@GetMapping("/getAllRStatEventOrg")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态累计超标监测点数")
public HttpResult<List<RArrayVO>> getAllRStatEventOrg(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatEventOrg");
List<RArrayVO> rStatHarmonicOrgAll = null;
String string = param.getType().toString();
switch (string) {
//查询超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicOrgAll = rStatEventOrgYService.getRStatEventOrgYAll(param);
break;
//查询超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicOrgAll = rStatEventOrgQService.getRStatEventOrgQAll(param);
break;
//查询超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicOrgAll = rStatEventOrgMService.getRStatEventOrgMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicOrgAll, methodDescribe);
}
/**
* 查询查询监测点稳态指标 日/月点数
*/
@GetMapping("/getAllRStatEventOrgIcon")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态各单位超标监测统计图")
public HttpResult<List<RStatEventMVO>> getAllRStatEventOrgIcon(REventMParam param) {
String methodDescribe = getMethodDescribe("getAllRStatEventOrgIcon");
List<RStatEventMVO> getAllRStatEventOrgIcon = null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数统计图-年数据
case BizParamConstant.STAT_BIZ_YEAR:
getAllRStatEventOrgIcon = rStatEventOrgYService.getRStatHarmonicOrgYIcon(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
getAllRStatEventOrgIcon = rStatEventOrgQService.getRStatHarmonicOrgQIcon(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
getAllRStatEventOrgIcon = rStatEventOrgMService.getRStatHarmonicOrgMIcon(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, getAllRStatEventOrgIcon, methodDescribe);
}
}

View File

@@ -1,80 +0,0 @@
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import com.njcn.event.pojo.vo.RVoltageIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationMService;
import com.njcn.event.service.majornetwork.RStatSubstationVoltageMService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-变电站分类总览")
@RequestMapping("/event/rStatSubstation")
public class RStatSubstationMController extends BaseController {
private final RStatSubstationMService rStatSubstationMService;
private final RStatSubstationVoltageMService rStatSubstationVoltageMService;
/**
* 变电站暂态指标超标分布(按发生频次)
*/
@GetMapping("/getStatSubstationIconDistributed")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站暂态分布(按发生频次)")
public HttpResult<RSubstationIconVO> getAllRStatSubstation(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getStatSubstationIconDistributed");
RSubstationIconVO statSubstationIcon = rStatSubstationMService.getStatSubstationIcon(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
/**
* 变电站暂态分布(按电压等级)
*/
@GetMapping("/getStatSubstationIconVoltage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站暂态分布(按电压等级)")
public HttpResult<List<RVoltageIconVO>> getAllRStatSubstationIcon2(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getStatSubstationIconVoltage");
List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMService.getStatSubstationIcon(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
/**
* 变电站暂态指标发生频次
*/
@GetMapping("/getStatSubstationIconIndex")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站暂态指标发生频次")
public HttpResult<List<RSubstationIcon2VO>> getAllRStatSubstationIcon3(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getStatSubstationIconIndex");
List<RSubstationIcon2VO> statSubstationIcon = rStatSubstationMService.getStatSubstationIcon2(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
}

View File

@@ -22,13 +22,13 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(年)
*/
List<RStatEventOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint")String distributionPoint);
/**
* 获取配网区域暂态事件分类统计(月)
@@ -36,13 +36,13 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态事件分类统计(月)
@@ -50,11 +50,11 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
}

View File

@@ -21,13 +21,13 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(年)
*/
List<RStatOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态指标统计(季)
@@ -35,13 +35,13 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(季)
*/
List<RStatOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态指标统计(月)
@@ -49,11 +49,11 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(月)
*/
List<RStatOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
}

View File

@@ -23,7 +23,8 @@ public interface PwRmpEventDetailMapper {
* @author yzh
* @date 2022/10/31
*/
List<RmpEventDetailPO> getPwRmpEventDetail(UniversalFrontEndParam param);
List<RmpEventDetailPO> getPwRmpEventDetail(@Param("param") UniversalFrontEndParam param,
@Param("monitorIdList") List<String> monitorIdList);
/**
* 获取暂态事件明细

View File

@@ -22,15 +22,12 @@
rseo.data_type AS dataType
</sql>
<sql id="query_where">
rso.data_type = 02
AND rseo.data_type = 02
rso.data_type = #{distributionPoint}
AND rseo.data_type = #{distributionPoint}
AND rso.org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="monitorSort != null and monitorSort.size() >0">
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>

View File

@@ -15,7 +15,7 @@
data_Type AS dataType
</sql>
<sql id="query_where">
data_type = 02
data_type = #{distributionPoint}
AND org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
@@ -26,12 +26,6 @@
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(Data_Date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
<if test="monitorSort != null and monitorSort.size() != 0">
AND measurement_type_class IN
<foreach collection="monitorSort" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</sql>

View File

@@ -5,17 +5,28 @@
<!--获取配网暂态事件明细-->
<select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
event_id AS eventId,
measurement_point_id AS measurementPointId,
event_type AS eventType,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude,
phase AS phase,
event_describe AS eventDescribe,
wave_path AS wavePath
event_id AS eventId,
measurement_point_id AS measurementPointId,
event_type AS eventType,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude,
phase AS phase,
event_describe AS eventDescribe,
wave_path AS wavePath
FROM
r_mp_event_detail
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="param.startTime != null and param.startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{param.startTime}, '%Y-%m-%d')
</if>
<if test="param.endTime != null and param.endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{param.endTime}, '%Y-%m-%d')
</if>
</select>
<select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">

View File

@@ -1,7 +1,11 @@
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.RStatEventD;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,8 @@ import com.njcn.event.pojo.po.RStatEventD;
*/
public interface RStatEventDMapper extends BaseMapper<RStatEventD> {
List<RStatEventD> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType,
@Param("measurementId") String measurementId,
@Param("harmonicId") String harmonicId);
}

View File

@@ -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.RStatEventM;
import com.njcn.event.pojo.po.RStatEventQ;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +18,12 @@ import com.njcn.event.pojo.po.RStatEventM;
*/
public interface RStatEventMMapper extends BaseMapper<RStatEventM> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventM> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -18,13 +18,13 @@ public interface RStatEventOrgMapper {
/**
* 获取年区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -32,13 +32,13 @@ public interface RStatEventOrgMapper {
/**
* 获取季区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -46,13 +46,13 @@ public interface RStatEventOrgMapper {
/**
* 获取月区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);

View File

@@ -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.RStatEventQ;
import com.njcn.event.pojo.po.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +18,13 @@ import com.njcn.event.pojo.po.RStatEventQ;
*/
public interface RStatEventQMapper extends BaseMapper<RStatEventQ> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventQ> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -1,7 +1,11 @@
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.RStatEventVoltageM;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,9 @@ import com.njcn.event.pojo.po.RStatEventVoltageM;
*/
public interface RStatEventVoltageMMapper extends BaseMapper<RStatEventVoltageM> {
List<RStatEventVoltageM> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType,
@Param("measurementId") String measurementId,
@Param("harmonicId") String harmonicId);
}

View File

@@ -1,7 +1,11 @@
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.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,13 @@ import com.njcn.event.pojo.po.RStatEventY;
*/
public interface RStatEventYMapper extends BaseMapper<RStatEventY> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventY> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -19,13 +19,13 @@ public interface RStatOrgMapper {
/**
* 获取年区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标统计
*/
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -33,13 +33,13 @@ public interface RStatOrgMapper {
/**
* 获取季区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标统计
*/
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -47,13 +47,13 @@ public interface RStatOrgMapper {
/**
* 获取月区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标统计
*/
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);

View File

@@ -210,6 +210,17 @@
feature_amplitude AS featureAmplitude
FROM
`r_mp_event_detail`
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
</select>
<!--获取监测点电压暂降和短时中断分布情况-->
@@ -390,10 +401,11 @@
<choose>
<when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
-- 没写错就是start_time SUBSTRING第二个参数代表第一个字符开始取7个字符
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</when>
<when test="dateType != null and dateType == 5">
@@ -441,10 +453,10 @@
<choose>
<when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</when>
<when test="dateType != null and dateType == 5">

View File

@@ -13,5 +13,37 @@
<result column="event_count" property="eventCount" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventD">
SELECT
data_date,
measurement_type_class,
event_type,
sum(event_measurement) as eventMeasurement,
sum(event_measurement_ratio) as eventMeasurementRatio,
sum(event_count) as eventCount
FROM
r_stat_event_d
<where>
and data_Type=#{dataType}
and measurement_type_class=#{measurementId}
and event_type=#{harmonicId}
<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="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 &lt;= #{param.endTime}
</if>
</where>
GROUP BY
data_date,
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventM">
SELECT
measurement_type_class,
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_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="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 &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -20,10 +20,10 @@
rseo.data_type AS dataType
</sql>
<sql id="query_rStatEventOrg_where">
rso.data_type = "01"
AND rseo.data_type = "01"
rso.data_type = #{mainnetPointId}
AND rseo.data_type = #{mainnetPointId}
AND rso.org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
<foreach collection="deptCode" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventQ">
SELECT
measurement_type_class,
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_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="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 &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -17,5 +17,40 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventVoltageM">
SELECT
measurement_type_class,
event_type,
voltage_type,
sum(event_measurement_average)/count(*) as eventMeasurementAverage ,
sum(event_measurement_accrued) as eventMeasurementAccrued,
sum(event_freq) 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_voltage_m
<where>
and data_Type=#{dataType}
and measurement_type_class=#{measurementId}
and event_type=#{harmonicId}
<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="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 &lt;= #{param.endTime}
</if>
</where>
GROUP BY
voltage_type,
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventY">
SELECT
measurement_type_class,
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_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="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 &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,7 +16,7 @@
<sql id="query_where">
data_type = #{mainnetPointId}
AND org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
<foreach collection="deptCode" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">

View File

@@ -59,10 +59,10 @@
</foreach>
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</select>
</mapper>

View File

@@ -9,7 +9,7 @@ import com.njcn.event.mapper.distribution.PwRStatOrgMapper;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.po.RStatEventOrgPO;
import com.njcn.event.pojo.po.RStatOrgPO;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.PwRStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.system.api.DicDataFeignClient;
@@ -18,6 +18,7 @@ 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;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
@@ -57,28 +58,21 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
*/
@Override
public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 查询字典表
List<DictData> dictDataList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData();
// 创建集合封装返回数据
List<RStatOrgVO> result = new ArrayList<>();
// 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 获取配网id
String distributionPoint = getDistributionPoint();
// 创建集合封装查询数据
List<RStatOrgPO> rStatOrgPO = new ArrayList<>();
// 判断条件
switch (param.getType()) {
// 年
@@ -87,7 +81,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
// 季
case 2:
@@ -95,7 +89,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
// 月
case 3:
@@ -103,48 +97,39 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
default:
break;
}
if (CollUtil.isEmpty(rStatOrgPO)) {
return Collections.emptyList();
}
// 数据处理
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
for (RStatOrgPO po : rStatOrgPO) {
// 数据处理
if (!po.getOrgNo().equals(pwPmsMonitorDTO.getOrgId())) {
continue;
}
// 创建对象封装返回数据
RStatOrgVO rStatOrgVO = new RStatOrgVO();
rStatOrgVO.setOrgNo(po.getOrgNo());
rStatOrgVO.setOrgName(pwPmsMonitorDTO.getOrgName());
rStatOrgVO.setDataDate(po.getDataDate());
rStatOrgVO.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
rStatOrgVO.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
rStatOrgVO.setEventMeasurementAverage(po.getEventMeasurementAverage());
rStatOrgVO.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
rStatOrgVO.setEventCount(po.getEventCount());
rStatOrgVO.setDataType(po.getDataType());
// 字典数据处理
for (DictData dictData : dictDataList) {
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
rStatOrgVO.setMonitorSort(dictData.getName());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
rStatOrgVO.setEventFreq(po.getEventFreq());
return rStatOrgPO.stream().map(po -> {
RStatOrgVO vo = new RStatOrgVO();
BeanUtils.copyProperties(po, vo);
for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
if (dto.getOrgId().equals(po.getOrgNo())) {
vo.setOrgName(dto.getOrgName());
for (DictData dictData : dictDataList) {
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
vo.setMonitorSort(dictData.getName());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setEventMeasurementRatioAverage(df.format(((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0)) * 100));
vo.setEventMeasurementRatioAccrued(df.format(((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0)) * 100));
vo.setEventFreq(po.getEventFreq().toString());
} else {
vo.setEventMeasurementRatioAverage("/");
vo.setEventMeasurementRatioAccrued("/");
vo.setEventFreq("/");
}
}
}
}
result.add(rStatOrgVO);
}
}
return result;
return vo;
}).collect(Collectors.toList());
}
/**
@@ -154,32 +139,19 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
* @return 配网区域暂态事件分类统计
*/
@Override
public List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
public List<PwRStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 查询监测点类别字典表
List<DictData> lineSortList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData();
// 查询暂态指标字典表
List<DictData> eventStatisList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode())
.getData();
// 创建集合封装返回数据
List<RStatEventOrgVO> result = new ArrayList<>();
List<PwRStatEventOrgVO> result = new ArrayList<>();
// 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 创建集合封装查询数据
List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>();
// 获取配网id
String distributionPoint = getDistributionPoint();
// 判断条件
switch (param.getType()) {
// 年
@@ -188,7 +160,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
// 季
case 2:
@@ -196,7 +168,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
// 月
case 3:
@@ -204,105 +176,110 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
distributionPoint);
break;
default:
break;
}
if (CollUtil.isEmpty(rStatEventOrgVOList)) {
return Collections.emptyList();
}
// 查询监测点类别字典表
List<DictData> lineSortList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData();
// 查询暂态指标字典表
List<DictData> eventStatisList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode())
.getData();
// 将查询出的数据转为map集合
Map<String, List<RStatEventOrgPO>> rStatEventOrgVOMap = rStatEventOrgVOList.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
// 蒋监测点类别字典表转换成map集合
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
// 根据暂态指标code转换成map
Map<String, DictData> eventStatisMap = eventStatisList.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
// 蒋配网监测点信息根据单位转换成map
Map<String, List<PwPmsMonitorDTO>> pwPmsMonitorDTOMap =
pwPmsMonitorDTOList.stream().collect(Collectors.groupingBy(PwPmsMonitorDTO::getOrgId));
// 数据处理
rStatEventOrgVOMap.forEach((orgOn, rStatEventOrgVOs) -> {
RStatEventOrgVO vo = new RStatEventOrgVO();
rStatEventOrgVOMap.forEach((orgOn, pos) -> {
PwRStatEventOrgVO vo = new PwRStatEventOrgVO();
// 基础属性赋值
for (RStatEventOrgPO po : rStatEventOrgVOs) {
vo.setOrgNo(po.getOrgNo());
vo.setDataDate(po.getDataDate());
vo.setMeasurementTypeClass(po.getMeasurementTypeClass());
vo.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
vo.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
vo.setEventMeasurementAverage(po.getEventMeasurementAverage());
vo.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
vo.setEventCount(po.getEventCount());
vo.setEventFreq(po.getEEventFreq());
vo.setDataType(po.getDataType());
if (vo.getOrgNo() == null) {
vo.setOrgNo(pos.get(0).getOrgNo());
vo.setOrgName(pwPmsMonitorDTOMap.get(pos.get(0).getOrgNo()).get(0).getOrgName());
vo.setDataDate(pos.get(0).getDataDate());
vo.setMeasurementTypeClass(pos.get(0).getMeasurementTypeClass());
vo.setEffectiveMeasurementAverage(pos.get(0).getEffectiveMeasurementAverage());
vo.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued());
vo.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage());
vo.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued());
vo.setEventCount(pos.get(0).getEventCount());
vo.setEventFreq(pos.get(0).getEEventFreq());
vo.setDataType(pos.get(0).getDataType());
}
for (RStatEventOrgPO po : rStatEventOrgVOs) {
for (DictData dictData : lineSortList) {
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
vo.setMeasurementTypeClass(dictData.getName());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
}
// 暂态指标赋值
for (DictData eventStati : eventStatisList) {
if (eventStati.getId().equals(po.getEventType())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
// 日均短时中断
vo.setDayShortInterruptions(po.getEEventMeasurementAverage());
// 累计短时中断
vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均短时中断占比
vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
// 累计短时中断占比
vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
vo.setShortInterruptionsFreq(po.getEEventFreq());
vo.setShortInterruptionsCount(po.getEEventCount());
}
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
// 日均电压暂升
vo.setDayVoltageRise(po.getEEventMeasurementAverage());
// 累计电压暂升
vo.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂升占比
vo.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
vo.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageRiseFreq(po.getEEventFreq());
vo.setVoltageRiseCount(po.getEEventCount());
}
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
// 日均电压暂降
vo.setDayVoltageDip(po.getEEventMeasurementAverage());
// 累计电压暂降
vo.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂降占比
vo.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
vo.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageDipFreq(po.getEEventFreq());
vo.setVoltageDipCount(po.getEEventCount());
}
}
}
}
for (RStatEventOrgPO po : pos) {
// 取出监测点类别
String measurementTypeClass = po.getMeasurementTypeClass();
// 取出暂态指标id
String eventType = po.getEventType();
// 取出监测点类别code
String lineSortCode = lineSortMap.get(measurementTypeClass).getCode();
// 取出暂态指标code
String eventStatisCode = eventStatisMap.get(eventType).getCode();
vo.setMeasurementTypeClass(lineSortMap.get(measurementTypeClass).getName());
if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format(
(po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format(
(po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
}
if (eventStatisCode.equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
// 日均短时中断
vo.setDayShortInterruptions(po.getEEventMeasurementAverage());
// 累计短时中断
vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均短时中断占比
vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
// 累计短时中断占比
vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
vo.setShortInterruptionsFreq(po.getEEventFreq());
vo.setShortInterruptionsCount(po.getEEventCount());
}
}
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_RISE.getCode())) {
// 日均电压暂升
vo.setDayVoltageRise(po.getEEventMeasurementAverage());
// 累计电压暂升
vo.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂升占比
vo.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
vo.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageRiseFreq(po.getEEventFreq());
vo.setVoltageRiseCount(po.getEEventCount());
}
}
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_DIP.getCode())) {
// 日均电压暂降
vo.setDayVoltageDip(po.getEEventMeasurementAverage());
// 累计电压暂降
vo.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂降占比
vo.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
vo.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageDipFreq(po.getEEventFreq());
vo.setVoltageDipCount(po.getEEventCount());
}
}
}
result.add(vo);
});
// 添加单位名称
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
for (RStatEventOrgVO vo : result) {
if (pwPmsMonitorDTO.getOrgId().equals(vo.getOrgNo())) {
vo.setOrgName(pwPmsMonitorDTO.getOrgName());
}
}
}
return result;
}
@@ -321,4 +298,13 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
.getPwMonitorList(pwPmsMonitorParam)
.getData();
}
/**
* 获取配网id
*/
private String getDistributionPoint() {
return dicDataFeignClient
.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode())
.getData().getId();
}
}

View File

@@ -3,9 +3,7 @@ package com.njcn.event.service.distribution.Impl;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
@@ -18,11 +16,12 @@ 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;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -61,88 +60,53 @@ public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient
.getPwMonitorList(pwPmsMonitorParam)
.getData();
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<PwRmpEventDetailVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取配网暂态事件明细
List<RmpEventDetailPO> rmpEventDetails = pwRmpEventDetailMapper.getPwRmpEventDetail(param);
if (CollectionUtil.isEmpty(rmpEventDetails)) {
List<RmpEventDetailPO> rmpEventDetailsPO = pwRmpEventDetailMapper.getPwRmpEventDetail(param,
pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(rmpEventDetailsPO)) {
return Collections.emptyList();
}
// 创建集合,储存一类监测点
List<String> oneLineMonitorIds = new ArrayList<>();
// 查询检测点类型字典
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
// 将单位信息转为map集合 key: 单位id value: 单位实体
Map<String, PwPmsMonitorDTO> pwPmsMonitorDTOMap = pwPmsMonitorDTOList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, PwPmsMonitorDTO -> PwPmsMonitorDTO));
// 属性赋值
for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
for (RmpEventDetailPO rmpEventDetail : rmpEventDetails) {
if (rmpEventDetail.getMeasurementPointId().equals(dto.getMonitorId())) {
PwRmpEventDetailVO pwRmpEventDetailVO = new PwRmpEventDetailVO();
pwRmpEventDetailVO.setOrgId(dto.getOrgId());
pwRmpEventDetailVO.setOrgName(dto.getOrgName());
pwRmpEventDetailVO.setMonitorId(dto.getMonitorId());
pwRmpEventDetailVO.setMonitorSort(dto.getMonitorSort());
pwRmpEventDetailVO.setMonitorName(dto.getMonitorName());
pwRmpEventDetailVO.setMonitorVoltageLevel(dto.getVoltageLevel());
pwRmpEventDetailVO.setEventType(rmpEventDetail.getEventType());
pwRmpEventDetailVO.setStartTime(rmpEventDetail.getStartTime());
pwRmpEventDetailVO.setFeatureAmplitude(rmpEventDetail.getFeatureAmplitude());
pwRmpEventDetailVO.setDuration(rmpEventDetail.getDuration());
pwRmpEventDetailVO.setWavePath(rmpEventDetail.getWavePath());
result.add(pwRmpEventDetailVO);
}
}
}
for (DictData dictData : lineSortList) {
for (PwRmpEventDetailVO vo : result) {
return rmpEventDetailsPO.stream().map(po -> {
PwRmpEventDetailVO vo = new PwRmpEventDetailVO();
BeanUtils.copyProperties(po, vo);
vo.setMonitorId(po.getMeasurementPointId());
vo.setOrgId(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getOrgId());
vo.setOrgName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getOrgName());
vo.setMonitorSort(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorSort());
vo.setMonitorName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
vo.setMonitorVoltageLevel(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getVoltageLevel());
for (DictData dictData : lineSortList) {
if (vo.getMonitorSort().equals(dictData.getId())) {
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setMonitorSort(dictData.getName());
vo.setSubName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getPowerName());
vo.setPowerClient("/");
vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName());
monitorIdList.add(vo.getMonitorId());
} else if (dictData.getCode().equals(DicDataEnum.TWO_LINE.getCode())) {
vo.setSubName("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/");
vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName());
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
vo.setSubName("/");
vo.setPowerDistributionArea(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
vo.setPowerClient("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/");
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
vo.setMonitorSort(dictData.getName());
vo.setSubName("/");
vo.setPowerDistributionArea("/");
vo.setPowerClient(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
vo.setMonitorName("/");
}
}
}
}
// 查询监测点信息
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
pmsMonitorInfoParam.setMonitorIds(monitorIdList);
List<PmsMonitorInfoDTO> monitorInfos = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData();
for (PmsMonitorInfoDTO monitorInfo : monitorInfos) {
for (PwRmpEventDetailVO vo : result) {
if (vo.getMonitorId().equals(monitorInfo.getMonitorId())) {
vo.setSubName(monitorInfo.getPowerName());
}
}
}
return result;
return vo;
}).collect(Collectors.toList());
}
}

View File

@@ -1,7 +1,7 @@
package com.njcn.event.service.distribution;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.PwRStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import java.util.List;
@@ -29,5 +29,5 @@ public interface PwRStatOrgService {
* @param param 前端传入参数
* @return 配网区域暂态事件分类统计
*/
List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param);
List<PwRStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param);
}

View File

@@ -88,6 +88,7 @@ public class EventDetailServiceImpl implements EventDetailService {
stringBuilder.append(" tz('Asia/Shanghai')");
//sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println("sql------------->>>"+sql);
//结果集
QueryResult result = influxDbUtils.query(sql);
//结果集映射到对象中
@@ -123,6 +124,7 @@ public class EventDetailServiceImpl implements EventDetailService {
stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
//sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println(sql);
//结果集
QueryResult result = influxDbUtils.query(sql);
//结果集映射到对象中

View File

@@ -415,12 +415,12 @@ public class EventMonitorReportServiceImpl implements EventMonitorReportService
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位id集合
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//单位code集合
List<String> orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
pmsMonitorParam.setOrgIds(orgCodeList); //单位codes
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
return monitorList;

View File

@@ -13,6 +13,7 @@ import com.njcn.event.mapper.majornetwork.RStatEventDMapper;
import com.njcn.event.mapper.majornetwork.RStatEventMMapper;
import com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.*;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RStatEventMService;
@@ -21,6 +22,10 @@ import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;
@@ -47,6 +52,7 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
private final DicDataFeignClient dicDataFeignClient;
private final RStatEventDMapper rStatEventDMapper;
private final RStatEventVoltageMMapper rStatEventVoltageMMapper;
private final DeptFeignClient deptFeignClient;
@Override
@@ -64,11 +70,15 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
.eq(RStatEventM::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
List<RStatEventM> list = rStatEventMMapper.selectInfoList(baseParam,mainnetData.getId());
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
List<RStatEventMVO> rm = new ArrayList<>();
@@ -149,11 +159,16 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
.eq(RStatEventM::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
List<RStatEventM> list = rStatEventMMapper.selectInfoList(baseParam,distributionData.getId());
//根据暂态指标分组
Map<String, List<RStatEventM>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
//判断对象是否为空
@@ -242,15 +257,19 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventVoltageM> rStatHarmonicVoltageMS = rStatEventVoltageMMapper
.selectInfoList(baseParam,mainnetData.getId(), measurementData.getId(),eventData.getId());
//初始化对象
List<RStatEventMVO> arrayVOList = new ArrayList<>();
List<RStatEventVoltageM> rStatHarmonicVoltageMS = rStatEventVoltageMMapper.selectList(new LambdaQueryWrapper<RStatEventVoltageM>()
.eq(RStatEventVoltageM::getDataType, mainnetData.getId())
.eq(RStatEventVoltageM::getMeasurementTypeClass, measurementData.getId())
.eq(RStatEventVoltageM::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventVoltageM::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventVoltageM::getDataDate, param.getEndTime())
);
//将数据转换为map进行便利
Map<String, RStatEventVoltageM> voltageMMap = rStatHarmonicVoltageMS.stream()
.collect(Collectors.toMap(RStatEventVoltageM::getVoltageType, Function.identity()));
@@ -272,6 +291,21 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
}
});
}
//处理主节点不存在的集合
List<DictData> notMeasurementList = devVoltageData.stream().filter(r -> !voltageMMap.containsKey(r.getId()))
.collect(Collectors.toList());
for (DictData notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -311,13 +345,18 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
.eq(RStatEventD::getDataType, mainnetData.getId())
.eq(RStatEventD::getMeasurementTypeClass, measurementDate.getId())
.eq(RStatEventD::getEventType, harmonicDate.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
);
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper
.selectInfoList(baseParam,mainnetData.getId(), measurementDate.getId(),harmonicDate.getId());
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
//获取月份
@@ -390,14 +429,16 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
, "干扰源类型或者指标类型为空,请检查入参是否准确");
//获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper
.selectInfoList(baseParam,distributionData.getId(), measurementData.getId(),eventData.getId());
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
.eq(RStatEventD::getDataType, distributionData.getId())
.eq(RStatEventD::getMeasurementTypeClass, measurementData.getId())
.eq(RStatEventD::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
);
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
//获取月份

View File

@@ -50,8 +50,8 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -74,6 +74,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
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);
@@ -105,6 +106,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgM.getOrgNo());
r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r);
}
@@ -114,7 +116,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
}
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa);
arrayVOList.add(arrayVO);
}
@@ -133,9 +135,9 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -177,13 +179,29 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -198,8 +216,8 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
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 distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
@@ -230,6 +248,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r);
}
@@ -239,7 +258,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
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.getEventName()));
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
});
@@ -264,9 +283,9 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -329,6 +364,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F);

View File

@@ -49,8 +49,8 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -73,6 +73,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
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);
@@ -104,6 +105,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgQ.getOrgNo());
r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r);
}
@@ -113,7 +115,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
}
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa);
arrayVOList.add(arrayVO);
}
@@ -132,9 +134,9 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
public List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -176,13 +178,29 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (RStatEventOrgQ orgQ : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -197,8 +215,8 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
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 distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
@@ -229,6 +247,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r);
}
@@ -238,7 +257,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
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.getEventName()));
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
});
@@ -264,9 +283,9 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (RStatEventOrgQ orgQ : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -329,6 +364,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F);

View File

@@ -49,8 +49,8 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -73,6 +73,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
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);
@@ -104,6 +105,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgY.getOrgNo());
r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r);
}
@@ -113,7 +115,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
}
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa);
arrayVOList.add(arrayVO);
}
@@ -132,9 +134,9 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -176,13 +178,29 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (RStatEventOrgY orgY : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -197,8 +215,8 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
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 distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
@@ -229,6 +247,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(orgY.getOrgNo());
r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r);
}
@@ -238,7 +257,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
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.getEventName()));
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
});
@@ -264,9 +283,9 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (RStatEventOrgY orgY : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
//处理主节点不存在的集合
List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
.collect(Collectors.toList());
for (DeptDTO notData : notMeasurementList) {
RStatEventMVO iconVO = new RStatEventMVO();
iconVO.setSort(notData.getSort());
iconVO.setEventName(notData.getName());
iconVO.setEventMeasurementAverage(0);
iconVO.setEventMeasurementAccrued(0);
iconVO.setEventFreq(0.0F);
iconVO.setEventCount(0);
iconVO.setEventMeasurementRatioAverage(0.0F);
iconVO.setEventMeasurementRatioAccrued(0.0F);
arrayVOList.add(iconVO);
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@@ -330,6 +365,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F);

View File

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventQMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventQ;
import com.njcn.event.pojo.po.RStatEventY;
import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO;
import com.njcn.event.service.majornetwork.RStatEventQService;
@@ -14,6 +16,10 @@ import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -35,6 +41,7 @@ public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStat
private final RStatEventQMapper rStatEventQMapper;
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
public List<RArrayVO> getRStatEventQAll(StatisticsBizBaseParam param) {
@@ -51,11 +58,14 @@ public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStat
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventQ> list = rStatEventQMapper.selectList(new LambdaQueryWrapper<RStatEventQ>()
.eq(RStatEventQ::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
List<RStatEventQ> list = rStatEventQMapper.selectInfoList(baseParam,mainnetData.getId());
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
@@ -138,11 +148,16 @@ public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStat
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventQ> list = rStatEventQMapper.selectList(new LambdaQueryWrapper<RStatEventQ>()
.eq(RStatEventQ::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
List<RStatEventQ> list = rStatEventQMapper.selectInfoList(baseParam,distributionData.getId());
//根据暂态指标分组
Map<String, List<RStatEventQ>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventQ::getEventType));
//判断对象是否为空

View File

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventYMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventM;
import com.njcn.event.pojo.po.RStatEventY;
import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO;
@@ -14,6 +16,10 @@ import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -35,6 +41,7 @@ public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStat
private final RStatEventYMapper rStatEventYMapper;
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
public List<RArrayVO> getRStatEventYAll(StatisticsBizBaseParam param) {
@@ -51,11 +58,14 @@ public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStat
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventY> list = rStatEventYMapper.selectList(new LambdaQueryWrapper<RStatEventY>()
.eq(RStatEventY::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
List<RStatEventY> list = rStatEventYMapper.selectInfoList(baseParam,mainnetData.getId());
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
@@ -138,11 +148,16 @@ public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStat
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam=BeanUtil.copyProperties(param,StatSubstationBizBaseParam.class);
baseParam.setIds(deptIds);
//数据库查询
List<RStatEventY> list = rStatEventYMapper.selectList(new LambdaQueryWrapper<RStatEventY>()
.eq(RStatEventY::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
List<RStatEventY> list = rStatEventYMapper.selectInfoList(baseParam,distributionData.getId());
//根据暂态指标分组
Map<String, List<RStatEventY>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventY::getEventType));

View File

@@ -20,6 +20,7 @@ import com.njcn.event.pojo.po.RStatSubstationM;
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationMService;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -51,7 +52,7 @@ public class RStatSubstationMServiceImpl extends ServiceImpl<RStatSubstationMMap
RSubstationIconVO rSubstationIconVO = new RSubstationIconVO();
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
//变电站id
// baseParam.setIds(this.powerrIdList(param.getId()));
baseParam.setIds(this.powerrIdList(param.getId()));
String string = param.getType().toString();
switch (string) {
//查询变变电站暂态分布(按发生频次)-年数据
@@ -77,7 +78,7 @@ public class RStatSubstationMServiceImpl extends ServiceImpl<RStatSubstationMMap
List<RSubstationIcon2VO> rSubstationIconVO = new ArrayList<>();
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
//获取变电站id
// baseParam.setIds(this.powerrIdList(param.getId()));
baseParam.setIds(this.powerrIdList(param.getId()));
String string = param.getType().toString();
switch (string) {
//查询变电站暂态指标发生频次-年数据

View File

@@ -8,10 +8,20 @@ import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatSubstationVoltageM;
import com.njcn.event.pojo.vo.RVoltageIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationVoltageMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
@@ -26,10 +36,35 @@ import java.util.List;
public class RStatSubstationVoltageMServiceImpl extends ServiceImpl<RStatSubstationVoltageMMapper, RStatSubstationVoltageM> implements RStatSubstationVoltageMService {
private final RStatSubstationVoltageMMapper rStatSubstationVoltageMMapper;
private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
@Override
public List<RVoltageIconVO> getStatSubstationIcon(StatisticsBizBaseParam param) {
//获取当前部门下所有部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
return rStatSubstationVoltageMMapper.getStatSubstationIcon(baseParam);
baseParam.setIds(deptIds);
//获取电压信息
List<DictData> devVoltageData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
//查询数据库
List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMMapper.getStatSubstationIcon(baseParam);
Map<String, RVoltageIconVO> devVoltageMap = statSubstationIcon.stream()
.collect(Collectors.toMap(RVoltageIconVO::getSubstationVoltage, Function.identity()));
//处理主节点不存在的集合
List<DictData> notMeasurementList = devVoltageData.stream().filter(r -> !devVoltageMap.containsKey(r.getId()))
.collect(Collectors.toList());
for (DictData notData : notMeasurementList) {
RVoltageIconVO iconVO = new RVoltageIconVO();
iconVO.setSubstationVoltage(notData.getId());
iconVO.setSubstationCount(0);
iconVO.setHarmonicCount(0);
statSubstationIcon.add(iconVO);
}
return statSubstationIcon;
}
}

View File

@@ -1,14 +1,15 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
@@ -22,7 +23,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -63,8 +66,6 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
if (CollectionUtil.isEmpty(data)) {
return Collections.emptyList();
}
// 创建返回集合
List<RmpEventDetailVO> info = new ArrayList<>();
// 查询事件类型字典表
List<DictData> eventStatisData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
@@ -72,64 +73,52 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
// 查询监测点类别
String monitorSort = dicDataFeignClient.getDicDataById(param.getMonitorSort().get(0)).getData().getName();
for (PmsGeneralDeviceDTO pmsGeneralDeviceDTO : data) {
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTO.getMonitorIdList())) {
continue;
}
// 查询监测点信息
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
pmsMonitorInfoParam.setMonitorIds(pmsGeneralDeviceDTO.getMonitorIdList());
List<PmsMonitorInfoDTO> monitorInfo = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData();
if (CollectionUtil.isEmpty(monitorInfo)) {
return Collections.emptyList();
}
// 获取监测点id集合
List<String> monitorIds = monitorInfo.stream().map(PmsMonitorInfoDTO::getMonitorId).collect(Collectors.toList());
// 获取暂态事件明细
List<RmpEventDetailPO> detailsOfTransientEvents = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIds, param.getEventType(), param.getStartTime(), param.getEndTime());
if (CollectionUtil.isEmpty(detailsOfTransientEvents)) {
return Collections.emptyList();
}
// 属性赋值
for (RmpEventDetailPO po : detailsOfTransientEvents) {
RmpEventDetailVO vo = new RmpEventDetailVO();
vo.setDeptId(pmsGeneralDeviceDTO.getIndex());
vo.setDeptName(pmsGeneralDeviceDTO.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);
info.add(vo);
}
// 监测点名称赋值
for (PmsMonitorInfoDTO pmsMonitorInfoDTO : monitorInfo) {
for (RmpEventDetailVO rmpEventDetailVO : info) {
if (pmsMonitorInfoDTO.getMonitorId().equals(rmpEventDetailVO.getMeasurementPointId())){
rmpEventDetailVO.setMeasurementPointName(pmsMonitorInfoDTO.getMonitorName());
}
}
}
// 暂态指标赋值
for (DictData datum : eventStatisData) {
for (RmpEventDetailVO rmpEventDetailVO : info) {
if (datum.getId().equals(rmpEventDetailVO.getEventType())){
rmpEventDetailVO.setEventType(datum.getName());
}
}
}
// 取出所有监测点
List<String> monitorIds = data.stream().flatMap(pmsGeneralDeviceDTO -> pmsGeneralDeviceDTO.getMonitorIdList().stream()).collect(Collectors.toList());
if (CollUtil.isEmpty(monitorIds)) {
return Collections.emptyList();
}
return info;
// 获取暂态事件明细
List<RmpEventDetailPO> detailsOfTransientEvents = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIds, param.getEventType(), param.getStartTime(), param.getEndTime());
if (CollectionUtil.isEmpty(detailsOfTransientEvents)) {
return Collections.emptyList();
}
// 查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
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));
// 蒋监测点信息转换成map集合
Map<String, String> monitorInfoMap = monitorInfo.stream().collect(Collectors.toMap(PmsMonitorDTO::getId, PmsMonitorDTO::getName));
// 将事件类型转换成map集合
Map<String, String> eventStatisDataMap = eventStatisData.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
// 属性赋值
return detailsOfTransientEvents.stream().map(po -> {
RmpEventDetailVO vo = new RmpEventDetailVO();
for (PmsGeneralDeviceDTO dto : data) {
if (dto.getMonitorIdList().contains(po.getMeasurementPointId())){
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()));
}
}
return vo;
}).collect(Collectors.toList());
}

View File

@@ -2,14 +2,11 @@ package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.StatationStatClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.event.mapper.majornetwork.RStatEventOrgMapper;
import com.njcn.event.mapper.majornetwork.RStatOrgMapper;
import com.njcn.event.mapper.majornetwork.RStatSubstationMapper;
@@ -24,8 +21,11 @@ import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
@@ -56,10 +56,10 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final DicDataFeignClient dicDataFeignClient;
private final MonitorClient monitorClient;
private final StatationStatClient statationStatClient;
@@ -72,65 +72,51 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
*/
@Override
public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(data)) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isEmpty(deptDTOList)) {
return Collections.emptyList();
}
// 取出单位code
List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if (CollectionUtil.isEmpty(deptCode)) {
return Collections.emptyList();
}
// 获取主网的id
String mainnetPointId = getMainnetPointId();
// 创建返回集合
List<RStatOrgVO> info = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
List<RStatOrgVO> result = new ArrayList<>();
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年区域暂态指标统计
info = rStatOrgMapper.getYearRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
result = rStatOrgMapper.getYearRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
case 2:
// 获取季区域暂态指标统计
info = rStatOrgMapper.getQuarterRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
result = rStatOrgMapper.getQuarterRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
case 3:
// 获取月区域暂态指标统计
info = rStatOrgMapper.getMonthRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
result = rStatOrgMapper.getMonthRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
default:
break;
}
if (CollUtil.isEmpty(info)) {
if (CollUtil.isEmpty(result)) {
return Collections.emptyList();
}
for (RStatOrgVO rStatOrgVO : info) {
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(
df.format((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(
df.format((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0))) * 100);
for (RStatOrgVO rStatOrgVO : result) {
rStatOrgVO.setEventMeasurementRatioAverage(
df.format(((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0)) * 100));
rStatOrgVO.setEventMeasurementRatioAccrued(
df.format(((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0)) * 100));
}
// 匹配单位名称
for (PmsGeneralDeviceDTO dto : data) {
for (RStatOrgVO vo : info) {
if (dto.getIndex().equals(vo.getOrgNo())) {
vo.setOrgName(dto.getName());
}
}
}
return info;
Map<String, DeptDTO> deptDTOMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO -> DeptDTO));
return result.stream().peek(vo -> {
vo.setOrgName(deptDTOMap.get(vo.getOrgNo()).getName());
}).collect(Collectors.toList());
}
@@ -142,132 +128,104 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
*/
@Override
public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<SimpleDTO> voltageLevel = param.getVoltageLevel().stream().map(s -> {
SimpleDTO simpleDTO = new SimpleDTO();
simpleDTO.setId(s);
return simpleDTO;
}).collect(Collectors.toList());
pmsDeviceInfoParam.setVoltageLevel(voltageLevel);
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(data)) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isEmpty(deptDTOList)) {
return Collections.emptyList();
}
// 取出单位code
List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if (CollectionUtil.isEmpty(deptCode)) {
return Collections.emptyList();
}
// 获取主网的id
String mainnetPointId = getMainnetPointId();
//创建返回集合
List<RStatEventOrgVO> info = new ArrayList<>();
// 根据暂态指标枚举查询暂态指标
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<RStatEventOrgVO> result = new ArrayList<>();
// 创建集合封装查询数据
List<RStatEventOrgPO> temp = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年区域暂态指标分类统计表
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
case 2:
// 获取季区域暂态指标分类统计表
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
case 3:
// 获取月区域暂态指标分类统计表
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break;
default:
break;
}
if (CollUtil.isEmpty(temp)) {
return Collections.emptyList();
}
// 通过单位id将集合转换为map集合
Map<String, List<RStatEventOrgPO>> map = temp
.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
map.forEach((orgOn, rStatEventOrgVOs) -> {
// 根据暂态指标枚举查询暂态指标
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
// 根据暂态指标code转换成map
Map<String, DictData> eventStatisMap = eventStatis.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
// 通过单位code将集合转换为map集合
Map<String, List<RStatEventOrgPO>> tempMap = temp.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
// 匹配单位名称
Map<String, DeptDTO> deptDTOMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO -> DeptDTO));
// 属性赋值
tempMap.forEach((orgOn, pos) -> {
RStatEventOrgVO rStatEventOrgVO = new RStatEventOrgVO();
// 基础属性赋值
for (RStatEventOrgPO tmp : rStatEventOrgVOs) {
if (rStatEventOrgVO.getOrgNo() == null) {
rStatEventOrgVO.setOrgNo(tmp.getOrgNo());
rStatEventOrgVO.setDataDate(tmp.getDataDate());
rStatEventOrgVO.setEffectiveMeasurementAverage(tmp.getEffectiveMeasurementAverage());
rStatEventOrgVO.setEffectiveMeasurementAccrued(tmp.getEffectiveMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementAverage(tmp.getEventMeasurementAverage());
rStatEventOrgVO.setEventMeasurementAccrued(tmp.getEventMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((tmp.getEventMeasurementAverage() * 1.0) / (tmp.getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((tmp.getEventMeasurementAccrued() * 1.0) / (tmp.getEffectiveMeasurementAccrued() * 1.0))) * 100);
rStatEventOrgVO.setDataType(tmp.getDataType());
}
if (rStatEventOrgVO.getOrgNo() == null) {
rStatEventOrgVO.setOrgNo(pos.get(0).getOrgNo());
rStatEventOrgVO.setOrgName(deptDTOMap.get(pos.get(0).getOrgNo()).getName());
rStatEventOrgVO.setDataDate(pos.get(0).getDataDate());
rStatEventOrgVO.setEffectiveMeasurementAverage(pos.get(0).getEffectiveMeasurementAverage());
rStatEventOrgVO.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage());
rStatEventOrgVO.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAverage() * 1.0) / (pos.get(0).getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAccrued() * 1.0) / (pos.get(0).getEffectiveMeasurementAccrued() * 1.0))) * 100);
rStatEventOrgVO.setDataType(pos.get(0).getDataType());
}
for (RStatEventOrgPO tmp : rStatEventOrgVOs) {
// 暂态指标赋值
for (DictData eventStati : eventStatis) {
if (eventStati.getId().equals(tmp.getEventType())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
// 日均短时中断
rStatEventOrgVO.setDayShortInterruptions(tmp.getEEventMeasurementAverage());
// 累计短时中断
rStatEventOrgVO.setCumulativeShortInterruptions(tmp.getEventMeasurementAccrued());
// 日均短时中断占比
rStatEventOrgVO.setDayShortInterruptionsProportion(tmp.getEEventMeasurementRatioAverage());
// 累计短时中断占比
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(tmp.getEEventMeasurementRatioAccrued());
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
// 日均电压暂升
rStatEventOrgVO.setDayVoltageRise(tmp.getEEventMeasurementAverage());
// 累计电压暂升
rStatEventOrgVO.setCumulativeVoltageRise(tmp.getEventMeasurementAccrued());
// 日均电压暂升占比
rStatEventOrgVO.setDayVoltageRiseProportion(tmp.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
rStatEventOrgVO.setCumulativeVoltageRiseProportion(tmp.getEEventMeasurementRatioAccrued());
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
// 日均电压暂降
rStatEventOrgVO.setDayVoltageDip(tmp.getEEventMeasurementAverage());
// 累计电压暂降
rStatEventOrgVO.setCumulativeVoltageDip(tmp.getEventMeasurementAccrued());
// 日均电压暂降占比
rStatEventOrgVO.setDayVoltageDipProportion(tmp.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
rStatEventOrgVO.setCumulativeVoltageDipProportion(tmp.getEEventMeasurementRatioAccrued());
}
}
// 暂态指标赋值
for (RStatEventOrgPO po : pos) {
String eventStatisCode = eventStatisMap.get(po.getEventType()).getCode();
if (eventStatisCode.equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
// 日均短时中断
rStatEventOrgVO.setDayShortInterruptions(po.getEEventMeasurementAverage());
// 累计短时中断
rStatEventOrgVO.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
// 日均短时中断占比
rStatEventOrgVO.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
// 累计短时中断占比
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
}
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_RISE.getCode())) {
// 日均电压暂升
rStatEventOrgVO.setDayVoltageRise(po.getEEventMeasurementAverage());
// 累计电压暂升
rStatEventOrgVO.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
// 日均电压暂升占比
rStatEventOrgVO.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
rStatEventOrgVO.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
}
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_DIP.getCode())) {
// 日均电压暂降
rStatEventOrgVO.setDayVoltageDip(po.getEEventMeasurementAverage());
// 累计电压暂降
rStatEventOrgVO.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
// 日均电压暂降占比
rStatEventOrgVO.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
rStatEventOrgVO.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
}
}
info.add(rStatEventOrgVO);
result.add(rStatEventOrgVO);
});
// 匹配单位名称
for (PmsGeneralDeviceDTO dto : data) {
for (RStatEventOrgVO vo : info) {
if (dto.getIndex().equals(vo.getOrgNo())) {
vo.setOrgName(dto.getName());
}
}
}
return info;
return result;
}
/**
@@ -279,80 +237,67 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
@Override
public List<RStatSubstationVO> getRStatSubstation
(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
//创建返回集合
List<RStatSubstationVO> info = new ArrayList<>();
if (CollectionUtil.isEmpty(data)) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isEmpty(deptDTOList)) {
return Collections.emptyList();
}
//创建返回集合
List<RStatSubstationVO> temp = new ArrayList<>();
for (PmsGeneralDeviceDTO dto : data) {
// 创建对象封装数据
PmsStatationStatInfoParam pmsStatationStatInfoParam = new PmsStatationStatInfoParam();
if (CollectionUtil.isEmpty(dto.getPowerrIdList())) {
continue;
}
// 取出变电站id
List<String> powerrIdList = dto.getPowerrIdList();
// 通过变电站id获取变电站详细信息
pmsStatationStatInfoParam.setPowerIds(powerrIdList);
pmsStatationStatInfoParam.setPowerName(param.getSubName());
List<PmsStatationStatInfoDTO> subInfo = statationStatClient.getStatationStatInfo(pmsStatationStatInfoParam).getData();
if (CollUtil.isEmpty(subInfo)) {
return Collections.emptyList();
}
// 取出变电站id
List<String> powerIds = subInfo.stream().map(PmsStatationStatInfoDTO::getPowerId).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年变电站暂态指标分类统计表
temp = rStatSubstationMapper.getYearInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case 2:
// 获取季变电站暂态指标分类统计表
temp = rStatSubstationMapper.getQuarterInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case 3:
// 获取月变电站暂态指标分类统计表
temp = rStatSubstationMapper.getMonthInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
if (CollUtil.isEmpty(temp)) {
return Collections.emptyList();
}
// 匹配单位名称
for (RStatSubstationVO vo : temp) {
for (PmsStatationStatInfoDTO statInfoDTO : subInfo) {
if (vo.getSubstationId().equals(statInfoDTO.getPowerId())) {
vo.setDeptId(dto.getIndex());
vo.setDeptName(dto.getName());
vo.setSubstationName(statInfoDTO.getPowerName());
}
}
info.add(vo);
}
// 取出单位code
List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if (CollectionUtil.isEmpty(deptCode)) {
return Collections.emptyList();
}
return info;
// 查询变电站信息
PmsStatationStatInfoParam pmsStatationStatInfoParam = new PmsStatationStatInfoParam();
pmsStatationStatInfoParam.setOrgIds(deptCode);
if (StringUtils.isEmpty(param.getSubName())) {
pmsStatationStatInfoParam.setPowerName(param.getSubName());
}
List<StatationStat> powerInfo = statationStatClient.getPowerInfo(pmsStatationStatInfoParam).getData();
if (CollUtil.isEmpty(powerInfo)) {
return Collections.emptyList();
}
// 取出变电站id
List<String> powerIds = powerInfo.stream().map(StatationStat::getPowerId).collect(Collectors.toList());
//创建返回集合
List<RStatSubstationVO> result = new ArrayList<>();
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年变电站暂态指标分类统计表
result = rStatSubstationMapper.getYearInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case 2:
// 获取季变电站暂态指标分类统计表
result = rStatSubstationMapper.getQuarterInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case 3:
// 获取月变电站暂态指标分类统计表
result = rStatSubstationMapper.getMonthInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
if (CollUtil.isEmpty(result)) {
return Collections.emptyList();
}
// 将变电站信息根据变电站id转换成map集合
Map<String, StatationStat> powerMap = powerInfo.stream().collect(Collectors.toMap(StatationStat::getPowerId, StatationStat -> StatationStat));
// 属性赋值
return result.stream().peek(vo -> {
String substationId = vo.getSubstationId();
vo.setDeptId(powerMap.get(substationId).getOrgId());
vo.setSubstationName(powerMap.get(substationId).getPowerName());
String deptId = vo.getDeptId();
for (DeptDTO deptDTO : deptDTOList) {
if (deptId.equals(deptDTO.getCode())){
vo.setDeptName(deptDTO.getName());
}
}
}).collect(Collectors.toList());
}
/**