合并代码

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 @Data
@ApiModel("监测点暂态指标数据统计表") @ApiModel("主网-监测点暂态指标数据统计表")
public class RStatEventOrgVO implements Serializable { public class RStatEventOrgVO implements Serializable {
private static final long serialVersionUID = -15971491825708754L; private static final long serialVersionUID = -15971491825708754L;
@@ -41,12 +41,6 @@ public class RStatEventOrgVO implements Serializable {
@ApiModelProperty(name = "dataDate", value = "生成数据的时间,每年统计一次") @ApiModelProperty(name = "dataDate", value = "生成数据的时间,每年统计一次")
private Date dataDate; private Date dataDate;
/**
* 监测点类别
*/
@ApiModelProperty(name = "measurementTypeClass",value = "监测点类别")
private String measurementTypeClass;
/** /**
* 日均有效接入监测点数 * 日均有效接入监测点数
*/ */
@@ -83,17 +77,6 @@ public class RStatEventOrgVO implements Serializable {
@ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比") @ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比")
private Double eventMeasurementRatioAccrued; 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 = "累计暂态指标占比") @ApiModelProperty(name = "cumulativeShortInterruptionsProportion", value = "累计暂态指标占比")
private Double cumulativeShortInterruptionsProportion; 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 = "累计电压暂升占比") @ApiModelProperty(name = "cumulativeVoltageRiseProportion", value = "累计电压暂升占比")
private Double cumulativeVoltageRiseProportion; 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 = "累计电压暂降占比") @ApiModelProperty(name = "cumulativeVoltageDipProportion", value = "累计电压暂降占比")
private Double cumulativeVoltageDipProportion; 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 = "日均暂态超标监测点数占比") @ApiModelProperty(name = "eventMeasurementRatioAverage", value = "日均暂态超标监测点数占比")
private Double eventMeasurementRatioAverage; private String eventMeasurementRatioAverage;
/** /**
* 累计暂态超标监测点数占比 * 累计暂态超标监测点数占比
*/ */
@ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比") @ApiModelProperty(name = "eventMeasurementRatioAccrued", value = "累计暂态超标监测点数占比")
private Double eventMeasurementRatioAccrued; private String eventMeasurementRatioAccrued;
/** /**
* 暂态指标发生频次 * 暂态指标发生频次
*/ */
@ApiModelProperty(name = "eventFreq", value = "暂态指标发生频次") @ApiModelProperty(name = "eventFreq", value = "暂态指标发生频次")
private Double eventFreq; private String eventFreq;
/** /**
* 暂态指标发生次数 * 暂态指标发生次数

View File

@@ -20,7 +20,7 @@ public class RVoltageIconVO {
@ApiModelProperty(value = "变电站数量") @ApiModelProperty(value = "变电站数量")
private Integer substationCount; private Integer substationCount;
@ApiModelProperty(value = "态超标变电站数量") @ApiModelProperty(value = "态超标变电站数量")
private Integer harmonicCount; 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.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam; 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.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService; import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
@@ -61,9 +61,9 @@ public class PwRStatOrgController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网区域暂态事件分类统计") @ApiOperation("获取配网区域暂态事件分类统计")
@ApiImplicitParam(name = "param", value = "条件参数", required = true) @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"); String methodDescribe = getMethodDescribe("getPwRStatOrgClassified");
List<RStatEventOrgVO> list = pwRStatOrgService.getPwRStatOrgClassified(param); List<PwRStatEventOrgVO> list = pwRStatOrgService.getPwRStatOrgClassified(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); 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 deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(年) * @return 配网区域暂态事件分类统计(年)
*/ */
List<RStatEventOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList, List<RStatEventOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort); @Param("distributionPoint")String distributionPoint);
/** /**
* 获取配网区域暂态事件分类统计(月) * 获取配网区域暂态事件分类统计(月)
@@ -36,13 +36,13 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id * @param deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月) * @return 配网区域暂态事件分类统计(月)
*/ */
List<RStatEventOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList, List<RStatEventOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort); @Param("distributionPoint") String distributionPoint);
/** /**
* 获取配网区域暂态事件分类统计(月) * 获取配网区域暂态事件分类统计(月)
@@ -50,11 +50,11 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id * @param deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月) * @return 配网区域暂态事件分类统计(月)
*/ */
List<RStatEventOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList, List<RStatEventOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @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 deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态指标统计(年) * @return 配网区域暂态指标统计(年)
*/ */
List<RStatOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList, List<RStatOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort); @Param("distributionPoint") String distributionPoint);
/** /**
* 获取配网区域暂态指标统计(季) * 获取配网区域暂态指标统计(季)
@@ -35,13 +35,13 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id * @param deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态指标统计(季) * @return 配网区域暂态指标统计(季)
*/ */
List<RStatOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList, List<RStatOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort); @Param("distributionPoint") String distributionPoint);
/** /**
* 获取配网区域暂态指标统计(月) * 获取配网区域暂态指标统计(月)
@@ -49,11 +49,11 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id * @param deptIdList 单位id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param monitorSort 监测点类别 * @param distributionPoint 配网id
* @return 配网区域暂态指标统计(月) * @return 配网区域暂态指标统计(月)
*/ */
List<RStatOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList, List<RStatOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort); @Param("distributionPoint") String distributionPoint);
} }

View File

@@ -23,7 +23,8 @@ public interface PwRmpEventDetailMapper {
* @author yzh * @author yzh
* @date 2022/10/31 * @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 rseo.data_type AS dataType
</sql> </sql>
<sql id="query_where"> <sql id="query_where">
rso.data_type = 02 rso.data_type = #{distributionPoint}
AND rseo.data_type = 02 AND rseo.data_type = #{distributionPoint}
AND rso.org_no IN AND rso.org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=","> <foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
<if test="monitorSort != null and monitorSort.size() >0">
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d') AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if> </if>

View File

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

View File

@@ -5,17 +5,28 @@
<!--获取配网暂态事件明细--> <!--获取配网暂态事件明细-->
<select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO"> <select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT SELECT
event_id AS eventId, event_id AS eventId,
measurement_point_id AS measurementPointId, measurement_point_id AS measurementPointId,
event_type AS eventType, event_type AS eventType,
start_time AS startTime, start_time AS startTime,
duration AS duration, duration AS duration,
feature_amplitude AS featureAmplitude, feature_amplitude AS featureAmplitude,
phase AS phase, phase AS phase,
event_describe AS eventDescribe, event_describe AS eventDescribe,
wave_path AS wavePath wave_path AS wavePath
FROM 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>
<select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO"> <select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">

View File

@@ -1,7 +1,11 @@
package com.njcn.event.mapper.majornetwork; package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventD; import com.njcn.event.pojo.po.RStatEventD;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@@ -13,4 +17,8 @@ import com.njcn.event.pojo.po.RStatEventD;
*/ */
public interface RStatEventDMapper extends BaseMapper<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; package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.RStatEventM;
import com.njcn.event.pojo.po.RStatEventQ;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@@ -13,4 +18,12 @@ import com.njcn.event.pojo.po.RStatEventM;
*/ */
public interface RStatEventMMapper extends BaseMapper<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 startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 年区域暂态指标分类统计表 * @return 年区域暂态指标分类统计表
*/ */
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptIds") List<String> deptIds, List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);
@@ -32,13 +32,13 @@ public interface RStatEventOrgMapper {
/** /**
* 获取季区域暂态指标分类统计表 * 获取季区域暂态指标分类统计表
* *
* @param deptIds 部门id * @param deptCode 单位code
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 季区域暂态指标分类统计表 * @return 季区域暂态指标分类统计表
*/ */
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptIds") List<String> deptIds, List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);
@@ -46,13 +46,13 @@ public interface RStatEventOrgMapper {
/** /**
* 获取月区域暂态指标分类统计表 * 获取月区域暂态指标分类统计表
* *
* @param deptIds 部门id * @param deptCode 单位code
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 月区域暂态指标分类统计表 * @return 月区域暂态指标分类统计表
*/ */
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptIds") List<String> deptIds, List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);

View File

@@ -1,7 +1,12 @@
package com.njcn.event.mapper.majornetwork; package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.RStatEventQ;
import com.njcn.event.pojo.po.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@@ -13,4 +18,13 @@ import com.njcn.event.pojo.po.RStatEventQ;
*/ */
public interface RStatEventQMapper extends BaseMapper<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; package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventVoltageM; import com.njcn.event.pojo.po.RStatEventVoltageM;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@@ -13,4 +17,9 @@ import com.njcn.event.pojo.po.RStatEventVoltageM;
*/ */
public interface RStatEventVoltageMMapper extends BaseMapper<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; package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventY; import com.njcn.event.pojo.po.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@@ -13,4 +17,13 @@ import com.njcn.event.pojo.po.RStatEventY;
*/ */
public interface RStatEventYMapper extends BaseMapper<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 startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 年区域暂态指标统计 * @return 年区域暂态指标统计
*/ */
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptIds") List<String> deptIds, List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);
@@ -33,13 +33,13 @@ public interface RStatOrgMapper {
/** /**
* 获取季区域暂态指标统计 * 获取季区域暂态指标统计
* *
* @param deptIds 单位id * @param deptCode 单位code
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 季区域暂态指标统计 * @return 季区域暂态指标统计
*/ */
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptIds") List<String> deptIds, List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);
@@ -47,13 +47,13 @@ public interface RStatOrgMapper {
/** /**
* 获取月区域暂态指标统计 * 获取月区域暂态指标统计
* *
* @param deptIds 单位id * @param deptCode 单位code
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param mainnetPointId 主网字典id * @param mainnetPointId 主网字典id
* @return 月区域暂态指标统计 * @return 月区域暂态指标统计
*/ */
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptIds") List<String> deptIds, List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId); @Param("mainnetPointId") String mainnetPointId);

View File

@@ -210,6 +210,17 @@
feature_amplitude AS featureAmplitude feature_amplitude AS featureAmplitude
FROM 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="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> </select>
<!--获取监测点电压暂降和短时中断分布情况--> <!--获取监测点电压暂降和短时中断分布情况-->
@@ -390,10 +401,11 @@
<choose> <choose>
<when test="dateType != null and dateType == 3"> <when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''"> <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>
-- 没写错就是start_time SUBSTRING第二个参数代表第一个字符开始取7个字符
<if test="endTime != null and endTime != ''"> <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> </if>
</when> </when>
<when test="dateType != null and dateType == 5"> <when test="dateType != null and dateType == 5">
@@ -441,10 +453,10 @@
<choose> <choose>
<when test="dateType != null and dateType == 3"> <when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''"> <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>
<if test="endTime != null and endTime != ''"> <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> </if>
</when> </when>
<when test="dateType != null and dateType == 5"> <when test="dateType != null and dateType == 5">

View File

@@ -13,5 +13,37 @@
<result column="event_count" property="eventCount" /> <result column="event_count" property="eventCount" />
<result column="data_type" property="dataType" /> <result column="data_type" property="dataType" />
</resultMap> </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> </mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" /> <result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" /> <result column="data_type" property="dataType" />
</resultMap> </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> </mapper>

View File

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

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" /> <result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" /> <result column="data_type" property="dataType" />
</resultMap> </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> </mapper>

View File

@@ -17,5 +17,40 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" /> <result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" /> <result column="data_type" property="dataType" />
</resultMap> </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> </mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" /> <result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" /> <result column="data_type" property="dataType" />
</resultMap> </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> </mapper>

View File

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

View File

@@ -59,10 +59,10 @@
</foreach> </foreach>
</if> </if>
<if test="startTime != null and startTime != ''"> <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>
<if test="endTime != null and endTime != ''"> <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> </if>
</select> </select>
</mapper> </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.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.po.RStatEventOrgPO; import com.njcn.event.pojo.po.RStatEventOrgPO;
import com.njcn.event.pojo.po.RStatOrgPO; 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.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService; import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
@@ -18,6 +18,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -57,28 +58,21 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
*/ */
@Override @Override
public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) { public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) {
// 获取单位下的监测点id集合 // 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param); List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) { if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 查询字典表 // 查询字典表
List<DictData> dictDataList = dicDataFeignClient List<DictData> dictDataList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()) .getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData(); .getData();
// 创建集合封装返回数据
List<RStatOrgVO> result = new ArrayList<>();
// 取出单位id // 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList()); List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 获取配网id
String distributionPoint = getDistributionPoint();
// 创建集合封装查询数据 // 创建集合封装查询数据
List<RStatOrgPO> rStatOrgPO = new ArrayList<>(); List<RStatOrgPO> rStatOrgPO = new ArrayList<>();
// 判断条件 // 判断条件
switch (param.getType()) { switch (param.getType()) {
// 年 // 年
@@ -87,7 +81,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
// 季 // 季
case 2: case 2:
@@ -95,7 +89,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
// 月 // 月
case 3: case 3:
@@ -103,48 +97,39 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
default: default:
break; break;
} }
if (CollUtil.isEmpty(rStatOrgPO)) {
return Collections.emptyList();
}
// 数据处理 // 数据处理
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) { return rStatOrgPO.stream().map(po -> {
for (RStatOrgPO po : rStatOrgPO) { RStatOrgVO vo = new RStatOrgVO();
// 数据处理 BeanUtils.copyProperties(po, vo);
if (!po.getOrgNo().equals(pwPmsMonitorDTO.getOrgId())) { for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
continue; if (dto.getOrgId().equals(po.getOrgNo())) {
} vo.setOrgName(dto.getOrgName());
// 创建对象封装返回数据 for (DictData dictData : dictDataList) {
RStatOrgVO rStatOrgVO = new RStatOrgVO(); if (po.getMeasurementTypeClass().equals(dictData.getId())) {
rStatOrgVO.setOrgNo(po.getOrgNo()); vo.setMonitorSort(dictData.getName());
rStatOrgVO.setOrgName(pwPmsMonitorDTO.getOrgName()); if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
rStatOrgVO.setDataDate(po.getDataDate()); vo.setEventMeasurementRatioAverage(df.format(((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0)) * 100));
rStatOrgVO.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage()); vo.setEventMeasurementRatioAccrued(df.format(((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0)) * 100));
rStatOrgVO.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued()); vo.setEventFreq(po.getEventFreq().toString());
rStatOrgVO.setEventMeasurementAverage(po.getEventMeasurementAverage()); } else {
rStatOrgVO.setEventMeasurementAccrued(po.getEventMeasurementAccrued()); vo.setEventMeasurementRatioAverage("/");
rStatOrgVO.setEventCount(po.getEventCount()); vo.setEventMeasurementRatioAccrued("/");
rStatOrgVO.setDataType(po.getDataType()); vo.setEventFreq("/");
// 字典数据处理 }
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());
} }
} }
} }
result.add(rStatOrgVO);
} }
return vo;
} }).collect(Collectors.toList());
return result;
} }
/** /**
@@ -154,32 +139,19 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
* @return 配网区域暂态事件分类统计 * @return 配网区域暂态事件分类统计
*/ */
@Override @Override
public List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) { public List<PwRStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param); List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) { if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList(); 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 // 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList()); List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 创建集合封装查询数据 // 创建集合封装查询数据
List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>(); List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>();
// 获取配网id
String distributionPoint = getDistributionPoint();
// 判断条件 // 判断条件
switch (param.getType()) { switch (param.getType()) {
// 年 // 年
@@ -188,7 +160,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
// 季 // 季
case 2: case 2:
@@ -196,7 +168,7 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
// 月 // 月
case 3: case 3:
@@ -204,105 +176,110 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
deptIdList, deptIdList,
param.getStartTime(), param.getStartTime(),
param.getEndTime(), param.getEndTime(),
param.getMonitorSort()); distributionPoint);
break; break;
default: default:
break; break;
} }
if (CollUtil.isEmpty(rStatEventOrgVOList)) { if (CollUtil.isEmpty(rStatEventOrgVOList)) {
return Collections.emptyList(); 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集合
Map<String, List<RStatEventOrgPO>> rStatEventOrgVOMap = rStatEventOrgVOList.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo)); 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) -> { rStatEventOrgVOMap.forEach((orgOn, pos) -> {
RStatEventOrgVO vo = new RStatEventOrgVO(); PwRStatEventOrgVO vo = new PwRStatEventOrgVO();
// 基础属性赋值 // 基础属性赋值
for (RStatEventOrgPO po : rStatEventOrgVOs) { if (vo.getOrgNo() == null) {
vo.setOrgNo(po.getOrgNo()); vo.setOrgNo(pos.get(0).getOrgNo());
vo.setDataDate(po.getDataDate()); vo.setOrgName(pwPmsMonitorDTOMap.get(pos.get(0).getOrgNo()).get(0).getOrgName());
vo.setMeasurementTypeClass(po.getMeasurementTypeClass()); vo.setDataDate(pos.get(0).getDataDate());
vo.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage()); vo.setMeasurementTypeClass(pos.get(0).getMeasurementTypeClass());
vo.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued()); vo.setEffectiveMeasurementAverage(pos.get(0).getEffectiveMeasurementAverage());
vo.setEventMeasurementAverage(po.getEventMeasurementAverage()); vo.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued());
vo.setEventMeasurementAccrued(po.getEventMeasurementAccrued()); vo.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage());
vo.setEventCount(po.getEventCount()); vo.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued());
vo.setEventFreq(po.getEEventFreq()); vo.setEventCount(pos.get(0).getEventCount());
vo.setDataType(po.getDataType()); vo.setEventFreq(pos.get(0).getEEventFreq());
vo.setDataType(pos.get(0).getDataType());
} }
for (RStatEventOrgPO po : rStatEventOrgVOs) { for (RStatEventOrgPO po : pos) {
for (DictData dictData : lineSortList) { // 取出监测点类别
if (po.getMeasurementTypeClass().equals(dictData.getId())) { String measurementTypeClass = po.getMeasurementTypeClass();
vo.setMeasurementTypeClass(dictData.getName()); // 取出暂态指标id
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) { String eventType = po.getEventType();
vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100); // 取出监测点类别code
vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100); String lineSortCode = lineSortMap.get(measurementTypeClass).getCode();
} // 取出暂态指标code
// 暂态指标赋值 String eventStatisCode = eventStatisMap.get(eventType).getCode();
for (DictData eventStati : eventStatisList) { vo.setMeasurementTypeClass(lineSortMap.get(measurementTypeClass).getName());
if (eventStati.getId().equals(po.getEventType())) { if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) { vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format(
// 日均短时中断 (po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
vo.setDayShortInterruptions(po.getEEventMeasurementAverage()); vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format(
// 累计短时中断 (po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued()); }
if (eventStatisCode.equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) { // 日均短时中断
// 日均短时中断占比 vo.setDayShortInterruptions(po.getEEventMeasurementAverage());
vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage()); // 累计短时中断
// 累计短时中断占比 vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued()); if (lineSortCode.equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setShortInterruptionsFreq(po.getEEventFreq()); // 日均短时中断占比
vo.setShortInterruptionsCount(po.getEEventCount()); vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
} // 累计短时中断占比
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) { vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
// 日均电压暂升 vo.setShortInterruptionsFreq(po.getEEventFreq());
vo.setDayVoltageRise(po.getEEventMeasurementAverage()); vo.setShortInterruptionsCount(po.getEEventCount());
// 累计电压暂升
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());
}
}
}
}
} }
} }
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); result.add(vo);
}); });
// 添加单位名称
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
for (RStatEventOrgVO vo : result) {
if (pwPmsMonitorDTO.getOrgId().equals(vo.getOrgNo())) {
vo.setOrgName(pwPmsMonitorDTO.getOrgName());
}
}
}
return result; return result;
} }
@@ -321,4 +298,13 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
.getPwMonitorList(pwPmsMonitorParam) .getPwMonitorList(pwPmsMonitorParam)
.getData(); .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 cn.hutool.core.collection.CollectionUtil;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PwMonitorClient; 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.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam; import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper; import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam; 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 com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -61,88 +60,53 @@ public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient
.getPwMonitorList(pwPmsMonitorParam) .getPwMonitorList(pwPmsMonitorParam)
.getData(); .getData();
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) { if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList(); 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); List<RmpEventDetailPO> rmpEventDetailsPO = pwRmpEventDetailMapper.getPwRmpEventDetail(param,
pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(rmpEventDetails)) { if (CollectionUtil.isEmpty(rmpEventDetailsPO)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 创建集合,储存一类监测点
List<String> oneLineMonitorIds = new ArrayList<>();
// 查询检测点类型字典 // 查询检测点类型字典
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData(); 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) { return rmpEventDetailsPO.stream().map(po -> {
for (RmpEventDetailPO rmpEventDetail : rmpEventDetails) { PwRmpEventDetailVO vo = new PwRmpEventDetailVO();
if (rmpEventDetail.getMeasurementPointId().equals(dto.getMonitorId())) { BeanUtils.copyProperties(po, vo);
PwRmpEventDetailVO pwRmpEventDetailVO = new PwRmpEventDetailVO(); vo.setMonitorId(po.getMeasurementPointId());
pwRmpEventDetailVO.setOrgId(dto.getOrgId()); vo.setOrgId(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getOrgId());
pwRmpEventDetailVO.setOrgName(dto.getOrgName()); vo.setOrgName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getOrgName());
pwRmpEventDetailVO.setMonitorId(dto.getMonitorId()); vo.setMonitorSort(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorSort());
pwRmpEventDetailVO.setMonitorSort(dto.getMonitorSort()); vo.setMonitorName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
pwRmpEventDetailVO.setMonitorName(dto.getMonitorName()); vo.setMonitorVoltageLevel(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getVoltageLevel());
pwRmpEventDetailVO.setMonitorVoltageLevel(dto.getVoltageLevel()); for (DictData dictData : lineSortList) {
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) {
if (vo.getMonitorSort().equals(dictData.getId())) { if (vo.getMonitorSort().equals(dictData.getId())) {
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) { if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setMonitorSort(dictData.getName());
vo.setSubName(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getPowerName());
vo.setPowerClient("/"); vo.setPowerClient("/");
vo.setPowerDistributionArea("/"); vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName());
monitorIdList.add(vo.getMonitorId());
} else if (dictData.getCode().equals(DicDataEnum.TWO_LINE.getCode())) { } else if (dictData.getCode().equals(DicDataEnum.TWO_LINE.getCode())) {
vo.setSubName("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/");
vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName()); vo.setMonitorSort(dictData.getName());
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
vo.setSubName("/"); vo.setSubName("/");
vo.setPowerDistributionArea(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
vo.setPowerClient("/"); vo.setPowerClient("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/"); vo.setMonitorName("/");
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
vo.setMonitorSort(dictData.getName()); vo.setMonitorSort(dictData.getName());
vo.setSubName("/");
vo.setPowerDistributionArea("/");
vo.setPowerClient(pwPmsMonitorDTOMap.get(po.getMeasurementPointId()).getMonitorName());
vo.setMonitorName("/");
} }
} }
} }
} return vo;
// 查询监测点信息 }).collect(Collectors.toList());
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;
} }
} }

View File

@@ -1,7 +1,7 @@
package com.njcn.event.service.distribution; package com.njcn.event.service.distribution;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam; 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.pojo.vo.RStatOrgVO;
import java.util.List; import java.util.List;
@@ -29,5 +29,5 @@ public interface PwRStatOrgService {
* @param param 前端传入参数 * @param param 前端传入参数
* @return 配网区域暂态事件分类统计 * @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')"); stringBuilder.append(" tz('Asia/Shanghai')");
//sql语句 //sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder; String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println("sql------------->>>"+sql);
//结果集 //结果集
QueryResult result = influxDbUtils.query(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')"); stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
//sql语句 //sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder; String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println(sql);
//结果集 //结果集
QueryResult result = influxDbUtils.query(sql); QueryResult result = influxDbUtils.query(sql);
//结果集映射到对象中 //结果集映射到对象中

View File

@@ -415,12 +415,12 @@ public class EventMonitorReportServiceImpl implements EventMonitorReportService
if (CollUtil.isEmpty(deptDTOList)) { if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在"); throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
} }
//单位id集合 //单位code集合
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//查询监测点信息 //查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam(); PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorName(monitorName); //监测点名称 pmsMonitorParam.setMonitorName(monitorName); //监测点名称
pmsMonitorParam.setOrgIds(orgNoList); //单位ids pmsMonitorParam.setOrgIds(orgCodeList); //单位codes
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息 List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
return monitorList; 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.RStatEventMMapper;
import com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper; import com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper;
import com.njcn.event.pojo.param.REventMParam; 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.po.*;
import com.njcn.event.pojo.vo.*; import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RStatEventMService; 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.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; 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.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -47,6 +52,7 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final RStatEventDMapper rStatEventDMapper; private final RStatEventDMapper rStatEventDMapper;
private final RStatEventVoltageMMapper rStatEventVoltageMMapper; private final RStatEventVoltageMMapper rStatEventVoltageMMapper;
private final DeptFeignClient deptFeignClient;
@Override @Override
@@ -64,11 +70,15 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息 //获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData(); 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>() List<RStatEventM> list = rStatEventMMapper.selectInfoList(baseParam,mainnetData.getId());
.eq(RStatEventM::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); List<RArrayVO> arrayVOList = new ArrayList<>();
List<RStatEventMVO> rm = 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(); DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); 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>() List<RStatEventM> list = rStatEventMMapper.selectInfoList(baseParam,distributionData.getId());
.eq(RStatEventM::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
//根据暂态指标分组 //根据暂态指标分组
Map<String, List<RStatEventM>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType)); Map<String, List<RStatEventM>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
//判断对象是否为空 //判断对象是否为空
@@ -242,15 +257,19 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息 //获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData(); 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<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进行便利
Map<String, RStatEventVoltageM> voltageMMap = rStatHarmonicVoltageMS.stream() Map<String, RStatEventVoltageM> voltageMMap = rStatHarmonicVoltageMS.stream()
.collect(Collectors.toMap(RStatEventVoltageM::getVoltageType, Function.identity())); .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())); arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList; return arrayVOList;
} }
@@ -311,13 +345,18 @@ public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStat
//获取主网id信息 //获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData(); DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>() //获取当前部门下所有部门信息
.eq(RStatEventD::getDataType, mainnetData.getId()) List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
.eq(RStatEventD::getMeasurementTypeClass, measurementDate.getId()) List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
.eq(RStatEventD::getEventType, harmonicDate.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime()) 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 = Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate)); 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(); 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 = Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate)); 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(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//对象主节点 获取所有得暂降类型 //对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode( List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -74,6 +74,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (DeptDTO deptDTO : deptDTOList) { for (DeptDTO deptDTO : deptDTOList) {
RStatEventMVO r = new RStatEventMVO(); RStatEventMVO r = new RStatEventMVO();
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
r.setEventMeasurementAverage(0); r.setEventMeasurementAverage(0);
r.setEventMeasurementAccrued(0); r.setEventMeasurementAccrued(0);
r.setEventFreq(0.0F); r.setEventFreq(0.0F);
@@ -105,6 +106,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgM, RStatEventMVO.class); RStatEventMVO r = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgM.getOrgNo()); DeptDTO data1 = deptMap.get(orgM.getOrgNo());
r.setEventName(data1.getName()); r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r); b.add(r);
} }
@@ -114,7 +116,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO); linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
} }
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values()); List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa); arrayVO.setColumns(aa);
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
@@ -133,9 +135,9 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) { public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -177,13 +179,29 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (RStatEventOrgM orgM : value) { for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -198,8 +216,8 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
//子节点 获取所有得各单位类型 //子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//获取配网信息 //获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData(); 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); RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(org.getOrgNo()); DeptDTO deptDTO = deptMap.get(org.getOrgNo());
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r); eventVO.add(r);
} }
@@ -239,7 +258,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId())) List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
this.assignDept(notDeptList, eventVO, arrayVO); this.assignDept(notDeptList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
}); });
@@ -264,9 +283,9 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) { public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (RStatEventOrgM orgM : value) { for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -329,6 +364,7 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
for (DeptDTO dictData : deptDTOList) { for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO(); RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName()); notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0); notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0); notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F); 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(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//对象主节点 获取所有得暂降类型 //对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode( List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -73,6 +73,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (DeptDTO deptDTO : deptDTOList) { for (DeptDTO deptDTO : deptDTOList) {
RStatEventMVO r = new RStatEventMVO(); RStatEventMVO r = new RStatEventMVO();
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
r.setEventMeasurementAverage(0); r.setEventMeasurementAverage(0);
r.setEventMeasurementAccrued(0); r.setEventMeasurementAccrued(0);
r.setEventFreq(0.0F); r.setEventFreq(0.0F);
@@ -104,6 +105,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgQ, RStatEventMVO.class); RStatEventMVO r = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgQ.getOrgNo()); DeptDTO data1 = deptMap.get(orgQ.getOrgNo());
r.setEventName(data1.getName()); r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r); b.add(r);
} }
@@ -113,7 +115,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO); linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
} }
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values()); List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa); arrayVO.setColumns(aa);
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
@@ -132,9 +134,9 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
public List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param) { public List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -176,13 +178,29 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (RStatEventOrgQ orgQ : value) { for (RStatEventOrgQ orgQ : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -197,8 +215,8 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
//子节点 获取所有得各单位类型 //子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//获取配网信息 //获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData(); 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); RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(org.getOrgNo()); DeptDTO deptDTO = deptMap.get(org.getOrgNo());
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r); eventVO.add(r);
} }
@@ -238,7 +257,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId())) List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
this.assignDept(notDeptList, eventVO, arrayVO); this.assignDept(notDeptList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
}); });
@@ -264,9 +283,9 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param) { public List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (RStatEventOrgQ orgQ : value) { for (RStatEventOrgQ orgQ : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -329,6 +364,7 @@ public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper,
for (DeptDTO dictData : deptDTOList) { for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO(); RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName()); notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0); notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0); notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F); 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(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//对象主节点 获取所有得暂降类型 //对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode( List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
@@ -73,6 +73,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (DeptDTO deptDTO : deptDTOList) { for (DeptDTO deptDTO : deptDTOList) {
RStatEventMVO r = new RStatEventMVO(); RStatEventMVO r = new RStatEventMVO();
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
r.setEventMeasurementAverage(0); r.setEventMeasurementAverage(0);
r.setEventMeasurementAccrued(0); r.setEventMeasurementAccrued(0);
r.setEventFreq(0.0F); r.setEventFreq(0.0F);
@@ -104,6 +105,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class); RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgY.getOrgNo()); DeptDTO data1 = deptMap.get(orgY.getOrgNo());
r.setEventName(data1.getName()); r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r); b.add(r);
} }
@@ -113,7 +115,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO); linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
} }
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values()); List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa); arrayVO.setColumns(aa);
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
@@ -132,9 +134,9 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) { public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -176,13 +178,29 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (RStatEventOrgY orgY : value) { for (RStatEventOrgY orgY : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -197,8 +215,8 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
//子节点 获取所有得各单位类型 //子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合 //获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList()); List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
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()));
//获取配网信息 //获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData(); 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); RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(orgY.getOrgNo()); DeptDTO deptDTO = deptMap.get(orgY.getOrgNo());
r.setEventName(deptDTO.getName()); r.setEventName(deptDTO.getName());
r.setSort(deptDTO.getSort());
eventVO.add(r); eventVO.add(r);
} }
@@ -238,7 +257,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId())) List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
this.assignDept(notDeptList, eventVO, arrayVO); this.assignDept(notDeptList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName())); eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO); arrayVOList.add(arrayVO);
} }
}); });
@@ -264,9 +283,9 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) { public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) {
//各单位类型 //各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData(); 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集合 //获取部门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; DictData eventData;
//判断是是否传入检测点信息值(电压) //判断是是否传入检测点信息值(电压)
@@ -308,13 +327,29 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (RStatEventOrgY orgY : value) { for (RStatEventOrgY orgY : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class); RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName()); rStatEventMVO.setEventName(data.getName());
rStatEventMVO.setSort(data.getSort());
arrayVOList.add(rStatEventMVO); 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; return arrayVOList;
} }
@@ -330,6 +365,7 @@ public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper,
for (DeptDTO dictData : deptDTOList) { for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO(); RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName()); notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0); notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0); notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F); 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventQMapper; 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.RStatEventQ;
import com.njcn.event.pojo.po.RStatEventY;
import com.njcn.event.pojo.vo.RArrayVO; import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO; import com.njcn.event.pojo.vo.RStatEventMVO;
import com.njcn.event.service.majornetwork.RStatEventQService; 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.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; 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.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -35,6 +41,7 @@ public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStat
private final RStatEventQMapper rStatEventQMapper; private final RStatEventQMapper rStatEventQMapper;
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override @Override
public List<RArrayVO> getRStatEventQAll(StatisticsBizBaseParam param) { public List<RArrayVO> getRStatEventQAll(StatisticsBizBaseParam param) {
@@ -51,11 +58,14 @@ public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStat
//获取主网id信息 //获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData(); 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>() List<RStatEventQ> list = rStatEventQMapper.selectInfoList(baseParam,mainnetData.getId());
.eq(RStatEventQ::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); 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(); DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); 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>() List<RStatEventQ> list = rStatEventQMapper.selectInfoList(baseParam,distributionData.getId());
.eq(RStatEventQ::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
//根据暂态指标分组 //根据暂态指标分组
Map<String, List<RStatEventQ>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventQ::getEventType)); 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventYMapper; 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.po.RStatEventY;
import com.njcn.event.pojo.vo.RArrayVO; import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO; 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.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; 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.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -35,6 +41,7 @@ public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStat
private final RStatEventYMapper rStatEventYMapper; private final RStatEventYMapper rStatEventYMapper;
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
@Override @Override
public List<RArrayVO> getRStatEventYAll(StatisticsBizBaseParam param) { public List<RArrayVO> getRStatEventYAll(StatisticsBizBaseParam param) {
@@ -51,11 +58,14 @@ public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStat
//获取主网id信息 //获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData(); 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>() List<RStatEventY> list = rStatEventYMapper.selectInfoList(baseParam,mainnetData.getId());
.eq(RStatEventY::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); 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(); DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向) //初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>(); 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>() List<RStatEventY> list = rStatEventYMapper.selectInfoList(baseParam,distributionData.getId());
.eq(RStatEventY::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
//根据暂态指标分组 //根据暂态指标分组
Map<String, List<RStatEventY>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventY::getEventType)); 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.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO; import com.njcn.event.pojo.vo.RSubstationIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationMService; import com.njcn.event.service.majornetwork.RStatSubstationMService;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -51,7 +52,7 @@ public class RStatSubstationMServiceImpl extends ServiceImpl<RStatSubstationMMap
RSubstationIconVO rSubstationIconVO = new RSubstationIconVO(); RSubstationIconVO rSubstationIconVO = new RSubstationIconVO();
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class); StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
//变电站id //变电站id
// baseParam.setIds(this.powerrIdList(param.getId())); baseParam.setIds(this.powerrIdList(param.getId()));
String string = param.getType().toString(); String string = param.getType().toString();
switch (string) { switch (string) {
//查询变变电站暂态分布(按发生频次)-年数据 //查询变变电站暂态分布(按发生频次)-年数据
@@ -77,7 +78,7 @@ public class RStatSubstationMServiceImpl extends ServiceImpl<RStatSubstationMMap
List<RSubstationIcon2VO> rSubstationIconVO = new ArrayList<>(); List<RSubstationIcon2VO> rSubstationIconVO = new ArrayList<>();
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class); StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
//获取变电站id //获取变电站id
// baseParam.setIds(this.powerrIdList(param.getId())); baseParam.setIds(this.powerrIdList(param.getId()));
String string = param.getType().toString(); String string = param.getType().toString();
switch (string) { 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.po.RStatSubstationVoltageM;
import com.njcn.event.pojo.vo.RVoltageIconVO; import com.njcn.event.pojo.vo.RVoltageIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationVoltageMService; 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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@@ -26,10 +36,35 @@ import java.util.List;
public class RStatSubstationVoltageMServiceImpl extends ServiceImpl<RStatSubstationVoltageMMapper, RStatSubstationVoltageM> implements RStatSubstationVoltageMService { public class RStatSubstationVoltageMServiceImpl extends ServiceImpl<RStatSubstationVoltageMMapper, RStatSubstationVoltageM> implements RStatSubstationVoltageMService {
private final RStatSubstationVoltageMMapper rStatSubstationVoltageMMapper; private final RStatSubstationVoltageMMapper rStatSubstationVoltageMMapper;
private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
@Override @Override
public List<RVoltageIconVO> getStatSubstationIcon(StatisticsBizBaseParam param) { 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); 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; package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient; import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO; 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.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.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam; import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.po.RmpEventDetailPO;
@@ -22,7 +23,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; 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; import java.util.stream.Collectors;
/** /**
@@ -63,8 +66,6 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
if (CollectionUtil.isEmpty(data)) { if (CollectionUtil.isEmpty(data)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 创建返回集合
List<RmpEventDetailVO> info = new ArrayList<>();
// 查询事件类型字典表 // 查询事件类型字典表
List<DictData> eventStatisData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); 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(); String monitorSort = dicDataFeignClient.getDicDataById(param.getMonitorSort().get(0)).getData().getName();
for (PmsGeneralDeviceDTO pmsGeneralDeviceDTO : data) { // 取出所有监测点
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTO.getMonitorIdList())) { List<String> monitorIds = data.stream().flatMap(pmsGeneralDeviceDTO -> pmsGeneralDeviceDTO.getMonitorIdList().stream()).collect(Collectors.toList());
continue; if (CollUtil.isEmpty(monitorIds)) {
} return Collections.emptyList();
// 查询监测点信息
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());
}
}
}
} }
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.CollUtil;
import cn.hutool.core.collection.CollectionUtil; 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.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient; import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.StatationStatClient; 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.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.event.mapper.majornetwork.RStatEventOrgMapper; import com.njcn.event.mapper.majornetwork.RStatEventOrgMapper;
import com.njcn.event.mapper.majornetwork.RStatOrgMapper; import com.njcn.event.mapper.majornetwork.RStatOrgMapper;
import com.njcn.event.mapper.majornetwork.RStatSubstationMapper; 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.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -56,10 +56,10 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
private final DeptFeignClient deptFeignClient; private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient; private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final DicDataFeignClient dicDataFeignClient;
private final MonitorClient monitorClient; private final MonitorClient monitorClient;
private final StatationStatClient statationStatClient; private final StatationStatClient statationStatClient;
@@ -72,65 +72,51 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
*/ */
@Override @Override
public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) { public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) {
//获取所有子部门信息
// 获取当前用户的部门的子部门信息 List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); if (CollectionUtil.isEmpty(deptDTOList)) {
pmsDeviceInfoParam.setDeptIndex(param.getId()); return Collections.emptyList();
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO()); }
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData(); // 取出单位code
List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if (CollectionUtil.isEmpty(data)) { if (CollectionUtil.isEmpty(deptCode)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 获取主网的id // 获取主网的id
String mainnetPointId = getMainnetPointId(); String mainnetPointId = getMainnetPointId();
// 创建返回集合 // 创建返回集合
List<RStatOrgVO> info = new ArrayList<>(); List<RStatOrgVO> result = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日 // 类型1年 2季度 3月份 4日
switch (param.getType()) { switch (param.getType()) {
case 1: case 1:
// 获取年区域暂态指标统计 // 获取年区域暂态指标统计
info = rStatOrgMapper.getYearRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); result = rStatOrgMapper.getYearRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
case 2: case 2:
// 获取季区域暂态指标统计 // 获取季区域暂态指标统计
info = rStatOrgMapper.getQuarterRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); result = rStatOrgMapper.getQuarterRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
case 3: case 3:
// 获取月区域暂态指标统计 // 获取月区域暂态指标统计
info = rStatOrgMapper.getMonthRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); result = rStatOrgMapper.getMonthRStatOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
default: default:
break; break;
} }
if (CollUtil.isEmpty(result)) {
if (CollUtil.isEmpty(info)) {
return Collections.emptyList(); return Collections.emptyList();
} }
for (RStatOrgVO rStatOrgVO : result) {
for (RStatOrgVO rStatOrgVO : info) { rStatOrgVO.setEventMeasurementRatioAverage(
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble( df.format(((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0)) * 100));
df.format((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0))) * 100); rStatOrgVO.setEventMeasurementRatioAccrued(
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble( df.format(((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0)) * 100));
df.format((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0))) * 100);
} }
// 匹配单位名称 // 匹配单位名称
for (PmsGeneralDeviceDTO dto : data) { Map<String, DeptDTO> deptDTOMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO -> DeptDTO));
for (RStatOrgVO vo : info) { return result.stream().peek(vo -> {
if (dto.getIndex().equals(vo.getOrgNo())) { vo.setOrgName(deptDTOMap.get(vo.getOrgNo()).getName());
vo.setOrgName(dto.getName()); }).collect(Collectors.toList());
}
}
}
return info;
} }
@@ -142,132 +128,104 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
*/ */
@Override @Override
public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) { public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) {
//获取所有子部门信息
// 获取当前用户的部门的子部门信息 List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); if (CollectionUtil.isEmpty(deptDTOList)) {
pmsDeviceInfoParam.setDeptIndex(param.getId()); return Collections.emptyList();
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO()); }
List<SimpleDTO> voltageLevel = param.getVoltageLevel().stream().map(s -> { // 取出单位code
SimpleDTO simpleDTO = new SimpleDTO(); List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
simpleDTO.setId(s); if (CollectionUtil.isEmpty(deptCode)) {
return simpleDTO;
}).collect(Collectors.toList());
pmsDeviceInfoParam.setVoltageLevel(voltageLevel);
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(data)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 获取主网的id // 获取主网的id
String mainnetPointId = getMainnetPointId(); String mainnetPointId = getMainnetPointId();
//创建返回集合 //创建返回集合
List<RStatEventOrgVO> info = new ArrayList<>(); List<RStatEventOrgVO> result = new ArrayList<>();
// 根据暂态指标枚举查询暂态指标 // 创建集合封装查询数据
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<RStatEventOrgPO> temp = new ArrayList<>(); List<RStatEventOrgPO> temp = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日 // 类型1年 2季度 3月份 4日
switch (param.getType()) { switch (param.getType()) {
case 1: case 1:
// 获取年区域暂态指标分类统计表 // 获取年区域暂态指标分类统计表
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
case 2: case 2:
// 获取季区域暂态指标分类统计表 // 获取季区域暂态指标分类统计表
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
case 3: case 3:
// 获取月区域暂态指标分类统计表 // 获取月区域暂态指标分类统计表
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId); temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptCode, param.getStartTime(), param.getEndTime(), mainnetPointId);
break; break;
default: default:
break; break;
} }
if (CollUtil.isEmpty(temp)) { if (CollUtil.isEmpty(temp)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 根据暂态指标枚举查询暂态指标
// 通过单位id将集合转换为map集合 List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
Map<String, List<RStatEventOrgPO>> map = temp DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo)); // 根据暂态指标code转换成map
Map<String, DictData> eventStatisMap = eventStatis.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
map.forEach((orgOn, rStatEventOrgVOs) -> { // 通过单位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(); RStatEventOrgVO rStatEventOrgVO = new RStatEventOrgVO();
// 基础属性赋值 // 基础属性赋值
for (RStatEventOrgPO tmp : rStatEventOrgVOs) { if (rStatEventOrgVO.getOrgNo() == null) {
if (rStatEventOrgVO.getOrgNo() == null) { rStatEventOrgVO.setOrgNo(pos.get(0).getOrgNo());
rStatEventOrgVO.setOrgNo(tmp.getOrgNo()); rStatEventOrgVO.setOrgName(deptDTOMap.get(pos.get(0).getOrgNo()).getName());
rStatEventOrgVO.setDataDate(tmp.getDataDate()); rStatEventOrgVO.setDataDate(pos.get(0).getDataDate());
rStatEventOrgVO.setEffectiveMeasurementAverage(tmp.getEffectiveMeasurementAverage()); rStatEventOrgVO.setEffectiveMeasurementAverage(pos.get(0).getEffectiveMeasurementAverage());
rStatEventOrgVO.setEffectiveMeasurementAccrued(tmp.getEffectiveMeasurementAccrued()); rStatEventOrgVO.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementAverage(tmp.getEventMeasurementAverage()); rStatEventOrgVO.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage());
rStatEventOrgVO.setEventMeasurementAccrued(tmp.getEventMeasurementAccrued()); rStatEventOrgVO.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((tmp.getEventMeasurementAverage() * 1.0) / (tmp.getEffectiveMeasurementAverage() * 1.0))) * 100); 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((tmp.getEventMeasurementAccrued() * 1.0) / (tmp.getEffectiveMeasurementAccrued() * 1.0))) * 100); rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAccrued() * 1.0) / (pos.get(0).getEffectiveMeasurementAccrued() * 1.0))) * 100);
rStatEventOrgVO.setDataType(tmp.getDataType()); rStatEventOrgVO.setDataType(pos.get(0).getDataType());
}
} }
for (RStatEventOrgPO tmp : rStatEventOrgVOs) { // 暂态指标赋值
// 暂态指标赋值 for (RStatEventOrgPO po : pos) {
for (DictData eventStati : eventStatis) { String eventStatisCode = eventStatisMap.get(po.getEventType()).getCode();
if (eventStati.getId().equals(tmp.getEventType())) { if (eventStatisCode.equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) { // 日均短时中断
// 日均短时中断 rStatEventOrgVO.setDayShortInterruptions(po.getEEventMeasurementAverage());
rStatEventOrgVO.setDayShortInterruptions(tmp.getEEventMeasurementAverage()); // 累计短时中断
// 累计短时中断 rStatEventOrgVO.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
rStatEventOrgVO.setCumulativeShortInterruptions(tmp.getEventMeasurementAccrued()); // 日均短时中断占比
// 日均短时中断占比 rStatEventOrgVO.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
rStatEventOrgVO.setDayShortInterruptionsProportion(tmp.getEEventMeasurementRatioAverage()); // 累计短时中断占比
// 累计短时中断占比 rStatEventOrgVO.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(tmp.getEEventMeasurementRatioAccrued()); }
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_RISE.getCode())) {
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) { // 日均电压暂升
// 日均电压暂升 rStatEventOrgVO.setDayVoltageRise(po.getEEventMeasurementAverage());
rStatEventOrgVO.setDayVoltageRise(tmp.getEEventMeasurementAverage()); // 累计电压暂升
// 累计电压暂升 rStatEventOrgVO.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
rStatEventOrgVO.setCumulativeVoltageRise(tmp.getEventMeasurementAccrued()); // 日均电压暂升占比
// 日均电压暂升占比 rStatEventOrgVO.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
rStatEventOrgVO.setDayVoltageRiseProportion(tmp.getEEventMeasurementRatioAverage()); // 累计电压暂升占比
// 累计电压暂升占比 rStatEventOrgVO.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
rStatEventOrgVO.setCumulativeVoltageRiseProportion(tmp.getEEventMeasurementRatioAccrued()); }
if (eventStatisCode.equals(DicDataEnum.VOLTAGE_DIP.getCode())) {
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) { // 日均电压暂降
// 日均电压暂降 rStatEventOrgVO.setDayVoltageDip(po.getEEventMeasurementAverage());
rStatEventOrgVO.setDayVoltageDip(tmp.getEEventMeasurementAverage()); // 累计电压暂降
// 累计电压暂降 rStatEventOrgVO.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
rStatEventOrgVO.setCumulativeVoltageDip(tmp.getEventMeasurementAccrued()); // 日均电压暂降占比
// 日均电压暂降占比 rStatEventOrgVO.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
rStatEventOrgVO.setDayVoltageDipProportion(tmp.getEEventMeasurementRatioAverage()); // 累计电压暂降占比
// 累计电压暂降占比 rStatEventOrgVO.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
rStatEventOrgVO.setCumulativeVoltageDipProportion(tmp.getEEventMeasurementRatioAccrued());
}
}
} }
} }
info.add(rStatEventOrgVO); result.add(rStatEventOrgVO);
}); });
return result;
// 匹配单位名称
for (PmsGeneralDeviceDTO dto : data) {
for (RStatEventOrgVO vo : info) {
if (dto.getIndex().equals(vo.getOrgNo())) {
vo.setOrgName(dto.getName());
}
}
}
return info;
} }
/** /**
@@ -279,80 +237,67 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
@Override @Override
public List<RStatSubstationVO> getRStatSubstation public List<RStatSubstationVO> getRStatSubstation
(UniversalFrontEndParam param) { (UniversalFrontEndParam param) {
//获取所有子部门信息
// 获取当前用户的部门的子部门信息 List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); if (CollectionUtil.isEmpty(deptDTOList)) {
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
//创建返回集合
List<RStatSubstationVO> info = new ArrayList<>();
if (CollectionUtil.isEmpty(data)) {
return Collections.emptyList(); return Collections.emptyList();
} }
//创建返回集合 // 取出单位code
List<RStatSubstationVO> temp = new ArrayList<>(); List<String> deptCode = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if (CollectionUtil.isEmpty(deptCode)) {
for (PmsGeneralDeviceDTO dto : data) { return Collections.emptyList();
// 创建对象封装数据
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);
}
} }
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());
} }
/** /**