代码调整

This commit is contained in:
2022-11-08 09:48:02 +08:00
parent 7b0c2435fc
commit 3abd49707f
290 changed files with 13772 additions and 1639 deletions

View File

@@ -0,0 +1,102 @@
package com.njcn.event.controller.distribution;
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.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 配网-暂态事件分布统计
*
* @author yzh
* @date 2022/10/27
*/
@RestController
@RequestMapping("/pwEventCategoryDetails")
@Api(tags = "配网-暂态事件分布统计")
@RequiredArgsConstructor
public class PwEventCategoryDetailsController extends BaseController {
private final PwEventCategoryDetailsService pwEventCategoryDetailsService;
/**
* 获取配网区域暂态指标统计
*
* @param param 前端传入参数
* @return 配网区域暂态指标统计
*/
@PostMapping("/getPwEventCategoryDetails")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网暂态事件分布统计")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<EventDistributionStatisticsTableVO>> getPwEventCategoryDetails(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwEventCategoryDetails");
List<EventDistributionStatisticsTableVO> list = pwEventCategoryDetailsService.getPwEventCategoryDetails(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取配网持续时间概率分布函数
*
* @param param 前端传入参数
* @return 配网持续时间概率分布函数
*/
@PostMapping("/getPwDurationLineChart")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网持续时间概率分布函数")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<SimpleVO>> getPwDurationLineChart(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwDurationLineChart");
List<SimpleVO> list = pwEventCategoryDetailsService.getPwDurationLineChart(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取配网暂降幅值概率分布函数
*
* @param param 前端传入参数
* @return 配网持续时间概率分布函数
*/
@PostMapping("/getPwFeatureAmplitudeLineChart")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网暂降幅值概率分布函数")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<SimpleVO>> getPwFeatureAmplitudeLineChart(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwFeatureAmplitudeLineChart");
List<SimpleVO> list = pwEventCategoryDetailsService.getPwFeatureAmplitudeLineChart(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取配网暂态指标分布统计曲线图
*
* @param param 前端传入参数
* @return 配网持续时间概率分布函数
*/
@PostMapping("/getPwEventFeatureAmplitudeCurve")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网暂态指标分布统计曲线图")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<EventFeatureAmplitudeCurveVO> getPwEventFeatureAmplitudeCurve(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwEventFeatureAmplitudeCurve");
EventFeatureAmplitudeCurveVO vo = pwEventCategoryDetailsService.getPwEventFeatureAmplitudeCurve(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
}

View File

@@ -0,0 +1,88 @@
package com.njcn.event.controller.distribution;
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.REventPolylineVO;
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.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-09
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "配网指标分类概览-监测点分类总览")
@RequestMapping("/event/pwRStatHarmonic")
public class PwRStatEventController extends BaseController {
private final RStatEventYService rStatEventYService;
private final RStatEventQService rStatEventQService;
private final RStatEventMService rStatEventMService;
/**
* 查询查询监测点稳态指标 日/月点数
*/
@PostMapping("/getPwAllRStatEvent")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态累计超标监测点数")
public HttpResult<List<RArrayVO>> getPwAllRStatEvent(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwAllRStatEvent");
List<RArrayVO> rStatHarmonicMAll = null;
String string = param.getType().toString();
switch (string) {
//查询超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicMAll = rStatEventYService.getPwRStatEventYAll(param);
break;
//查询超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicMAll = rStatEventQService.getPwRStatEventQAll(param);
break;
//查询超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicMAll = rStatEventMService.getPwRStatEventMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicMAll, methodDescribe);
}
/**
* 暂态监测点-频率偏差-电压统计图
*/
@PostMapping("/getPwRStatHarmonicIconDate")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态监测点-频率偏差-越线日期统计图")
public HttpResult<List<REventPolylineVO>> getPwRStatHarmonicIconDate(@RequestBody REventMParam param) {
String methodDescribe = getMethodDescribe("getPwRStatHarmonicIconDate");
List<REventPolylineVO> rStatHarmonicIcon = rStatEventMService.getPwRStatHarmonicIcon2(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
}
}

View File

@@ -0,0 +1,103 @@
package com.njcn.event.controller.distribution;
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.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-09
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "配网指标分类概览-各单位分类总览")
@RequestMapping("/event/pwRStatHarmonic")
public class PwRStatEventOrgController extends BaseController {
private final RStatEventOrgYService rStatEventOrgYService;
private final RStatEventOrgQService rStatEventOrgQService;
private final RStatEventOrgMService rStatEventOrgMService;
/**
* 查询查询监测点暂态指标 日/月点数
*/
@PostMapping("/getPwAllRStatEventOrg")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态累计超标监测点数")
public HttpResult<List<RArrayVO>> getPwAllRStatEventOrg(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwAllRStatEventOrg");
List<RArrayVO> rStatHarmonicOrgAll = null;
String string = param.getType().toString();
switch (string) {
//查询超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicOrgAll = rStatEventOrgYService.getPwRStatEventOrgYAll(param);
break;
//查询超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicOrgAll = rStatEventOrgQService.getPwRStatEventOrgQAll(param);
break;
//查询超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicOrgAll = rStatEventOrgMService.getPwRStatEventOrgMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicOrgAll, methodDescribe);
}
/**
* 查询查询监测点稳态指标 日/月点数
*/
@PostMapping("/getPwAllRStatEventOrgIcon")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询暂态各单位超标监测统计图")
public HttpResult<List<RStatEventMVO>> getPwAllRStatEventOrgIcon(@RequestBody REventMParam param) {
String methodDescribe = getMethodDescribe("getPwAllRStatEventOrgIcon");
List<RStatEventMVO> orgList = null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数统计图-年数据
case BizParamConstant.STAT_BIZ_YEAR:
orgList = rStatEventOrgYService.getPwRStatHarmonicOrgYIcon(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
orgList = rStatEventOrgQService.getPwRStatHarmonicOrgQIcon(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
orgList = rStatEventOrgMService.getPwRStatHarmonicOrgMIcon(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, orgList, methodDescribe);
}
}

View File

@@ -0,0 +1,70 @@
package com.njcn.event.controller.distribution;
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.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 配网-暂态事件统计
*
* @author yzh
* @date 2022/10/24
*/
@RestController
@RequestMapping("/pwRStatOrg")
@Api(tags = "配网-暂态事件统计")
@RequiredArgsConstructor
public class PwRStatOrgController extends BaseController {
private final PwRStatOrgService pwRStatOrgService;
/**
* 获取配网区域暂态事件统计
*
* @param param 前端传入参数
* @return 配网区域暂态指标统计
*/
@PostMapping("/getPwRStatOrg")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网区域暂态事件统计")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatOrgVO>> getPwRStatOrg(@RequestBody PwUniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getPwRStatOrg");
List<RStatOrgVO> list = pwRStatOrgService.getPwRStatOrg(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取配网区域暂态事件分类统计
*
* @param param 前端传入参数
* @return 配网区域暂态指标统计
*/
@PostMapping("/getPwRStatOrgClassified")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取配网区域暂态事件分类统计")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatEventOrgVO>> getPwRStatOrgClassified(@RequestBody PwUniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getPwRStatOrgClassified");
List<RStatEventOrgVO> list = pwRStatOrgService.getPwRStatOrgClassified(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -0,0 +1,52 @@
package com.njcn.event.controller.distribution;
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.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
import com.njcn.event.service.distribution.PwRmpEventDetailService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 配网-暂态事件明细
*
* @author yzh
* @date 2022/10/31
*/
@RestController
@RequestMapping("/pwEventCategoryDetails")
@Api(tags = "配网-暂态事件明细")
@RequiredArgsConstructor
public class PwRmpEventDetailController extends BaseController {
private final PwRmpEventDetailService pwRmpEventDetailService;
/**
* 获取配网暂态事件明细
*
* @param param 前端传入参数
* @return 暂态事件明细
*/
@PostMapping("/getPwRmpEventDetail")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取暂态事件明细")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<PwRmpEventDetailVO>> getPwRmpEventDetail(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getPwRmpEventDetail");
List<PwRmpEventDetailVO> list = pwRmpEventDetailService.getPwRmpEventDetail(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -8,7 +8,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaAnalysisVO;
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO;
import com.njcn.event.service.AreaAnalysisService;
import com.njcn.event.service.majornetwork.AreaAnalysisService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -11,7 +11,7 @@ import com.njcn.event.pojo.vo.AreaLineVO;
import com.njcn.event.pojo.vo.EventHeatMapVO;
import com.njcn.event.pojo.vo.EventSeverityVO;
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO;
import com.njcn.event.service.AreaLineService;
import com.njcn.event.service.majornetwork.AreaLineService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -7,7 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaStatisticalVO;
import com.njcn.event.service.AreaStatisticalService;
import com.njcn.event.service.majornetwork.AreaStatisticalService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -7,7 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.service.EventDetailService;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -95,7 +96,7 @@ public class EventDetailController extends BaseController {
public HttpResult<List<EventDetail>> getEventDetail(@RequestBody List<String> lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
String methodDescribe = getMethodDescribe("getEventDetail");
LogUtil.njcnDebug(log, "{}监测点id为{}", methodDescribe, lineIndexes);
List<EventDetail> result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime);
List<EventDetail> result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime, new ArrayList<>());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@@ -119,7 +120,7 @@ public class EventDetailController extends BaseController {
public HttpResult<List<EventDetail>> getEventDetailLimit(@RequestBody List<String> lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) {
String methodDescribe = getMethodDescribe("getEventDetailLimit");
LogUtil.njcnDebug(log, "{}监测点id为{}", methodDescribe, lineIndexes);
List<EventDetail> result = eventDetailService.getEventDetailLimit(lineIndexes, startTime, endTime, pageSize, pageNum);
List<EventDetail> result = eventDetailService.getEventDetailLimit(lineIndexes, startTime, endTime, pageSize, pageNum, new ArrayList<>());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}

View File

@@ -0,0 +1,103 @@
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.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.majornetwork.EventDistributionStatisticsService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 主网-暂态指标分布统计
*
* @author yzh
* @date 2022/10/20
*/
@RestController
@RequestMapping("/eventDistributionStatistics")
@Api(tags = "主网-暂态指标分布统计")
@RequiredArgsConstructor
public class EventDistributionStatisticsController extends BaseController {
private final EventDistributionStatisticsService eventDistributionStatisticsService;
/**
* 获取暂态指标分布统计表格
*
* @param param 前端传入参数
* @return 暂态指标分布统计
*/
@PostMapping("/getEventDistributionStatisticsTable")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取暂态指标分布统计表格")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<EventDistributionStatisticsTableVO>> getEventDistributionStatisticsTable(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getEventDistributionStatisticsTable");
List<EventDistributionStatisticsTableVO> eventDistributionStatisticsVO = eventDistributionStatisticsService.getEventDistributionStatisticsTable(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDistributionStatisticsVO, methodDescribe);
}
/**
* 获取持续时间折线图
*
* @param param 前端传入参数
* @return 持续时间折线图
*/
@PostMapping("/getEventDurationLineChart")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取持续时间折线图")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<SimpleVO>> getEventDurationLineChart(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getEventDurationLineChart");
List<SimpleVO> list = eventDistributionStatisticsService.getEventDurationLineChart(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取特征幅值折线图
*
* @param param 前端传入参数
* @return 特征幅值折线图
*/
@PostMapping("/getEventFeatureAmplitudeLineChart")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取特征幅值折线图")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<SimpleVO>> getEventFeatureAmplitudeLineChart(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getEventFeatureAmplitudeLineChart");
List<SimpleVO> list = eventDistributionStatisticsService.getEventFeatureAmplitudeLineChart(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取暂态指标分布统计曲线图
*
* @param param 前端传入参数
* @return 暂态指标分布统计曲线图
*/
@PostMapping("/getEventFeatureAmplitudeCurve")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取暂态指标分布统计曲线图")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<EventFeatureAmplitudeCurveVO> getEventFeatureAmplitudeCurve(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getEventFeatureAmplitudeCurve");
EventFeatureAmplitudeCurveVO curve = eventDistributionStatisticsService.getEventFeatureAmplitudeCurve(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, curve, methodDescribe);
}
}

View File

@@ -0,0 +1,66 @@
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.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.EventMonitorReportParam;
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
import com.njcn.event.pojo.vo.EventMonitorReportVO;
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
import com.njcn.event.service.majornetwork.EventMonitorReportService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 暂态指标监测点统计报表
* @Title EventMonitorDailyReportController
* @Package com.njcn.event.controller
* @Author jianghaifei
* @Date 2022-10-25 09:36
* @Version V1.0
*/
@RestController
@RequestMapping("/eventMonitorReport")
@Api(tags = "主网-暂态指标统计报表")
@RequiredArgsConstructor
public class EventMonitorReportController extends BaseController {
private final EventMonitorReportService eventMonitorReportService;
@PostMapping("getDailyReport")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态指标监测点日报")
public HttpResult<List<EventMonitorReportVO>> getDailyReport(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
String methodDescribe = getMethodDescribe("getDailyReport");
List<EventMonitorReportVO> list = eventMonitorReportService.getDailyReport(eventMonitorReportParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@PostMapping("getEventDipShortDistribution")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态指标监测点电压暂降和短时中断分布情况")
public HttpResult<EventDipShortDistributionVO> getEventDipShortDistribution(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
String methodDescribe = getMethodDescribe("getEventDipShortDistribution");
EventDipShortDistributionVO eventDipShortDistributionVO = eventMonitorReportService.getEventDipShortDistributionByCond(eventMonitorReportParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDipShortDistributionVO, methodDescribe);
}
@PostMapping("getEventRiseDistribution")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("暂态指标监测点电压暂升分布情况")
public HttpResult<EventRiseDistributionVO> getEventRiseDistribution(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
String methodDescribe = getMethodDescribe("getEventRiseDistribution");
EventRiseDistributionVO eventRiseDistributionVO = eventMonitorReportService.getEventRiseDistributionByCond(eventMonitorReportParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventRiseDistributionVO, methodDescribe);
}
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
@@ -11,10 +11,9 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.EventAnalysisService;
import com.njcn.event.service.majornetwork.EventAnalysisService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;

View File

@@ -0,0 +1,101 @@
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

@@ -0,0 +1,106 @@
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

@@ -0,0 +1,80 @@
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

@@ -1,21 +1,18 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.vo.DetailVO;
import com.njcn.event.pojo.vo.GeneralVO;
import com.njcn.event.pojo.vo.ReasonsVO;
import com.njcn.event.pojo.vo.WaveTypeVO;
import com.njcn.event.service.ReportService;
import com.njcn.poi.util.PoiUtil;
import com.njcn.event.service.majornetwork.ReportService;
import com.njcn.web.controller.BaseController;
import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
@@ -23,22 +20,13 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
import java.util.List;
/**

View File

@@ -1,6 +1,6 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -8,20 +8,19 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import com.njcn.event.service.RmpEventDetailService;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 暂态事件明细
* 主网-暂态事件明细
*
* @author yzh
* @date 2022/10/12
@@ -29,7 +28,7 @@ import java.util.List;
@RestController
@RequestMapping("/rmpEventDetail")
@Api(tags = "暂态事件明细")
@Api(tags = "主网-暂态事件明细")
@RequiredArgsConstructor
public class RmpEventDetailController extends BaseController {
@@ -43,11 +42,31 @@ public class RmpEventDetailController extends BaseController {
*/
@PostMapping("/getDetailsOfTransientEvents")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取区域暂态指标统计")
// @ApiImplicitParam(name = "UniversalFrontEndParam", value = "前端参数", required = true)
@ApiOperation("获取暂态事件明细")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RmpEventDetailVO>> getRmpEventDetail(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getRmpEventDetail");
List<RmpEventDetailVO> list = rmpEventDetailService.getRmpEventDetail(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 获取暂态指标类型列表
*
* @return 暂态指标类型列表
*/
@GetMapping("/getEventStatisList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取暂态指标类型列表")
public HttpResult<List<DictData>> getEventStatisList() {
String methodDescribe = getMethodDescribe("getEventStatisList");
List<DictData> list = rmpEventDetailService.getEventStatisList();
if (CollectionUtil.isEmpty(list)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -9,9 +9,10 @@ import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.service.StatisticsOfTransientIndicatorssService;
import com.njcn.event.service.majornetwork.StatisticsOfTransientIndicatorssService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
@@ -22,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 暂态指标统计
* 主网-暂态指标统计
*
* @author yzh
* @date 2022/10/10
@@ -30,7 +31,7 @@ import java.util.List;
@RestController
@RequestMapping("/statisticsOfTransientIndicators")
@Api(tags = "暂态指标统计")
@Api(tags = "主网-暂态指标统计")
@RequiredArgsConstructor
public class StatisticsOfTransientIndicatorsController extends BaseController {
@@ -45,7 +46,7 @@ public class StatisticsOfTransientIndicatorsController extends BaseController {
@PostMapping("/getRStatOrg")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取区域暂态指标统计")
// @ApiImplicitParam(name = "UniversalFrontEndParam", value = "前端参数", required = true)
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatOrgVO>> getRStatOrg(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getRStatOrg");
List<RStatOrgVO> list = statisticsOfTransientIndicatorssService.getRStatOrg(param);
@@ -61,7 +62,7 @@ public class StatisticsOfTransientIndicatorsController extends BaseController {
@PostMapping("/getRStatEventOrg")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取区域暂态指标分类统计表")
// @ApiImplicitParam(name = "UniversalFrontEndParam", value = "前端参数", required = true)
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatEventOrgVO>> getRStatEventOrg(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getRStatEventOrg");
List<RStatEventOrgVO> list = statisticsOfTransientIndicatorssService.getRStatEventOrg(param);
@@ -78,7 +79,7 @@ public class StatisticsOfTransientIndicatorsController extends BaseController {
@PostMapping("/getRStatSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取变电站暂态指标分类统计表")
// @ApiImplicitParam(name = "UniversalFrontEndParam", value = "前端参数", required = true)
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatSubstationVO>> getRStatSubstation(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getRStatSubstation");
List<RStatSubstationVO> list = statisticsOfTransientIndicatorssService.getRStatSubstation(param);

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller;
package com.njcn.event.controller.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
@@ -12,7 +12,7 @@ import com.njcn.event.pojo.param.TransientParam;
import com.njcn.event.pojo.param.WaveFileParam;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.TransientVO;
import com.njcn.event.service.TransientService;
import com.njcn.event.service.majornetwork.TransientService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.controller.area;
package com.njcn.event.controller.majornetwork.area;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -7,10 +7,9 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.AreaSubLineVO;
import com.njcn.event.service.AreaInfoService;
import com.njcn.event.service.majornetwork.AreaInfoService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@@ -1,56 +0,0 @@
package com.njcn.event.mapper;
import com.njcn.event.pojo.vo.RStatOrgVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 暂态指标统计
*
* @author yzh
* @date 2022/10/10
*/
@Mapper
public interface RStatOrgMapper {
/**
* 获取年区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 年区域暂态指标统计
*/
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取季区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 季区域暂态指标统计
*/
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取月区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 月区域暂态指标统计
*/
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
}

View File

@@ -1,16 +0,0 @@
package com.njcn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import org.apache.ibatis.annotations.Mapper;
/**
* 暂态事件明细
*
* @author yzh
* @date 2022/10/12
*/
@Mapper
public interface RmpEventDetailMapper extends BaseMapper<RmpEventDetailVO> {
}

View File

@@ -0,0 +1,76 @@
package com.njcn.event.mapper.distribution;
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
import com.njcn.event.pojo.po.EventDurationLineChartPO;
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 配网-暂态事件分布统计
*
* @author yzh
* @date 2022/10/28
*/
@Mapper
public interface PwEventCategoryDetailsMapper {
/**
* 获取配网暂态指标分布统计
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return com.njcn.event.pojo.po.EventDistributionStatisticsPO
* @author yzh
* @date 2022/10/31
*/
EventDistributionStatisticsPO getPwEventCategoryDetailsMapper(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取配网持续时间折线图
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 持续时间折线图
* @author yzh
* @date 2022/10/31
*/
EventDurationLineChartPO getPwEventDurationLineChart(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取配网特征幅值折线图
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO
* @author yzh
* @date 2022/10/31
*/
EventFeatureAmplitudeLineChartPO getPwEventFeatureAmplitudeLineChart(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取配网监测点暂态事件明细数据
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return java.util.List<com.njcn.event.pojo.po.RmpEventDetailPO>
* @author yzh
* @date 2022/10/31
*/
List<RmpEventDetailPO> getPwRmpEventDetail(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
}

View File

@@ -0,0 +1,60 @@
package com.njcn.event.mapper.distribution;
import com.njcn.event.pojo.po.RStatEventOrgPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 配网-暂态事件统计
*
* @author yzh
* @date 2022/10/25
*/
@Mapper
public interface PwRStatOrgClassifiedMapper {
/**
* 获取配网区域暂态事件分类统计(年)
* <p>
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态事件分类统计(年)
*/
List<RStatEventOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
/**
* 获取配网区域暂态事件分类统计(月)
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
/**
* 获取配网区域暂态事件分类统计(月)
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
}

View File

@@ -0,0 +1,59 @@
package com.njcn.event.mapper.distribution;
import com.njcn.event.pojo.po.RStatOrgPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 配网-暂态事件统计
*
* @author yzh
* @date 2022/10/24
*/
@Mapper
public interface PwRStatOrgMapper {
/**
* 获取配网区域暂态指标统计(年)
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态指标统计(年)
*/
List<RStatOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
/**
* 获取配网区域暂态指标统计(季)
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态指标统计(季)
*/
List<RStatOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
/**
* 获取配网区域暂态指标统计(月)
*
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @return 配网区域暂态指标统计(月)
*/
List<RStatOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.event.mapper.distribution;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import java.util.List;
/**
* 配网-暂态事件明细
*
* @author yzh
* @date 2022/10/31
*/
public interface PwRmpEventDetailMapper {
/**
* 获取配网暂态事件明细
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.po.RmpEventDetailPO>
* @author yzh
* @date 2022/10/31
*/
List<RmpEventDetailPO> getPwRmpEventDetail(UniversalFrontEndParam param);
}

View File

@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.distribution.PwEventCategoryDetailsMapper">
<!--获取暂态指标分布统计-->
<select id="getPwEventCategoryDetailsMapper"
resultType="com.njcn.event.pojo.po.EventDistributionStatisticsPO">
SELECT
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 60000 AND
duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with180000s"
FROM
(
SELECT
duration,
feature_amplitude
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
)
r
</select>
<!--获取持续时间折线图-->
<select id="getPwEventDurationLineChart" resultType="com.njcn.event.pojo.po.EventDurationLineChartPO">
SELECT COALESCE
(
round(sum(CASE WHEN duration &gt; 0 AND duration &lt;= 100 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration100",
COALESCE(
round(sum(CASE WHEN duration &gt; 100 AND duration &lt;= 250 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration250",
COALESCE(
round(sum(CASE WHEN duration &gt; 250 AND duration &lt;= 500 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration500",
COALESCE(
round(sum(CASE WHEN duration &gt; 500 AND duration &lt;= 1000 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration1000",
COALESCE(
round(sum(CASE WHEN duration &gt; 1000 AND duration &lt;= 1100 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration1100"
FROM
(
SELECT
measurement_point_id,
duration
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
)
r
</select>
<!--获取特征幅值折线图-->
<select id="getPwEventFeatureAmplitudeLineChart"
resultType="com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO"> SELECT
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 0 AND feature_amplitude &lt;= 10 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude10",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 10 AND feature_amplitude &lt;= 20 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude20",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 20 AND feature_amplitude &lt;= 30 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude30",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 30 AND feature_amplitude &lt;= 40 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude40",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 40 AND feature_amplitude &lt;= 50 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude50",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 50 AND feature_amplitude &lt;= 60 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude60",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 60 AND feature_amplitude &lt;= 70 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude70",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 70 AND feature_amplitude &lt;= 80 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude80",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 80 AND feature_amplitude &lt;= 90 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude90"
FROM
(
SELECT
measurement_point_id,
feature_amplitude
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
) AS r</select>
<!--获取配网监测点暂态事件明细数据-->
<select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
measurement_point_id as measurementPointId,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude
FROM
`r_mp_event_detail`
</select>
</mapper>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.distribution.PwRStatOrgClassifiedMapper">
<sql id="query_field">
rso.org_no AS orgNo,
rso.data_date AS dataDate,
rso.measurement_type_class AS measurementTypeClass,
rso.effective_measurement_average AS effectiveMeasurementAverage,
rso.effective_measurement_accrued AS effectiveMeasurementAccrued,
rso.event_measurement_average AS eventMeasurementAverage,
rso.event_measurement_accrued AS eventMeasurementAccrued,
rso.event_freq AS eventFreq,
rso.event_count AS eventCount,
rseo.event_type,
rseo.event_measurement_average AS eEventMeasurementAverage,
rseo.event_measurement_accrued AS eEventMeasurementAccrued,
rseo.event_measurement_ratio_average AS eEventMeasurementRatioAverage,
rseo.event_measurement_ratio_accrued AS eEventMeasurementRatioAccrued,
rseo.event_freq AS eEventFreq,
rseo.event_count AS eEventCount,
rseo.data_type AS dataType
</sql>
<sql id="query_where">
rso.data_type = 02
AND rseo.data_type = 02
AND rso.org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="monitorSort != null and monitorSort.size() >0">
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
</sql>
<!--获取配网区域暂态事件分类统计(年)-->
<select id="getYearInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_field"></include>
FROM
r_stat_org_y AS rso
LEFT JOIN r_stat_event_org_y AS rseo ON rso.org_no = rseo.org_no
WHERE
<include refid="query_where"></include>
</select>
<!--获取配网区域暂态事件分类统计(月)-->
<select id="getQuarterInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_field"></include>
FROM
r_stat_org_q AS rso
LEFT JOIN r_stat_event_org_q AS rseo ON rso.org_no = rseo.org_no
WHERE
<include refid="query_where"></include>
</select>
<!--获取配网区域暂态事件分类统计(月)-->
<select id="getMonthInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_field"></include>
FROM
r_stat_org_m AS rso
LEFT JOIN r_stat_event_org_m AS rseo ON rso.org_no = rseo.org_no
WHERE
<include refid="query_where"></include>
</select>
</mapper>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.distribution.PwRStatOrgMapper">
<sql id="query_field">
org_no AS orgNo,
Data_Date AS dataDate,
measurement_type_class AS measurementTypeClass,
effective_measurement_average AS effectiveMeasurementAverage,
effective_measurement_accrued AS effectiveMeasurementAccrued,
event_measurement_average AS eventMeasurementAverage,
event_measurement_accrued AS eventMeasurementAccrued,
event_count AS eventCount,
event_freq AS eventFreq,
data_Type AS dataType
</sql>
<sql id="query_where">
data_type = 02
AND org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(Data_Date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(Data_Date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
<if test="monitorSort != null and monitorSort.size() != 0">
AND measurement_type_class IN
<foreach collection="monitorSort" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</sql>
<!--配网区域暂态指标统计(年)-->
<select id="getYearInfo" resultType="com.njcn.event.pojo.po.RStatOrgPO">
SELECT
<include refid="query_field"></include>
FROM
`r_stat_org_y`
WHERE
<include refid="query_where"></include>
</select>
<!--获取配网区域暂态指标统计(季)-->
<select id="getQuarterInfo" resultType="com.njcn.event.pojo.po.RStatOrgPO">
SELECT
<include refid="query_field"></include>
FROM
`r_stat_org_q`
WHERE
<include refid="query_where"></include>
</select>
<!--获取配网区域暂态指标统计(月)-->
<select id="getMonthInfo" resultType="com.njcn.event.pojo.po.RStatOrgPO">
SELECT
<include refid="query_field"></include>
FROM
`r_stat_org_m`
WHERE
<include refid="query_where"></include>
</select>
</mapper>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.distribution.PwRmpEventDetailMapper">
<!--获取配网暂态事件明细-->
<select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
event_id AS eventId,
measurement_point_id AS measurementPointId,
event_type AS eventType,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude,
phase AS phase,
event_describe AS eventDescribe,
wave_path AS wavePath
FROM
r_mp_event_detail
</select>
</mapper>

View File

@@ -0,0 +1,89 @@
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
import com.njcn.event.pojo.po.EventDurationLineChartPO;
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author yzh
* @date 2022/10/20
*/
@Mapper
public interface EventDistributionStatisticsMapper {
/**
* 获取暂态指标分布统计
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 暂态指标分布统计
*/
EventDistributionStatisticsPO getEventDistributionStatistics(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取持续时间折线图
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 持续时间折线图
*/
EventDurationLineChartPO getEventDurationLineChart(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取特征幅值折线图
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 特征幅值折线图
*/
EventFeatureAmplitudeLineChartPO getEventFeatureAmplitudeLineChart(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取监测点暂态事件明细数据
*
* @param monitorIdList 监测点id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 监测点暂态事件明细数据
*/
List<RmpEventDetailPO> getRmpEventDetail(@Param("monitorIdList") List<String> monitorIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/***
* 获取监测点电压暂降和短时中断分布情况
* @author jianghaifei
* @date 2022-10-27 10:46
* @param map
* @return com.njcn.event.pojo.vo.EventDipShortDistributionVO
*/
EventDipShortDistributionVO getEventDipShortDistributionByCond(Map<String, Object> map);
/***
* 获取监测点电压暂升分布情况
* @author jianghaifei
* @date 2022-10-27 10:46
* @param map
* @return com.njcn.event.pojo.vo.EventRiseDistributionVO
*/
EventRiseDistributionVO getEventRiseDistributionByCond(Map<String, Object> map);
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.mapper;
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.PmsMonitorPO;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.mapper;
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.PqDevice;
import org.apache.ibatis.annotations.Param;

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventD;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-12
*/
public interface RStatEventDMapper extends BaseMapper<RStatEventD> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventM;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-11
*/
public interface RStatEventMMapper extends BaseMapper<RStatEventM> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventOrgM;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-11
*/
public interface RStatEventOrgMMapper extends BaseMapper<RStatEventOrgM> {
}

View File

@@ -1,7 +1,6 @@
package com.njcn.event.mapper;
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.po.RStatEventOrgPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -19,37 +18,43 @@ public interface RStatEventOrgMapper {
/**
* 获取年区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标分类统计表
*/
List<RStatEventOrgVO> getYearRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
/**
* 获取季区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标分类统计表
*/
List<RStatEventOrgVO> getQuarterRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
/**
* 获取月区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param deptIds 部门id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标分类统计表
*/
List<RStatEventOrgVO> getMonthRStatEventOrgInfoInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.RStatEventOrgQ;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-17
*/
public interface RStatEventOrgQMapper extends BaseMapper<RStatEventOrgQ> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.RStatEventOrgY;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-17
*/
public interface RStatEventOrgYMapper extends BaseMapper<RStatEventOrgY> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventQ;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-12
*/
public interface RStatEventQMapper extends BaseMapper<RStatEventQ> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventVoltageM;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-14
*/
public interface RStatEventVoltageMMapper extends BaseMapper<RStatEventVoltageM> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RStatEventY;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-12
*/
public interface RStatEventYMapper extends BaseMapper<RStatEventY> {
}

View File

@@ -0,0 +1,61 @@
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.vo.RStatOrgVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 暂态指标统计
*
* @author yzh
* @date 2022/10/10
*/
@Mapper
public interface RStatOrgMapper {
/**
* 获取年区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标统计
*/
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
/**
* 获取季区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标统计
*/
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
/**
* 获取月区域暂态指标统计
*
* @param deptIds 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标统计
*/
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptIds") List<String> deptIds,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
}

View File

@@ -0,0 +1,35 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatSubstationM;
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
public interface RStatSubstationMMapper extends BaseMapper<RStatSubstationM> {
/**
* 变电站暂态指标超标分布(按发生频次)
* @param param
* @return
*/
RSubstationIconVO getStatSubstationIconM(@Param("param") StatSubstationBizBaseParam param);
/**
* 变电站暂态指标发生频次
* @param param
* @return
*/
List<RSubstationIcon2VO> getStatSubstationIcon2M(@Param("param") StatSubstationBizBaseParam param);
}

View File

@@ -1,7 +1,6 @@
package com.njcn.event.mapper;
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.po.PmsMonitorPO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@@ -0,0 +1,35 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatSubstationQ;
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
public interface RStatSubstationQMapper extends BaseMapper<RStatSubstationQ> {
/**
* 变电站暂态指标超标分布(按发生频次)
* @param param
* @return
*/
RSubstationIconVO getStatSubstationIconQ(@Param("param") StatSubstationBizBaseParam param);
/**
* 变电站暂态指标发生频次
* @param param
* @return
*/
List<RSubstationIcon2VO> getStatSubstationIcon2Q(@Param("param") StatSubstationBizBaseParam param);
}

View File

@@ -0,0 +1,28 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatSubstationVoltageM;
import com.njcn.event.pojo.vo.RVoltageIconVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
public interface RStatSubstationVoltageMMapper extends BaseMapper<RStatSubstationVoltageM> {
/**
* 变电站暂态分布(按电压等级)
* @param param
* @return
*/
List<RVoltageIconVO> getStatSubstationIcon(@Param("param") StatSubstationBizBaseParam param);
}

View File

@@ -0,0 +1,36 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatSubstationY;
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
public interface RStatSubstationYMapper extends BaseMapper<RStatSubstationY> {
/**
* 变电站暂态分布(按发生频次)
* @param param
* @return
*/
RSubstationIconVO getStatSubstationIconY(@Param("param") StatSubstationBizBaseParam param);
/**
* 变电站暂态指标发生频次
* @param param
* @return
*/
List<RSubstationIcon2VO> getStatSubstationIcon2Y(@Param("param") StatSubstationBizBaseParam param);
}

View File

@@ -0,0 +1,33 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 暂态事件明细
*
* @author yzh
* @date 2022/10/12
*/
@Mapper
public interface RmpEventDetailMapper extends BaseMapper<RmpEventDetailVO> {
/**
* 获取暂态事件明细
*
* @param monitorIds 监测点id
* @param eventType 暂态指标类型
* @param startTime 开始时间
* @param endTime 结束时间
* @return 暂态事件明细
*/
List<RmpEventDetailPO> getDetailsOfTransientEvents(@Param("monitorIds") List<String> monitorIds,
@Param("eventType") List<String> eventType,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
}

View File

@@ -0,0 +1,11 @@
package com.njcn.event.mapper.majornetwork;
import org.apache.ibatis.annotations.Mapper;
/**
* @author yzh
* @date 2022/10/19
*/
@Mapper
public interface RmpEventReportDayMapper {
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.mapper;
package com.njcn.event.mapper.majornetwork;
import com.njcn.event.pojo.vo.TransientVO;
import org.apache.ibatis.annotations.Param;

View File

@@ -0,0 +1,438 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper">
<!--获取暂态指标分布统计-->
<select id="getEventDistributionStatistics"
resultType="com.njcn.event.pojo.po.EventDistributionStatisticsPO">
SELECT
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 0 AND r.feature_amplitude &lt;= 10 AND duration &gt; 60000 AND
duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude10with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 10 AND r.feature_amplitude &lt;= 40 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude40with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 40 AND r.feature_amplitude &lt;= 70 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude70with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 70 AND r.feature_amplitude &lt;= 85 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude85with180000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 0 AND
duration &lt;= 20 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with20s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 20 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with100s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 100 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with500s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with1000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with3000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 3000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with20000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 20000
AND duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with60000s",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt; 85 AND r.feature_amplitude &lt;= 90 AND duration &gt; 60000
AND duration &lt;= 180000 THEN 1 ELSE 0 END ), 0 ) "featureAmplitude90with180000s"
FROM
(
SELECT
duration,
feature_amplitude
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
)
r
</select>
<!--获取持续时间折线图-->
<select id="getEventDurationLineChart" resultType="com.njcn.event.pojo.po.EventDurationLineChartPO">
SELECT COALESCE
(
round(sum(CASE WHEN duration &gt; 0 AND duration &lt;= 100 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration100",
COALESCE(
round(sum(CASE WHEN duration &gt; 100 AND duration &lt;= 250 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration250",
COALESCE(
round(sum(CASE WHEN duration &gt; 250 AND duration &lt;= 500 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration500",
COALESCE(
round(sum(CASE WHEN duration &gt; 500 AND duration &lt;= 1000 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration1000",
COALESCE(
round(sum(CASE WHEN duration &gt; 1000 AND duration &lt;= 1100 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100,
0
) "duration1100"
FROM
(
SELECT
measurement_point_id,
duration
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
)
r
</select>
<!--获取特征幅值折线图-->
<select id="getEventFeatureAmplitudeLineChart"
resultType="com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO">
SELECT
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 0 AND feature_amplitude &lt;= 10 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude10",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 10 AND feature_amplitude &lt;= 20 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude20",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 20 AND feature_amplitude &lt;= 30 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude30",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 30 AND feature_amplitude &lt;= 40 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude40",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 40 AND feature_amplitude &lt;= 50 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude50",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 50 AND feature_amplitude &lt;= 60 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude60",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 60 AND feature_amplitude &lt;= 70 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude70",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 70 AND feature_amplitude &lt;= 80 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude80",
COALESCE(round(sum(CASE WHEN feature_amplitude &gt; 80 AND feature_amplitude &lt;= 90 THEN 1 ELSE 0 END) /
COUNT(r.measurement_point_id), 2) * 100, 0) "featureAmplitude90"
FROM
(
SELECT
measurement_point_id,
feature_amplitude
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
) AS r
</select>
<!--获取监测点暂态事件明细数据-->
<select id="getRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
measurement_point_id as measurementPointId,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude
FROM
`r_mp_event_detail`
</select>
<!--获取监测点电压暂降和短时中断分布情况-->
<select id="getEventDipShortDistributionByCond"
resultType="com.njcn.event.pojo.vo.EventDipShortDistributionVO">
SELECT
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 80 AND r.feature_amplitude &lt;= 90 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp90with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 70 AND r.feature_amplitude &lt; 80 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp80with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 60 AND r.feature_amplitude &lt; 70 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp70with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 50 AND r.feature_amplitude &lt; 60 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp60with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 40 AND r.feature_amplitude &lt; 50 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp50with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 30 AND r.feature_amplitude &lt; 40 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp40with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 20 AND r.feature_amplitude &lt; 30 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp30with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 10 AND r.feature_amplitude &lt; 20 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp20with60000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 10 AND
duration &lt;= 100 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with100ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 100 AND
duration &lt;= 250 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with250ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 250 AND
duration &lt;= 500 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with500ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 500 AND
duration &lt;= 1000 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with1000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 1000 AND
duration &lt;= 3000 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with3000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 3000 AND
duration &lt;= 10000 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with10000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 10000 AND
duration &lt;= 20000 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with20000ms",
COALESCE( sum( CASE WHEN r.feature_amplitude &gt;= 0 AND r.feature_amplitude &lt; 10 AND duration &gt; 20000 AND
duration &lt;= 60000 THEN 1 ELSE 0 END ), 0 ) "featureAmp10with60000ms"
FROM
(
SELECT
duration,
feature_amplitude
FROM
r_mp_event_detail
WHERE 1 = 1
AND measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND event_type IN
<foreach collection="eventTypeList" item="type" open="(" close=")" separator=",">
#{type}
</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>
)
r
</select>
<!--获取监测点电压暂升分布情况-->
<select id="getEventRiseDistributionByCond" resultType="com.njcn.event.pojo.vo.EventRiseDistributionVO">
SELECT
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= 120 AND duration &gt; 10 AND duration &lt;= 500 THEN 1 ELSE 0 END), 0) "featureAmp120with500ms",
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= 120 AND duration &gt; 500 AND duration &lt;= 5000 THEN 1 ELSE 0 END), 0) "featureAmp120with5000ms",
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= 120 AND duration &gt; 5000 AND duration &lt;= 60000 THEN 1 ELSE 0 END), 0) "featureAmp120with60000ms",
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= -120 AND r.feature_amplitude &lt;= 110 AND duration &gt; 10 AND duration &lt;= 500 THEN 1 ELSE 0 END), 0) "featureAmp110with500ms",
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= -120 AND r.feature_amplitude &lt;= 110 AND duration &gt; 500 AND duration &lt;= 5000 THEN 1 ELSE 0 END), 0) "featureAmp110with5000ms",
COALESCE(sum(CASE WHEN r.feature_amplitude &gt;= -120 AND r.feature_amplitude &lt;= 110 AND duration &gt; 5000 AND duration &lt;= 60000 THEN 1 ELSE 0 END), 0) "featureAmp110with60000ms"
FROM
(
SELECT
duration,
feature_amplitude
FROM
r_mp_event_detail
WHERE 1 = 1
AND measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND event_type IN
<foreach collection="eventTypeList" item="type" open="(" close=")" separator=",">
#{type}
</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>
)
r
</select>
</mapper>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.PmsMonitorMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.PmsMonitorMapper">
<!--根据部门id查询监测点id-->
<select id="getMonitorInfo" resultType="com.njcn.event.pojo.po.PmsMonitorPO">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.PqDeviceMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.PqDeviceMapper">
<resultMap type="com.njcn.event.pojo.po.PqDevice" id="PqDeviceMap">
<result property="id" column="Id" jdbcType="VARCHAR"/>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventDMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventD">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="measurement_type_class" property="measurementTypeClass" />
<result column="event_type" property="eventType" />
<result column="event_measurement" property="eventMeasurement" />
<result column="event_measurement_ratio" property="eventMeasurementRatio" />
<result column="event_count" property="eventCount" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventMMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventM">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="measurement_type_class" property="measurementTypeClass" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventOrgM">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.RStatEventOrgMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventOrgMapper">
<sql id="query_rStatEventOrg_field">
@@ -16,10 +16,13 @@
rseo.event_measurement_ratio_average AS eEventMeasurementRatioAverage,
rseo.event_measurement_ratio_accrued AS eEventMeasurementRatioAccrued,
rseo.event_freq AS eventFreq,
rseo.event_count as eventCount
rseo.event_count AS eventCount,
rseo.data_type AS dataType
</sql>
<sql id="query_rStatEventOrg_where">
rso.org_no IN
rso.data_type = "01"
AND rseo.data_type = "01"
AND rso.org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
@@ -32,7 +35,7 @@
</sql>
<!--指标分类统计表-->
<select id="getYearRStatEventOrgInfo" resultType="com.njcn.event.pojo.vo.RStatEventOrgVO">
<select id="getYearRStatEventOrgInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_rStatEventOrg_field"></include>
FROM
@@ -44,7 +47,7 @@
<!--获取季区域暂态指标分类统计表-->
<select id="getQuarterRStatEventOrgInfo" resultType="com.njcn.event.pojo.vo.RStatEventOrgVO">
<select id="getQuarterRStatEventOrgInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_rStatEventOrg_field"></include>
FROM
@@ -56,7 +59,7 @@
<!--获取月区域暂态指标分类统计表-->
<select id="getMonthRStatEventOrgInfoInfo" resultType="com.njcn.event.pojo.vo.RStatEventOrgVO">
<select id="getMonthRStatEventOrgInfoInfo" resultType="com.njcn.event.pojo.po.RStatEventOrgPO">
SELECT
<include refid="query_rStatEventOrg_field"></include>
FROM

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventOrgQMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventOrgQ">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventOrgYMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventOrgY">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventQMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventQ">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="measurement_type_class" property="measurementTypeClass" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventVoltageM">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="measurement_type_class" property="measurementTypeClass" />
<result column="event_type" property="eventType" />
<result column="voltage_type" property="voltageType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatEventYMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatEventY">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="measurement_type_class" property="measurementTypeClass" />
<result column="event_type" property="eventType" />
<result column="event_measurement_average" property="eventMeasurementAverage" />
<result column="event_measurement_accrued" property="eventMeasurementAccrued" />
<result column="event_freq" property="eventFreq" />
<result column="event_count" property="eventCount" />
<result column="event_measurement_ratio_average" property="eventMeasurementRatioAverage" />
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
</mapper>

View File

@@ -1,19 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.RStatOrgMapper">
<sql id="query_where">
org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(data_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
</sql>
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatOrgMapper">
<sql id="query_field">
org_no AS orgNo,
@@ -23,7 +10,21 @@
event_measurement_average AS eventMeasurementAverage,
event_measurement_accrued AS eventMeasurementAccrued,
event_count AS eventCount,
event_freq AS eventFreq
event_freq AS eventFreq,
data_type AS dataType
</sql>
<sql id="query_where">
data_type = #{mainnetPointId}
AND org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(data_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
</sql>

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatSubstationMMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatSubstationM">
<id column="data_date" property="dataDate" />
<result column="substation_id" property="substationId" />
<result column="effective_measurement_average" property="effectiveMeasurementAverage" />
<result column="effective_measurement_accrued" property="effectiveMeasurementAccrued" />
<result column="event_freq" property="harmonicOverDay" />
<result column="harmonic_count" property="harmonicCount" />
<result column="freq_over_day" property="freqOverDay" />
<result column="freq_count" property="freqCount" />
<result column="v_dev_over_day" property="vDevOverDay" />
<result column="v_dev_count" property="vDevCount" />
<result column="v_over_day" property="vOverDay" />
<result column="v_count" property="vCount" />
<result column="i_over_day" property="iOverDay" />
<result column="i_count" property="iCount" />
<result column="unbalance_over_day" property="unbalanceOverDay" />
<result column="unbalance_count" property="unbalanceCount" />
<result column="i_neg_over_day" property="iNegOverDay" />
<result column="i_neg_count" property="iNegCount" />
<result column="flicker_over_day" property="flickerOverDay" />
<result column="flicker_count" property="flickerCount" />
<result column="inuharm_over_day" property="inuharmOverDay" />
<result column="inuharm_count" property="inuharmCount" />
<result column="event_count" property="eventCount" />
<result column="event_freq" property="eventFreq" />
<result column="sag_count" property="sagCount" />
<result column="sag_freq" property="sagFreq" />
<result column="swell_count" property="swellCount" />
<result column="swell_freq" property="swellFreq" />
<result column="interrupt_count" property="interruptCount" />
<result column="interrupt_freq" property="interruptFreq" />
</resultMap>
<select id="getStatSubstationIconM" resultType="com.njcn.event.pojo.vo.RSubstationIconVO">
SELECT
COALESCE( sum( CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END ), 0 ) "num_1",
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END ), 0 ) "num_2" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END ), 0 ) "num_3" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END ), 0 ) "num_4" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END ), 0 ) "num_5" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END ), 0 ) "num_6" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END ), 0 ) "num_7" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END ), 0 ) "num_8" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END ), 0 ) "num_9" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END ), 0 ) "num_10" ,
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_1",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_2",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_3",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_4",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_5",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_6",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_7",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_8",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_9",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_10"
FROM
(
SELECT
substation_id,
event_freq
FROM
r_stat_substation_m
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
) X
</select>
<select id="getStatSubstationIcon2M" resultType="com.njcn.event.pojo.vo.RSubstationIcon2VO">
SELECT
substation_id,
interrupt_freq,
swell_freq,
sag_freq
FROM
r_stat_substation_m
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
</select>
</mapper>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.RStatSubstationMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatSubstationMapper">
<sql id="query_field">
substation_id AS substationId,

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatSubstationQMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatSubstationQ">
<id column="data_date" property="dataDate" />
<result column="substation_id" property="substationId" />
<result column="effective_measurement_average" property="effectiveMeasurementAverage" />
<result column="effective_measurement_accrued" property="effectiveMeasurementAccrued" />
<result column="event_freq" property="harmonicAverageOverDay" />
<result column="freq_average_over_day" property="freqAverageOverDay" />
<result column="v_dev_average_over_day" property="vDevAverageOverDay" />
<result column="v_average_over_day" property="vAverageOverDay" />
<result column="i_average_over_day" property="iAverageOverDay" />
<result column="unbalance_average_over_day" property="unbalanceAverageOverDay" />
<result column="i_neg_average_over_day" property="iNegAverageOverDay" />
<result column="flicker_average_over_day" property="flickerAverageOverDay" />
<result column="inuharm_average_over_day" property="inuharmAverageOverDay" />
<result column="event_count" property="eventCount" />
<result column="event_freq" property="eventFreq" />
<result column="sag_count" property="sagCount" />
<result column="sag_freq" property="sagFreq" />
<result column="swell_count" property="swellCount" />
<result column="swell_freq" property="swellFreq" />
<result column="interrupt_count" property="interruptCount" />
<result column="interrupt_freq" property="interruptFreq" />
</resultMap>
<select id="getStatSubstationIconQ" resultType="com.njcn.event.pojo.vo.RSubstationIconVO">
SELECT
COALESCE( sum( CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END ), 0 ) "num_1",
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END ), 0 ) "num_2" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END ), 0 ) "num_3" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END ), 0 ) "num_4" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END ), 0 ) "num_5" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END ), 0 ) "num_6" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END ), 0 ) "num_7" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END ), 0 ) "num_8" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END ), 0 ) "num_9" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END ), 0 ) "num_10" ,
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_1",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_2",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_3",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_4",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_5",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_6",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_7",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_8",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_9",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_10"
FROM
(
SELECT
substation_id,
event_freq
FROM
r_stat_substation_q
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
) X
</select>
<select id="getStatSubstationIcon2Q" resultType="com.njcn.event.pojo.vo.RSubstationIcon2VO">
SELECT
substation_id,
interrupt_freq,
swell_freq,
sag_freq
FROM
r_stat_substation_q
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatSubstationVoltageMMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatSubstationVoltageM">
<id column="org_no" property="orgNo" />
<result column="data_date" property="dataDate" />
<result column="substation_voltage" property="substationVoltage" />
<result column="substation_count" property="substationCount" />
<result column="harmonic_count" property="harmonicCount" />
<result column="event_count" property="eventCount" />
</resultMap>
<select id="getStatSubstationIcon" resultType="com.njcn.event.pojo.vo.RVoltageIconVO">
SELECT
substation_voltage as 'substationVoltage',
sum( substation_count ) as 'substationCount',
sum( event_count ) as 'harmonicCount'
FROM
r_stat_substation_voltage_m
<where>
<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 #{param.endTime} >= data_date
</if>
</where>
GROUP BY substation_voltage
</select>
</mapper>

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RStatSubstationYMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.event.pojo.po.RStatSubstationY">
<id column="data_date" property="dataDate" />
<result column="substation_id" property="substationId" />
<result column="effective_measurement_average" property="effectiveMeasurementAverage" />
<result column="effective_measurement_accrued" property="effectiveMeasurementAccrued" />
<result column="event_freq" property="harmonicOverDay" />
<result column="freq_average_over_day" property="freqAverageOverDay" />
<result column="v_dev_average_over_day" property="vDevAverageOverDay" />
<result column="v_average_over_day" property="vAverageOverDay" />
<result column="i_average_over_day" property="iAverageOverDay" />
<result column="unbalance_average_over_day" property="unbalanceAverageOverDay" />
<result column="i_neg_average_over_day" property="iNegAverageOverDay" />
<result column="flicker_average_over_day" property="flickerAverageOverDay" />
<result column="inuharm_average_over_day" property="inuharmAverageOverDay" />
<result column="event_count" property="eventCount" />
<result column="event_freq" property="eventFreq" />
<result column="sag_count" property="sagCount" />
<result column="sag_freq" property="sagFreq" />
<result column="swell_count" property="swellCount" />
<result column="swell_freq" property="swellFreq" />
<result column="interrupt_count" property="interruptCount" />
<result column="interrupt_freq" property="interruptFreq" />
</resultMap>
<select id="getStatSubstationIconY" resultType="com.njcn.event.pojo.vo.RSubstationIconVO">
SELECT
COALESCE( sum( CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END ), 0 ) "num_1",
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END ), 0 ) "num_2" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END ), 0 ) "num_3" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END ), 0 ) "num_4" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END ), 0 ) "num_5" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END ), 0 ) "num_6" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END ), 0 ) "num_7" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END ), 0 ) "num_8" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END ), 0 ) "num_9" ,
COALESCE ( sum( CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END ), 0 ) "num_10" ,
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 0 AND 10 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_1",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 11 AND 20 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_2",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 21 AND 30 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_3",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 31 AND 40 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_4",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 41 AND 50 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_5",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 51 AND 60 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_6",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 61 AND 70 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_7",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 71 AND 80 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_8",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 81 AND 90 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_9",
COALESCE ( round(sum(CASE WHEN X.event_freq BETWEEN 91 AND 100 THEN 1 ELSE 0 END) / COUNT(X.substation_id),4)*100 , 0 ) "upRatio_10"
FROM
(
SELECT
substation_id,
event_freq
FROM
r_stat_substation_y
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
) X
</select>
<select id="getStatSubstationIcon2Y" resultType="com.njcn.event.pojo.vo.RSubstationIcon2VO">
SELECT
substation_id,
interrupt_freq,
swell_freq,
sag_freq
FROM
r_stat_substation_y
<where>
<if test="param != null and param.ids != null and param.ids.size > 0">
AND substation_id 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 #{param.endTime}>= data_date
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.RmpEventDetailMapper">
<select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
event_id as eventId,
measurement_point_id as measurementPointId,
Event_Type as eventType,
start_time as startTime,
Duration as duration,
feature_amplitude as featureAmplitude,
phase as phase,
event_describe as eventDescribe,
wave_path as wavePath
FROM
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="eventType != null and eventType.size() >0">
AND Event_Type IN
<foreach collection="eventType" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<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>
</mapper>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.RmpEventDetailMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.RmpEventReportDayMapper">
</mapper>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.TransientMapper">
<mapper namespace="com.njcn.event.mapper.majornetwork.TransientMapper">
<select id="getTransientData" resultType="TransientVO">
SELECT

View File

@@ -1,71 +0,0 @@
package com.njcn.event.service.Impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.mapper.PmsMonitorMapper;
import com.njcn.event.mapper.RmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.PmsMonitorPO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import com.njcn.event.service.RmpEventDetailService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 暂态事件明细
*
* @author yzh
* @date 2022/10/12
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, RmpEventDetailVO> implements RmpEventDetailService {
private final RmpEventDetailMapper rmpEventDetailMapper;
private final DeptFeignClient deptFeignClient;
private final PmsMonitorMapper pmsMonitorMapper;
/**
* 获取暂态事件明细
*
* @param param 前端参数
* @return 暂态事件明细
*/
@Override
public List<RmpEventDetailVO> getRmpEventDetail(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isNotEmpty(data)) {
//创建返回集合
List<RmpEventDetailVO> info = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
// 根据部门id查询监测点id
List<PmsMonitorPO> monitorInfo = pmsMonitorMapper.getMonitorInfo(deptIds);
return info;
} else {
return new ArrayList<>();
}
}
}

View File

@@ -1,334 +0,0 @@
package com.njcn.event.service.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.event.mapper.PmsMonitorMapper;
import com.njcn.event.mapper.RStatEventOrgMapper;
import com.njcn.event.mapper.RStatOrgMapper;
import com.njcn.event.mapper.RStatSubstationMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.PmsMonitorPO;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.service.StatisticsOfTransientIndicatorssService;
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.WebUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 暂态指标统计
*
* @author yzh
* @date 2022/10/10
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOfTransientIndicatorssService {
private final DeptFeignClient deptFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final RStatOrgMapper rStatOrgMapper;
private final RStatEventOrgMapper rStatEventOrgMapper;
private final RStatSubstationMapper rStatSubstationMapper;
private final PmsMonitorMapper pmsMonitorMapper;
/**
* 获取区域暂态指标统计
*
* @param param 前端参数
* @return 区域暂态指标统计
*/
@Override
public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isNotEmpty(data)) {
// 创建返回集合
List<RStatOrgVO> info = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年区域暂态指标统计
info = rStatOrgMapper.getYearRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
case 2:
// 获取季区域暂态指标统计
info = rStatOrgMapper.getQuarterRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
case 3:
// 获取月区域暂态指标统计
info = rStatOrgMapper.getMonthRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
for (RStatOrgVO rStatOrgVO : info) {
rStatOrgVO.setEventMeasurementRatioAverage(rStatOrgVO.getEventMeasurementAverage() / rStatOrgVO.getEffectiveMeasurementAverage());
rStatOrgVO.setEventMeasurementRatioAccrued(rStatOrgVO.getEventMeasurementAccrued() / rStatOrgVO.getEffectiveMeasurementAccrued());
}
// 匹配单位名称
for (DeptDTO dto : data) {
for (RStatOrgVO vo : info) {
if (dto.getId().equals(vo.getOrgNo())) {
vo.setOrgName(dto.getName());
}
}
}
return info;
} else {
return new ArrayList<>();
}
}
/**
* 获取区域暂态指标分类统计表
*
* @param param 前端参数
* @return 区域暂态指标分类统计表
*/
@Override
public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isNotEmpty(data)) {
//创建返回集合
List<RStatEventOrgVO> info = new ArrayList<>();
// 根据暂态指标枚举查询暂态指标
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<RStatEventOrgVO> temp = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年区域暂态指标分类统计表
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
case 2:
// 获取季区域暂态指标分类统计表
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
case 3:
// 获取月区域暂态指标分类统计表
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
Map<String, List<RStatEventOrgVO>> map = temp
.stream().collect(Collectors.groupingBy(RStatEventOrgVO::getOrgNo));
map.forEach((orgOn, rStatEventOrgVOs) -> {
RStatEventOrgVO rStatEventOrgVO = new RStatEventOrgVO();
// 基础属性赋值
for (RStatEventOrgVO tmp : rStatEventOrgVOs) {
if (rStatEventOrgVO.getOrgNo() == null) {
rStatEventOrgVO.setOrgNo(tmp.getOrgNo());
rStatEventOrgVO.setDataDate(tmp.getDataDate());
rStatEventOrgVO.setEffectiveMeasurementAverage(tmp.getEffectiveMeasurementAverage());
rStatEventOrgVO.setEffectiveMeasurementAccrued(tmp.getEffectiveMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementAverage(tmp.getEventMeasurementAverage());
rStatEventOrgVO.setEventMeasurementAccrued(tmp.getEventMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementRatioAverage(tmp.getEventMeasurementAverage() / tmp.getEffectiveMeasurementAverage());
rStatEventOrgVO.setEventMeasurementRatioAccrued(tmp.getEventMeasurementAccrued() / tmp.getEffectiveMeasurementAccrued());
}
}
for (RStatEventOrgVO tmp : rStatEventOrgVOs) {
// 暂态指标赋值
for (DictData eventStati : eventStatis) {
if (eventStati.getId().equals(tmp.getEventType())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
// 日均短时中断
rStatEventOrgVO.setDayShortInterruptions(tmp.getEEventMeasurementAverage());
// 累计短时中断
rStatEventOrgVO.setCumulativeShortInterruptions(tmp.getEventMeasurementAccrued());
// 日均短时中断占比
rStatEventOrgVO.setDayShortInterruptionsProportion(tmp.getEEventMeasurementRatioAverage());
// 累计短时中断占比
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(tmp.getEEventMeasurementRatioAccrued());
// 短时中断监测点数
rStatEventOrgVO.setShortInterruptionsMonitor(314159);
// 短时中断占比
rStatEventOrgVO.setShortInterruptionsProportion(3.14159);
// 短时中断次数
rStatEventOrgVO.setShortInterruptionsCount(tmp.getEEventCount());
// 短时中断频次
rStatEventOrgVO.setShortInterruptionsFrequency(tmp.getEEventFreq());
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
// 日均电压暂升
rStatEventOrgVO.setDayVoltageRise(tmp.getEEventMeasurementAverage());
// 累计电压暂升
rStatEventOrgVO.setCumulativeVoltageRise(tmp.getEventMeasurementAccrued());
// 日均电压暂升占比
rStatEventOrgVO.setDayVoltageRiseProportion(tmp.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
rStatEventOrgVO.setCumulativeVoltageRiseProportion(tmp.getEEventMeasurementRatioAccrued());
// 电压暂升占比
rStatEventOrgVO.setVoltageRiseProportion(3.14159);
// 电压暂升次数
rStatEventOrgVO.setVoltageRiseCount(tmp.getEEventCount());
// 电压暂升频次
rStatEventOrgVO.setVoltageRiseFrequency(tmp.getEEventFreq());
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
// 日均电压暂降
rStatEventOrgVO.setDayVoltageDip(tmp.getEEventMeasurementAverage());
// 累计电压暂降
rStatEventOrgVO.setCumulativeVoltageDip(tmp.getEventMeasurementAccrued());
// 日均电压暂降占比
rStatEventOrgVO.setDayVoltageDipProportion(tmp.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
rStatEventOrgVO.setCumulativeVoltageDipProportion(tmp.getEEventMeasurementRatioAccrued());
// 电压暂升占比
rStatEventOrgVO.setVoltageDipProportion(3.14159);
// 电压暂降次数
rStatEventOrgVO.setVoltageDipCount(tmp.getEEventCount());
// 电压暂降频次
rStatEventOrgVO.setVoltageDipFrequency(tmp.getEEventFreq());
}
}
}
}
info.add(rStatEventOrgVO);
});
// 匹配单位名称
for (DeptDTO dto : data) {
for (RStatEventOrgVO vo : info) {
if (dto.getId().equals(vo.getOrgNo())) {
vo.setOrgName(dto.getName());
}
}
}
return info;
} else {
return new ArrayList<>();
}
}
/**
* 获取变电站暂态指标分类统计表
*
* @param param 前端传入参数
* @return 变电站暂态指标分类统计表
*/
@Override
public List<RStatSubstationVO> getRStatSubstation
(UniversalFrontEndParam param) {
// 获取当前用户的部门的子部门信息
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
if (CollectionUtil.isNotEmpty(data)) {
//创建返回集合
List<RStatSubstationVO> info = new ArrayList<>();
// 过滤出部门id
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
// 创建集合用于封装查询出的监测点信息
List<PmsMonitorPO> mInfo = new ArrayList<>();
// 根据部门id查询监测点id
List<PmsMonitorPO> monitorInfo = pmsMonitorMapper.getMonitorInfo(deptIds);
// 过滤出变电站id
List<String> powerrIds = new ArrayList<>();
// 判断前端参数是否传入的变电站名称
if (param.getSubName() != null) {
for (PmsMonitorPO po : monitorInfo) {
if (po.getPowerrName().contains(param.getSubName())) {
PmsMonitorPO pmsMonitor = new PmsMonitorPO();
BeanUtils.copyProperties(po,pmsMonitor);
mInfo.add(pmsMonitor);
}
}
powerrIds = mInfo.stream().map(PmsMonitorPO::getPowerrId).collect(Collectors.toList());
}else {
powerrIds = monitorInfo.stream().map(PmsMonitorPO::getPowerrId).collect(Collectors.toList());
}
// 类型1年 2季度 3月份 4日
switch (param.getType()) {
case 1:
// 获取年变电站暂态指标分类统计表
info = rStatSubstationMapper.getYearInfo(powerrIds, param.getStartTime(), param.getEndTime());
break;
case 2:
// 获取季变电站暂态指标分类统计表
info = rStatSubstationMapper.getQuarterInfo(powerrIds, param.getStartTime(), param.getEndTime());
break;
case 3:
// 获取月变电站暂态指标分类统计表
info = rStatSubstationMapper.getMonthInfo(powerrIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
// 匹配单位名称
for (RStatSubstationVO vo : info) {
for (PmsMonitorPO pmsMonitor : monitorInfo) {
if (vo.getSubstationId().equals(pmsMonitor.getPowerrId())) {
vo.setDeptId(pmsMonitor.getOrgId());
vo.setDeptName(pmsMonitor.getOrgName());
vo.setSubstationName(pmsMonitor.getPowerrName());
}
}
}
return info;
} else {
return new ArrayList<>();
}
}
}

View File

@@ -0,0 +1,355 @@
package com.njcn.event.service.distribution.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.event.mapper.distribution.PwEventCategoryDetailsMapper;
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
import com.njcn.event.pojo.po.EventDurationLineChartPO;
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 配网-暂态事件分布统计
*
* @author yzh
* @date 2022/10/28
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetailsService {
private final PwMonitorClient pwMonitorClient;
private final PwEventCategoryDetailsMapper pwEventCategoryDetailsMapper;
/**
* 获取配网暂态事件分布统计
*
* @param param 条件参数
* @return 配网暂态事件分布统计
*/
@Override
public List<EventDistributionStatisticsTableVO> getPwEventCategoryDetails(StatisticsBizBaseParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 创建集合,返回数据
List<EventDistributionStatisticsTableVO> vos = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取暂态指标分布统计
EventDistributionStatisticsPO po = pwEventCategoryDetailsMapper.getPwEventCategoryDetailsMapper(
monitorIdList,
param.getStartTime(),
param.getEndTime());
if (ObjectUtil.isEmpty(po)) {
return Collections.emptyList();
}
// 特征幅值10%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude10 = new EventDistributionStatisticsTableVO();
featureAmplitude10.setFeatureAmplitude("10%");
featureAmplitude10.setDuration20(po.getFeatureAmplitude10with20s());
featureAmplitude10.setDuration100(po.getFeatureAmplitude10with100s());
featureAmplitude10.setDuration500(po.getFeatureAmplitude10with500s());
featureAmplitude10.setDuration1000(po.getFeatureAmplitude10with1000s());
featureAmplitude10.setDuration3000(po.getFeatureAmplitude10with3000s());
featureAmplitude10.setDuration20000(po.getFeatureAmplitude10with20000s());
featureAmplitude10.setDuration60000(po.getFeatureAmplitude10with60000s());
featureAmplitude10.setDuration180000(po.getFeatureAmplitude10with180000s());
// 特征幅值40%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude40 = new EventDistributionStatisticsTableVO();
featureAmplitude40.setFeatureAmplitude("40%");
featureAmplitude40.setDuration20(po.getFeatureAmplitude40with20s());
featureAmplitude40.setDuration100(po.getFeatureAmplitude40with100s());
featureAmplitude40.setDuration500(po.getFeatureAmplitude40with500s());
featureAmplitude40.setDuration1000(po.getFeatureAmplitude40with1000s());
featureAmplitude40.setDuration3000(po.getFeatureAmplitude40with3000s());
featureAmplitude40.setDuration20000(po.getFeatureAmplitude40with20000s());
featureAmplitude40.setDuration60000(po.getFeatureAmplitude40with60000s());
featureAmplitude40.setDuration180000(po.getFeatureAmplitude40with180000s());
// 特征幅值70%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude70 = new EventDistributionStatisticsTableVO();
featureAmplitude70.setFeatureAmplitude("70%");
featureAmplitude70.setDuration20(po.getFeatureAmplitude70with20s());
featureAmplitude70.setDuration100(po.getFeatureAmplitude70with100s());
featureAmplitude70.setDuration500(po.getFeatureAmplitude70with500s());
featureAmplitude70.setDuration1000(po.getFeatureAmplitude70with1000s());
featureAmplitude70.setDuration3000(po.getFeatureAmplitude70with3000s());
featureAmplitude70.setDuration20000(po.getFeatureAmplitude70with20000s());
featureAmplitude70.setDuration60000(po.getFeatureAmplitude70with60000s());
featureAmplitude70.setDuration180000(po.getFeatureAmplitude70with180000s());
// 特征幅值85%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude85 = new EventDistributionStatisticsTableVO();
featureAmplitude85.setFeatureAmplitude("85%");
featureAmplitude85.setDuration20(po.getFeatureAmplitude85with20s());
featureAmplitude85.setDuration100(po.getFeatureAmplitude85with100s());
featureAmplitude85.setDuration500(po.getFeatureAmplitude85with500s());
featureAmplitude85.setDuration1000(po.getFeatureAmplitude85with1000s());
featureAmplitude85.setDuration3000(po.getFeatureAmplitude85with3000s());
featureAmplitude85.setDuration20000(po.getFeatureAmplitude85with20000s());
featureAmplitude85.setDuration60000(po.getFeatureAmplitude85with60000s());
featureAmplitude85.setDuration180000(po.getFeatureAmplitude85with180000s());
// 特征幅值90%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude90 = new EventDistributionStatisticsTableVO();
featureAmplitude90.setFeatureAmplitude("90%");
featureAmplitude90.setDuration20(po.getFeatureAmplitude90with20s());
featureAmplitude90.setDuration100(po.getFeatureAmplitude90with100s());
featureAmplitude90.setDuration500(po.getFeatureAmplitude90with500s());
featureAmplitude90.setDuration1000(po.getFeatureAmplitude90with1000s());
featureAmplitude90.setDuration3000(po.getFeatureAmplitude90with3000s());
featureAmplitude90.setDuration20000(po.getFeatureAmplitude90with20000s());
featureAmplitude90.setDuration60000(po.getFeatureAmplitude90with60000s());
featureAmplitude90.setDuration180000(po.getFeatureAmplitude90with180000s());
// 属性赋值
vos.add(featureAmplitude10);
vos.add(featureAmplitude40);
vos.add(featureAmplitude70);
vos.add(featureAmplitude85);
vos.add(featureAmplitude90);
return vos;
}
/**
* 获取配网持续时间概率分布函数
*
* @param param 条件参数
* @return 配网持续时间概率分布函数
* @author yzh
* @date 2022/10/31
*/
@Override
public List<SimpleVO> getPwDurationLineChart(StatisticsBizBaseParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<SimpleVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取持续时间折线图
EventDurationLineChartPO po = pwEventCategoryDetailsMapper.getPwEventDurationLineChart(
monitorIdList,
param.getStartTime(),
param.getEndTime());
if (ObjectUtil.isEmpty(po)) {
return Collections.emptyList();
}
SimpleVO vo100 = new SimpleVO();
vo100.setName("0.1");
vo100.setValue(po.getDuration100());
SimpleVO vo250 = new SimpleVO();
vo250.setName("0.25");
vo250.setValue(po.getDuration250());
SimpleVO vo500 = new SimpleVO();
vo500.setName("0.5");
vo500.setValue(po.getDuration500());
SimpleVO vo1000 = new SimpleVO();
vo1000.setName("1");
vo1000.setValue(po.getDuration1000());
SimpleVO vo1100 = new SimpleVO();
vo1100.setName("1.1");
vo1100.setValue(po.getDuration1100());
// 创建map集合封装数据
result.add(vo100);
result.add(vo250);
result.add(vo500);
result.add(vo1000);
result.add(vo1100);
return result;
}
/**
* 获取配网暂降幅值概率分布函数
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
* @author yzh
* @date 2022/10/31
*/
@Override
public List<SimpleVO> getPwFeatureAmplitudeLineChart(StatisticsBizBaseParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<SimpleVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取特征幅值折线图
EventFeatureAmplitudeLineChartPO po = pwEventCategoryDetailsMapper.getPwEventFeatureAmplitudeLineChart(monitorIdList,
param.getStartTime(),
param.getEndTime());
if (ObjectUtil.isEmpty(po)) {
return Collections.emptyList();
}
SimpleVO vo10 = new SimpleVO();
vo10.setName("10%");
vo10.setValue(po.getFeatureAmplitude10());
SimpleVO vo20 = new SimpleVO();
vo20.setName("20%");
vo20.setValue(po.getFeatureAmplitude20());
SimpleVO vo30 = new SimpleVO();
vo30.setName("30%");
vo30.setValue(po.getFeatureAmplitude30());
SimpleVO vo40 = new SimpleVO();
vo40.setName("40%");
vo40.setValue(po.getFeatureAmplitude40());
SimpleVO vo50 = new SimpleVO();
vo50.setName("50%");
vo50.setValue(po.getFeatureAmplitude50());
SimpleVO vo60 = new SimpleVO();
vo60.setName("60%");
vo60.setValue(po.getFeatureAmplitude60());
SimpleVO vo70 = new SimpleVO();
vo70.setName("70%");
vo70.setValue(po.getFeatureAmplitude70());
SimpleVO vo80 = new SimpleVO();
vo80.setName("80%");
vo80.setValue(po.getFeatureAmplitude80());
SimpleVO vo90 = new SimpleVO();
vo90.setName("90%");
vo90.setValue(po.getFeatureAmplitude90());
// 创建map集合封装数据
result.add(vo10);
result.add(vo20);
result.add(vo30);
result.add(vo40);
result.add(vo50);
result.add(vo60);
result.add(vo70);
result.add(vo80);
result.add(vo90);
return result;
}
/**
* 获取配网暂态指标分布统计曲线图
*
* @param param 条件参数
* @return com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO
* @author yzh
* @date 2022/10/31
*/
@Override
public EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
// 创建集合返回数据
List<SimpleVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
// 获取监测点暂态事件明细数据
List<RmpEventDetailPO> rmpEventDetailList = pwEventCategoryDetailsMapper.getPwRmpEventDetail(monitorIdList, param.getStartTime(), param.getEndTime());
if (CollUtil.isEmpty(rmpEventDetailList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList> curveDataList = rmpEventDetailList.parallelStream()
.map(dto -> {
EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList eventFeatureAmplitudeCurve = new EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList();
eventFeatureAmplitudeCurve.setMeasurementPointId(dto.getMeasurementPointId());
eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude());
eventFeatureAmplitudeCurve.setDuration(dto.getDuration());
Instant instant = dto.getStartTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault();
eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(instant, zoneId));
return eventFeatureAmplitudeCurve;
})
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
}
/**
* 获取单位id
*
* @param param 条件参数
* @return 单位id
*/
private List<PwPmsMonitorDTO> getPwMonitorList(StatisticsBizBaseParam param) {
// 获取单位下的监测点id集合
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(param.getId());
return pwMonitorClient
.getPwMonitorList(pwPmsMonitorParam)
.getData();
}
}

View File

@@ -0,0 +1,324 @@
package com.njcn.event.service.distribution.Impl;
import cn.hutool.core.collection.CollUtil;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.event.mapper.distribution.PwRStatOrgClassifiedMapper;
import com.njcn.event.mapper.distribution.PwRStatOrgMapper;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.po.RStatEventOrgPO;
import com.njcn.event.pojo.po.RStatOrgPO;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import com.njcn.event.service.distribution.PwRStatOrgService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 配网-暂态事件统计
*
* @author yzh
* @date 2022/10/24
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class PwRStatOrgServiceImpl implements PwRStatOrgService {
private final PwMonitorClient monitorClient;
private final DicDataFeignClient dicDataFeignClient;
private final PwRStatOrgMapper pwRStatOrgMapper;
private final PwRStatOrgClassifiedMapper pwRStatOrgClassifiedMapper;
private final DecimalFormat df = new DecimalFormat("###.00");
/**
* 获取配网区域暂态指标统计
*
* @param param 前端传入参数
* @return 配网区域暂态指标统计
*/
@Override
public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) {
// 获取单位下的监测点id集合
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 查询字典表
List<DictData> dictDataList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData();
// 创建集合封装返回数据
List<RStatOrgVO> result = new ArrayList<>();
// 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 创建集合封装查询数据
List<RStatOrgPO> rStatOrgPO = new ArrayList<>();
// 判断条件
switch (param.getType()) {
// 年
case 1:
rStatOrgPO = pwRStatOrgMapper.getYearInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
// 季
case 2:
rStatOrgPO = pwRStatOrgMapper.getQuarterInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
// 月
case 3:
rStatOrgPO = pwRStatOrgMapper.getMonthInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
default:
break;
}
// 数据处理
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
for (RStatOrgPO po : rStatOrgPO) {
// 数据处理
if (!po.getOrgNo().equals(pwPmsMonitorDTO.getOrgId())) {
continue;
}
// 创建对象封装返回数据
RStatOrgVO rStatOrgVO = new RStatOrgVO();
rStatOrgVO.setOrgNo(po.getOrgNo());
rStatOrgVO.setOrgName(pwPmsMonitorDTO.getOrgName());
rStatOrgVO.setDataDate(po.getDataDate());
rStatOrgVO.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
rStatOrgVO.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
rStatOrgVO.setEventMeasurementAverage(po.getEventMeasurementAverage());
rStatOrgVO.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
rStatOrgVO.setEventCount(po.getEventCount());
rStatOrgVO.setDataType(po.getDataType());
// 字典数据处理
for (DictData dictData : dictDataList) {
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
rStatOrgVO.setMonitorSort(dictData.getName());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
rStatOrgVO.setEventFreq(po.getEventFreq());
}
}
}
result.add(rStatOrgVO);
}
}
return result;
}
/**
* 获取配网区域暂态事件分类统计
*
* @param param 前端传入参数
* @return 配网区域暂态事件分类统计
*/
@Override
public List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 查询监测点类别字典表
List<DictData> lineSortList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
.getData();
// 查询暂态指标字典表
List<DictData> eventStatisList = dicDataFeignClient
.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode())
.getData();
// 创建集合封装返回数据
List<RStatEventOrgVO> result = new ArrayList<>();
// 取出单位id
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
// 创建集合封装查询数据
List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>();
// 判断条件
switch (param.getType()) {
// 年
case 1:
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getYearInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
// 季
case 2:
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getQuarterInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
// 月
case 3:
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getMonthInfo(
deptIdList,
param.getStartTime(),
param.getEndTime(),
param.getMonitorSort());
break;
default:
break;
}
if (CollUtil.isEmpty(rStatEventOrgVOList)) {
return Collections.emptyList();
}
// 将查询出的数据转为map集合
Map<String, List<RStatEventOrgPO>> rStatEventOrgVOMap = rStatEventOrgVOList.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
// 数据处理
rStatEventOrgVOMap.forEach((orgOn, rStatEventOrgVOs) -> {
RStatEventOrgVO vo = new RStatEventOrgVO();
// 基础属性赋值
for (RStatEventOrgPO po : rStatEventOrgVOs) {
vo.setOrgNo(po.getOrgNo());
vo.setDataDate(po.getDataDate());
vo.setMeasurementTypeClass(po.getMeasurementTypeClass());
vo.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
vo.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
vo.setEventMeasurementAverage(po.getEventMeasurementAverage());
vo.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
vo.setEventCount(po.getEventCount());
vo.setEventFreq(po.getEEventFreq());
vo.setDataType(po.getDataType());
}
for (RStatEventOrgPO po : rStatEventOrgVOs) {
for (DictData dictData : lineSortList) {
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
vo.setMeasurementTypeClass(dictData.getName());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
}
// 暂态指标赋值
for (DictData eventStati : eventStatisList) {
if (eventStati.getId().equals(po.getEventType())) {
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
// 日均短时中断
vo.setDayShortInterruptions(po.getEEventMeasurementAverage());
// 累计短时中断
vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均短时中断占比
vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
// 累计短时中断占比
vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
vo.setShortInterruptionsFreq(po.getEEventFreq());
vo.setShortInterruptionsCount(po.getEEventCount());
}
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
// 日均电压暂升
vo.setDayVoltageRise(po.getEEventMeasurementAverage());
// 累计电压暂升
vo.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂升占比
vo.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂升占比
vo.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageRiseFreq(po.getEEventFreq());
vo.setVoltageRiseCount(po.getEEventCount());
}
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
// 日均电压暂降
vo.setDayVoltageDip(po.getEEventMeasurementAverage());
// 累计电压暂降
vo.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
// 日均电压暂降占比
vo.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
// 累计电压暂降占比
vo.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
vo.setVoltageDipFreq(po.getEEventFreq());
vo.setVoltageDipCount(po.getEEventCount());
}
}
}
}
}
}
}
result.add(vo);
});
// 添加单位名称
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
for (RStatEventOrgVO vo : result) {
if (pwPmsMonitorDTO.getOrgId().equals(vo.getOrgNo())) {
vo.setOrgName(pwPmsMonitorDTO.getOrgName());
}
}
}
return result;
}
/**
* 获取单位id
*
* @param param 条件参数
* @return 单位id
*/
private List<PwPmsMonitorDTO> getPwMonitorList(PwUniversalFrontEndParam param) {
// 获取单位下的监测点id集合
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(param.getId());
pwPmsMonitorParam.setMonitorSort(param.getMonitorSort());
return monitorClient
.getPwMonitorList(pwPmsMonitorParam)
.getData();
}
}

View File

@@ -0,0 +1,148 @@
package com.njcn.event.service.distribution.Impl;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
import com.njcn.event.service.distribution.PwRmpEventDetailService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 配网-暂态事件明细
*
* @author yzh
* @date 2022/10/31
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
private final PwRmpEventDetailMapper pwRmpEventDetailMapper;
private final PwMonitorClient pwMonitorClient;
private final DicDataFeignClient dicDataFeignClient;
private final MonitorClient monitorClient;
/**
* 获取配网暂态事件明细
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.vo.RmpEventDetailVO>
* @author yzh
* @date 2022/10/31
*/
@Override
public List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param) {
// 获取单位下的监测点id集合
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(param.getId());
pwPmsMonitorParam.setMonitorName(param.getMonitorName());
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient
.getPwMonitorList(pwPmsMonitorParam)
.getData();
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<PwRmpEventDetailVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取配网暂态事件明细
List<RmpEventDetailPO> rmpEventDetails = pwRmpEventDetailMapper.getPwRmpEventDetail(param);
if (CollectionUtil.isEmpty(rmpEventDetails)) {
return Collections.emptyList();
}
// 创建集合,储存一类监测点
List<String> oneLineMonitorIds = new ArrayList<>();
// 查询检测点类型字典
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
// 属性赋值
for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
for (RmpEventDetailPO rmpEventDetail : rmpEventDetails) {
if (rmpEventDetail.getMeasurementPointId().equals(dto.getMonitorId())) {
PwRmpEventDetailVO pwRmpEventDetailVO = new PwRmpEventDetailVO();
pwRmpEventDetailVO.setOrgId(dto.getOrgId());
pwRmpEventDetailVO.setOrgName(dto.getOrgName());
pwRmpEventDetailVO.setMonitorId(dto.getMonitorId());
pwRmpEventDetailVO.setMonitorSort(dto.getMonitorSort());
pwRmpEventDetailVO.setMonitorName(dto.getMonitorName());
pwRmpEventDetailVO.setMonitorVoltageLevel(dto.getVoltageLevel());
pwRmpEventDetailVO.setEventType(rmpEventDetail.getEventType());
pwRmpEventDetailVO.setStartTime(rmpEventDetail.getStartTime());
pwRmpEventDetailVO.setFeatureAmplitude(rmpEventDetail.getFeatureAmplitude());
pwRmpEventDetailVO.setDuration(rmpEventDetail.getDuration());
pwRmpEventDetailVO.setWavePath(rmpEventDetail.getWavePath());
result.add(pwRmpEventDetailVO);
}
}
}
for (DictData dictData : lineSortList) {
for (PwRmpEventDetailVO vo : result) {
if (vo.getMonitorSort().equals(dictData.getId())) {
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
vo.setPowerClient("/");
vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName());
monitorIdList.add(vo.getMonitorId());
} else if (dictData.getCode().equals(DicDataEnum.TWO_LINE.getCode())) {
vo.setSubName("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/");
vo.setPowerDistributionArea("/");
vo.setMonitorSort(dictData.getName());
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
vo.setSubName("/");
vo.setPowerClient("/");
vo.setPowerClient(vo.getMonitorName());
vo.setMonitorName("/");
vo.setMonitorSort(dictData.getName());
}
}
}
}
// 查询监测点信息
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

@@ -0,0 +1,55 @@
package com.njcn.event.service.distribution;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import java.util.List;
/**
* 配网-暂态事件分布统计
*
* @author yzh
* @date 2022/10/28
*/
public interface PwEventCategoryDetailsService {
/**
* 获取配网暂态事件分布统计
*
* @param param 条件参数
* @return 配网暂态事件分布统计
*/
List<EventDistributionStatisticsTableVO> getPwEventCategoryDetails(StatisticsBizBaseParam param);
/**
* 获取配网持续时间概率分布函数
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
* @author yzh
* @date 2022/10/31
*/
List<SimpleVO> getPwDurationLineChart(StatisticsBizBaseParam param);
/**
* 获取配网暂降幅值概率分布函数
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
* @author yzh
* @date 2022/10/31
*/
List<SimpleVO> getPwFeatureAmplitudeLineChart(StatisticsBizBaseParam param);
/**
* 获取配网暂态指标分布统计曲线图
*
* @param param 条件参数
* @return com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO
* @author yzh
* @date 2022/10/31
*/
EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param);
}

View File

@@ -0,0 +1,33 @@
package com.njcn.event.service.distribution;
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
import com.njcn.event.pojo.vo.RStatEventOrgVO;
import com.njcn.event.pojo.vo.RStatOrgVO;
import java.util.List;
/**
* 配网-暂态事件统计
*
* @author yzh
* @date 2022/10/24
*/
public interface PwRStatOrgService {
/**
* 获取配网区域暂态指标统计
*
* @param param 前端传入参数
* @return 配网区域暂态指标统计
*/
List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param);
/**
* 获取配网区域暂态事件分类统计
*
* @param param 前端传入参数
* @return 配网区域暂态事件分类统计
*/
List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.event.service.distribution;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
import java.util.List;
/**
* 配网-暂态事件明细
*
* @author yzh
* @date 2022/10/31
*/
public interface PwRmpEventDetailService {
/**
* 获取配网暂态事件明细
*
* @param param 条件参数
* @return java.util.List<com.njcn.event.pojo.vo.RmpEventDetailVO>
* @author yzh
* @date 2022/10/31
*/
List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param);
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaAnalysisVO;

View File

@@ -1,8 +1,7 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.AreaSubLineVO;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaStatisticalVO;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.dto.wave.WaveDataDTO;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service;
package com.njcn.event.service.majornetwork;
import com.njcn.event.pojo.po.EventDetail;
@@ -29,10 +29,10 @@ public interface EventDetailService {
/**
* 根据监测点集合获取暂态列表
*/
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime);
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType);
/**
* 根据监测点集合以及分页信息获取暂降事件
*/
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum);
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<Integer> waveType);
}

View File

@@ -0,0 +1,50 @@
package com.njcn.event.service.majornetwork;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import java.util.List;
/**
* 暂态指标分布统计
*
* @author yzh
* @date 2022/10/20
*/
public interface EventDistributionStatisticsService {
/**
* 获取暂态指标分布统计
*
* @param param 条件参数
* @return 暂态指标分布统计
*/
List<EventDistributionStatisticsTableVO> getEventDistributionStatisticsTable(StatisticsBizBaseParam param);
/**
* 获取持续时间折线图
*
* @param param 条件参数
* @return 持续时间折线图
*/
List<SimpleVO> getEventDurationLineChart(StatisticsBizBaseParam param);
/**
* 获取特征幅值折线图
*
* @param param 条件参数
* @return 特征幅值折线图
*/
List<SimpleVO> getEventFeatureAmplitudeLineChart(StatisticsBizBaseParam param);
/**
* 获取暂态指标分布统计曲线图
*
* @param param 条件参数
* @return 暂态指标分布统计曲线图
*/
EventFeatureAmplitudeCurveVO getEventFeatureAmplitudeCurve(StatisticsBizBaseParam param);
}

View File

@@ -0,0 +1,24 @@
package com.njcn.event.service.majornetwork;
import com.njcn.event.pojo.param.EventMonitorReportParam;
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
import com.njcn.event.pojo.vo.EventMonitorReportVO;
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
import java.util.List;
/**
* @Title EventMonitorDailyReportService
* @Package com.njcn.event.service
* @Author jianghaifei
* @Date 2022-10-25 09:39
* @Version V1.0
*/
public interface EventMonitorReportService {
List<EventMonitorReportVO> getDailyReport(EventMonitorReportParam eventMonitorReportParam);
EventDipShortDistributionVO getEventDipShortDistributionByCond(EventMonitorReportParam eventMonitorReportParam);
EventRiseDistributionVO getEventRiseDistributionByCond(EventMonitorReportParam eventMonitorReportParam);
}

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
@@ -11,13 +11,11 @@ import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.vo.AreaAnalysisVO;
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO;
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO.VoltageToleranceCurveDataList;
import com.njcn.event.service.AreaAnalysisService;
import com.njcn.event.service.majornetwork.AreaAnalysisService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import org.checkerframework.checker.units.qual.A;
import org.influxdb.querybuilder.clauses.Clause;
import org.springframework.stereotype.Service;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
@@ -6,16 +6,12 @@ import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.TerminalBaseClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
import com.njcn.event.pojo.constant.Param;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.AreaLineVO;
import com.njcn.event.pojo.vo.AreaSubLineVO;
import com.njcn.event.service.AreaInfoService;
import com.njcn.event.utils.CommUtil;
import com.njcn.event.service.majornetwork.AreaInfoService;
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDBCommUtils;
@@ -23,7 +19,6 @@ import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.influxdb.dto.QueryResult;
import org.influxdb.impl.InfluxDBResultMapper;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

View File

@@ -1,26 +1,23 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil;
import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.pojo.vo.SubstationDetailVO;
import com.njcn.event.influxdb.PqsOnlinerateQuery;
import com.njcn.event.mapper.PqDeviceMapper;
import com.njcn.event.mapper.majornetwork.PqDeviceMapper;
import com.njcn.event.pojo.po.PqDevice;
import com.njcn.event.pojo.po.PqsOnlinerate;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO;
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO;
import com.njcn.event.service.AreaLineService;
import com.njcn.event.service.majornetwork.AreaLineService;
import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.system.pojo.enums.StatisticsEnum;

View File

@@ -1,4 +1,4 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
@@ -17,7 +17,7 @@ import com.njcn.event.pojo.vo.AreaStatisticalVO.MonthlyStatisticsVO;
import com.njcn.event.pojo.vo.AreaStatisticalVO.VoltageStatisticsVO;
import com.njcn.event.pojo.vo.MonthCalculationVO;
import com.njcn.event.pojo.vo.VoltageLevelCalculationVO;
import com.njcn.event.service.AreaStatisticalService;
import com.njcn.event.service.majornetwork.AreaStatisticalService;
import com.njcn.system.pojo.enums.StatisticsEnum;
import lombok.RequiredArgsConstructor;
import org.influxdb.querybuilder.clauses.Clause;

View File

@@ -1,11 +1,8 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.abel533.echarts.code.X;
import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
import com.njcn.common.pojo.exception.BusinessException;
@@ -21,8 +18,8 @@ import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.EventAnalysisService;
import com.njcn.event.service.EventDetailService;
import com.njcn.event.service.majornetwork.EventAnalysisService;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -36,7 +33,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
@@ -44,9 +40,6 @@ import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static cn.hutool.poi.excel.sax.ElementName.v;
/**
* pqs-event
*

View File

@@ -1,12 +1,9 @@
package com.njcn.event.service.Impl;
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.db.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.service.EventDetailService;
import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDBCommUtils;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.influxdb.utils.AssembleSqlUtil;
import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -30,6 +27,7 @@ public class EventDetailServiceImpl implements EventDetailService {
private final InfluxDbUtils influxDbUtils;
@Override
public List<EventDetail> getEventDetailData(String id, String startTime, String endTime) {
//组装sql语句
@@ -67,7 +65,7 @@ public class EventDetailServiceImpl implements EventDetailService {
}
@Override
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime) {
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
//组装sql语句
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
@@ -75,9 +73,18 @@ public class EventDetailServiceImpl implements EventDetailService {
if (lineIndexes.size() - i != 1) {
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or ");
} else {
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ").append(" tz('Asia/Shanghai')");
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ");
}
}
stringBuilder.append(" and ");
for (int i = 0; i < waveType.size(); i++) {
if (waveType.size() - i != 1) {
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or ");
} else {
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' ");
}
}
stringBuilder.append(" tz('Asia/Shanghai')");
//sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println("sql------------->>>"+sql);
@@ -92,22 +99,31 @@ public class EventDetailServiceImpl implements EventDetailService {
}
@Override
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum) {
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<Integer> waveType) {
//组装sql语句
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
stringBuilder.append("(");
for (int i = 0; i < lineIndexes.size(); i++) {
if (lineIndexes.size() - i != 1) {
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or ");
} else {
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("') ");
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ");
}
}
stringBuilder.append(" and ");
for (int i = 0; i < waveType.size(); i++) {
if (waveType.size() - i != 1) {
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or ");
} else {
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' ");
}
}
int i = (pageNum - 1)*pageSize;
stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
//sql语句
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
System.out.println(sql);
//结果集
QueryResult result = influxDbUtils.query(sql);
//结果集映射到对象中

View File

@@ -0,0 +1,354 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
import com.njcn.event.pojo.po.EventDurationLineChartPO;
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.majornetwork.EventDistributionStatisticsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 暂态指标分布统计
*
* @author yzh
* @date 2022/10/20
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class EventDistributionStatisticsServiceImpl implements EventDistributionStatisticsService {
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final EventDistributionStatisticsMapper eventDistributionStatisticsMapper;
/**
* 获取暂态指标分布统计
*
* @param param 条件参数
* @return 暂态指标分布统计
*/
@Override
public List<EventDistributionStatisticsTableVO> getEventDistributionStatisticsTable(StatisticsBizBaseParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
return Collections.emptyList();
}
// 创建集合,返回数据
List<EventDistributionStatisticsTableVO> vos = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取暂态指标分布统计
EventDistributionStatisticsPO po = eventDistributionStatisticsMapper.getEventDistributionStatistics(
monitorIdList,
param.getStartTime(),
param.getEndTime());
if (ObjectUtil.isEmpty(po)) {
return Collections.emptyList();
}
// 特征幅值10%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude10 = new EventDistributionStatisticsTableVO();
featureAmplitude10.setFeatureAmplitude("10%");
featureAmplitude10.setDuration20(po.getFeatureAmplitude10with20s());
featureAmplitude10.setDuration100(po.getFeatureAmplitude10with100s());
featureAmplitude10.setDuration500(po.getFeatureAmplitude10with500s());
featureAmplitude10.setDuration1000(po.getFeatureAmplitude10with1000s());
featureAmplitude10.setDuration3000(po.getFeatureAmplitude10with3000s());
featureAmplitude10.setDuration20000(po.getFeatureAmplitude10with20000s());
featureAmplitude10.setDuration60000(po.getFeatureAmplitude10with60000s());
featureAmplitude10.setDuration180000(po.getFeatureAmplitude10with180000s());
// 特征幅值40%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude40 = new EventDistributionStatisticsTableVO();
featureAmplitude40.setFeatureAmplitude("40%");
featureAmplitude40.setDuration20(po.getFeatureAmplitude40with20s());
featureAmplitude40.setDuration100(po.getFeatureAmplitude40with100s());
featureAmplitude40.setDuration500(po.getFeatureAmplitude40with500s());
featureAmplitude40.setDuration1000(po.getFeatureAmplitude40with1000s());
featureAmplitude40.setDuration3000(po.getFeatureAmplitude40with3000s());
featureAmplitude40.setDuration20000(po.getFeatureAmplitude40with20000s());
featureAmplitude40.setDuration60000(po.getFeatureAmplitude40with60000s());
featureAmplitude40.setDuration180000(po.getFeatureAmplitude40with180000s());
// 特征幅值70%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude70 = new EventDistributionStatisticsTableVO();
featureAmplitude70.setFeatureAmplitude("70%");
featureAmplitude70.setDuration20(po.getFeatureAmplitude70with20s());
featureAmplitude70.setDuration100(po.getFeatureAmplitude70with100s());
featureAmplitude70.setDuration500(po.getFeatureAmplitude70with500s());
featureAmplitude70.setDuration1000(po.getFeatureAmplitude70with1000s());
featureAmplitude70.setDuration3000(po.getFeatureAmplitude70with3000s());
featureAmplitude70.setDuration20000(po.getFeatureAmplitude70with20000s());
featureAmplitude70.setDuration60000(po.getFeatureAmplitude70with60000s());
featureAmplitude70.setDuration180000(po.getFeatureAmplitude70with180000s());
// 特征幅值85%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude85 = new EventDistributionStatisticsTableVO();
featureAmplitude85.setFeatureAmplitude("85%");
featureAmplitude85.setDuration20(po.getFeatureAmplitude85with20s());
featureAmplitude85.setDuration100(po.getFeatureAmplitude85with100s());
featureAmplitude85.setDuration500(po.getFeatureAmplitude85with500s());
featureAmplitude85.setDuration1000(po.getFeatureAmplitude85with1000s());
featureAmplitude85.setDuration3000(po.getFeatureAmplitude85with3000s());
featureAmplitude85.setDuration20000(po.getFeatureAmplitude85with20000s());
featureAmplitude85.setDuration60000(po.getFeatureAmplitude85with60000s());
featureAmplitude85.setDuration180000(po.getFeatureAmplitude85with180000s());
// 特征幅值90%
// 创建对象返回参数
EventDistributionStatisticsTableVO featureAmplitude90 = new EventDistributionStatisticsTableVO();
featureAmplitude90.setFeatureAmplitude("90%");
featureAmplitude90.setDuration20(po.getFeatureAmplitude90with20s());
featureAmplitude90.setDuration100(po.getFeatureAmplitude90with100s());
featureAmplitude90.setDuration500(po.getFeatureAmplitude90with500s());
featureAmplitude90.setDuration1000(po.getFeatureAmplitude90with1000s());
featureAmplitude90.setDuration3000(po.getFeatureAmplitude90with3000s());
featureAmplitude90.setDuration20000(po.getFeatureAmplitude90with20000s());
featureAmplitude90.setDuration60000(po.getFeatureAmplitude90with60000s());
featureAmplitude90.setDuration180000(po.getFeatureAmplitude90with180000s());
// 属性赋值
vos.add(featureAmplitude10);
vos.add(featureAmplitude40);
vos.add(featureAmplitude70);
vos.add(featureAmplitude85);
vos.add(featureAmplitude90);
return vos;
}
/**
* 获取持续时间折线图
*
* @param param 条件参数
* @return 持续时间折线图
*/
@Override
public List<SimpleVO> getEventDurationLineChart(StatisticsBizBaseParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<SimpleVO> result = new ArrayList<>();
// 将监测点id取出
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取持续时间折线图
EventDurationLineChartPO po = eventDistributionStatisticsMapper.getEventDurationLineChart(
monitorIdList,
param.getStartTime(),
param.getEndTime());
SimpleVO vo100 = new SimpleVO();
vo100.setName("0.1");
vo100.setValue(po.getDuration100());
SimpleVO vo250 = new SimpleVO();
vo250.setName("0.25");
vo250.setValue(po.getDuration250());
SimpleVO vo500 = new SimpleVO();
vo500.setName("0.5");
vo500.setValue(po.getDuration500());
SimpleVO vo1000 = new SimpleVO();
vo1000.setName("1");
vo1000.setValue(po.getDuration1000());
SimpleVO vo1100 = new SimpleVO();
vo1100.setName("1.1");
vo1100.setValue(po.getDuration1100());
// 创建map集合封装数据
result.add(vo100);
result.add(vo250);
result.add(vo500);
result.add(vo1000);
result.add(vo1100);
return result;
}
/**
* 获取特征幅值折线图
*
* @param param 条件参数
* @return 特征幅值折线图
*/
@Override
public List<SimpleVO> getEventFeatureAmplitudeLineChart(StatisticsBizBaseParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
return Collections.emptyList();
}
// 创建集合返回数据
List<SimpleVO> result = new ArrayList<>();
// 取出所有监测点id
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
if (CollectionUtil.isEmpty(monitorIdList)) {
return Collections.emptyList();
}
// 获取特征幅值折线图
EventFeatureAmplitudeLineChartPO po = eventDistributionStatisticsMapper.getEventFeatureAmplitudeLineChart(monitorIdList,
param.getStartTime(),
param.getEndTime());
if (ObjectUtil.isEmpty(po)) {
return Collections.emptyList();
}
SimpleVO vo10 = new SimpleVO();
vo10.setName("10%");
vo10.setValue(po.getFeatureAmplitude10());
SimpleVO vo20 = new SimpleVO();
vo20.setName("20%");
vo20.setValue(po.getFeatureAmplitude20());
SimpleVO vo30 = new SimpleVO();
vo30.setName("30%");
vo30.setValue(po.getFeatureAmplitude30());
SimpleVO vo40 = new SimpleVO();
vo40.setName("40%");
vo40.setValue(po.getFeatureAmplitude40());
SimpleVO vo50 = new SimpleVO();
vo50.setName("50%");
vo50.setValue(po.getFeatureAmplitude50());
SimpleVO vo60 = new SimpleVO();
vo60.setName("60%");
vo60.setValue(po.getFeatureAmplitude60());
SimpleVO vo70 = new SimpleVO();
vo70.setName("70%");
vo70.setValue(po.getFeatureAmplitude70());
SimpleVO vo80 = new SimpleVO();
vo80.setName("80%");
vo80.setValue(po.getFeatureAmplitude80());
SimpleVO vo90 = new SimpleVO();
vo90.setName("90%");
vo90.setValue(po.getFeatureAmplitude90());
// 创建map集合封装数据
result.add(vo10);
result.add(vo20);
result.add(vo30);
result.add(vo40);
result.add(vo50);
result.add(vo60);
result.add(vo70);
result.add(vo80);
result.add(vo90);
return result;
}
/**
* 获取暂态指标分布统计曲线图
*
* @param param 条件参数
* @return 暂态指标分布统计曲线图
*/
@Override
public EventFeatureAmplitudeCurveVO getEventFeatureAmplitudeCurve(StatisticsBizBaseParam param) {
// 获取当前用户的部门的子部门信息
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setDeptIndex(param.getId());
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
if (CollUtil.isEmpty(pmsGeneralDeviceDTOList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
// 取出所有监测点id
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
if (CollUtil.isEmpty(monitorIdList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
// 获取监测点暂态事件明细数据
List<RmpEventDetailPO> rmpEventDetailList = eventDistributionStatisticsMapper.getRmpEventDetail(monitorIdList, param.getStartTime(), param.getEndTime());
if (CollUtil.isEmpty(rmpEventDetailList)) {
return EventFeatureAmplitudeCurveVO.empty();
}
List<EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList> curveDataList = rmpEventDetailList.parallelStream()
.map(dto -> {
EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList eventFeatureAmplitudeCurve = new EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList();
eventFeatureAmplitudeCurve.setMeasurementPointId(dto.getMeasurementPointId());
eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude());
eventFeatureAmplitudeCurve.setDuration(dto.getDuration());
eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault()));
return eventFeatureAmplitudeCurve;
})
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
}
/**
* 获取全部的LineID
*
* @param pmsGeneralDeviceDTOList 部门信息集合
* @return lineIds
*/
private List<String> getAllLineIdList(List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList) {
if (CollUtil.isEmpty(pmsGeneralDeviceDTOList)) {
return Collections.emptyList();
}
return pmsGeneralDeviceDTOList
.stream()
.flatMap(pmsGeneralDeviceDTO -> pmsGeneralDeviceDTO.getMonitorIdList().stream())
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,228 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.pojo.param.EventMonitorReportParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
import com.njcn.event.pojo.vo.EventMonitorReportVO;
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
import com.njcn.event.service.majornetwork.EventMonitorReportService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Title EventMonitorDailyReportServiceImpl
* @Package com.njcn.event.service.Impl
* @Author jianghaifei
* @Date 2022-10-25 09:39
* @Version V1.0
*/
@Service
@RequiredArgsConstructor
public class EventMonitorReportServiceImpl implements EventMonitorReportService {
private final MonitorClient monitorClient;
private final DeptFeignClient deptFeignClient;
private final RmpEventDetailMapper rmpEventDetailMapper;
private final DicDataFeignClient dicDataFeignClient;
private final EventDistributionStatisticsMapper eventDistributionStatisticsMapper;
@Override
public List<EventMonitorReportVO> getDailyReport(EventMonitorReportParam eventMonitorReportParam) {
//提取查询参数
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
String id = eventMonitorReportParam.getId(); //单位id
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
String endTime = eventMonitorReportParam.getEndTime(); //截止时间
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位id集合
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//获取电压等级的字典
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
//将电压信息转成mapkeyid valuename
Map<String, String> voltageLevelMap = voltageLevelList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//获取暂态指标的字典
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
//将暂态指标信息转成mapkeyid value实体
Map<String, DictData> eventStatisMap = eventStatisList.stream().collect(Collectors.toMap(DictData::getId, data -> data));
//将暂态指标信息转成mapkeycode value实体
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id信息
Map<String, PmsMonitorDTO> monitorMap = monitorList.stream().collect(Collectors.toMap(PmsMonitorDTO::getId, monitor -> monitor));
//查询暂态事件明细
List<RmpEventDetailPO> detailList = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIdList, null, startTime, endTime);
Map<String, List<RmpEventDetailPO>> groupByMIdDetailMap = detailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.toList()));
List<EventMonitorReportVO> resultList = new ArrayList<>();
groupByMIdDetailMap.forEach((key, monitorEventDetailList) -> {
//封装返回需要返回的信息
PmsMonitorDTO pmsMonitorDTO = monitorMap.get(key);
EventMonitorReportVO eventMonitorReportVO = new EventMonitorReportVO();
eventMonitorReportVO.setDate(startTime); //查询时间
//监测点基本信息
eventMonitorReportVO.setMonitorId(pmsMonitorDTO.getId()); //监测点id
eventMonitorReportVO.setMonitorName(pmsMonitorDTO.getName()); //监测点name
eventMonitorReportVO.setOrgId(pmsMonitorDTO.getOrgId()); //单位id
eventMonitorReportVO.setOrgName(pmsMonitorDTO.getOrgName()); //单位name
eventMonitorReportVO.setVoltageLevel(pmsMonitorDTO.getVoltageLevel()); //监测点电压等级
eventMonitorReportVO.setVoltageLevelName(voltageLevelMap.get(pmsMonitorDTO.getVoltageLevel())); //监测点电压等级名称
//暂升、暂降、短时中断次数
Map<String, List<RmpEventDetailPO>> countMap = monitorEventDetailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getEventType, Collectors.toList()));
countMap.forEach((countKey, value) -> {
String code = eventStatisMap.get(countKey).getCode();
switch (code) {
case "Voltage_Dip":
eventMonitorReportVO.setVoltageDipCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //电压暂降次数
break;
case "Voltage_Rise":
eventMonitorReportVO.setVoltageRiseCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //电压暂升次数
break;
case "Short_Interruptions":
eventMonitorReportVO.setShortInterruptionCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //短时中断
break;
default: break;
}
});
eventMonitorReportVO.setVoltageDipCount(eventMonitorReportVO.getVoltageDipCount() == null ? 0 : eventMonitorReportVO.getVoltageDipCount());
eventMonitorReportVO.setVoltageRiseCount(eventMonitorReportVO.getVoltageRiseCount() == null ? 0 : eventMonitorReportVO.getVoltageRiseCount());
eventMonitorReportVO.setShortInterruptionCount(eventMonitorReportVO.getShortInterruptionCount() == null ? 0 : eventMonitorReportVO.getShortInterruptionCount());
// //短时中断、暂降分布情况
// Map<String, Object> condMap = new HashMap<>();
// condMap.put("monitorIdList", Arrays.asList(key.split(",")));
// condMap.put("startTime", startTime);
// condMap.put("endTime", endTime);
// condMap.put("eventTypeList", Arrays.asList(eventStatisMapByCode.get("Voltage_Dip").getId(), eventStatisMapByCode.get("Short_Interruptions").getId()));
// EventDipShortDistributionVO eventDipShortDistributionVO = eventDistributionStatisticsMapper.getEventDipShortDistributionByCond(condMap);
// eventMonitorReportVO.setDipShortStatisticsVO(eventDipShortDistributionVO);
//暂升分布情况
// Map<String, Object> riseCondMap = new HashMap<>();
// riseCondMap.put("monitorIdList", Arrays.asList(key.split(",")));
// riseCondMap.put("startTime", startTime);
// riseCondMap.put("endTime", endTime);
// riseCondMap.put("eventTypeList", Collections.singletonList(eventStatisMapByCode.get("Voltage_Rise").getId()));
// EventRiseDistributionVO eventRiseDistributionVO = eventDistributionStatisticsMapper.getEventRiseDistributionByCond(riseCondMap);
// eventMonitorReportVO.setRiseStatisticsVO(eventRiseDistributionVO);
resultList.add(eventMonitorReportVO);
});
return resultList;
}
/***
* 暂态指标监测点电压暂降和短时中断分布情况
* @author jianghaifei
* @date 2022-10-28 14:56
* @param eventMonitorReportParam
* @return com.njcn.event.pojo.vo.EventDipShortDistributionVO
*/
@Override
public EventDipShortDistributionVO getEventDipShortDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
//提取参数
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
String id = eventMonitorReportParam.getId(); //单位id
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位id集合
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id集合
//获取暂态指标的字典
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
//将暂态指标信息转成mapkeycode value实体
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
//短时中断、暂降分布情况
Map<String, Object> condMap = new HashMap<>();
condMap.put("monitorIdList", monitorIdList);
condMap.put("startTime", startTime);
condMap.put("endTime", endTime);
condMap.put("eventTypeList", Arrays.asList(eventStatisMapByCode.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), eventStatisMapByCode.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId()));
return eventDistributionStatisticsMapper.getEventDipShortDistributionByCond(condMap);
}
@Override
public EventRiseDistributionVO getEventRiseDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
//提取参数
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
String id = eventMonitorReportParam.getId(); //单位id
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位id集合
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id集合
//获取暂态指标的字典
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
//将暂态指标信息转成mapkeycode value实体
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
//暂升分布情况
Map<String, Object> riseCondMap = new HashMap<>();
riseCondMap.put("monitorIdList", monitorIdList);
riseCondMap.put("startTime", startTime);
riseCondMap.put("endTime", endTime);
riseCondMap.put("eventTypeList", Collections.singletonList(eventStatisMapByCode.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId()));
return eventDistributionStatisticsMapper.getEventRiseDistributionByCond(riseCondMap);
}
}

View File

@@ -0,0 +1,20 @@
package com.njcn.event.service.majornetwork.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.mapper.majornetwork.RStatEventDMapper;
import com.njcn.event.pojo.po.RStatEventD;
import com.njcn.event.service.majornetwork.RStatEventDService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author rui.wu
* @since 2022-10-12
*/
@Service
public class RStatEventDServiceImpl extends ServiceImpl<RStatEventDMapper, RStatEventD> implements RStatEventDService {
}

View File

@@ -0,0 +1,591 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventDMapper;
import com.njcn.event.mapper.majornetwork.RStatEventMMapper;
import com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.po.*;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RStatEventMService;
import com.njcn.device.pq.utils.PublicDateUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author rui.wu
* @since 2022-10-11
*/
@Service
@RequiredArgsConstructor
public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStatEventM> implements RStatEventMService {
private final RStatEventMMapper rStatEventMMapper;
private final DicDataFeignClient dicDataFeignClient;
private final RStatEventDMapper rStatEventDMapper;
private final RStatEventVoltageMMapper rStatEventVoltageMMapper;
@Override
public List<RArrayVO> getRStatEventMAll(StatisticsBizBaseParam param) {
//子节点 获取所有得干扰源类型(监测点类型)
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
Map<String, DictData> interferenceMap = interferenceSourceTypeData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
Map<String, DictData> lineTypeMap = lineTypeData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//数据库查询
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
.eq(RStatEventM::getDataType, mainnetData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
List<RStatEventMVO> rm = new ArrayList<>();
for (DictData lineTypeDatum : interferenceSourceTypeData) {
RStatEventMVO r = new RStatEventMVO();
r.setEventName(lineTypeDatum.getName());
r.setSort(lineTypeDatum.getSort());
r.setEventMeasurementAverage(0);
r.setEventMeasurementAccrued(0);
r.setEventFreq(0.0F);
r.setEventCount(0);
r.setEventMeasurementRatioAverage(0.0F);
r.setEventMeasurementRatioAccrued(0.0F);
rm.add(r);
}
for (DictData lineTypeDatum : lineTypeData) {
RArrayVO r = new RArrayVO();
r.setRowName(lineTypeDatum.getName());
r.setColumns(rm);
r.setSort(lineTypeDatum.getSort());
arrayVOList.add(r);
}
//根据暂态指标分组
Map<String, List<RStatEventM>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
//重新生成数据结构
MeasurementTypeClassMap.forEach((key, value) -> {
if (lineTypeMap.containsKey(key)) {
RArrayVO arrayVO = new RArrayVO();
DictData data = lineTypeMap.get(key);
arrayVO.setRowName(data.getName());
arrayVO.setSort(data.getSort());
List<RStatEventMVO> b = new ArrayList<>();
b.addAll(rm);
for (RStatEventM rStatEventM : value) {
if(interferenceMap.containsKey(rStatEventM.getMeasurementTypeClass())){
RStatEventMVO r = BeanUtil.copyProperties(rStatEventM, RStatEventMVO.class);
DictData data1 = interferenceMap.get(rStatEventM.getMeasurementTypeClass());
r.setEventName(data1.getName());
r.setSort(data1.getSort());
b.add(r);
}
}
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
for (RStatEventMVO harmonicMVO : b) {
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
}
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVO.setColumns(aa);
arrayVOList.add(arrayVO);
}
});
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
for (RArrayVO rArrayVO : arrayVOList) {
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
}
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
return aa;
}
@Override
public List<RArrayVO> getPwRStatEventMAll(StatisticsBizBaseParam param) {
//对象主节点 获取所有得暂降类型
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
Map<String, DictData> eventMap = eventData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//子节点 获取监测点类别
List<DictData> lineData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.LINE_SORT.getCode()).getData();
Map<String, DictData> lineMap = lineData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//获取配网id信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
//数据库查询
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
.eq(RStatEventM::getDataType, distributionData.getId())
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
//根据暂态指标分组
Map<String, List<RStatEventM>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
//判断对象是否为空
if (CollUtil.isNotEmpty(list)) {
//重新生成数据结构
measurementMap.forEach((key, value) -> {
List<RStatEventMVO> eventVO = new ArrayList<>();
if (eventMap.containsKey(key)) {
RArrayVO arrayVO = new RArrayVO();
DictData data = eventMap.get(key);
arrayVO.setRowName(data.getName());
arrayVO.setSort(data.getSort());
for (RStatEventM rStatEvent : value) {
if(lineMap.containsKey(rStatEvent.getMeasurementTypeClass())){
RStatEventMVO r = BeanUtil.copyProperties(rStatEvent, RStatEventMVO.class);
DictData data1 = lineMap.get(rStatEvent.getMeasurementTypeClass());
r.setEventName(data1.getName());
r.setSort(data1.getSort());
eventVO.add(r);
}
}
//根据监测点类别获取差集
Map<String, List<RStatEventM>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventM::getMeasurementTypeClass));
List<DictData> differenceList = lineData.stream().filter(r -> !listMap.containsKey(r.getId()))
.collect(Collectors.toList());
this.assignDict(differenceList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
});
}
//处理主节点不存在的集合
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementMap.containsKey(r.getId()))
.collect(Collectors.toList());
for (DictData notData : notMeasurementList) {
List<RStatEventMVO> eventVO = new ArrayList<>();
RArrayVO arrayVO = new RArrayVO();
arrayVO.setRowName(notData.getName());
arrayVO.setSort(notData.getSort());
this.assignDict(lineData, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
return arrayVOList;
}
@Override
public List<RStatEventMVO> getRStatHarmonicIcon(REventMParam param) {
//干扰数据类型(监测对象)
DictData measurementData;
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
//干扰数据类型(监测对象)
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
measurementData = interferenceSourceTypeData.get(0);
//指标对象类型
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
eventData = indicatorTypeDate.get(0);
} else {
//获取检测点对象(电压)
measurementData = dicDataFeignClient.getDicDataById(
param.getMonitorID()).getData();
//获取指标对象(频率偏差)
eventData = dicDataFeignClient.getDicDataById(
param.getStasisID()).getData();
}
//反防止参数查询数据报错
Assert.isTrue(
ObjectUtil.isNotNull(measurementData) || ObjectUtil.isNotNull(eventData)
, "干扰源类型或者指标类型为空,请检查入参是否准确");
//获取电压字典
List<DictData> devVoltageData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
Map<String, DictData> devVoltageMap = devVoltageData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//初始化对象
List<RStatEventMVO> arrayVOList = new ArrayList<>();
List<RStatEventVoltageM> rStatHarmonicVoltageMS = rStatEventVoltageMMapper.selectList(new LambdaQueryWrapper<RStatEventVoltageM>()
.eq(RStatEventVoltageM::getDataType, mainnetData.getId())
.eq(RStatEventVoltageM::getMeasurementTypeClass, measurementData.getId())
.eq(RStatEventVoltageM::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventVoltageM::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventVoltageM::getDataDate, param.getEndTime())
);
//将数据转换为map进行便利
Map<String, RStatEventVoltageM> voltageMMap = rStatHarmonicVoltageMS.stream()
.collect(Collectors.toMap(RStatEventVoltageM::getVoltageType, Function.identity()));
//对象
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
voltageMMap.forEach((key, value) -> {
if (devVoltageMap.containsKey(key)) {
DictData data = devVoltageMap.get(key);
RStatEventMVO riconvo = new RStatEventMVO();
riconvo.setEventName(data.getName());
riconvo.setSort(data.getSort());
riconvo.setEventMeasurementAverage(value.getEventMeasurementAverage());
riconvo.setEventMeasurementAccrued(value.getEventMeasurementAccrued());
riconvo.setEventFreq(value.getEventFreq());
riconvo.setEventCount(value.getEventCount());
riconvo.setEventMeasurementRatioAverage(value.getEventMeasurementRatioAverage());
riconvo.setEventMeasurementRatioAccrued(value.getEventMeasurementRatioAccrued());
arrayVOList.add(riconvo);
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
return arrayVOList;
}
@SneakyThrows
@Override
public List<REventPolylineVO> getRStatHarmonicIcon2(REventMParam param) {
//初始化对象
List<REventPolylineVO> iconList = new ArrayList<>();
DictData measurementDate;
//指标对象类型属性
DictData harmonicDate;
//判断是是否传入检测点信息值(电压)
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
//干扰数据类型(监测对象)
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
measurementDate = interferenceSourceTypeData.get(0);
//指标对象类型
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
harmonicDate = indicatorTypeDate.get(0);
} else {
//获取检测点对象(电压)
measurementDate = dicDataFeignClient.getDicDataById(
param.getMonitorID()).getData();
//获取指标对象(频率偏差)
harmonicDate = dicDataFeignClient.getDicDataById(
param.getStasisID()).getData();
}
//反防止参数查询数据报错
Assert.isTrue(
ObjectUtil.isNotNull(measurementDate) || ObjectUtil.isNotNull(harmonicDate)
, "干扰源类型或者指标类型为空,请检查入参是否准确");
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
.eq(RStatEventD::getDataType, mainnetData.getId())
.eq(RStatEventD::getMeasurementTypeClass, measurementDate.getId())
.eq(RStatEventD::getEventType, harmonicDate.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
);
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
//获取月份
List<String> intervalTime = this.getIntervalTime(param.getStartTime(), param.getEndTime());
for (String interTime : intervalTime) {
//生成初始时间
String startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
String endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date dt = simpleDateFormat.parse(startTime);
Date dtDate = simpleDateFormat.parse(endTime);
Integer year = Integer.valueOf(String.format("%tY", dt));
Integer mon = Integer.valueOf(String.format("%tm", dt));
Integer day = Integer.valueOf(String.format("%td", dtDate));
//生成月份数据
List<String> dayTime = this.getIntervalDateTime(year, mon, day);
for (String s : dayTime) {
REventPolylineVO rPolylineVO = new REventPolylineVO();
rPolylineVO.setDate(s);
if (rStatEventDMap.containsKey(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"))) {
List<RStatEventD> rSd = rStatEventDMap.get(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"));
rPolylineVO.setEventCount(rSd.get(0).getEventCount());
rPolylineVO.setEventMeasurement(rSd.get(0).getEventMeasurement());
rPolylineVO.setEventMeasurementRatio(rSd.get(0).getEventMeasurementRatio());
rPolylineVO.setEventFreq(1);
} else {
rPolylineVO.setEventMeasurement(0);
rPolylineVO.setEventMeasurementRatio(0.0F);
rPolylineVO.setEventCount(0);
rPolylineVO.setEventFreq(0);
}
iconList.add(rPolylineVO);
}
}
return iconList;
}
@SneakyThrows
@Override
public List<REventPolylineVO> getPwRStatHarmonicIcon2(REventMParam param) {
//初始化对象
List<REventPolylineVO> iconList = new ArrayList<>();
DictData measurementData;
//指标对象类型属性
DictData eventData;
//判断是是否传入监测点信息值
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
//干扰数据类型(监测对象)
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.LINE_SORT.getCode()).getData();
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
measurementData = interferenceSourceTypeData.get(0);
//指标对象类型
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
eventData = indicatorTypeDate.get(0);
} else {
//获取检测点对象(电压)
measurementData = dicDataFeignClient.getDicDataById(
param.getMonitorID()).getData();
//获取指标对象(频率偏差)
eventData = dicDataFeignClient.getDicDataById(
param.getStasisID()).getData();
}
//反防止参数查询数据报错
Assert.isTrue(
ObjectUtil.isNotNull(measurementData) || ObjectUtil.isNotNull(eventData)
, "干扰源类型或者指标类型为空,请检查入参是否准确");
//获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
.eq(RStatEventD::getDataType, distributionData.getId())
.eq(RStatEventD::getMeasurementTypeClass, measurementData.getId())
.eq(RStatEventD::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
);
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
//获取月份
List<String> intervalTime = this.getIntervalTime(param.getStartTime(), param.getEndTime());
for (String interTime : intervalTime) {
//生成初始时间
String startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
String endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date dt = simpleDateFormat.parse(startTime);
Date dtDate = simpleDateFormat.parse(endTime);
Integer year = Integer.valueOf(String.format("%tY", dt));
Integer mon = Integer.valueOf(String.format("%tm", dt));
Integer day = Integer.valueOf(String.format("%td", dtDate));
//生成月份数据
List<String> dayTime = this.getIntervalDateTime(year, mon, day);
for (String s : dayTime) {
REventPolylineVO rPolylineVO = new REventPolylineVO();
rPolylineVO.setDate(s);
if (rStatEventDMap.containsKey(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"))) {
List<RStatEventD> rSd = rStatEventDMap.get(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"));
rPolylineVO.setEventCount(rSd.get(0).getEventCount());
rPolylineVO.setEventMeasurement(rSd.get(0).getEventMeasurement());
rPolylineVO.setEventMeasurementRatio(rSd.get(0).getEventMeasurementRatio());
rPolylineVO.setEventFreq(1);
} else {
rPolylineVO.setEventMeasurement(0);
rPolylineVO.setEventMeasurementRatio(0.0F);
rPolylineVO.setEventCount(0);
rPolylineVO.setEventFreq(0);
}
iconList.add(rPolylineVO);
}
}
return iconList;
}
/**
* 根据用户选择的时间区间返回月份日期
*/
@SneakyThrows
private List<String> getIntervalTime(String startTime, String endTime) {
List<String> times = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
Date start = sdf.parse(startTime);
Date end = sdf.parse(endTime);
// 同月
if (start.getTime() == end.getTime()) {
String time = startTime.substring(0, 7);
times.add(time);
} else if (start.getYear() == end.getYear()) {
// 同年
int startM = start.getMonth() + 1;
int endM = end.getMonth() + 1;
int temp = endM - startM;
for (int i = 0; i <= temp; i++) {
String time = start.getYear() + 1900 + "";
int month = startM + i;
if (month < 10) {
time = time + "-0" + month;
} else {
time = time + "-" + month;
}
times.add(time);
}
} else {
// 不同年!!!!这里忽略了年份之间跨年的情况
int startY = start.getYear() + 1900;
int startM = start.getMonth() + 1;
int endY = end.getYear() + 1900;
int endM = end.getMonth() + 1;
int tempS = 12 - startM;
// 连续的年份
if (endY - startY == 1) {
// 第一年的时间获取
for (int i = 0; i <= tempS; i++) {
int month = startM + i;
String time = startY + "-";
if (month < 10) {
time = time + "0" + month;
} else {
time = time + month;
}
times.add(time);
}
// 第二年的时间获取
for (int i = 1; i <= endM; i++) {
String time = endY + "-";
if (i < 10) {
time = time + "0" + i;
} else {
time = time + i;
}
times.add(time);
}
} else {
// 不连续的年份
// 第一年的时间获取
for (int i = 0; i <= tempS; i++) {
int month = startM + i;
String time = startY + "-";
if (month < 10) {
time = time + "0" + month;
} else {
time = time + month;
}
times.add(time);
}
int tempY = endY - startY;
// 中间年份的时间
for (int i = 1; i < tempY; i++) {
for (int j = 1; j <= 12; j++) {
String time = startY + i + "-";
if (j < 10) {
time = time + "0" + j;
} else {
time = time + j;
}
times.add(time);
}
}
// 最后一年的时间获取
for (int i = 1; i <= endM; i++) {
String time = endY + "-";
if (i < 10) {
time = time + "0" + i;
} else {
time = time + i;
}
times.add(time);
}
}
}
return times;
}
@SneakyThrows
private List<String> getIntervalDateTime(Integer startTime, Integer endTime, Integer dd) {
List<String> list = new ArrayList<>();
Calendar calendar = Calendar.getInstance(Locale.CHINA);
calendar.set(startTime, endTime - 1, 1);
//年份
int year = calendar.get(Calendar.YEAR);
//月份
int month = calendar.get(Calendar.MONTH) + 1;
for (int i = 1; i <= dd; i++) {
String date = null;
if (month < 10 && i < 10) {
date = year + "-0" + month + "-0" + i;
}
if (month < 10 && i >= 10) {
date = year + "-0" + month + "-" + i;
}
if (month >= 10 && i < 10) {
date = year + "-" + month + "-0" + i;
}
if (month >= 10 && i >= 10) {
date = year + "-" + month + "-" + i;
}
list.add(date);
}
return list;
}
/**
* 便利赋值
*
* @param DictDataList 暂态类型集合
* @param eventVO 暂态监测点
* @param arrayVO 初始化对象
*/
private void assignDict(List<DictData> DictDataList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
for (DictData dictData : DictDataList) {
RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName());
notEventVO.setSort(dictData.getSort());
notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F);
notEventVO.setEventCount(0);
notEventVO.setEventMeasurementRatioAverage(0.0F);
notEventVO.setEventMeasurementRatioAccrued(0.0F);
eventVO.add(notEventVO);
}
arrayVO.setColumns(eventVO);
}
}

View File

@@ -0,0 +1,342 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.po.RStatEventOrgM;
import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO;
import com.njcn.event.service.majornetwork.RStatEventOrgMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author rui.wu
* @since 2022-10-11
*/
@Service
@RequiredArgsConstructor
public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper, RStatEventOrgM> implements RStatEventOrgMService {
private final DicDataFeignClient dicDataFeignClient;
private final DeptFeignClient deptFeignClient;
private final RStatEventOrgMMapper statEventOrgMMapper;
@Override
public List<RArrayVO> getRStatEventOrgMAll(StatisticsBizBaseParam param) {
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
//对象主节点 获取所有得暂降类型
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
Map<String, DictData> lineTypeMap = lineTypeData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//数据库查询
List<RStatEventOrgM> list = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
.eq(RStatEventOrgM::getDataType, mainnetData.getId())
.in(RStatEventOrgM::getOrgNo, deptIds)
.ge(param.getStartTime() != null, RStatEventOrgM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventOrgM::getDataDate, param.getEndTime()));
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
List<RStatEventMVO> rm = new ArrayList<>();
for (DeptDTO deptDTO : deptDTOList) {
RStatEventMVO r = new RStatEventMVO();
r.setEventName(deptDTO.getName());
r.setEventMeasurementAverage(0);
r.setEventMeasurementAccrued(0);
r.setEventFreq(0.0F);
r.setEventCount(0);
r.setEventMeasurementRatioAverage(0.0F);
r.setEventMeasurementRatioAccrued(0.0F);
rm.add(r);
}
for (DictData lineTypeDatum : lineTypeData) {
RArrayVO r = new RArrayVO();
r.setRowName(lineTypeDatum.getName());
r.setColumns(rm);
r.setSort(lineTypeDatum.getSort());
arrayVOList.add(r);
}
//根据检测点对象分组
Map<String, List<RStatEventOrgM>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
//重新生成数据结构
MeasurementTypeClassMap.forEach((key, value) -> {
if (lineTypeMap.containsKey(key)) {
RArrayVO arrayVO = new RArrayVO();
DictData data = lineTypeMap.get(key);
arrayVO.setRowName(data.getName());
arrayVO.setSort(data.getSort());
List<RStatEventMVO> b = new ArrayList<>();
b.addAll(rm);
for (RStatEventOrgM orgM : value) {
if(deptMap.containsKey(orgM.getOrgNo())){
RStatEventMVO r = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
DeptDTO data1 = deptMap.get(orgM.getOrgNo());
r.setEventName(data1.getName());
b.add(r);
}
}
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
for (RStatEventMVO harmonicMVO : b) {
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
}
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
arrayVO.setColumns(aa);
arrayVOList.add(arrayVO);
}
});
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
for (RArrayVO rArrayVO : arrayVOList) {
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
}
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
return aa;
}
@Override
public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
//指标对象类型
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
eventData = indicatorTypeDate.get(0);
} else {
//获取指标对象(频率偏差)
eventData = dicDataFeignClient.getDicDataById(
param.getStasisID()).getData();
}
//反防止参数查询数据报错
Assert.isTrue(
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
, "各单位或者指标类型为空,请检查入参是否准确");
//获取主网id信息
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
//初始化对象
List<RStatEventMVO> arrayVOList = new ArrayList<>();
List<RStatEventOrgM> rStatHarmonicVoltageMS = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
.eq(RStatEventOrgM::getDataType, mainnetData.getId())
.in(RStatEventOrgM::getOrgNo, deptIds)
.eq(RStatEventOrgM::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgM::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgM::getDataDate, param.getEndTime())
);
//将数据转换为map进行便利
Map<String, List<RStatEventOrgM>> voltageMMap = rStatHarmonicVoltageMS.stream()
.collect(Collectors.groupingBy(RStatEventOrgM::getOrgNo));
//对象
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
voltageMMap.forEach((key, value) -> {
if (deptMap.containsKey(key)) {
DeptDTO data = deptMap.get(key);
for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
return arrayVOList;
}
@Override
public List<RArrayVO> getPwRStatEventOrgMAll(StatisticsBizBaseParam param) {
//对象主节点 获取所有得暂降类型
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
Map<String, DictData> eventMap = eventData.stream()
.collect(Collectors.toMap(DictData::getId, Function.identity()));
//子节点 获取所有得各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
//获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//数据库查询
List<RStatEventOrgM> list = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
.eq(RStatEventOrgM::getDataType, distributionData.getId())
.in(RStatEventOrgM::getOrgNo, deptIds)
.ge(param.getStartTime() != null, RStatEventOrgM::getDataDate, param.getStartTime())
.le(param.getEndTime() != null, RStatEventOrgM::getDataDate, param.getEndTime()));
//初始化指标类型(横向)
List<RArrayVO> arrayVOList = new ArrayList<>();
//根据检测点对象分组
Map<String, List<RStatEventOrgM>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
if (CollUtil.isNotEmpty(list)) {
//重新生成数据结构
measurementTypeClassMap.forEach((key, value) -> {
if (eventMap.containsKey(key)) {
List<RStatEventMVO> eventVO = new ArrayList<>();
RArrayVO arrayVO = new RArrayVO();
DictData data = eventMap.get(key);
arrayVO.setRowName(data.getName());
arrayVO.setSort(data.getSort());
for (RStatEventOrgM org : value) {
if(deptMap.containsKey(org.getOrgNo())){
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
r.setEventName(deptDTO.getName());
eventVO.add(r);
}
}
//根据监测点类别获取差集
Map<String, List<RStatEventOrgM>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
.collect(Collectors.toList());
this.assignDept(notDeptList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
arrayVOList.add(arrayVO);
}
});
}
//处理主节点不存在的集合
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
.collect(Collectors.toList());
for (DictData notData : notMeasurementList) {
List<RStatEventMVO> eventVO = new ArrayList<>();
RArrayVO arrayVO = new RArrayVO();
arrayVO.setRowName(notData.getName());
arrayVO.setSort(notData.getSort());
this.assignDept(deptDTOList, eventVO, arrayVO);
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
arrayVOList.add(arrayVO);
}
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
return arrayVOList;
}
@Override
public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) {
//各单位类型
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
//获取部门id集合
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
//指标对象类型属性
DictData eventData;
//判断是是否传入检测点信息值(电压)
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
//指标对象类型
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
eventData = indicatorTypeDate.get(0);
} else {
//获取指标对象(频率偏差)
eventData = dicDataFeignClient.getDicDataById(
param.getStasisID()).getData();
}
//反防止参数查询数据报错
Assert.isTrue(
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
, "各单位或者指标类型为空,请检查入参是否准确");
//获取配网信息
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
//初始化对象
List<RStatEventMVO> arrayVOList = new ArrayList<>();
List<RStatEventOrgM> rStatHarmonicVoltageMS = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
.eq(RStatEventOrgM::getDataType, distributionData.getId())
.in(RStatEventOrgM::getOrgNo, deptIds)
.eq(RStatEventOrgM::getEventType, eventData.getId())
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgM::getDataDate, param.getStartTime())
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgM::getDataDate, param.getEndTime())
);
//将数据转换为map进行便利
Map<String, List<RStatEventOrgM>> voltageMMap = rStatHarmonicVoltageMS.stream()
.collect(Collectors.groupingBy(RStatEventOrgM::getOrgNo));
//对象
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
voltageMMap.forEach((key, value) -> {
if (deptMap.containsKey(key)) {
DeptDTO data = deptMap.get(key);
for (RStatEventOrgM orgM : value) {
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
rStatEventMVO.setEventName(data.getName());
arrayVOList.add(rStatEventMVO);
}
}
});
}
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
return arrayVOList;
}
/**
* 便利赋值
*
* @param deptDTOList 部门集合
* @param eventVO 暂态监测点
* @param arrayVO 初始化对象
*/
private void assignDept(List<DeptDTO> deptDTOList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
for (DeptDTO dictData : deptDTOList) {
RStatEventMVO notEventVO = new RStatEventMVO();
notEventVO.setEventName(dictData.getName());
notEventVO.setEventMeasurementAverage(0);
notEventVO.setEventMeasurementAccrued(0);
notEventVO.setEventFreq(0.0F);
notEventVO.setEventCount(0);
notEventVO.setEventMeasurementRatioAverage(0.0F);
notEventVO.setEventMeasurementRatioAccrued(0.0F);
eventVO.add(notEventVO);
}
arrayVO.setColumns(eventVO);
}
}

Some files were not shown because too many files have changed in this diff Show More