算法模块删除不必要的代码,有备份,如果存疑就联系我
This commit is contained in:
@@ -40,8 +40,8 @@ public class MeasurementExecutor extends BaseExecutor {
|
||||
private final RMpEventDetailService rMpEventDetailService;
|
||||
private final RMpEventDetailDService rMpEventDetailDService;
|
||||
private final RMpEventDetailQService rMpEventDetailQService;
|
||||
|
||||
private final RMpEventDetailYService rMpEventDetailYService;
|
||||
|
||||
private final DayDataService dayDataService;
|
||||
private final RStatAbnormalDService rStatAbnormalDService;
|
||||
private final ROperatingMonitorService rOperatingMonitorService;
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.device;
|
||||
|
||||
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.prepare.harmonic.pojo.param.DeviceAbnormaStatisticsParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.device.DeviceAbnormalStatisticsService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "终端异常统计")
|
||||
@RestController
|
||||
@RequestMapping("/deviceAbnormal")
|
||||
@RequiredArgsConstructor
|
||||
public class DeviceAbnormalController extends BaseController {
|
||||
|
||||
private final DeviceAbnormalStatisticsService deviceAbnormaStatisticsService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/statistics")
|
||||
@ApiOperation("终端异常统计")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<Boolean> dailyDeviceAbnormaStatistics(@RequestBody DeviceAbnormaStatisticsParam param) {
|
||||
String methodDescribe = getMethodDescribe("dailyDeviceAbnormaStatistics");
|
||||
boolean res = deviceAbnormaStatisticsService.dailyDeviceAbnormaStatistics(param);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
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.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.IRMpMonitorAlarmCountMService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RMpTargetWarnDService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.AlarmDetailService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author qijian
|
||||
* @date 2022/12/28
|
||||
* 监测点指标告警明细
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/alarmDetail")
|
||||
@Api(tags = "监测点指标告警明细")
|
||||
@AllArgsConstructor
|
||||
public class AlarmDetailController extends BaseController {
|
||||
|
||||
private final AlarmDetailService alarmDetailService;
|
||||
|
||||
private final RMpTargetWarnDService rMpTargetWarnDService;
|
||||
|
||||
private final IRMpMonitorAlarmCountMService rMpMonitorAlarmCountMService;
|
||||
|
||||
/* @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/alarmDetailAlarm")
|
||||
@ApiOperation("监测点指标告警日统计")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> alarmDetailAlarm(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("alarmDetailAlarm");
|
||||
alarmDetailService.alarmDetailAlarm(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @author xuyang
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/targetDiff")
|
||||
@ApiOperation("监测点稳态指标差值日统计")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> targetDiff(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("targetDiff");
|
||||
// alarmDetailService.targetDiff(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/alarmDay")
|
||||
@ApiOperation("监测点指标告警日统计(新)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> alarmDay(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("alarmDay");
|
||||
// rMpTargetWarnDService.alarmDay(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/alarmMonth")
|
||||
@ApiOperation("监测点指标告警月统计(新)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> alarmMonth(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("alarmMonth");
|
||||
// rMpMonitorAlarmCountMService.alarmMonth(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.DayDataService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/10/24 9:26【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "日表数据处理")
|
||||
@RestController
|
||||
@RequestMapping("daydata")
|
||||
@RequiredArgsConstructor
|
||||
public class DayDataController extends BaseController {
|
||||
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final DayDataService dayDataService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
/* @Deprecated
|
||||
@ApiOperation("day表定时任务")
|
||||
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
|
||||
@PostMapping("dayDataHanlder")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> dayDataHanlder(@RequestBody LineParam jobParam ){
|
||||
log.info(LocalDateTime.now()+"dayDataHanlder开始执行");
|
||||
String methodDescribe = getMethodDescribe("dayDataHanlder");
|
||||
Boolean result = true;
|
||||
List<String> indexLists = new ArrayList<> ();
|
||||
if(CollectionUtils.isEmpty (jobParam.getLineIds ())){
|
||||
indexLists = lineFeignClient.getLineList ( ).getData ( );
|
||||
}else{
|
||||
indexLists = jobParam.getLineIds ();
|
||||
}
|
||||
String startTime = jobParam.getDataDate ()+" "+"00:00:00";
|
||||
String endTime = jobParam.getDataDate ()+" "+"23:59:59";
|
||||
|
||||
dayDataService.dayDataJobHandler (indexLists,startTime,endTime);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
@ApiOperation("day表定时任务(MySQL库)")
|
||||
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
|
||||
@PostMapping("dataToDay")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> dataToDayHandler(@RequestBody LineParam jobParam ){
|
||||
//特殊处理后面需要删除
|
||||
if(Objects.isNull(jobParam.getLineType())){
|
||||
jobParam.setLineType(2);
|
||||
}
|
||||
String startTime,endTime;
|
||||
log.info(LocalDateTime.now()+"dataToDayHandler开始执行,开始时间-结束时间"+jobParam.getBeginTime()+"___"+jobParam.getEndTime());
|
||||
String methodDescribe = getMethodDescribe("dataToDayHandler");
|
||||
List<String> indexLists = new ArrayList<> ();
|
||||
if(CollectionUtils.isEmpty (jobParam.getLineIds())){
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else{
|
||||
indexLists = jobParam.getLineIds();
|
||||
}
|
||||
if (Objects.nonNull(jobParam.getRepairFlag()) && jobParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
startTime = item+" "+"00:00:00";
|
||||
endTime = item+" "+"23:59:59";
|
||||
// dayDataService.dataToDayHandler(indexLists,startTime,endTime,jobParam.getLineType());
|
||||
}
|
||||
} else {
|
||||
// dayDataService.dataToDayHandler(indexLists,jobParam.getBeginTime(),jobParam.getEndTime(),jobParam.getLineType());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.HarmonicGeneralService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/11/3 9:00
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "稳态综合评估")
|
||||
@RestController
|
||||
@RequestMapping("/general")
|
||||
@RequiredArgsConstructor
|
||||
public class HarmonicGeneralController extends BaseController {
|
||||
|
||||
private final HarmonicGeneralService harmonicGeneralService;
|
||||
|
||||
@Deprecated
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/generalData")
|
||||
@ApiOperation("稳态综合评估日数据计算")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> generalData(@RequestBody @Validated LineParam lineParam){
|
||||
String methodDescribe = getMethodDescribe("generalData");
|
||||
harmonicGeneralService.generalData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/generalDataToMysql")
|
||||
@ApiOperation("稳态综合评估日数据计算(MySQL入库)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> generalDataToMysql(@RequestBody @Validated LineParam lineParam){
|
||||
log.info(LocalDateTime.now()+"generalDataToMysql开始执行");
|
||||
String methodDescribe = getMethodDescribe("generalDataToMysql");
|
||||
if (lineParam.getType() == 3){
|
||||
int year = Integer.parseInt(lineParam.getDataDate().split("-")[0]);
|
||||
int month = Integer.parseInt(lineParam.getDataDate().split("-")[1]);
|
||||
List<String> dayList = PublicUtil.getDayByMonth(year,month);
|
||||
for (String item : dayList) {
|
||||
log.info(item+"-->开始执行");
|
||||
harmonicGeneralService.generalDataToMysql(lineParam,item);
|
||||
}
|
||||
} else {
|
||||
harmonicGeneralService.generalDataToMysql(lineParam,lineParam.getDataDate());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.HarmonicMetricService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/11/3 8:59
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "稳态指标评估")
|
||||
@RestController
|
||||
@RequestMapping("/metric")
|
||||
@RequiredArgsConstructor
|
||||
public class HarmonicMetricController extends BaseController {
|
||||
|
||||
private final HarmonicMetricService harmonicMetricService;
|
||||
|
||||
@Deprecated
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/metricData")
|
||||
@ApiOperation("稳态指标评估日数据计算")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> metricData(@RequestBody @Validated LineParam lineParam){
|
||||
String methodDescribe = getMethodDescribe("metricData");
|
||||
harmonicMetricService.metricData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/metricDataToMysql")
|
||||
@ApiOperation("稳态指标评估日数据计算(MySQL入库)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> metricDataToMysql(@RequestBody @Validated LineParam lineParam){
|
||||
log.info(LocalDateTime.now()+"metricDataToMysql开始执行");
|
||||
String methodDescribe = getMethodDescribe("metricDataToMysql");
|
||||
if (lineParam.getType() == 3){
|
||||
int year = Integer.parseInt(lineParam.getDataDate().split("-")[0]);
|
||||
int month = Integer.parseInt(lineParam.getDataDate().split("-")[1]);
|
||||
List<String> dayList = PublicUtil.getDayByMonth(year,month);
|
||||
for (String item : dayList) {
|
||||
log.info(item+"-->开始执行");
|
||||
harmonicMetricService.metricDataToMysql(lineParam,item);
|
||||
}
|
||||
} else {
|
||||
harmonicMetricService.metricDataToMysql(lineParam,lineParam.getDataDate());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
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.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.*;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/20 16:05
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/harmonicOverLimit")
|
||||
@Api(tags = "监测点稳态指标统计")
|
||||
@AllArgsConstructor
|
||||
public class HarmonicOverLimitController extends BaseController {
|
||||
|
||||
private final IRMpPartHarmonicDetailDService mpPartHarmonicDetailDService;
|
||||
|
||||
private final IRMpSurplusHarmonicDetailDService mpSurplusHarmonicDetailDService;
|
||||
|
||||
private final IRMpPartHarmonicDetailMService mpPartHarmonicDetailMService;
|
||||
|
||||
private final IRMpSurplusHarmonicDetailMService mpSurplusHarmonicDetailMService;
|
||||
|
||||
private final IRMpVThdService mpVThdService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/harmonicDetailDay1")
|
||||
@ApiOperation("监测点稳态指标超标明细日表1")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> harmonicDetailDay1(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("harmonicDetailDay1");
|
||||
// mpPartHarmonicDetailDService.insertHarmonicDetailDayOne(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/harmonicDetailDay2")
|
||||
@ApiOperation("监测点稳态指标超标明细日表2")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> harmonicDetailDay2(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("harmonicDetailDay2");
|
||||
// mpSurplusHarmonicDetailDService.insertHarmonicDetailDayTwo(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/harmonicDetailMonth1")
|
||||
@ApiOperation("监测点稳态指标超标明细月表1")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> harmonicDetailMonth1(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("harmonicDetailMonth1");
|
||||
// mpPartHarmonicDetailMService.insertHarmonicDetailMonthOne(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/harmonicDetailMonth2")
|
||||
@ApiOperation("监测点稳态指标超标明细月表2")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> harmonicDetailMonth2(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("harmonicDetailMonth2");
|
||||
// mpSurplusHarmonicDetailMService.insertHarmonicDetailMonthTwo(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/harmonicThdDay")
|
||||
@ApiOperation("谐波畸变率日表")
|
||||
@ApiImplicitParam(name = "lineParam", value = "算法通用查询参数", required = true)
|
||||
public HttpResult<Boolean> harmonicThdDay(@RequestBody @Validated LineParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("harmonicThdDay");
|
||||
// mpVThdService.insertHarmonicVThdDay(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.IntegrityService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/24 20:03
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "数据完整性统计")
|
||||
@RestController
|
||||
@RequestMapping("/integrity")
|
||||
@RequiredArgsConstructor
|
||||
public class IntegrityController extends BaseController {
|
||||
|
||||
private final IntegrityService integrityService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/dataIntegrity")
|
||||
@ApiOperation("数据完整性统计(MySQL库)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> dataIntegrity(@RequestBody @Validated LineParam lineParam){
|
||||
log.info(LocalDateTime.now()+"dataIntegrity开始执行");
|
||||
String methodDescribe = getMethodDescribe("dataIntegrity");
|
||||
String startTime,endTime;
|
||||
if (Objects.nonNull(lineParam.getRepairFlag()) && lineParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
startTime = item+" "+"00:00:00";
|
||||
endTime = item+" "+"23:59:59";
|
||||
integrityService.dataIntegrity(lineParam,startTime,endTime);
|
||||
}
|
||||
} else {
|
||||
integrityService.dataIntegrity(lineParam,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, CommonResponseEnum.SUCCESS.getMessage(), methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.LimitTargetService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/26 13:32
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "监测点T相数据超限处理")
|
||||
@RestController
|
||||
@RequestMapping("/limitTarget")
|
||||
@RequiredArgsConstructor
|
||||
public class LimitTargetController extends BaseController {
|
||||
|
||||
private final LimitTargetService limitTargetService;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
@Deprecated
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLimitTargetData")
|
||||
@ApiOperation("生成limit_target表")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> getLimitTargetData(@RequestBody @Validated LineParam lineParam){
|
||||
String methodDescribe = getMethodDescribe("getLimitTargetData");
|
||||
limitTargetService.getLimitTargetData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/limitTargetData")
|
||||
@ApiOperation("生成limit_target表(MySQL入库)")
|
||||
@ApiImplicitParam(name = "jobParam", value = "参数", required = true)
|
||||
public HttpResult<String> limitTargetData(@RequestBody LineParam jobParam){
|
||||
log.info(LocalDateTime.now()+"limitTargetData开始执行");
|
||||
String methodDescribe = getMethodDescribe("limitTargetData");
|
||||
String startTime,endTime;
|
||||
List<String> indexLists;
|
||||
if(CollectionUtils.isEmpty (jobParam.getLineIds ())){
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds ().getData ( );
|
||||
}else{
|
||||
indexLists = jobParam.getLineIds ();
|
||||
}
|
||||
if (jobParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
startTime = item+" "+"00:00:00";
|
||||
endTime = item+" "+"23:59:59";
|
||||
limitTargetService.limitTargetData(indexLists,startTime,endTime);
|
||||
}
|
||||
} else {
|
||||
limitTargetService.limitTargetData(indexLists,jobParam.getBeginTime(), jobParam.getEndTime());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.Impl.line.LimitRateServiceImpl;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.LimitRateService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/10/19 9:58【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "监测点数据超限处理limitRate")
|
||||
@RestController
|
||||
@RequestMapping("limitrate")
|
||||
@RequiredArgsConstructor
|
||||
public class LimitrateController extends BaseController {
|
||||
|
||||
|
||||
private final LimitRateService limitRateService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
/* @Deprecated
|
||||
@ApiOperation("limitrate表定时任务")
|
||||
@ApiImplicitParam(value = "limitRateHanlderParam",name = "limitRateHanlderParam",required = true)
|
||||
@PostMapping("LimitRateHanlder")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> limitRateHanlder(@RequestBody LineParam limitRateHanlderParam ){
|
||||
String methodDescribe = getMethodDescribe("limitRateHanlder");
|
||||
Boolean result = true;
|
||||
List<String> indexLists = new ArrayList<> ();
|
||||
if(CollectionUtils.isEmpty (limitRateHanlderParam.getLineIds ())){
|
||||
indexLists = lineFeignClient.getLineList ( ).getData ( );
|
||||
}else{
|
||||
indexLists = limitRateHanlderParam.getLineIds ();
|
||||
}
|
||||
String startTime = limitRateHanlderParam.getDataDate ()+" "+"00:00:00";
|
||||
String endTime = limitRateHanlderParam.getDataDate ()+" "+"23:59:59";
|
||||
|
||||
limitRateService.limitRateJobHandler (indexLists,startTime,endTime);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}*/
|
||||
|
||||
@ApiOperation("生成limitRate表(MySQL入库)")
|
||||
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
|
||||
@PostMapping("LimitRate")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> limitRate(@RequestBody LineParam jobParam){
|
||||
log.info(LocalDateTime.now()+"limitRate开始执行");
|
||||
String startTime,endTime;
|
||||
String methodDescribe = getMethodDescribe("limitRate");
|
||||
List<String> indexLists;
|
||||
if(CollectionUtils.isEmpty (jobParam.getLineIds ())){
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds ().getData ( );
|
||||
}else{
|
||||
indexLists = jobParam.getLineIds ();
|
||||
}
|
||||
if (jobParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
startTime = item+" "+"00:00:00";
|
||||
endTime = item+" "+"23:59:59";
|
||||
// limitRateService.limitRate(indexLists,startTime,endTime);
|
||||
}
|
||||
} else {
|
||||
// limitRateService.limitRate(indexLists,jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.OnlineRateService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生成在线率数据表
|
||||
*
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/27 9:17
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "生成在线率数据表")
|
||||
@RestController
|
||||
@RequestMapping("/onlineRate")
|
||||
@RequiredArgsConstructor
|
||||
public class OnlineRateController extends BaseController {
|
||||
|
||||
private final OnlineRateService onlineRateService;
|
||||
|
||||
@Deprecated
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOnlineRateData")
|
||||
@ApiOperation("生成在线率数据")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> getOnlineRateData(@RequestBody @Validated LineParam lineParam){
|
||||
String methodDescribe = getMethodDescribe("getOnlineRateData");
|
||||
onlineRateService.getOnlineRateData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/onlineRateData")
|
||||
@ApiOperation("生成在线率数据(MySQL入库)")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> onlineRateData(@RequestBody @Validated LineParam lineParam){
|
||||
log.info(LocalDateTime.now()+"onlineRateData开始执行");
|
||||
String methodDescribe = getMethodDescribe("onlineRateData");
|
||||
if (lineParam.getType() == 3){
|
||||
int year = Integer.parseInt(lineParam.getDataDate().split("-")[0]);
|
||||
int month = Integer.parseInt(lineParam.getDataDate().split("-")[1]);
|
||||
List<String> dayList = PublicUtil.getDayByMonth(year,month);
|
||||
for (String item : dayList) {
|
||||
log.info(item+"-->开始执行");
|
||||
onlineRateService.onlineRateData(lineParam,item);
|
||||
}
|
||||
} else {
|
||||
onlineRateService.onlineRateData(lineParam,lineParam.getDataDate());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
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.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.NjcnDateUtils;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.PollutionService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 监测点污染指标
|
||||
*
|
||||
* @author xiaoyao
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/18 8:54
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "监测点污染指标")
|
||||
@RestController
|
||||
@RequestMapping("/pollution")
|
||||
@RequiredArgsConstructor
|
||||
@Deprecated
|
||||
public class PollutionController extends BaseController {
|
||||
|
||||
private final PollutionService pollutionService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/processPollutionData")
|
||||
@ApiOperation("处理监测点污染指标")
|
||||
@ApiImplicitParam(name = "jobParam", value = "参数", required = true)
|
||||
public HttpResult<String> processPollutionData(@RequestBody @Validated LineParam jobParam){
|
||||
String methodDescribe = getMethodDescribe("processPollutionData");
|
||||
if (jobParam.getRepairFlag()&&Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(jobParam.getType())){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
jobParam.setBeginTime(item+" "+"00:00:00");
|
||||
jobParam.setEndTime(item+" "+"23:59:59");
|
||||
System.out.println(jobParam);
|
||||
pollutionService.processPollutionData(jobParam);
|
||||
}
|
||||
} else {
|
||||
pollutionService.processPollutionData(jobParam);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RAlarmCountService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "指标告警统计")
|
||||
@RestController
|
||||
@RequestMapping("/rAlarmCount")
|
||||
@RequiredArgsConstructor
|
||||
public class RAlarmCountController extends BaseController {
|
||||
|
||||
private final RAlarmCountService rAlarmCountService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rAlarmCountHandler")
|
||||
@ApiOperation("指标告警统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> rAlarmCountHandler(@RequestBody @Validated OrgParam orgParam) {
|
||||
log.info(LocalDateTime.now() + "rAlarmCountHandler开始执行");
|
||||
String methodDescribe = getMethodDescribe("rAlarmCountHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if (StringUtils.isEmpty(orgParam.getOrgId())) {
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
} else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetChildrenMoreDTO> data = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
|
||||
rAlarmCountService.handler(data,orgParam.getDataDate(),orgParam.getType());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RStatAbnormalDService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/19 15:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/rmstatabnormal")
|
||||
@Api(tags = "监测点异常_日统计")
|
||||
@AllArgsConstructor
|
||||
public class RMStatAbnormalDController extends BaseController {
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final RStatAbnormalDService rStatAbnormalDService;
|
||||
|
||||
|
||||
@ApiOperation("监测点异常_日统计(MySQL库)")
|
||||
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
|
||||
@PostMapping("handlerMonitorAbnormal")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> handlerMonitorAbnormal(@RequestBody LineParam jobParam ){
|
||||
log.info(LocalDateTime.now()+"handlerMonitorAbnormal开始执行");
|
||||
String methodDescribe = getMethodDescribe("handlerMonitorAbnormal");
|
||||
List<String> indexLists;
|
||||
if (CollectionUtils.isEmpty(jobParam.getLineIds())) {
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else {
|
||||
indexLists = jobParam.getLineIds();
|
||||
}
|
||||
if (jobParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
rStatAbnormalDService.handlerMonitorAbnormal(indexLists,item);
|
||||
}
|
||||
} else {
|
||||
rStatAbnormalDService.handlerMonitorAbnormal (indexLists,jobParam.getBeginTime());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.DeviceParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RMpDevEvaluateDetailPOService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "终端数据评价")
|
||||
@RestController
|
||||
@RequestMapping("/rMpDevEvaluateDetail")
|
||||
@RequiredArgsConstructor
|
||||
public class RMpDevEvaluateDetailController extends BaseController {
|
||||
|
||||
|
||||
private final RMpDevEvaluateDetailPOService rMpDevEvaluateDetailPOService;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/handler")
|
||||
@ApiOperation("终端数据评价_日统计")
|
||||
@ApiImplicitParam(name = "deviceParam", value = "参数", required = true)
|
||||
public HttpResult<String> handler(@RequestBody @Validated DeviceParam deviceParam) {
|
||||
log.info(LocalDateTime.now() + "handler始执行");
|
||||
String methodDescribe = getMethodDescribe("handler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
if (CollectionUtils.isEmpty(deviceParam.getDetailList())) {
|
||||
List<DeviceParam.DeviceDetail> list = new ArrayList<>();
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetDeviceDTO> data1 = commTerminalGeneralClient.deptGetDeviceAndMonitor(deptGetLineParam).getData();
|
||||
|
||||
List<LineDevGetDTO> info = new ArrayList<>();
|
||||
/*主网*/
|
||||
List<LineDevGetDTO> collect = data1.stream().map(DeptGetDeviceDTO::getDeviceList).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
/*配网*/
|
||||
List<LineDevGetDTO> collect2 = data1.stream().map(DeptGetDeviceDTO::getPwDeviceList).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
info.addAll(collect);
|
||||
info.addAll(collect2);
|
||||
List<LineDevGetDTO> collect1 = info.stream().distinct().collect(Collectors.toList());
|
||||
collect1.forEach(temp -> {
|
||||
DeviceParam.DeviceDetail deviceDetail = new DeviceParam.DeviceDetail();
|
||||
deviceDetail.setDevId(temp.getDevId());
|
||||
deviceDetail.setLineIds(temp.getMonitorIds());
|
||||
deviceDetail.setUpdateTime(temp.getUpdateTime() + "");
|
||||
deviceDetail.setDeviceStatus(temp.getComFlag() + "");
|
||||
list.add(deviceDetail);
|
||||
});
|
||||
deviceParam.setDetailList(list);
|
||||
}
|
||||
if (deviceParam.getRepairFlag()) {
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(deviceParam.getBeginTime(), deviceParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item + "-->开始执行");
|
||||
deviceParam.setDataDate(item);
|
||||
deviceParam.setBeginTime(item + " " + "00:00:00");
|
||||
deviceParam.setEndTime(item + " " + "23:59:59");
|
||||
// rMpDevEvaluateDetailPOService.handler(deviceParam);
|
||||
}
|
||||
} else {
|
||||
// rMpDevEvaluateDetailPOService.handler(deviceParam);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
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.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "监测点暂态指标超标明细")
|
||||
@RestController
|
||||
@RequestMapping("/rmpeventdetail")
|
||||
@RequiredArgsConstructor
|
||||
public class RMpEventdetailController extends BaseController {
|
||||
|
||||
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final RMpEventDetailService rMpEventDetailService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/eventdetailHandler")
|
||||
@ApiOperation("监测点暂态指标处理")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> eventdetailHandler(@RequestBody @Validated LineParam lineParam) {
|
||||
log.info(LocalDateTime.now() + "eventdetailHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("eventdetailHandler");
|
||||
List<String> indexLists;
|
||||
if (CollectionUtils.isEmpty(lineParam.getLineIds())) {
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else {
|
||||
indexLists = lineParam.getLineIds();
|
||||
}
|
||||
lineParam.setLineIds(indexLists);
|
||||
|
||||
rMpEventDetailService.eventdetailHandler(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpMonitorEvaluateDService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/19 15:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/rmpmonitorevaluate")
|
||||
@Api(tags = "监测点评价_日统计")
|
||||
@AllArgsConstructor
|
||||
public class RMpMonitorEvaluateDController extends BaseController {
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final RMpMonitorEvaluateDService rMpMonitorEvaluateDService;
|
||||
|
||||
|
||||
@ApiOperation("监测点评价_日统计(MySQL库)")
|
||||
@ApiImplicitParam(value = "jobParam", name = "jobParam", required = true)
|
||||
@PostMapping("handlerMonitorEvaluate")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> handlerMonitorEvaluate(@RequestBody LineParam jobParam) {
|
||||
log.info(LocalDateTime.now() + "handlerMonitorEvaluate开始执行");
|
||||
String methodDescribe = getMethodDescribe("handlerMonitorEvaluate");
|
||||
String startTime,endTime;
|
||||
List<String> indexLists;
|
||||
if (CollectionUtils.isEmpty(jobParam.getLineIds())) {
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else {
|
||||
indexLists = jobParam.getLineIds();
|
||||
}
|
||||
if (jobParam.getRepairFlag()){
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(),jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item+"-->开始执行");
|
||||
startTime = item+" "+"00:00:00";
|
||||
endTime = item+" "+"23:59:59";
|
||||
rMpMonitorEvaluateDService.dayDataJobHandler(indexLists,startTime, endTime);
|
||||
}
|
||||
} else {
|
||||
rMpMonitorEvaluateDService.dayDataJobHandler(indexLists, jobParam.getBeginTime(), jobParam.getEndTime());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
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.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpPassRateDService;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "监测点稳态指标合格率统计")
|
||||
@RestController
|
||||
@RequestMapping("/rmppassrate")
|
||||
@RequiredArgsConstructor
|
||||
public class RMpPassRateController extends BaseController {
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final RMpPassRateDService rMpPassRateDService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/passRateHandler")
|
||||
@ApiOperation("监测点稳态指标合格率统计")
|
||||
@ApiImplicitParam(name = "lineParam", value = "参数", required = true)
|
||||
public HttpResult<String> passRateHandler(@RequestBody @Validated LineParam lineParam){
|
||||
log.info(LocalDateTime.now()+"passRateHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("passRateHandler");
|
||||
List<String> indexLists = new ArrayList<> ();
|
||||
if(CollectionUtils.isEmpty (lineParam.getLineIds ())){
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds ().getData ();
|
||||
}else{
|
||||
indexLists = lineParam.getLineIds ();
|
||||
}
|
||||
lineParam.setLineIds (indexLists);
|
||||
|
||||
rMpPassRateDService.passRateHandler(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorMService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/19 15:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/roperatingmonitor")
|
||||
@Api(tags = "监测点数据质量")
|
||||
@AllArgsConstructor
|
||||
public class ROperatingMonitorController extends BaseController {
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final ROperatingMonitorService rOperatingMonitorService;
|
||||
private final ROperatingMonitorMService rOperatingMonitorMService;
|
||||
|
||||
@ApiOperation("监测点数据质量_日统计(MySQL库)")
|
||||
@ApiImplicitParam(value = "jobParam", name = "jobParam", required = true)
|
||||
@PostMapping("handlerMonitorOperatingD")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> handlerMonitorOperatingD(@RequestBody LineParam jobParam) {
|
||||
log.info(LocalDateTime.now() + "handlerMonitorOperatingD开始执行");
|
||||
String methodDescribe = getMethodDescribe("handlerMonitorOperatingD");
|
||||
List<String> indexLists;
|
||||
if (CollectionUtils.isEmpty(jobParam.getLineIds())) {
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else {
|
||||
indexLists = jobParam.getLineIds();
|
||||
}
|
||||
if (jobParam.getRepairFlag()) {
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(jobParam.getBeginTime(), jobParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item + "-->开始执行");
|
||||
rOperatingMonitorService.handlerMonitorOperatingD(indexLists, item);
|
||||
}
|
||||
} else {
|
||||
rOperatingMonitorService.handlerMonitorOperatingD(indexLists, jobParam.getDataDate());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("监测点数据质量_月统计(MySQL库)")
|
||||
@ApiImplicitParam(value = "jobParam", name = "jobParam", required = true)
|
||||
@PostMapping("handlerMonitorOperatingM")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<Boolean> handlerMonitorOperatingM(@RequestBody LineParam jobParam) {
|
||||
|
||||
log.info(LocalDateTime.now() + "handlerMonitorOperatingM开始执行");
|
||||
String methodDescribe = getMethodDescribe("handlerMonitorOperatingM");
|
||||
List<String> indexLists;
|
||||
if (CollectionUtils.isEmpty(jobParam.getLineIds())) {
|
||||
indexLists = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
} else {
|
||||
indexLists = jobParam.getLineIds();
|
||||
}
|
||||
rOperatingMonitorMService.handlerMonitorOperatingM(indexLists,jobParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.common.utils.NjcnDateUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.DeviceParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.device.RStatDevSignalDPOService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "终端通信管理")
|
||||
@RestController
|
||||
@RequestMapping("/rstatdevsignal")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatDevSignalController extends BaseController {
|
||||
|
||||
|
||||
private final RStatDevSignalDPOService rStatDevSignalDPOService;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rstatdevsignalHandler")
|
||||
@ApiOperation("终端通信管理_日统计")
|
||||
@ApiImplicitParam(name = "deviceParam", value = "参数", required = true)
|
||||
public HttpResult<String> rstatdevsignalHandler(@RequestBody @Validated DeviceParam deviceParam) {
|
||||
log.info(LocalDateTime.now() + "rstatdevsignalHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("rstatdevsignalHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
if (CollectionUtils.isEmpty(deviceParam.getDetailList())) {
|
||||
List<DeviceParam.DeviceDetail> list = new ArrayList<>();
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetDeviceDTO> data1 = commTerminalGeneralClient.deptGetDeviceAndMonitor(deptGetLineParam).getData();
|
||||
|
||||
List<LineDevGetDTO> info=new ArrayList<>();
|
||||
/*主网*/
|
||||
List<LineDevGetDTO> collect = data1.stream().map(DeptGetDeviceDTO::getDeviceList).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
/*配网*/
|
||||
List<LineDevGetDTO> collect2 = data1.stream().map(DeptGetDeviceDTO::getPwDeviceList).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
info.addAll(collect);
|
||||
info.addAll(collect2);
|
||||
List<LineDevGetDTO> collect1 = info.stream().distinct().collect(Collectors.toList());
|
||||
collect1.forEach(temp -> {
|
||||
DeviceParam.DeviceDetail deviceDetail = new DeviceParam.DeviceDetail();
|
||||
deviceDetail.setDevId(temp.getDevId());
|
||||
deviceDetail.setLineIds(temp.getMonitorIds());
|
||||
deviceDetail.setUpdateTime(temp.getUpdateTime() + "");
|
||||
deviceDetail.setDeviceStatus(temp.getComFlag()+ "");
|
||||
list.add(deviceDetail);
|
||||
});
|
||||
|
||||
deviceParam.setDetailList(list);
|
||||
}
|
||||
if (deviceParam.getRepairFlag()) {
|
||||
List<String> timeRange = NjcnDateUtils.findEveryDay(deviceParam.getBeginTime(), deviceParam.getEndTime());
|
||||
for (String item : timeRange) {
|
||||
log.info(item + "-->开始执行");
|
||||
deviceParam.setDataDate(item);
|
||||
deviceParam.setBeginTime(item + " " + "00:00:00");
|
||||
deviceParam.setEndTime(item + " " + "23:59:59");
|
||||
// rStatDevSignalDPOService.eventdetailHandler(deviceParam);
|
||||
}
|
||||
} else {
|
||||
// rStatDevSignalDPOService.eventdetailHandler(deviceParam);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatEventService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "暂态指标统计")
|
||||
@RestController
|
||||
@RequestMapping("/rStartEvent")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventController extends BaseController {
|
||||
|
||||
private final RStatEventService rStatEventDService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rStartEventHandler")
|
||||
@ApiOperation("暂态指标统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> rStartEventHandler(@RequestBody @Validated OrgParam orgParam) {
|
||||
log.info(LocalDateTime.now() + "rStartEventHandler开始执行");
|
||||
String methodDescribe = getMethodDescribe("rStartEventHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if (StringUtils.isEmpty(orgParam.getOrgId())) {
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
} else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetChildrenMoreDTO> data = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
|
||||
rStatEventDService.handler(data,orgParam.getDataDate(),orgParam.getType());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatEventOrgService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "单位暂态指标数据统计")
|
||||
@RestController
|
||||
@RequestMapping("/rStartEventOrg")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventOrgController extends BaseController {
|
||||
|
||||
private final RStatEventOrgService rStatEventOrgService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rStartEventOrgHandler")
|
||||
@ApiOperation("单位暂态指标数据统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> rStartEventOrgHandler(@RequestBody @Validated OrgParam orgParam) {
|
||||
log.info(LocalDateTime.now() + "rStartEventOrgHandler开始执行");
|
||||
String methodDescribe = getMethodDescribe("rStartEventOrgHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if (StringUtils.isEmpty(orgParam.getOrgId())) {
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
} else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetChildrenMoreDTO> data = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
|
||||
rStatEventOrgService.handler(data,orgParam.getDataDate(),orgParam.getType());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatHarmonicService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatOrgService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "单位监测点稳态指标统计")
|
||||
@RestController
|
||||
@RequestMapping("/rstatharmonic")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatHarmonicController extends BaseController {
|
||||
|
||||
|
||||
private final RStatHarmonicService service;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/Handler")
|
||||
@ApiOperation("单位监测点稳态指标统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> handler(@RequestBody @Validated OrgParam orgParam ){
|
||||
log.info(LocalDateTime.now()+"dayHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("dayHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if(StringUtils.isEmpty(orgParam.getOrgId())){
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
}else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetChildrenMoreDTO> data = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
service.handler (data,orgParam.getDataDate(),orgParam.getType());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatHarmonicOrgService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatHarmonicService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "单位稳态指标数据统计(xy)")
|
||||
@RestController
|
||||
@RequestMapping("/rstatharmonicorg")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatHarmonicOrgController extends BaseController {
|
||||
|
||||
|
||||
private final RStatHarmonicOrgService service;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/Handler")
|
||||
@ApiOperation("单位监测点稳态指标统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> handler(@RequestBody @Validated OrgParam orgParam ){
|
||||
log.info(LocalDateTime.now()+"dayHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("dayHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if(StringUtils.isEmpty(orgParam.getOrgId())){
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
orgParam.setOrgId(data.getId());
|
||||
}
|
||||
service.handler(orgParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetDeviceDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.DeviceParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatOrgService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.device.RStatDevSignalDPOService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "单位监测点统计")
|
||||
@RestController
|
||||
@RequestMapping("/rstatorg")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatOrgController extends BaseController {
|
||||
|
||||
|
||||
private final RStatOrgService rStatOrgService;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/Handler")
|
||||
@ApiOperation("单位监测点_统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> handler(@RequestBody @Validated OrgParam orgParam ){
|
||||
log.info(LocalDateTime.now()+"dayHandler始执行");
|
||||
String methodDescribe = getMethodDescribe("handler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if(StringUtils.isEmpty(orgParam.getOrgId())){
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
}else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetChildrenMoreDTO> data = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
rStatOrgService.handler (data,orgParam.getDataDate(),orgParam.getType());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatEventOrgService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatSubstationService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 13:47【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "变电站指标统计")
|
||||
@RestController
|
||||
@RequestMapping("/rStartSubstation")
|
||||
@RequiredArgsConstructor
|
||||
public class RStatSubstationController extends BaseController {
|
||||
|
||||
private final RStatSubstationService rStatSubstationService;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rStartSubstationHandler")
|
||||
@ApiOperation("变电站指标统计")
|
||||
@ApiImplicitParam(name = "orgParam", value = "参数", required = true)
|
||||
public HttpResult<String> rStartSubstationHandler(@RequestBody @Validated OrgParam orgParam) {
|
||||
log.info(LocalDateTime.now() + "rStartSubstationHandler开始执行");
|
||||
String methodDescribe = getMethodDescribe("rStartSubstationHandler");
|
||||
/**
|
||||
* 支持补录
|
||||
*/
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
|
||||
if (StringUtils.isEmpty(orgParam.getOrgId())) {
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
} else {
|
||||
deptGetLineParam.setDeptId(orgParam.getOrgId());
|
||||
}
|
||||
deptGetLineParam.setServerName(ServerInfo.PREPARE_BOOT);
|
||||
List<DeptGetSubStationDTO> data = commTerminalGeneralClient.deptSubStation(deptGetLineParam).getData();
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
// rStatSubstationService.handler(data,orgParam.getDataDate(),orgParam.getType());
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("该方法总耗时为 ---> "+(end-start));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.harmonic.pojo.po.*;
|
||||
@@ -79,7 +78,6 @@ public class PrimaryGridDataServiceImpl implements PrimaryGridDataService {
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpDevEvaluateDetailPO;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpDevEvaluateDetailPOMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpMonitorEvaluateDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ROperatingMonitorDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
|
||||
@@ -18,15 +17,12 @@ import com.njcn.prepare.harmonic.pojo.po.RMpDevSolveDetailPO;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RMpDevEvaluateDetailPOService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.device.RMpDevSolveDetailPOService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -50,60 +46,8 @@ public class RMpDevEvaluateDetailPOServiceImpl extends MppServiceImpl<RMpDevEval
|
||||
|
||||
private final ROperatingMonitorDMapper rOperatingMonitorDMapper;
|
||||
private final RMpDevSolveDetailPOService rMpDevSolveDetailPOService;
|
||||
private final DecimalFormat df = new DecimalFormat("#.00");
|
||||
|
||||
private final RMpMonitorEvaluateDMapper revaluateDMapper;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = {Exception.class})
|
||||
// @Async("asyncExecutor")
|
||||
// @SneakyThrows
|
||||
// public void handler(DeviceParam deviceParam) {
|
||||
//
|
||||
// List<RMpDevEvaluateDetailPO> rMpDevEvaluateDetailPOList = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(deviceParam.getDataDate());
|
||||
// QueryWrapper<ROperatingMonitorDPO> wrapper = new QueryWrapper<>();
|
||||
// QueryWrapper<RMpDevSolveDetailPO> wrapper1 = new QueryWrapper<>();
|
||||
//
|
||||
// deviceParam.getDetailList().forEach(temp -> {
|
||||
//
|
||||
// RMpDevEvaluateDetailPO rMpDevEvaluateDetailPO = new RMpDevEvaluateDetailPO();
|
||||
// rMpDevEvaluateDetailPO.setDeviceId(temp.getDevId());
|
||||
// rMpDevEvaluateDetailPO.setDataDate(date);
|
||||
//
|
||||
// wrapper.clear();
|
||||
// wrapper1.clear();
|
||||
// wrapper1.select(RMpDevSolveDetailPO.COL_DEFECT_SEVERITY).
|
||||
// eq(RMpDevSolveDetailPO.COL_DEVICE_ID,temp.getDevId()).
|
||||
// eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",deviceParam.getDataDate());
|
||||
// RMpDevSolveDetailPO one = rMpDevSolveDetailPOService.getOne(wrapper1);
|
||||
// Double defectSeverity = PubUtils.getDefectSeverity(one.getDefectSeverity());
|
||||
// rMpDevEvaluateDetailPO.setDevScore(Double.valueOf(df.format(defectSeverity/3)));
|
||||
//
|
||||
// List<ROperatingMonitorDPO> rOperatingMonitorDPOS = new ArrayList<>();
|
||||
//
|
||||
// List<String> lineIds = temp.getLineIds();
|
||||
// if(CollUtil.isNotEmpty(lineIds)){
|
||||
// wrapper.in("measurement_point_id", lineIds);
|
||||
// rOperatingMonitorDPOS = rOperatingMonitorDMapper.selectList(wrapper);
|
||||
// }
|
||||
// double asDouble1=0.00 ,asDouble2=0.00,aDouble=0.00;
|
||||
// if(rOperatingMonitorDPOS.size()>0){
|
||||
// asDouble1= rOperatingMonitorDPOS.stream().mapToDouble(po -> po.getDataIntegrityRate().doubleValue()).average().getAsDouble();
|
||||
// asDouble2 = rOperatingMonitorDPOS.stream().mapToDouble(po -> po.getIndexIntegrityRate().doubleValue()).average().getAsDouble();
|
||||
// long count = rOperatingMonitorDPOS.stream().filter(po -> po.getIsUnusual() == 1 && po.getDataIntegrityRate().compareTo(new BigDecimal(0.95)) == 1).count();
|
||||
// aDouble = Double.valueOf(count) / rOperatingMonitorDPOS.size();
|
||||
// }
|
||||
// rMpDevEvaluateDetailPO.setDevDataRate(Double.valueOf(df.format(asDouble1)));
|
||||
// rMpDevEvaluateDetailPO.setDevTargetRate(Double.valueOf(df.format(asDouble2)));
|
||||
// rMpDevEvaluateDetailPO.setDevEffectiveRate(Double.valueOf(df.format(aDouble)));
|
||||
// rMpDevEvaluateDetailPOList.add(rMpDevEvaluateDetailPO);
|
||||
//
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId(rMpDevEvaluateDetailPOList,500);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
|
||||
@@ -10,12 +10,10 @@ import com.njcn.prepare.harmonic.mapper.mysql.area.RMpMonitorAlarmCountMMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpTargetWarnDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.IRMpMonitorAlarmCountMService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RMpTargetWarnDService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -38,69 +36,8 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class RMpMonitorAlarmCountMServiceImpl extends MppServiceImpl<RMpMonitorAlarmCountMMapper, RMpMonitorAlarmCountMPO> implements IRMpMonitorAlarmCountMService {
|
||||
|
||||
private final RMpTargetWarnDService rMpTargetWarnDService;
|
||||
|
||||
private final RMpTargetWarnDMapper rMpTargetWarnDMapper;
|
||||
|
||||
// @Override
|
||||
// public void alarmMonth(LineParam lineParam) {
|
||||
// List<RMpMonitorAlarmCountMDTO> monthList = rMpTargetWarnDService.getDate(lineParam);
|
||||
// if (!CollectionUtils.isEmpty(monthList)){
|
||||
// List<RMpMonitorAlarmCountMPO> result = new ArrayList<>();
|
||||
// List<RMpMonitorAlarmCountMDTO> harmonicList = new ArrayList<>(),eventList = new ArrayList<>();
|
||||
// //判断稳态指标评级结果-根据稳态指标严重度之和排序(去除严重度为0的数据在作比较)
|
||||
// List<RMpMonitorAlarmCountMDTO> list1 = monthList.stream().filter(item->item.getHarmonicTypeGradeTotal()>0).collect(Collectors.toList());
|
||||
// List<RMpMonitorAlarmCountMDTO> list2 = monthList.stream().filter(item->item.getHarmonicTypeGradeTotal()<=0).collect(Collectors.toList());
|
||||
// if (!CollectionUtils.isEmpty(list1)){
|
||||
// for (int i = 0; i < list1.size(); i++) {
|
||||
// if (i < list1.size()*0.3){
|
||||
// list1.get(i).setHarmonicTypeGrade(0);
|
||||
// } else if (i >= list1.size()*0.3 && i < list1.size()*0.7){
|
||||
// list1.get(i).setHarmonicTypeGrade(1);
|
||||
// } else {
|
||||
// list1.get(i).setHarmonicTypeGrade(2);
|
||||
// }
|
||||
// harmonicList.add(list1.get(i));
|
||||
// }
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(list2)){
|
||||
// list2.forEach(item->{
|
||||
// item.setHarmonicTypeGrade(2);
|
||||
// harmonicList.add(item);
|
||||
// });
|
||||
// }
|
||||
// //判断暂态指标评级结果-根据暂态指标严重度之和排序(去除严重度为0的数据在作比较)
|
||||
// List<RMpMonitorAlarmCountMDTO> list3 = harmonicList.stream().filter(item->item.getEventTypeGradeTotal()>0).collect(Collectors.toList());
|
||||
// List<RMpMonitorAlarmCountMDTO> list4 = harmonicList.stream().filter(item->item.getEventTypeGradeTotal()<=0).collect(Collectors.toList());
|
||||
// if (!CollectionUtils.isEmpty(list3)){
|
||||
// for (int i = 0; i < list3.size(); i++) {
|
||||
// if (i < list3.size()*0.3){
|
||||
// list3.get(i).setEventTypeGrade(0);
|
||||
// } else if (i >= list3.size()*0.3 && i < list3.size()*0.7){
|
||||
// list3.get(i).setEventTypeGrade(1);
|
||||
// } else {
|
||||
// list3.get(i).setEventTypeGrade(2);
|
||||
// }
|
||||
// eventList.add(list3.get(i));
|
||||
// }
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(list4)){
|
||||
// list4.forEach(item->{
|
||||
// item.setEventTypeGrade(2);
|
||||
// eventList.add(item);
|
||||
// });
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(eventList)){
|
||||
// eventList.forEach(item->{
|
||||
// RMpMonitorAlarmCountMPO rMpMonitorAlarmCountMpo = new RMpMonitorAlarmCountMPO();
|
||||
// BeanUtils.copyProperties(item,rMpMonitorAlarmCountMpo);
|
||||
// result.add(rMpMonitorAlarmCountMpo);
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId(result,50);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void alarmMonth(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.area;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.harmonic.pojo.po.RMpTargetWarnDPO;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpTargetWarnDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataVDMapper;
|
||||
@@ -17,8 +15,6 @@ import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -42,41 +38,11 @@ import java.util.stream.Collectors;
|
||||
public class RMpTargetWarnDServiceImpl extends MppServiceImpl<RMpTargetWarnDMapper, RMpTargetWarnDPO> implements RMpTargetWarnDService {
|
||||
|
||||
|
||||
private @Autowired
|
||||
RMpTargetWarnDMapper rMpTargetWarnDMapper;
|
||||
|
||||
private final AlarmDetailService alarmDetailService;
|
||||
|
||||
private final RStatDataVDMapper rStatDataVDMapper;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
/**
|
||||
* @param monitorIdList
|
||||
* @param dataDate
|
||||
* @Description: 计算出当前机构累计稳态超标监测点数(当月)
|
||||
* @Param: [monitorIdList, dataDate]
|
||||
* @return: java.lang.Integer
|
||||
* @Author: clam
|
||||
* @Date: 2022/12/15
|
||||
*/
|
||||
@Override
|
||||
public Integer queryHarmonicMeasurementAccrued(List<String> monitorIdList, String dataDate) {
|
||||
Integer result = 0;
|
||||
|
||||
QueryWrapper<RMpTargetWarnDPO> wrapper = new QueryWrapper ( );
|
||||
if(CollectionUtils.isEmpty (monitorIdList)){
|
||||
return result;
|
||||
}
|
||||
wrapper.select ("distinct measurement_point_id ").
|
||||
in ("measurement_point_id",monitorIdList).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring (0, 7)).
|
||||
eq ("is_harmonic",1);
|
||||
result = rMpTargetWarnDMapper.selectCount (wrapper);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*******************************************新算法***********************************************************************/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void alarmDay(CalculatedParam calculatedParam) {
|
||||
@@ -247,37 +213,5 @@ public class RMpTargetWarnDServiceImpl extends MppServiceImpl<RMpTargetWarnDMapp
|
||||
return result;
|
||||
}
|
||||
|
||||
/*******************************************新算法结束***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public void alarmDay(LineParam lineParam) {
|
||||
// List<RMpTargetWarnDPO> list = new ArrayList<>();
|
||||
// //月处理
|
||||
// if (Objects.equals(true,lineParam.getRepairFlag())){
|
||||
//
|
||||
// List<String> dayList = NjcnDateUtils.findEveryDay(lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
// for (String item : dayList) {
|
||||
// log.info(item+"-->开始执行");
|
||||
// List<RMpTargetWarnDPO> day = getData(item,lineParam.getLineIds());
|
||||
// if (!CollectionUtils.isEmpty(day)){
|
||||
// list.addAll(day);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //日处理
|
||||
// else {
|
||||
// list = getData(lineParam.getDataDate(),lineParam.getLineIds());
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(list)){
|
||||
// this.saveOrUpdateBatchByMultiId(list,50);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public List<RMpMonitorAlarmCountMDTO> getDate(LineParam lineParam) {
|
||||
// return this.baseMapper.getDate(lineParam.getBeginTime(),lineParam.getEndTime(),lineParam.getLineIds());
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -15,25 +15,18 @@ import com.njcn.prepare.harmonic.pojo.mysql.po.RStatHarmonicMPO;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.RStatOrgQPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.RStatOrgYPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.OrgParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.*;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.RStatHarmonicOrgService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatHarmonicOrgDPOService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatHarmonicOrgMPOService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatHarmonicOrgQPOService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RStatHarmonicOrgYPOService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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.po.Dept;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -55,8 +48,6 @@ public class RStatHarmonicOrgServiceImpl implements RStatHarmonicOrgService {
|
||||
private final
|
||||
DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final RStatOrgDMapper rStatOrgDMapper;
|
||||
private final RStatOrgQMapper rStatOrgQMapper;
|
||||
private final RStatOrgYMapper rStatOrgYMapper;
|
||||
@@ -428,390 +419,5 @@ public class RStatHarmonicOrgServiceImpl implements RStatHarmonicOrgService {
|
||||
}
|
||||
|
||||
}
|
||||
/**------------------------------------------------------------------------------------------------------------**/
|
||||
|
||||
@Override
|
||||
public void handler(OrgParam orgParam) {
|
||||
switch (orgParam.getType()) {
|
||||
case 1:
|
||||
this.hanlderYear (orgParam);
|
||||
break;
|
||||
case 2:
|
||||
this.hanlderQtr (orgParam);
|
||||
break;
|
||||
case 3:
|
||||
this.hanlderM (orgParam);
|
||||
break;
|
||||
case 5:
|
||||
this.hanlderDay ( orgParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderYear(OrgParam orgParam) {
|
||||
List<RStatHarmonicOrgYPO> rStatHarmonicOrgYPOList = new ArrayList<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(orgParam.getOrgId()).getData();
|
||||
Date date = DateUtil.parse(orgParam.getDataDate());
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(orgParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RStatHarmonicMPO> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
data.stream().forEach(temp->{
|
||||
int sumEffectiveMeasurement =0;
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no",temp).
|
||||
eq("YEAR( data_date)", orgParam.getDataDate().substring(0,4));
|
||||
|
||||
|
||||
List<RStatOrgMPO> rStatOrgMPOS = rStatOrgMMapper.selectList(rStatOrgMPOQueryWrapper);
|
||||
if(CollectionUtils.isEmpty(rStatOrgMPOS)){
|
||||
sumEffectiveMeasurement=0;
|
||||
}else {
|
||||
sumEffectiveMeasurement = rStatOrgMPOS.stream().mapToInt(RStatOrgMPO::getEffectiveMeasurementAccrued).sum();
|
||||
}
|
||||
int finalSumEffectiveMeasurement = sumEffectiveMeasurement;
|
||||
dataTypeMap.forEach((k, v)->{
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.clear();
|
||||
queryWrapper.eq("org_no",temp).
|
||||
eq("harmonic_type",dictData.getId()).
|
||||
eq("data_type",v.getId()).
|
||||
eq("YEAR( data_date)", orgParam.getDataDate().substring(0,4));
|
||||
List<RStatHarmonicMPO> rStatHarmonicMPOS = rStatHarmonicMPOMapper.selectList(queryWrapper);
|
||||
Double overLimitMeasurementAverage =0.00;
|
||||
int overDay =0;
|
||||
int overLimitMeasurementAccrued=0;
|
||||
Double averageOverDay =0.00;
|
||||
Double overLimitMeasurementRatioAverage=0.00;
|
||||
Double overLimitMeasurementRatioAccrued=0.00;
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicMPOS)){
|
||||
|
||||
overDay = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
overLimitMeasurementAccrued = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverLimitMeasurementAccrued).sum();
|
||||
double asDouble = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().getAsDouble();
|
||||
overLimitMeasurementAverage = Double.parseDouble(df.format(asDouble));
|
||||
double asDouble1 = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().getAsDouble();
|
||||
|
||||
overLimitMeasurementRatioAverage = Double.parseDouble(df.format(asDouble1));
|
||||
if(finalSumEffectiveMeasurement ==0){
|
||||
overLimitMeasurementRatioAccrued=0.00;
|
||||
}else {
|
||||
overLimitMeasurementRatioAccrued=Double.parseDouble(df.format((float)overLimitMeasurementAccrued / finalSumEffectiveMeasurement));
|
||||
}
|
||||
if(!(overLimitMeasurementAccrued==0)){
|
||||
averageOverDay = Double.parseDouble(df.format((float)overDay / overLimitMeasurementAccrued));
|
||||
}
|
||||
}
|
||||
RStatHarmonicOrgYPO rStatHarmonicOrgYPO = new RStatHarmonicOrgYPO();
|
||||
rStatHarmonicOrgYPO.setOrgNo(temp);
|
||||
rStatHarmonicOrgYPO.setDataDate(localDate);
|
||||
rStatHarmonicOrgYPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicOrgYPO.setDataType(v.getId());
|
||||
rStatHarmonicOrgYPO.setAverageOverDay(averageOverDay);
|
||||
rStatHarmonicOrgYPO.setOverLimitMeasurementAccrued(overLimitMeasurementAccrued);
|
||||
rStatHarmonicOrgYPO.setOverLimitMeasurementAverage(overLimitMeasurementAverage);
|
||||
rStatHarmonicOrgYPO.setOverLimitMeasurementRatioAccrued(overLimitMeasurementRatioAccrued);
|
||||
rStatHarmonicOrgYPO.setOverLimitMeasurementRatioAverage(overLimitMeasurementRatioAverage);
|
||||
|
||||
rStatHarmonicOrgYPOList.add(rStatHarmonicOrgYPO);
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicOrgYPOList)){
|
||||
rStatHarmonicYPOService.saveOrUpdateBatchByMultiId(rStatHarmonicOrgYPOList,500);
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderQtr(OrgParam orgParam) {
|
||||
List<RStatHarmonicOrgQPO> rStatHarmonicOrgQPOList = new ArrayList<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(orgParam.getOrgId()).getData();
|
||||
Date date = DateUtil.parse(orgParam.getDataDate());
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(orgParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RStatHarmonicMPO> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
data.stream().forEach(temp->{
|
||||
int sumEffectiveMeasurement =0;
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no",temp).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (orgParam.getDataDate()));
|
||||
|
||||
List<RStatOrgMPO> rStatOrgMPOS = rStatOrgMMapper.selectList(rStatOrgMPOQueryWrapper);
|
||||
if(CollectionUtils.isEmpty(rStatOrgMPOS)){
|
||||
sumEffectiveMeasurement=0;
|
||||
}else {
|
||||
sumEffectiveMeasurement = rStatOrgMPOS.stream().mapToInt(RStatOrgMPO::getEffectiveMeasurementAccrued).sum();
|
||||
}
|
||||
int finalSumEffectiveMeasurement = sumEffectiveMeasurement;
|
||||
dataTypeMap.forEach((k, v)->{
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.clear();
|
||||
queryWrapper.eq("org_no",temp).
|
||||
eq("harmonic_type",dictData.getId()).
|
||||
eq("data_type",v.getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (orgParam.getDataDate()));
|
||||
List<RStatHarmonicMPO> rStatHarmonicMPOS = rStatHarmonicMPOMapper.selectList(queryWrapper);
|
||||
Double overLimitMeasurementAverage =0.00;
|
||||
int overDay =0;
|
||||
int overLimitMeasurementAccrued=0;
|
||||
Double averageOverDay =0.00;
|
||||
Double overLimitMeasurementRatioAverage=0.00;
|
||||
Double overLimitMeasurementRatioAccrued=0.00;
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicMPOS)){
|
||||
|
||||
overDay = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
overLimitMeasurementAccrued = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverLimitMeasurementAccrued).sum();
|
||||
double asDouble = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().getAsDouble();
|
||||
overLimitMeasurementAverage = Double.parseDouble(df.format(asDouble));
|
||||
double asDouble1 = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().getAsDouble();
|
||||
|
||||
overLimitMeasurementRatioAverage = Double.parseDouble(df.format(asDouble1));
|
||||
if(finalSumEffectiveMeasurement ==0){
|
||||
overLimitMeasurementRatioAccrued=0.00;
|
||||
}else {
|
||||
overLimitMeasurementRatioAccrued=Double.parseDouble(df.format((float)overLimitMeasurementAccrued / finalSumEffectiveMeasurement));
|
||||
}
|
||||
if(!(overLimitMeasurementAccrued==0)){
|
||||
averageOverDay = Double.parseDouble(df.format((float)overDay / overLimitMeasurementAccrued));
|
||||
}
|
||||
}
|
||||
RStatHarmonicOrgQPO rStatHarmonicOrgQPO = new RStatHarmonicOrgQPO();
|
||||
rStatHarmonicOrgQPO.setOrgNo(temp);
|
||||
rStatHarmonicOrgQPO.setDataDate(localDate);
|
||||
rStatHarmonicOrgQPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicOrgQPO.setDataType(v.getId());
|
||||
rStatHarmonicOrgQPO.setAverageOverDay(averageOverDay);
|
||||
rStatHarmonicOrgQPO.setOverLimitMeasurementAccrued(overLimitMeasurementAccrued);
|
||||
rStatHarmonicOrgQPO.setOverLimitMeasurementAverage(overLimitMeasurementAverage);
|
||||
rStatHarmonicOrgQPO.setOverLimitMeasurementRatioAccrued(overLimitMeasurementRatioAccrued);
|
||||
rStatHarmonicOrgQPO.setOverLimitMeasurementRatioAverage(overLimitMeasurementRatioAverage);
|
||||
|
||||
rStatHarmonicOrgQPOList.add(rStatHarmonicOrgQPO);
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicOrgQPOList)){
|
||||
rStatHarmonicQPOService.saveOrUpdateBatchByMultiId(rStatHarmonicOrgQPOList,500);
|
||||
}
|
||||
}
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderM(OrgParam orgParam) {
|
||||
List<RStatHarmonicOrgMPO> rStatHarmonicOrgMPOList = new ArrayList<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(orgParam.getOrgId()).getData();
|
||||
Date date = DateUtil.parse(orgParam.getDataDate());
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(orgParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RStatHarmonicMPO> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
data.stream().forEach(temp->{
|
||||
int sumEffectiveMeasurement =0;
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no",temp).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",orgParam.getDataDate().substring(0, 7));
|
||||
List<RStatOrgMPO> rStatOrgMPOS = rStatOrgMMapper.selectList(rStatOrgMPOQueryWrapper);
|
||||
if(CollectionUtils.isEmpty(rStatOrgMPOS)){
|
||||
sumEffectiveMeasurement=0;
|
||||
}else {
|
||||
sumEffectiveMeasurement = rStatOrgMPOS.stream().mapToInt(RStatOrgMPO::getEffectiveMeasurementAccrued).sum();
|
||||
}
|
||||
int finalSumEffectiveMeasurement = sumEffectiveMeasurement;
|
||||
dataTypeMap.forEach((k, v)->{
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.clear();
|
||||
queryWrapper.eq("org_no",temp).
|
||||
eq("harmonic_type",dictData.getId()).
|
||||
eq("data_type",v.getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",orgParam.getDataDate().substring(0, 7));
|
||||
List<RStatHarmonicMPO> rStatHarmonicMPOS = rStatHarmonicMPOMapper.selectList(queryWrapper);
|
||||
Double overLimitMeasurementAverage =0.00;
|
||||
int overDay =0;
|
||||
int overLimitMeasurementAccrued=0;
|
||||
Double overLimitMeasurementRatioAverage=0.00;
|
||||
Double overLimitMeasurementRatioAccrued=0.00;
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicMPOS)){
|
||||
|
||||
overDay = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
overLimitMeasurementAccrued = rStatHarmonicMPOS.stream().mapToInt(RStatHarmonicMPO::getOverLimitMeasurementAccrued).sum();
|
||||
double asDouble = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().getAsDouble();
|
||||
overLimitMeasurementAverage = Double.parseDouble(df.format(asDouble));
|
||||
double asDouble1 = rStatHarmonicMPOS.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().getAsDouble();
|
||||
|
||||
overLimitMeasurementRatioAverage = Double.parseDouble(df.format(asDouble1));
|
||||
if(finalSumEffectiveMeasurement ==0){
|
||||
overLimitMeasurementRatioAccrued=0.00;
|
||||
}else {
|
||||
overLimitMeasurementRatioAccrued=Double.parseDouble(df.format((float)overLimitMeasurementAccrued / finalSumEffectiveMeasurement));
|
||||
}
|
||||
}
|
||||
RStatHarmonicOrgMPO rStatHarmonicOrgMPO = new RStatHarmonicOrgMPO();
|
||||
rStatHarmonicOrgMPO.setOrgNo(temp);
|
||||
rStatHarmonicOrgMPO.setDataDate(localDate);
|
||||
rStatHarmonicOrgMPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicOrgMPO.setDataType(v.getId());
|
||||
rStatHarmonicOrgMPO.setOverDay(overDay);
|
||||
rStatHarmonicOrgMPO.setOverLimitMeasurementAccrued(overLimitMeasurementAccrued);
|
||||
rStatHarmonicOrgMPO.setOverLimitMeasurementAverage(overLimitMeasurementAverage);
|
||||
rStatHarmonicOrgMPO.setOverLimitMeasurementRatioAccrued(overLimitMeasurementRatioAccrued);
|
||||
rStatHarmonicOrgMPO.setOverLimitMeasurementRatioAverage(overLimitMeasurementRatioAverage);
|
||||
|
||||
rStatHarmonicOrgMPOList.add(rStatHarmonicOrgMPO);
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicOrgMPOList)){
|
||||
rStatHarmonicMPOService.saveOrUpdateBatchByMultiId(rStatHarmonicOrgMPOList,500);
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderDay(OrgParam orgParam) {
|
||||
List<RStatHarmonicOrgDPO> rStatHarmonicOrgDPOList = new ArrayList<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(orgParam.getOrgId()).getData();
|
||||
Date date = DateUtil.parse(orgParam.getDataDate());
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(orgParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RStatHarmonicDPO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
data.stream().forEach(temp->{
|
||||
int sumEffectiveMeasurement =0;
|
||||
List<RStatOrgDVO> rStatOrgDVOS = rStatOrgDMapper.listAll(orgParam.getDataDate(), temp);
|
||||
if(CollectionUtils.isEmpty(rStatOrgDVOS)){
|
||||
sumEffectiveMeasurement=0;
|
||||
}else {
|
||||
sumEffectiveMeasurement = rStatOrgDVOS.stream().mapToInt(RStatOrgDVO::getEffectiveMeasurement).sum();
|
||||
}
|
||||
int finalSumEffectiveMeasurement = sumEffectiveMeasurement;
|
||||
dataTypeMap.forEach((k, v)->{
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("over_limit_measurement").
|
||||
eq("org_no",temp).
|
||||
eq("data_type",v.getId()).
|
||||
eq("harmonic_type",dictData.getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",orgParam.getDataDate());
|
||||
List<RStatHarmonicDPO> rStatHarmonicDPOList = rStatHarmonicDPOMapper.selectList(queryWrapper);
|
||||
int sumOverLimitMeasurement =0;
|
||||
|
||||
if(CollectionUtils.isEmpty(rStatOrgDVOS)){
|
||||
sumOverLimitMeasurement=0;
|
||||
}else {
|
||||
sumOverLimitMeasurement = rStatHarmonicDPOList.stream().mapToInt(RStatHarmonicDPO::getOverLimitMeasurement).sum();
|
||||
}
|
||||
RStatHarmonicOrgDPO rStatHarmonicOrgDPO = new RStatHarmonicOrgDPO();
|
||||
rStatHarmonicOrgDPO.setOrgNo(temp);
|
||||
rStatHarmonicOrgDPO.setDataDate(localDate);
|
||||
rStatHarmonicOrgDPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicOrgDPO.setDataType(v.getId());
|
||||
rStatHarmonicOrgDPO.setOverLimitMeasurementAverage(sumOverLimitMeasurement);
|
||||
if(finalSumEffectiveMeasurement ==0){
|
||||
rStatHarmonicOrgDPO.setOverLimitMeasurementRatioAverage(0.00);
|
||||
}else {
|
||||
rStatHarmonicOrgDPO.setOverLimitMeasurementRatioAverage(Double.parseDouble(df.format((float)sumOverLimitMeasurement / finalSumEffectiveMeasurement)));
|
||||
}
|
||||
rStatHarmonicOrgDPOList.add(rStatHarmonicOrgDPO);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicOrgDPOList)){
|
||||
rStatHarmonicDPOService.saveOrUpdateBatchByMultiId(rStatHarmonicOrgDPOList,500);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<RStatOrgDVO> rStatOrgDVOS = null;
|
||||
|
||||
int sumEffectiveMeasurement = rStatOrgDVOS.stream().mapToInt(RStatOrgDVO::getEffectiveMeasurement).sum();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,12 @@ import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.*;
|
||||
import com.njcn.prepare.harmonic.service.mysql.area.*;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
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.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -855,624 +851,6 @@ public class RStatHarmonicServiceImpl implements RStatHarmonicService {
|
||||
/***----------------------------------------------------------------------------------------------**/
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.hanlderOracleYear (data, dataDate, type);
|
||||
break;
|
||||
case 2:
|
||||
this.hanlderOracleQtr (data, dataDate, type);
|
||||
break;
|
||||
case 3:
|
||||
this.hanlderM ( data, dataDate, type);
|
||||
break;
|
||||
case 5:
|
||||
this.hanlderDay ( data, dataDate, type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderOracleYear(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatHarmonicYPO> rStatHarmonicYPOList = new ArrayList<>();
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN);
|
||||
/*获取监测点类型类型*/
|
||||
QueryWrapper<RMpPartHarmonicDetailM> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgYPO> rStatOrgYPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatHarmonicMPO> harmonicMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
DecimalFormat df = new DecimalFormat("0.00000");
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<String, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineTag));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgYPOQueryWrapper.clear();
|
||||
rStatOrgYPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("YEAR( data_date)", dataDate.substring(0,4));
|
||||
RStatOrgYPO rStatOrgYPO = rStatOrgYMapper.selectOne(rStatOrgYPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicYPO rStatHarmonicYPO = new RStatHarmonicYPO();
|
||||
rStatHarmonicYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicYPO.setDataDate(localDate);
|
||||
rStatHarmonicYPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicYPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicYPO.setMeasurementTypeClass(k);
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicYPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicMPOQueryWrapper.clear();
|
||||
harmonicMPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RStatHarmonicMPO> list = rStatHarmonicMPOService.list(harmonicMPOQueryWrapper);
|
||||
double asDouble = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
int sum1 = list.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
rStatHarmonicYPO.setOverLimitMeasurementAverage(asDouble);
|
||||
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
|
||||
if (rStatHarmonicYPO.getOverLimitMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicYPO.setAverageOverDay(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) sum1 / rStatHarmonicYPO.getOverLimitMeasurementAccrued());
|
||||
rStatHarmonicYPO.setAverageOverDay(Double.parseDouble(value));
|
||||
}
|
||||
|
||||
if (rStatOrgYPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicYPO.getOverLimitMeasurementAccrued() / rStatOrgYPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicYPOList.add(rStatHarmonicYPO);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
/*配网*/
|
||||
if(CollectionUtil.isNotEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())){
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgYPOQueryWrapper.clear();
|
||||
rStatOrgYPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("YEAR( data_date)", dataDate.substring(0,4));
|
||||
RStatOrgYPO rStatOrgYPO = rStatOrgYMapper.selectOne(rStatOrgYPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicYPO rStatHarmonicYPO = new RStatHarmonicYPO();
|
||||
rStatHarmonicYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicYPO.setDataDate(localDate);
|
||||
rStatHarmonicYPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicYPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicYPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicYPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicMPOQueryWrapper.clear();
|
||||
harmonicMPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RStatHarmonicMPO> list = rStatHarmonicMPOService.list(harmonicMPOQueryWrapper);
|
||||
double asDouble = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
int sum1 = list.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
rStatHarmonicYPO.setOverLimitMeasurementAverage(asDouble);
|
||||
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
|
||||
if (rStatHarmonicYPO.getOverLimitMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicYPO.setAverageOverDay(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) sum1 / rStatHarmonicYPO.getOverLimitMeasurementAccrued());
|
||||
rStatHarmonicYPO.setAverageOverDay(Double.parseDouble(value));
|
||||
}
|
||||
|
||||
if (rStatOrgYPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicYPO.getOverLimitMeasurementAccrued() / rStatOrgYPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicYPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicYPOList.add(rStatHarmonicYPO);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
if(CollectionUtil.isNotEmpty(rStatHarmonicYPOList)){
|
||||
rStatHarmonicYPOService.saveOrUpdateBatchByMultiId(rStatHarmonicYPOList,500);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderOracleQtr(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatHarmonicQPO> rStatHarmonicQPOList = new ArrayList<>();
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RMpPartHarmonicDetailM> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgQPO> rStatOrgQPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatHarmonicMPO> harmonicMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
DecimalFormat df = new DecimalFormat("0.00000");
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<String, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineTag));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgQPOQueryWrapper.clear();
|
||||
rStatOrgQPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
RStatOrgQPO rStatOrgQPO = rStatOrgQMapper.selectOne(rStatOrgQPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicQPO rStatHarmonicQPO = new RStatHarmonicQPO();
|
||||
rStatHarmonicQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicQPO.setDataDate(localDate);
|
||||
rStatHarmonicQPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicQPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicQPO.setMeasurementTypeClass(k);
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicQPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicMPOQueryWrapper.clear();
|
||||
harmonicMPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RStatHarmonicMPO> list = rStatHarmonicMPOService.list(harmonicMPOQueryWrapper);
|
||||
double asDouble = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
int sum1 = list.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
rStatHarmonicQPO.setOverLimitMeasurementAverage(asDouble);
|
||||
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
|
||||
if (rStatHarmonicQPO.getOverLimitMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicQPO.setAverageOverDay(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) sum1 / rStatHarmonicQPO.getOverLimitMeasurementAccrued());
|
||||
rStatHarmonicQPO.setAverageOverDay(Double.parseDouble(value));
|
||||
}
|
||||
|
||||
if (rStatOrgQPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicQPO.getOverLimitMeasurementAccrued() / rStatOrgQPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicQPOList.add(rStatHarmonicQPO);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
/*配网*/
|
||||
if(CollectionUtil.isNotEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())){
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgQPOQueryWrapper.clear();
|
||||
rStatOrgQPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
RStatOrgQPO rStatOrgQPO = rStatOrgQMapper.selectOne(rStatOrgQPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicQPO rStatHarmonicQPO = new RStatHarmonicQPO();
|
||||
rStatHarmonicQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicQPO.setDataDate(localDate);
|
||||
rStatHarmonicQPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicQPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicQPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicQPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicMPOQueryWrapper.clear();
|
||||
harmonicMPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RStatHarmonicMPO> list = rStatHarmonicMPOService.list(harmonicMPOQueryWrapper);
|
||||
double asDouble = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementAverage).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = list.stream().mapToDouble(RStatHarmonicMPO::getOverLimitMeasurementRatioAverage).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
int sum1 = list.stream().mapToInt(RStatHarmonicMPO::getOverDay).sum();
|
||||
rStatHarmonicQPO.setOverLimitMeasurementAverage(asDouble);
|
||||
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
|
||||
if (rStatHarmonicQPO.getOverLimitMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicQPO.setAverageOverDay(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) sum1 / rStatHarmonicQPO.getOverLimitMeasurementAccrued());
|
||||
rStatHarmonicQPO.setAverageOverDay(Double.parseDouble(value));
|
||||
}
|
||||
|
||||
if (rStatOrgQPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicQPO.getOverLimitMeasurementAccrued() / rStatOrgQPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicQPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicQPOList.add(rStatHarmonicQPO);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
if(CollectionUtil.isNotEmpty(rStatHarmonicQPOList)){
|
||||
rStatHarmonicQPOService.saveOrUpdateBatchByMultiId(rStatHarmonicQPOList,500);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderM(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
|
||||
List<RStatHarmonicMPO> rStatHarmonicMPOList = new ArrayList<>();
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RMpPartHarmonicDetailM> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatHarmonicDPO> harmonicDPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
DecimalFormat df = new DecimalFormat("0.00000");
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<String, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineTag));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
RStatOrgMPO rStatOrgMPO = rStatOrgMMapper.selectOne(rStatOrgMPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicMPO rStatHarmonicMPO = new RStatHarmonicMPO();
|
||||
rStatHarmonicMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicMPO.setDataDate(localDate);
|
||||
rStatHarmonicMPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicMPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicMPO.setMeasurementTypeClass(k);
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicMPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicDPOQueryWrapper.clear();
|
||||
harmonicDPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", k).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RStatHarmonicDPO> rStatHarmonicDPOList = rStatHarmonicDPOService.list(harmonicDPOQueryWrapper);
|
||||
double asDouble = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurement).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurementRatio).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
rStatHarmonicMPO.setOverLimitMeasurementAverage(asDouble);
|
||||
double sum = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurement).sum();
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
int i = BigDecimal.valueOf(asDouble1).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
|
||||
rStatHarmonicMPO.setOverDay(i);
|
||||
|
||||
if (rStatOrgMPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicMPO.getOverLimitMeasurementAccrued() / rStatOrgMPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicMPOList.add(rStatHarmonicMPO);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
/*配网*/
|
||||
if(CollectionUtil.isNotEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())){
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("freq_over_day", "v_dev_over_day", "v_over_day", "i_over_day", "unbalance_over_day", "i_neg_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS = rMpPartHarmonicDetailMMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailMQueryWrapper.select("flicker_over_day", "inuharm_over_day").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS = rMpSurplusHarmonicDetailMMapper.selectList(rMpSurplusHarmonicDetailMQueryWrapper);
|
||||
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
RStatOrgMPO rStatOrgMPO = rStatOrgMMapper.selectOne(rStatOrgMPOQueryWrapper);
|
||||
|
||||
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATOR.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicMPO rStatHarmonicMPO = new RStatHarmonicMPO();
|
||||
rStatHarmonicMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicMPO.setDataDate(localDate);
|
||||
rStatHarmonicMPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicMPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
rStatHarmonicMPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
/**4、累计超标监测点数*/
|
||||
rStatHarmonicMPO.setOverLimitMeasurementAccrued(getOverLimitMeasurementAccruedTime(dictData, rMpPartHarmonicDetailMS, rMpSurplusHarmonicDetailMS));
|
||||
/*3、日均超标监测点数,6、日均超标监测点数占比*/
|
||||
harmonicDPOQueryWrapper.clear();
|
||||
harmonicDPOQueryWrapper.eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
eq("harmonic_type", dictData.getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring(0, 7));
|
||||
List<RStatHarmonicDPO> rStatHarmonicDPOList = rStatHarmonicDPOService.list(harmonicDPOQueryWrapper);
|
||||
double asDouble = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurement).average().orElse(0.00);
|
||||
asDouble = BigDecimal.valueOf(asDouble).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
double asDouble1 = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurementRatio).average().orElse(0.00);
|
||||
asDouble1 = BigDecimal.valueOf(asDouble1).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
rStatHarmonicMPO.setOverLimitMeasurementAverage(asDouble);
|
||||
double sum = rStatHarmonicDPOList.stream().mapToDouble(RStatHarmonicDPO::getOverLimitMeasurement).sum();
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAverage(asDouble1);
|
||||
|
||||
int i = BigDecimal.valueOf(asDouble1).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
||||
|
||||
rStatHarmonicMPO.setOverDay(i);
|
||||
|
||||
if (rStatOrgMPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
//todo为0时如何设值
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAccrued(0.00);
|
||||
|
||||
} else {
|
||||
String value = df.format((float) rStatHarmonicMPO.getOverLimitMeasurementAccrued() / rStatOrgMPO.getEffectiveMeasurementAccrued());
|
||||
rStatHarmonicMPO.setOverLimitMeasurementRatioAccrued(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicMPOList.add(rStatHarmonicMPO);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
if(CollectionUtil.isNotEmpty(rStatHarmonicMPOList)){
|
||||
rStatHarmonicMPOService.saveOrUpdateBatchByMultiId(rStatHarmonicMPOList,500);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getOverLimitMeasurementAccruedTime(DictData dictData, List<RMpPartHarmonicDetailM> rMpPartHarmonicDetailMS, List<RMpSurplusHarmonicDetailM> rMpSurplusHarmonicDetailMS) {
|
||||
Integer value = 0;
|
||||
if (Objects.equals(dictData.getCode(),DicDataEnum.VOLTAGE_DEV.getCode())) {
|
||||
@@ -1502,144 +880,6 @@ public class RStatHarmonicServiceImpl implements RStatHarmonicService {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
private void hanlderDay(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatHarmonicDPO> rStatHarmonicDPOList = new ArrayList<>();
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
QueryWrapper<RMpPartHarmonicDetailD> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RMpSurplusHarmonicDetailD> rMpSurplusHarmonicDetailDQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgDPO> rStatOrgDPOQueryWrapper = new QueryWrapper<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00000");
|
||||
|
||||
/*获取稳态统计指标*/
|
||||
List<DictData> steadyStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
/*获取数据类型*/
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
;
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if(!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())){
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<String, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineTag));
|
||||
collect.forEach((k, v)->{
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("is_freq","is_v_dev","is_v","is_i","is_unbalance","is_i_neg").
|
||||
in("measurement_point_id",collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",dataDate);
|
||||
List<RMpPartHarmonicDetailD> rMpPartHarmonicDetailDS = rMpPartHarmonicDetailDMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailDQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailDQueryWrapper.select("is_flicker","is_inuharm").
|
||||
in("measurement_point_id",collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",dataDate);
|
||||
List<RMpSurplusHarmonicDetailD> rMpSurplusHarmonicDetailDS = rMpSurplusHarmonicDetailDMapper.selectList(rMpSurplusHarmonicDetailDQueryWrapper);
|
||||
|
||||
rStatOrgDPOQueryWrapper.clear();
|
||||
rStatOrgDPOQueryWrapper.select("effective_measurement").
|
||||
eq("org_no",deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class",k).
|
||||
eq("data_type",dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')",dataDate);
|
||||
RStatOrgDPO rStatOrgDPO = rStatOrgDMapper.selectOne(rStatOrgDPOQueryWrapper);
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if(Objects.equals(dictData.getCode(),DicDataEnum.TOTAL_INDICATOR.getCode())){
|
||||
return;
|
||||
}
|
||||
RStatHarmonicDPO rStatHarmonicDPO = new RStatHarmonicDPO();
|
||||
rStatHarmonicDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicDPO.setDataDate(localDate);
|
||||
rStatHarmonicDPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicDPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
rStatHarmonicDPO.setMeasurementTypeClass(k);
|
||||
rStatHarmonicDPO.setOverLimitMeasurement(getSteadyStatisData(dictData,rMpPartHarmonicDetailDS,rMpSurplusHarmonicDetailDS));
|
||||
if(rStatOrgDPO.getEffectiveMeasurement()==0){
|
||||
rStatHarmonicDPO.setOverLimitMeasurementRatio(1.00);
|
||||
|
||||
}else{
|
||||
String value = df.format((float)rStatHarmonicDPO.getOverLimitMeasurement() / rStatOrgDPO.getEffectiveMeasurement());
|
||||
rStatHarmonicDPO.setOverLimitMeasurementRatio(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicDPOList.add(rStatHarmonicDPO);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
/*配网*/
|
||||
if(!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> pwMonitorMap = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
pwMonitorMap.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
queryWrapper.clear();
|
||||
queryWrapper.select("is_freq", "is_v_dev", "is_v", "is_i", "is_unbalance", "is_i_neg").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
List<RMpPartHarmonicDetailD> rMpPartHarmonicDetailDS = rMpPartHarmonicDetailDMapper.selectList(queryWrapper);
|
||||
|
||||
rMpSurplusHarmonicDetailDQueryWrapper.clear();
|
||||
rMpSurplusHarmonicDetailDQueryWrapper.select("is_flicker", "is_inuharm").
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
List<RMpSurplusHarmonicDetailD> rMpSurplusHarmonicDetailDS = rMpSurplusHarmonicDetailDMapper.selectList(rMpSurplusHarmonicDetailDQueryWrapper);
|
||||
|
||||
rStatOrgDPOQueryWrapper.clear();
|
||||
rStatOrgDPOQueryWrapper.select("effective_measurement").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
RStatOrgDPO rStatOrgDPO = rStatOrgDMapper.selectOne(rStatOrgDPOQueryWrapper);
|
||||
|
||||
steadyStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.NEG_CURRENT.getCode())) {
|
||||
return;
|
||||
}
|
||||
RStatHarmonicDPO rStatHarmonicDPO = new RStatHarmonicDPO();
|
||||
rStatHarmonicDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatHarmonicDPO.setDataDate(localDate);
|
||||
rStatHarmonicDPO.setHarmonicType(dictData.getId());
|
||||
rStatHarmonicDPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
rStatHarmonicDPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatHarmonicDPO.setOverLimitMeasurement(getSteadyStatisData(dictData, rMpPartHarmonicDetailDS, rMpSurplusHarmonicDetailDS));
|
||||
if (rStatOrgDPO.getEffectiveMeasurement() == 0) {
|
||||
rStatHarmonicDPO.setOverLimitMeasurementRatio(1.00);
|
||||
|
||||
} else {
|
||||
String value = df.format(rStatHarmonicDPO.getOverLimitMeasurement() / rStatOrgDPO.getEffectiveMeasurement());
|
||||
rStatHarmonicDPO.setOverLimitMeasurementRatio(Double.parseDouble(value));
|
||||
}
|
||||
rStatHarmonicDPOList.add(rStatHarmonicDPO);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if(!CollectionUtils.isEmpty(rStatHarmonicDPOList)){
|
||||
rStatHarmonicDPOService.saveOrUpdateBatchByMultiId(rStatHarmonicDPOList,500);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String getmeasurementType(Integer k, Map<String, DictData> lineSortMap) {
|
||||
String value ="";
|
||||
switch (k) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,118 +38,6 @@ public class DeviceAbnormaStatisticsServiceImpl extends MppServiceImpl<DeviceAbn
|
||||
private final DeviceAbnormaStatisticsMapper deviceAbnormaStatisticsMapper;
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
@Override
|
||||
public boolean dailyDeviceAbnormaStatistics (DeviceAbnormaStatisticsParam param) {
|
||||
Map<String, List<TopMsgPO>> comMap = new HashMap<>();
|
||||
Map<String, List<AlarmPO>> deviceFlowMap = new HashMap<>();
|
||||
// 获取所有装置以及下属监测点
|
||||
List<AlarmPO> lines = deviceAbnormaStatisticsMapper.getLines();
|
||||
if(CollectionUtil.isEmpty(lines)){
|
||||
return true;
|
||||
}
|
||||
// 根据装置id分组
|
||||
Map<String, List<AlarmPO>> devMap = lines.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
|
||||
// 监测点集合
|
||||
List<String> monotorIds = lines.stream().map(AlarmPO::getId).collect(Collectors.toList());
|
||||
// 装置id集合
|
||||
List<String> devIds = new ArrayList<>(devMap.keySet());
|
||||
// 获取异常告警策略
|
||||
List<AlarmStrategyVO> alarmStrategyVOS = deviceAbnormaStatisticsMapper.selectAlarmStrategy();
|
||||
Map<Integer, List<AlarmStrategyVO>> levMap = alarmStrategyVOS.stream().collect(Collectors.groupingBy(AlarmStrategyVO::getAlgoDesc));
|
||||
// 获取监测点数据完整性
|
||||
List<AlarmPO> lineIntegritys = deviceAbnormaStatisticsMapper.getIntegrityByLineIds(
|
||||
monotorIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getTime())));
|
||||
Map<String, List<AlarmPO>> lineIntegrityMap = lineIntegritys.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
|
||||
// 告警信息统计
|
||||
List<AlarmPO> lineAlarms = deviceAbnormaStatisticsMapper.getAlarmByLines(
|
||||
monotorIds,
|
||||
devIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getTime())));
|
||||
Map<String, List<AlarmPO>> lineAlarmsMap = lineAlarms.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
|
||||
// 获取终端在线率
|
||||
List<AlarmPO> deviceOnlineRate = deviceAbnormaStatisticsMapper.getOnlineRateByDevice(
|
||||
devIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getTime())));
|
||||
Map<String, List<AlarmPO>> deviceOnlineMap = deviceOnlineRate.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
|
||||
// 获取设备流量
|
||||
List<AlarmPO> deviceFlow = deviceAbnormaStatisticsMapper.getFlowByDevice(devIds,param.getTime().substring(0,7));
|
||||
if (CollectionUtil.isNotEmpty(deviceFlow)) {
|
||||
deviceFlowMap = deviceFlow.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
|
||||
}
|
||||
// 获取通信中断信息
|
||||
List<TopMsgPO> comMsgs = getPqsCommunicate(devIds, param.getTime());
|
||||
if (CollectionUtil.isNotEmpty(comMsgs)) {
|
||||
comMap = comMsgs.stream().collect(Collectors.groupingBy(TopMsgPO::getDevId));
|
||||
}
|
||||
// 整合装置信息
|
||||
List<TopMsgPO> topMsgPOS = new ArrayList<>();
|
||||
for (Map.Entry<String, List<AlarmPO>> devEntry : devMap.entrySet()) {
|
||||
TopMsgPO topMsg = new TopMsgPO();
|
||||
topMsg.setDevId(devEntry.getKey());
|
||||
int deviceLevel = devEntry.getValue().stream().mapToInt(AlarmPO::getLevel).min().orElse(-1);
|
||||
// 装置等级
|
||||
topMsg.setDeviceLevel(deviceLevel);
|
||||
// 等级对应的告警策略
|
||||
AlarmStrategyVO alarmStrategyVO = levMap.get(deviceLevel).get(0);
|
||||
// 数据完整性
|
||||
if (lineIntegrityMap.containsKey(devEntry.getKey())) {
|
||||
topMsg.setIntegrityFlag(lineIntegrityMap.get(devEntry.getKey()).get(0).getIntegrity() < alarmStrategyVO.getIntegrityValue() ? 0 : 1);
|
||||
topMsg.setIntegrityValue(lineIntegrityMap.get(devEntry.getKey()).get(0).getIntegrity());
|
||||
} else {
|
||||
topMsg.setIntegrityFlag(-1);
|
||||
}
|
||||
// 装置告警
|
||||
if (lineAlarmsMap.containsKey(devEntry.getKey())) {
|
||||
List<AlarmPO> lineAlarmPOS = lineAlarmsMap.get(devEntry.getKey());
|
||||
int alarmCount = lineAlarmPOS.stream().mapToInt(AlarmPO::getAlarmCount).sum();
|
||||
String alarmDesc = String.join(",", lineAlarmPOS.stream().map(AlarmPO::getAlarmDesc).collect(Collectors.toList()));
|
||||
topMsg.setAlarmCountFlag(alarmCount > alarmStrategyVO.getWarnValue() ? 0 : 1);
|
||||
topMsg.setAlarmCount(alarmCount);
|
||||
topMsg.setAlarmDesc(alarmDesc);
|
||||
} else {
|
||||
topMsg.setAlarmCountFlag(1);
|
||||
topMsg.setAlarmCount(0);
|
||||
}
|
||||
// 在线率
|
||||
if (deviceOnlineMap.containsKey(devEntry.getKey())) {
|
||||
AlarmPO alarmPO = deviceOnlineMap.get(devEntry.getKey()).get(0);
|
||||
topMsg.setOnlineRateFlag(alarmPO.getOnlineRate() * 100 < alarmStrategyVO.getOnlineValue() ? 0 : 1);
|
||||
topMsg.setOnlineRateValue(alarmPO.getOnlineRate() *100);
|
||||
} else {
|
||||
topMsg.setOnlineRateFlag(-1);
|
||||
}
|
||||
// 流量
|
||||
if (deviceFlowMap.containsKey(devEntry.getKey()) && Objects.nonNull(deviceFlowMap.get(devEntry.getKey()).get(0).getFlowProportion())) {
|
||||
AlarmPO alarmPO = deviceFlowMap.get(devEntry.getKey()).get(0);
|
||||
topMsg.setFlowFlag(alarmPO.getActualValue() > alarmPO.getFlowMeal() ? 0 : 1);
|
||||
topMsg.setFlowValue(alarmPO.getFlowProportion());
|
||||
} else {
|
||||
topMsg.setFlowFlag(-1);
|
||||
}
|
||||
|
||||
if (comMap.containsKey(devEntry.getKey())) {
|
||||
TopMsgPO comOutPO = comMap.get(devEntry.getKey()).get(0);
|
||||
List<PqsCommunicate> abnormals = comOutPO.getCommunicates().stream().filter(t -> t.getDuration() > alarmStrategyVO.getOffTimeValue()).collect(Collectors.toList());
|
||||
topMsg.setOfftimeFlag(abnormals.size() > 0 ? 0 :1);
|
||||
topMsg.setComOutCount(abnormals.size());
|
||||
List<String> abnormalDesc = abnormals.stream().map(PqsCommunicate::getDesc).collect(Collectors.toList());
|
||||
topMsg.setComOutDescription(String.join(",",abnormalDesc));
|
||||
} else {
|
||||
topMsg.setOfftimeFlag(1);
|
||||
topMsg.setComOutCount(0);
|
||||
}
|
||||
if (topMsg.getFlowFlag() ==0 || topMsg.getIntegrityFlag() ==0 || topMsg.getOfftimeFlag() == 0
|
||||
|| topMsg.getAlarmCountFlag() ==0 || topMsg.getOnlineRateFlag() ==0) {
|
||||
topMsgPOS.add(topMsg);
|
||||
}
|
||||
|
||||
}
|
||||
return topMsgPOS.size()>0 ? deviceAbnormaStatisticsMapper.insertTopMsg(topMsgPOS) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deviceAbnormaStatisticsD(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -17,10 +17,8 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -98,39 +96,4 @@ public class RStatDevSignalDPOServiceImpl extends MppServiceImpl<RStatDevSignalD
|
||||
}
|
||||
}
|
||||
|
||||
// public void eventdetailHandler(DeviceParam deviceParam) {
|
||||
// List<RStatDevSignalDPO> rStatDevSignalDPOList = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(deviceParam.getDataDate());
|
||||
// QueryWrapper<RMpMonitorEvaluateDPO> wrapper = new QueryWrapper<>();
|
||||
// DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RUNNING.getCode()).getData();
|
||||
// deviceParam.getDetailList().forEach(temp -> {
|
||||
//
|
||||
// RStatDevSignalDPO rStatDevSignalDPO = new RStatDevSignalDPO();
|
||||
// rStatDevSignalDPO.setDeviceId(temp.getDevId());
|
||||
// rStatDevSignalDPO.setDeviceStatus(data.getId());
|
||||
// rStatDevSignalDPO.setUpdateTime(temp.getUpdateTime());
|
||||
// rStatDevSignalDPO.setDataDate(date);
|
||||
// /**
|
||||
// * 1、运行状态:设备下任意一个监测点有效接入分钟数(effective_minute_count > 0)为在线状态,反之离线状态
|
||||
// */
|
||||
// Integer effective_minute_count = 0;
|
||||
// List<String> lineIds = temp.getLineIds();
|
||||
// if (CollUtil.isNotEmpty(lineIds)) {
|
||||
// wrapper.clear();
|
||||
// wrapper.select("sum(effective_minute_count) as effective_minute_count ");
|
||||
// wrapper.eq("device_id", temp.getDevId());
|
||||
// wrapper.in("measurement_point_id", lineIds);
|
||||
// RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = revaluateDMapper.selectOne(wrapper);
|
||||
// effective_minute_count = rMpMonitorEvaluateDPO.getEffectiveMinuteCount();
|
||||
// }
|
||||
// String runStatus = "0";
|
||||
// if (effective_minute_count > 0 && temp.getDeviceStatus().equals("1")) {
|
||||
// runStatus = "1";
|
||||
// }
|
||||
// rStatDevSignalDPO.setRunStatus(runStatus);
|
||||
// rStatDevSignalDPOList.add(rStatDevSignalDPO);
|
||||
//
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId(rStatDevSignalDPOList, 500);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpTargetWarnDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataVDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.*;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
@@ -11,11 +8,9 @@ import com.njcn.prepare.harmonic.pojo.dto.AlarmDetailDayDTO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpTargetDiffDPO;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.AlarmDetailService;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -38,50 +33,8 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class AlarmDetailServiceImpl extends MppServiceImpl<AlarmMapper, RMpTargetDiffDPO> implements AlarmDetailService {
|
||||
|
||||
private final DistributionMonitorClient distributionMonitorClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RMpTargetWarnDMapper rMpTargetWarnDMapper;
|
||||
|
||||
private final RMpMeasurePhaseReportDPOMapper rMpMeasurePhaseReportDPOMapper;
|
||||
|
||||
private final RMpMeasureReportDPOMapper rMpMeasureReportDPOMapper;
|
||||
|
||||
private final RMpHarmonicVRateReportDPOMapper rMpHarmonicVRateReportDPOMapper;
|
||||
|
||||
private final RMpEventDetailDMapper rMpEventDetailDMapper;
|
||||
|
||||
private final RMpPltReportDPOMapper rMpPltReportDPOMapper;
|
||||
|
||||
private final RStatDataVDMapper rStatDataVDMapper;
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = {Exception.class})
|
||||
// @Async("asyncExecutor")
|
||||
// public void targetDiff(LineParam lineParam) {
|
||||
// String startTime,endTime;
|
||||
// //月处理
|
||||
// if (Objects.equals(true,lineParam.getRepairFlag())){
|
||||
// List<String> rangeDate = NjcnDateUtils.findEveryDay(lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
// for (String item : rangeDate) {
|
||||
// log.info(item+"-->开始执行");
|
||||
// startTime = item + " 00:00:00";
|
||||
// endTime = PublicUtil.getYesterday(item) + " 00:00:00";
|
||||
// diffData(startTime,endTime,lineParam.getLineIds());
|
||||
// }
|
||||
// }
|
||||
// //日处理
|
||||
// else {
|
||||
// startTime = lineParam.getBeginTime();
|
||||
// endTime = PublicUtil.getYesterday(lineParam.getDataDate()) + " 00:00:00";
|
||||
// diffData(startTime,endTime,lineParam.getLineIds());
|
||||
// }
|
||||
// }
|
||||
|
||||
/*******************************************新算法***********************************************************************/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void targetDiff(CalculatedParam calculatedParam) {
|
||||
@@ -102,7 +55,7 @@ public class AlarmDetailServiceImpl extends MppServiceImpl<AlarmMapper, RMpTarge
|
||||
/**
|
||||
* 生成指标差值日统计
|
||||
*/
|
||||
public List<RMpTargetDiffDPO> diffData(String startTime, String endTime, List<String> list) {
|
||||
private List<RMpTargetDiffDPO> diffData(String startTime, String endTime, List<String> list) {
|
||||
List<RMpTargetDiffDPO> intersectionList = new ArrayList<>();
|
||||
List<RMpTargetDiffDPO> localData = rStatDataVDMapper.getDayData(startTime,list);
|
||||
List<RMpTargetDiffDPO> yesterdayData = rStatDataVDMapper.getDayData(endTime,list);
|
||||
@@ -131,320 +84,4 @@ public class AlarmDetailServiceImpl extends MppServiceImpl<AlarmMapper, RMpTarge
|
||||
return this.baseMapper.getAvgDiffData(endTime,time,list);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 处理数据(电压偏差告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/28
|
||||
// */
|
||||
// private void processVoltageDeviationAlarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// double localMax = rMpMeasurePhaseReportDPOMapper.getMaxVDeUp(lineId, localDate);
|
||||
// double yesterdayMax = rMpMeasurePhaseReportDPOMapper.getMaxVDeUp(lineId, yesterday);
|
||||
// double beforeYesterdayMax = rMpMeasurePhaseReportDPOMapper.getMaxVDeUp(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsVDevWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsVDevWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(频率偏差告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/29
|
||||
// */
|
||||
// private void processFrequencyDeviationAlarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// double localMax = rMpMeasureReportDPOMapper.getMaxFrequencyDeviation(lineId, localDate);
|
||||
// double yesterdayMax = rMpMeasureReportDPOMapper.getMaxFrequencyDeviation(lineId, yesterday);
|
||||
// double beforeYesterdayMax = rMpMeasureReportDPOMapper.getMaxFrequencyDeviation(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsFreqWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsFreqWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(三相电压不平衡告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/29
|
||||
// */
|
||||
// private void processUnbalance95Alarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// double localMax = rMpMeasureReportDPOMapper.getMaxUnbalance95(lineId, localDate);
|
||||
// double yesterdayMax = rMpMeasureReportDPOMapper.getMaxUnbalance95(lineId, yesterday);
|
||||
// double beforeYesterdayMax = rMpMeasureReportDPOMapper.getMaxUnbalance95(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsUnbalanceWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsUnbalanceWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(谐波电压告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/29
|
||||
// */
|
||||
// private void processVoltageHarmonicThd95Alarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// double localMax = rMpHarmonicVRateReportDPOMapper.getMaxVoltageHarmonicThd95(lineId, localDate);
|
||||
// double yesterdayMax = rMpHarmonicVRateReportDPOMapper.getMaxVoltageHarmonicThd95(lineId, yesterday);
|
||||
// double beforeYesterdayMax = rMpHarmonicVRateReportDPOMapper.getMaxVoltageHarmonicThd95(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsVWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsVWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(长时电压闪变告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/30
|
||||
// */
|
||||
// private void processFlashingAlarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// double localMax = rMpPltReportDPOMapper.getMaxFlashing(lineId, localDate);
|
||||
// double yesterdayMax = rMpPltReportDPOMapper.getMaxFlashing(lineId, yesterday);
|
||||
// double beforeYesterdayMax = rMpPltReportDPOMapper.getMaxFlashing(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsFlickerWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsFlickerWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(电压暂降告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/29
|
||||
// */
|
||||
// private void processSagTimesAlarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// int localMax = rMpEventDetailDMapper.getSagTimes(lineId, localDate);
|
||||
// int yesterdayMax = rMpEventDetailDMapper.getSagTimes(lineId, yesterday);
|
||||
// int beforeYesterdayMax = rMpEventDetailDMapper.getSagTimes(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsSagWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsSagWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 处理数据(电压短时中断告警日统计)
|
||||
// * @author qijian
|
||||
// * @date 2022/12/29
|
||||
// */
|
||||
// private void processInterruptTimesAlarm(String date, Integer type, String lineId) {
|
||||
// //日期条件(取前天、昨天、今天)
|
||||
// LocalDate localDate = LocalDate.parse(date);
|
||||
// LocalDate yesterday = localDate.plusDays(-1);
|
||||
// LocalDate beforeYesterday = yesterday.plusDays(-1);
|
||||
// int localMax = rMpEventDetailDMapper.getInterruptTimes(lineId, localDate);
|
||||
// int yesterdayMax = rMpEventDetailDMapper.getInterruptTimes(lineId, yesterday);
|
||||
// int beforeYesterdayMax = rMpEventDetailDMapper.getInterruptTimes(lineId, beforeYesterday);
|
||||
//
|
||||
// //计算RM和CL值
|
||||
// double rm = ((localMax - yesterdayMax) + (yesterdayMax - beforeYesterdayMax)) / 2;
|
||||
// double cl = (localMax + yesterdayMax + beforeYesterdayMax) / 3;
|
||||
//
|
||||
// //计算RL和UCL值
|
||||
// double rl = rm * 3.3;
|
||||
// double ucl = cl + rm * 3;
|
||||
//
|
||||
// //如果本日最大值>UCL 且 本日最大值>昨日最大值,则告警
|
||||
// if (localMax > ucl && localMax > yesterdayMax){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsInterruptWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //如果本日>昨日>前日,且前日的值超过RL值,则告警
|
||||
// if (localMax > yesterdayMax && yesterdayMax > beforeYesterdayMax && beforeYesterdayMax > rl){
|
||||
// RMpTargetWarnDPO rMpTargetWarnD = new RMpTargetWarnDPO();
|
||||
// rMpTargetWarnD.setMeasurementPointId(lineId);
|
||||
// rMpTargetWarnD.setDataDate(DateUtil.parse(date));
|
||||
// rMpTargetWarnD.setIsInterruptWarn(1);
|
||||
// addAlarmData(rMpTargetWarnD);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 存入数据库
|
||||
// * @author qijian
|
||||
// * @date 2022/12/28
|
||||
// */
|
||||
// private void addAlarmData(RMpTargetWarnDPO rMpTargetWarnD) {
|
||||
// LambdaQueryWrapper<RMpTargetWarnDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(RMpTargetWarnDPO::getMeasurementPointId, rMpTargetWarnD.getMeasurementPointId()).eq(RMpTargetWarnDPO::getDataDate, rMpTargetWarnD.getDataDate());
|
||||
// RMpTargetWarnDPO rMpTargetWarnDOne = rMpTargetWarnDMapper.selectOne(lambdaQueryWrapper);
|
||||
// if (Objects.nonNull(rMpTargetWarnDOne)) {
|
||||
// rMpTargetWarnDMapper.update(rMpTargetWarnD, lambdaQueryWrapper);
|
||||
// } else {
|
||||
// rMpTargetWarnDMapper.insert(rMpTargetWarnD);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -11,22 +11,16 @@ import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatComassesDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.HarmonicGeneralService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.influxdb.dto.BatchPoints;
|
||||
import org.influxdb.dto.Point;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -44,94 +38,6 @@ public class HarmonicGeneralServiceImpl extends MppServiceImpl<RStatComassesDMap
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void generalData(LineParam lineParam) {
|
||||
List<String> lineIdOutList;
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
List<Overlimit> overLimitList = getAllLineOutData();
|
||||
lineIdOutList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
lineIdOutList = new ArrayList<>(lineParam.getLineIds());
|
||||
}
|
||||
Date dateOut = DateUtil.parse(lineParam.getDataDate());
|
||||
List<String> records = new ArrayList<>();
|
||||
for (String lineId : lineIdOutList){
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("line_id",lineId);
|
||||
Map<String, Object> fields = getGeneralData(lineId,lineParam.getDataDate());
|
||||
if (CollUtil.isEmpty(fields)){
|
||||
continue;
|
||||
}
|
||||
Point point = influxDbUtils.pointBuilder("pqs_comasses", dateOut.getTime(), TimeUnit.MILLISECONDS,tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).tag("line_id", lineId).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
records.add(batchPoints.lineProtocol());
|
||||
}
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(),"", InfluxDB.ConsistencyLevel.ALL, records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void generalDataToMysql(LineParam lineParam, String time) {
|
||||
List<RStatComassesDPO> list = new ArrayList<>();
|
||||
List<String> lineIdOutList;
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
List<Overlimit> overLimitList = getAllLineOutData();
|
||||
lineIdOutList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
lineIdOutList = new ArrayList<>(lineParam.getLineIds());
|
||||
}
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (String lineId : lineIdOutList){
|
||||
RStatComassesDPO rStatComassesDpo = new RStatComassesDPO();
|
||||
rStatComassesDpo.setTime(dateOut);
|
||||
rStatComassesDpo.setLineId(lineId);
|
||||
Map<String, Object> fields = getGeneralData(lineId,time);
|
||||
if(CollUtil.isNotEmpty(fields)) {
|
||||
rStatComassesDpo.setFreqDev1(Objects.isNull(fields.get("freq_dev1")) ? 0.0 : Double.parseDouble(fields.get("freq_dev1").toString()));
|
||||
rStatComassesDpo.setFreqDev2(Objects.isNull(fields.get("freq_dev2")) ? 0.0 : Double.parseDouble(fields.get("freq_dev2").toString()));
|
||||
rStatComassesDpo.setFreqDev3(Objects.isNull(fields.get("freq_dev3")) ? 0.0 : Double.parseDouble(fields.get("freq_dev3").toString()));
|
||||
rStatComassesDpo.setFreqDev4(Objects.isNull(fields.get("freq_dev4")) ? 0.0 : Double.parseDouble(fields.get("freq_dev4").toString()));
|
||||
rStatComassesDpo.setFreqDev5(Objects.isNull(fields.get("freq_dev5")) ? 0.0 : Double.parseDouble(fields.get("freq_dev5").toString()));
|
||||
|
||||
rStatComassesDpo.setVuDev1(Objects.isNull(fields.get("vu_dev1")) ? 0.0 : Double.parseDouble(fields.get("vu_dev1").toString()));
|
||||
rStatComassesDpo.setVuDev2(Objects.isNull(fields.get("vu_dev2")) ? 0.0 : Double.parseDouble(fields.get("vu_dev2").toString()));
|
||||
rStatComassesDpo.setVuDev3(Objects.isNull(fields.get("vu_dev3")) ? 0.0 : Double.parseDouble(fields.get("vu_dev3").toString()));
|
||||
rStatComassesDpo.setVuDev4(Objects.isNull(fields.get("vu_dev4")) ? 0.0 : Double.parseDouble(fields.get("vu_dev4").toString()));
|
||||
rStatComassesDpo.setVuDev5(Objects.isNull(fields.get("vu_dev5")) ? 0.0 : Double.parseDouble(fields.get("vu_dev5").toString()));
|
||||
|
||||
rStatComassesDpo.setDataPst1(Objects.isNull(fields.get("data_pst1")) ? 0.0 : Double.parseDouble(fields.get("data_pst1").toString()));
|
||||
rStatComassesDpo.setDataPst2(Objects.isNull(fields.get("data_pst2")) ? 0.0 : Double.parseDouble(fields.get("data_pst2").toString()));
|
||||
rStatComassesDpo.setDataPst3(Objects.isNull(fields.get("data_pst3")) ? 0.0 : Double.parseDouble(fields.get("data_pst3").toString()));
|
||||
rStatComassesDpo.setDataPst4(Objects.isNull(fields.get("data_pst4")) ? 0.0 : Double.parseDouble(fields.get("data_pst4").toString()));
|
||||
rStatComassesDpo.setDataPst5(Objects.isNull(fields.get("data_pst5")) ? 0.0 : Double.parseDouble(fields.get("data_pst5").toString()));
|
||||
|
||||
rStatComassesDpo.setVUnbalance1(Objects.isNull(fields.get("v_unbalance1")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance1").toString()));
|
||||
rStatComassesDpo.setVUnbalance2(Objects.isNull(fields.get("v_unbalance2")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance2").toString()));
|
||||
rStatComassesDpo.setVUnbalance3(Objects.isNull(fields.get("v_unbalance3")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance3").toString()));
|
||||
rStatComassesDpo.setVUnbalance4(Objects.isNull(fields.get("v_unbalance4")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance4").toString()));
|
||||
rStatComassesDpo.setVUnbalance5(Objects.isNull(fields.get("v_unbalance5")) ? 0.0 : Double.parseDouble(fields.get("v_unbalance5").toString()));
|
||||
|
||||
rStatComassesDpo.setVThd1(Objects.isNull(fields.get("v_thd1")) ? 0.0 : Double.parseDouble(fields.get("v_thd1").toString()));
|
||||
rStatComassesDpo.setVThd2(Objects.isNull(fields.get("v_thd2")) ? 0.0 : Double.parseDouble(fields.get("v_thd2").toString()));
|
||||
rStatComassesDpo.setVThd3(Objects.isNull(fields.get("v_thd3")) ? 0.0 : Double.parseDouble(fields.get("v_thd3").toString()));
|
||||
rStatComassesDpo.setVThd4(Objects.isNull(fields.get("v_thd4")) ? 0.0 : Double.parseDouble(fields.get("v_thd4").toString()));
|
||||
rStatComassesDpo.setVThd5(Objects.isNull(fields.get("v_thd5")) ? 0.0 : Double.parseDouble(fields.get("v_thd5").toString()));
|
||||
|
||||
rStatComassesDpo.setEvent1(Objects.isNull(fields.get("event1")) ? 0.0 : Double.parseDouble(fields.get("event1").toString()));
|
||||
rStatComassesDpo.setEvent2(Objects.isNull(fields.get("event2")) ? 0.0 : Double.parseDouble(fields.get("event2").toString()));
|
||||
rStatComassesDpo.setEvent3(Objects.isNull(fields.get("event3")) ? 0.0 : Double.parseDouble(fields.get("event3").toString()));
|
||||
rStatComassesDpo.setEvent4(Objects.isNull(fields.get("event4")) ? 0.0 : Double.parseDouble(fields.get("event4").toString()));
|
||||
rStatComassesDpo.setEvent5(Objects.isNull(fields.get("event5")) ? 0.0 : Double.parseDouble(fields.get("event5").toString()));
|
||||
list.add(rStatComassesDpo);
|
||||
}
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newGeneralData(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -67,60 +67,8 @@ public class HarmonicMetricServiceImpl extends MppServiceImpl<RStatAssesDMapper,
|
||||
private final RStatDataPltDMapper rStatDataPltDMapper;
|
||||
private final NormalLimitService normalLimitService;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void metricData(LineParam lineParam) {
|
||||
List<String> lineIdList;
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
List<Overlimit> overLimitList = getAllLineData();
|
||||
lineIdList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
lineIdList = new ArrayList<>(lineParam.getLineIds());
|
||||
}
|
||||
Date dateOut = DateUtil.parse(lineParam.getDataDate());
|
||||
List<String> records = new ArrayList<>();
|
||||
for (String lineId : lineIdList){
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("line_id",lineId);
|
||||
Map<String, Object> fields = getMetricData(lineId,lineParam.getDataDate());
|
||||
Point point = influxDbUtils.pointBuilder("pqs_asses", dateOut.getTime(), TimeUnit.MILLISECONDS,tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).tag("line_id", lineId).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
records.add(batchPoints.lineProtocol());
|
||||
}
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(),"", InfluxDB.ConsistencyLevel.ALL, records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void metricDataToMysql(LineParam lineParam,String time) {
|
||||
List<RStatAssesDPO> list = new ArrayList<>();
|
||||
List<String> lineIdList;
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
List<Overlimit> overLimitList = getAllLineData();
|
||||
lineIdList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
lineIdList = new ArrayList<>(lineParam.getLineIds());
|
||||
}
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (String lineId : lineIdList){
|
||||
Map<String, Object> fields = getMetricData(lineId,time);
|
||||
if(CollUtil.isNotEmpty(fields)) {
|
||||
RStatAssesDPO rStatAssesDpo = new RStatAssesDPO();
|
||||
rStatAssesDpo.setTime(dateOut);
|
||||
rStatAssesDpo.setLineId(lineId);
|
||||
rStatAssesDpo.setVuDev(Double.parseDouble(fields.get("vu_dev").toString()));
|
||||
rStatAssesDpo.setFreqDev(Double.parseDouble(fields.get("freq_dev").toString()));
|
||||
rStatAssesDpo.setDataPlt(Double.parseDouble(fields.get("data_plt").toString()));
|
||||
rStatAssesDpo.setVUnbalanceCp95(Double.parseDouble(fields.get("v_unbalance_cp95").toString()));
|
||||
rStatAssesDpo.setVThdCp95(Double.parseDouble(fields.get("v_thd_cp95").toString()));
|
||||
list.add(rStatAssesDpo);
|
||||
}
|
||||
}
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void newMetricData(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -56,43 +56,11 @@ public class IntegrityServiceImpl extends MppServiceImpl<RStatIntegrityDMapper,
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DataVMapper dataVMapper;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
@Deprecated
|
||||
public void dataIntegrity(LineParam lineParam, String startTime, String endTime) {
|
||||
LocalDate dateTime = LocalDate.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
List<LineDevGetDTO> lineDevGetDTOList;
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
Dept dept = deptFeignClient.getRootDept().getData();
|
||||
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(dept.getId());
|
||||
deptGetLineParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
List<String> monitorIds = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||
lineDevGetDTOList = commTerminalGeneralClient.getMonitorDetailList(monitorIds).getData();
|
||||
}else {
|
||||
lineDevGetDTOList = commTerminalGeneralClient.getMonitorDetailList(lineParam.getLineIds()).getData();
|
||||
}
|
||||
List<RStatIntegrityD> list = new ArrayList<>();
|
||||
for (LineDevGetDTO lineDetail :lineDevGetDTOList){
|
||||
int dataCount = getDataCount(lineDetail.getPointId(),startTime,endTime);
|
||||
RStatIntegrityD integrityDpo = new RStatIntegrityD();
|
||||
integrityDpo.setTimeId(dateTime);
|
||||
integrityDpo.setLineIndex(lineDetail.getPointId());
|
||||
integrityDpo.setDueTime(InfluxDBPublicParam.DAY_MINUTE/lineDetail.getInterval());
|
||||
integrityDpo.setRealTime(dataCount);
|
||||
list.add(integrityDpo);
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(list,500);
|
||||
}
|
||||
|
||||
/********************************新算法************************************************/
|
||||
@Override
|
||||
@@ -141,10 +109,9 @@ public class IntegrityServiceImpl extends MppServiceImpl<RStatIntegrityDMapper,
|
||||
|
||||
/**
|
||||
* 获取data_v中各个监测点的数据总数
|
||||
* @param lineIndex
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
* @param lineIndex 监测点索引
|
||||
* @param startTime 起始时间
|
||||
* @param endTime 结束时间
|
||||
*/
|
||||
public List<MeasurementCount> getMeasurementCount(List<String> lineIndex, String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class,MeasurementCount.class);
|
||||
|
||||
@@ -1,29 +1,18 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.harmonic.pojo.po.LimitRate;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.LimitTargetService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.influxdb.dto.BatchPoints;
|
||||
import org.influxdb.dto.Point;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -31,7 +20,6 @@ import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 生成limit_target表
|
||||
@@ -45,55 +33,9 @@ import java.util.concurrent.TimeUnit;
|
||||
@AllArgsConstructor
|
||||
public class LimitTargetServiceImpl extends MppServiceImpl<RStatLimitTargetDMapper, RStatLimitTargetDPO> implements LimitTargetService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final IRStatLimitRateDService statLimitRateDService;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void getLimitTargetData(LineParam lineParam) {
|
||||
List<String> records;
|
||||
Date dateOut = DateUtil.parse(lineParam.getDataDate());
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
List<LimitRate> limitRateData = getLimitRateData(null,lineParam.getDataDate());
|
||||
records = processOutData(limitRateData,dateOut);
|
||||
}else {
|
||||
List<LimitRate> limitRateData = new ArrayList<>();
|
||||
for (String lineId : lineParam.getLineIds()){
|
||||
List<LimitRate> limitRateOut = getLimitRateData(lineId,lineParam.getDataDate());
|
||||
limitRateData.addAll(limitRateOut);
|
||||
}
|
||||
records = processOutData(limitRateData,dateOut);
|
||||
}
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(),"", InfluxDB.ConsistencyLevel.ALL, records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void limitTargetData(List<String> indexLists,String startTime,String endTime) {
|
||||
log.info(LocalDateTime.now()+"r_stat_limit_target_d开始执行=======》");
|
||||
List<RStatLimitTargetDPO> list = new ArrayList<>();
|
||||
LocalDate dateOut = LocalDate.parse(startTime,DatePattern.NORM_DATE_FORMATTER);
|
||||
List<RStatLimitRateDPO> limitRateData = new ArrayList<>();
|
||||
|
||||
if (CollUtil.isEmpty(indexLists)){
|
||||
limitRateData = getLimitRateDataFromMysql(null,startTime,endTime);
|
||||
} else {
|
||||
limitRateData = getLimitRateDataFromMysql(indexLists,startTime,endTime);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(limitRateData)){
|
||||
for (RStatLimitRateDPO limitRate : limitRateData){
|
||||
RStatLimitTargetDPO limitTarget = new RStatLimitTargetDPO();
|
||||
limitTarget.setTime(dateOut);
|
||||
limitTarget.setLineId(limitRate.getLineId());
|
||||
limitTarget.setPhasicType(limitRate.getPhasicType());
|
||||
chanelData(limitRate,limitTarget);
|
||||
list.add(limitTarget);
|
||||
}
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
log.info(LocalDateTime.now()+"r_stat_limit_target_d开始执行=======》");
|
||||
}
|
||||
|
||||
/***********************************************新算法*******************************************************************/
|
||||
@Override
|
||||
@@ -135,115 +77,6 @@ public class LimitTargetServiceImpl extends MppServiceImpl<RStatLimitTargetDMapp
|
||||
|
||||
/***********************************************新算法结束*******************************************************************/
|
||||
|
||||
private List<LimitRate> getLimitRateData(String lineId,String date){
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT * FROM limit_rate WHERE time >= '").append(date).append(" 00:00:00' and time <= '")
|
||||
.append(date).append(" 23:59:59' ").append(" and phasic_type = 'T'");
|
||||
if (StrUtil.isNotBlank(lineId)) {
|
||||
sql.append(" and line_id = '").append(lineId).append("'");
|
||||
}
|
||||
sql.append(" tz('Asia/Shanghai')");
|
||||
QueryResult sqlResult = influxDbUtils.query(sql.toString());
|
||||
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
|
||||
return resultMapper.toPOJO(sqlResult, LimitRate.class);
|
||||
}
|
||||
|
||||
private List<String> processOutData(List<LimitRate> limitRateData,Date dateOut){
|
||||
List<String> records = new ArrayList<>();
|
||||
for (LimitRate limitRate : limitRateData){
|
||||
Map<String, String> tags = processTagDate(limitRate);
|
||||
Map<String, Object> fields = processFieldsDate(limitRate);
|
||||
Point point = influxDbUtils.pointBuilder("limit_target", dateOut.getTime(), TimeUnit.MILLISECONDS,tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).tag("line_id", limitRate.getLineId()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
records.add(batchPoints.lineProtocol());
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
private Map<String, String> processTagDate(LimitRate limitRate){
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("line_id",limitRate.getLineId());
|
||||
tags.put("phasic_type",limitRate.getPhasicType());
|
||||
return tags;
|
||||
}
|
||||
|
||||
private Map<String, Object> processFieldsDate(LimitRate limitRate){
|
||||
Map<String, Object> fields = new HashMap<>();
|
||||
fields.put("alltime",limitRate.getAllTime());
|
||||
fields.put("flicker_alltime",limitRate.getFlickerAllTime());
|
||||
fields.put("freq_dev_overtime",(limitRate.getFreqDevOverTime()>0)?1:0);
|
||||
fields.put("voltage_dev_overtime",(limitRate.getVoltageDevOverTime()>0)?1:0);
|
||||
fields.put("ubalance_overtime",(limitRate.getUBalanceOverTime()>0)?1:0);
|
||||
fields.put("flicker_overtime",(limitRate.getFlickerOverTime()>0)?1:0);
|
||||
fields.put("uaberrance_overtime",(limitRate.getUAberranceOverTime()>0)?1:0);
|
||||
fields.put("i_neg_overtime",(limitRate.getINegOverTime()>0)?1:0);
|
||||
fields.put("uharm_2_overtime",(limitRate.getUHarm2OverTime()>0)?1:0);
|
||||
fields.put("uharm_3_overtime",(limitRate.getUHarm3OverTime()>0)?1:0);
|
||||
fields.put("uharm_4_overtime",(limitRate.getUHarm4OverTime()>0)?1:0);
|
||||
fields.put("uharm_5_overtime",(limitRate.getUHarm5OverTime()>0)?1:0);
|
||||
fields.put("uharm_6_overtime",(limitRate.getUHarm6OverTime()>0)?1:0);
|
||||
fields.put("uharm_7_overtime",(limitRate.getUHarm7OverTime()>0)?1:0);
|
||||
fields.put("uharm_8_overtime",(limitRate.getUHarm8OverTime()>0)?1:0);
|
||||
fields.put("uharm_9_overtime",(limitRate.getUHarm9OverTime()>0)?1:0);
|
||||
fields.put("uharm_10_overtime",(limitRate.getUHarm10OverTime()>0)?1:0);
|
||||
fields.put("uharm_11_overtime",(limitRate.getUHarm11OverTime()>0)?1:0);
|
||||
fields.put("uharm_12_overtime",(limitRate.getUHarm12OverTime()>0)?1:0);
|
||||
fields.put("uharm_13_overtime",(limitRate.getUHarm13OverTime()>0)?1:0);
|
||||
fields.put("uharm_14_overtime",(limitRate.getUHarm14OverTime()>0)?1:0);
|
||||
fields.put("uharm_15_overtime",(limitRate.getUHarm15OverTime()>0)?1:0);
|
||||
fields.put("uharm_16_overtime",(limitRate.getUHarm16OverTime()>0)?1:0);
|
||||
fields.put("uharm_17_overtime",(limitRate.getUHarm17OverTime()>0)?1:0);
|
||||
fields.put("uharm_18_overtime",(limitRate.getUHarm18OverTime()>0)?1:0);
|
||||
fields.put("uharm_19_overtime",(limitRate.getUHarm19OverTime()>0)?1:0);
|
||||
fields.put("uharm_20_overtime",(limitRate.getUHarm20OverTime()>0)?1:0);
|
||||
fields.put("uharm_21_overtime",(limitRate.getUHarm21OverTime()>0)?1:0);
|
||||
fields.put("uharm_22_overtime",(limitRate.getUHarm22OverTime()>0)?1:0);
|
||||
fields.put("uharm_23_overtime",(limitRate.getUHarm23OverTime()>0)?1:0);
|
||||
fields.put("uharm_24_overtime",(limitRate.getUHarm24OverTime()>0)?1:0);
|
||||
fields.put("uharm_25_overtime",(limitRate.getUHarm25OverTime()>0)?1:0);
|
||||
fields.put("iharm_2_overtime",(limitRate.getIHarm2OverTime()>0)?1:0);
|
||||
fields.put("iharm_3_overtime",(limitRate.getIHarm3OverTime()>0)?1:0);
|
||||
fields.put("iharm_4_overtime",(limitRate.getIHarm4OverTime()>0)?1:0);
|
||||
fields.put("iharm_5_overtime",(limitRate.getIHarm5OverTime()>0)?1:0);
|
||||
fields.put("iharm_6_overtime",(limitRate.getIHarm6OverTime()>0)?1:0);
|
||||
fields.put("iharm_7_overtime",(limitRate.getIHarm7OverTime()>0)?1:0);
|
||||
fields.put("iharm_8_overtime",(limitRate.getIHarm8OverTime()>0)?1:0);
|
||||
fields.put("iharm_9_overtime",(limitRate.getIHarm9OverTime()>0)?1:0);
|
||||
fields.put("iharm_10_overtime",(limitRate.getIHarm10OverTime()>0)?1:0);
|
||||
fields.put("iharm_11_overtime",(limitRate.getIHarm11OverTime()>0)?1:0);
|
||||
fields.put("iharm_12_overtime",(limitRate.getIHarm12OverTime()>0)?1:0);
|
||||
fields.put("iharm_13_overtime",(limitRate.getIHarm13OverTime()>0)?1:0);
|
||||
fields.put("iharm_14_overtime",(limitRate.getIHarm14OverTime()>0)?1:0);
|
||||
fields.put("iharm_15_overtime",(limitRate.getIHarm15OverTime()>0)?1:0);
|
||||
fields.put("iharm_16_overtime",(limitRate.getIHarm16OverTime()>0)?1:0);
|
||||
fields.put("iharm_17_overtime",(limitRate.getIHarm17OverTime()>0)?1:0);
|
||||
fields.put("iharm_18_overtime",(limitRate.getIHarm18OverTime()>0)?1:0);
|
||||
fields.put("iharm_19_overtime",(limitRate.getIHarm19OverTime()>0)?1:0);
|
||||
fields.put("iharm_20_overtime",(limitRate.getIHarm20OverTime()>0)?1:0);
|
||||
fields.put("iharm_21_overtime",(limitRate.getIHarm21OverTime()>0)?1:0);
|
||||
fields.put("iharm_22_overtime",(limitRate.getIHarm22OverTime()>0)?1:0);
|
||||
fields.put("iharm_23_overtime",(limitRate.getIHarm23OverTime()>0)?1:0);
|
||||
fields.put("iharm_24_overtime",(limitRate.getIHarm24OverTime()>0)?1:0);
|
||||
fields.put("iharm_25_overtime",(limitRate.getIHarm25OverTime()>0)?1:0);
|
||||
fields.put("inuharm_1_overtime",(limitRate.getInuHarm1OverTime()>0)?1:0);
|
||||
fields.put("inuharm_2_overtime",(limitRate.getInuHarm2OverTime()>0)?1:0);
|
||||
fields.put("inuharm_3_overtime",(limitRate.getInuHarm3OverTime()>0)?1:0);
|
||||
fields.put("inuharm_4_overtime",(limitRate.getInuHarm4OverTime()>0)?1:0);
|
||||
fields.put("inuharm_5_overtime",(limitRate.getInuHarm5OverTime()>0)?1:0);
|
||||
fields.put("inuharm_6_overtime",(limitRate.getInuHarm6OverTime()>0)?1:0);
|
||||
fields.put("inuharm_7_overtime",(limitRate.getInuHarm7OverTime()>0)?1:0);
|
||||
fields.put("inuharm_8_overtime",(limitRate.getInuHarm8OverTime()>0)?1:0);
|
||||
fields.put("inuharm_9_overtime",(limitRate.getInuHarm9OverTime()>0)?1:0);
|
||||
fields.put("inuharm_10_overtime",(limitRate.getInuHarm10OverTime()>0)?1:0);
|
||||
fields.put("inuharm_11_overtime",(limitRate.getInuHarm11OverTime()>0)?1:0);
|
||||
fields.put("inuharm_12_overtime",(limitRate.getInuHarm12OverTime()>0)?1:0);
|
||||
fields.put("inuharm_13_overtime",(limitRate.getInuHarm13OverTime()>0)?1:0);
|
||||
fields.put("inuharm_14_overtime",(limitRate.getInuHarm14OverTime()>0)?1:0);
|
||||
fields.put("inuharm_15_overtime",(limitRate.getInuHarm15OverTime()>0)?1:0);
|
||||
fields.put("inuharm_16_overtime",(limitRate.getInuHarm16OverTime()>0)?1:0);
|
||||
return fields;
|
||||
}
|
||||
|
||||
private void chanelData(RStatLimitRateDPO limitRate, RStatLimitTargetDPO limitTarget){
|
||||
//有一个指标超标,allTime则为1
|
||||
|
||||
@@ -5,11 +5,9 @@ import cn.hutool.core.date.TimeInterval;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.OverLimitClient;
|
||||
import com.njcn.harmonic.pojo.po.day.*;
|
||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.*;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.AbnormalMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.line.MpSurplusAbnormalD;
|
||||
@@ -45,13 +43,8 @@ public class NormalLimitServiceImpl extends MppServiceImpl<AbnormalMapper, MpSur
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
private final OverLimitClient overLimitClient;
|
||||
|
||||
private final RStatDataHarmRateVDMapper rStatDataHarmRateVDMapper;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.energy.pojo.constant.ModelState;
|
||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
||||
@@ -16,25 +14,18 @@ import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatOnlineRateDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.OnLineRateDTO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.OnlineRateService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.influxdb.dto.BatchPoints;
|
||||
import org.influxdb.dto.Point;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,68 +42,6 @@ public class OnlineRateServiceImpl extends MppServiceImpl<RStatOnlineRateDMapper
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void getOnlineRateData(LineParam lineParam) {
|
||||
List<String> lineIdList = lineParam.getLineIds();
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
lineIdList = lineFeignClient.getDeviceList().getData();
|
||||
}
|
||||
List<PqsCommunicate> outCommunicateData = new ArrayList<>();
|
||||
for (String lineId : lineIdList){
|
||||
List<PqsCommunicate> communicateData = getCommunicateData(lineId);
|
||||
outCommunicateData.addAll(communicateData);
|
||||
}
|
||||
List<String> records = new ArrayList<>();
|
||||
Date dateOut = DateUtil.parse(lineParam.getDataDate());
|
||||
for (PqsCommunicate pqsCommunicate : outCommunicateData){
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
Map<String, Object> fields = new HashMap<>();
|
||||
Date newDate = Date.from(pqsCommunicate.getTime());
|
||||
OnLineRateDTO onLineRate = onLineMinute(newDate,dateOut,pqsCommunicate.getType(),pqsCommunicate.getDevId(),lineParam.getDataDate());
|
||||
tags.put("dev_id",pqsCommunicate.getDevId());
|
||||
fields.put("online_min",onLineRate.getOnLineMinute());
|
||||
fields.put("offline_min",onLineRate.getOffLineMinute());
|
||||
fields.put("online_rate",onLineRate.getRate());
|
||||
Point point = influxDbUtils.pointBuilder("pqs_onlinerate", dateOut.getTime(), TimeUnit.MILLISECONDS,tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).tag("dev_id", pqsCommunicate.getDevId()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
records.add(batchPoints.lineProtocol());
|
||||
}
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(),"", InfluxDB.ConsistencyLevel.ALL, records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void onlineRateData(LineParam lineParam,String time) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String data = time + " 00:00:00";
|
||||
LocalDateTime dateTime = LocalDateTime.parse(data,df);
|
||||
List<String> lineIdList = lineParam.getLineIds();
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
lineIdList = lineFeignClient.getDeviceList().getData();
|
||||
}
|
||||
List<PqsCommunicate> outCommunicateData = new ArrayList<>();
|
||||
for (String lineId : lineIdList){
|
||||
List<PqsCommunicate> communicateData = getCommunicateData(lineId);
|
||||
outCommunicateData.addAll(communicateData);
|
||||
}
|
||||
List<RStatOnlinerateD> list = new ArrayList<>();
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (PqsCommunicate pqsCommunicate : outCommunicateData){
|
||||
RStatOnlinerateD onlineRateDpo = new RStatOnlinerateD();
|
||||
Date newDate = Date.from(pqsCommunicate.getTime());
|
||||
OnLineRateDTO onLineRate = onLineMinute(newDate,dateOut,pqsCommunicate.getType(),pqsCommunicate.getDevId(),time);
|
||||
onlineRateDpo.setTimeId(dateTime);
|
||||
onlineRateDpo.setDevIndex(pqsCommunicate.getDevId());
|
||||
onlineRateDpo.setOnlineMin(onLineRate.getOnLineMinute());
|
||||
onlineRateDpo.setOfflineMin(onLineRate.getOffLineMinute());
|
||||
list.add(onlineRateDpo);
|
||||
}
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deviceOnlineRate(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetBandDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.*;
|
||||
@@ -22,18 +14,14 @@ import com.njcn.harmonic.pojo.po.day.*;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.*;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.PollutionDTO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.day.*;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.PollutionService;
|
||||
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.po.Dept;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -79,8 +67,6 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final IRStatDataVDService dataVDService;
|
||||
private final IRStatDataHarmRateVDService harmRateVDService;
|
||||
private final IRStatDataIDService dataIDService;
|
||||
@@ -335,89 +321,8 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
|
||||
/*--------------------------------------------原始代码------------------------------------------------------*/
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
@Deprecated
|
||||
public void processPollutionData(LineParam lineParam) {
|
||||
|
||||
TimeInterval timer = new TimeInterval();
|
||||
List<PollutionDTO> pollutionList;
|
||||
LocalDate local = LocalDate.now();
|
||||
if (StrUtil.isNotBlank(lineParam.getDataDate())){
|
||||
local = LocalDateTimeUtil.parseDate(lineParam.getBeginTime());
|
||||
}
|
||||
|
||||
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.POLLUTION_STATIS.getCode()).getData();
|
||||
//时间类型为日的情况下执行influxdb计算
|
||||
if (Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(lineParam.getType())){
|
||||
List<Overlimit> overLimitList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(lineParam.getLineIds())){
|
||||
overLimitList = getAllLinesLimitData();
|
||||
}else {
|
||||
for (String lineId : lineParam.getLineIds()){
|
||||
Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(lineId).getData();
|
||||
overLimitList.add(overlimit);
|
||||
}
|
||||
}
|
||||
List<String> lineList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
|
||||
//指标数据获取
|
||||
List<PublicDTO> harmonicVoltageList = getHarmonicVoltage(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> harmonicCurrentList = getHarmonicCurrent(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> frequencyDeviationList = getFrequencyDeviation(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> voltageDeviationList = getVoltageDeviation(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> threePhaseVoltageList = getThreePhaseVoltageUnbalance(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> negativeSequenceList = getNegativeSequenceCurrent(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> interHarmonicVoltageList = getInterharmonicVoltage(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
List<PublicDTO> voltageFlickerList = getVoltageFlicker(overLimitList,lineParam.getBeginTime(),lineParam.getEndTime());
|
||||
LogUtil.njcnDebug(log, "监测点污染指标数据查询耗时:{}", timer.intervalRestart());
|
||||
|
||||
List<PollutionDTO> lineIdList = new ArrayList<>();
|
||||
lineList.forEach(item->{
|
||||
PollutionDTO pollutionDTO = new PollutionDTO();
|
||||
pollutionDTO.setLineId(item);
|
||||
lineIdList.add(pollutionDTO);
|
||||
});
|
||||
pollutionList = processPollutionList(lineIdList,harmonicVoltageList,harmonicCurrentList,frequencyDeviationList,voltageDeviationList,threePhaseVoltageList,negativeSequenceList,interHarmonicVoltageList,voltageFlickerList);
|
||||
|
||||
//MySql入表 r_mp_pollution_d
|
||||
insertPollutionDayMySql(pollutionList, dictData, local);
|
||||
LogUtil.njcnDebug(log, "监测点污染指标数据MySql插入耗时:{}", timer.intervalRestart());
|
||||
}
|
||||
|
||||
|
||||
LocalDate localEnd = LocalDateTimeUtil.parseDate(lineParam.getEndTime());
|
||||
LambdaQueryWrapper<RMpPollutionDPO> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
List<RMpPollutionDPO> pollutionDayList =new ArrayList<>();
|
||||
if(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(lineParam.getType())){
|
||||
lambdaQuery.ge(RMpPollutionDPO::getDataDate, local).le(RMpPollutionDPO::getDataDate,localEnd);
|
||||
pollutionDayList = rMpPollutionDMapper.selectList(lambdaQuery);
|
||||
}
|
||||
|
||||
//MySql入表变电站、单位
|
||||
insertPolluctionMySql(pollutionDayList, dictData, local, localEnd, lineParam.getType());
|
||||
LogUtil.njcnDebug(log, "监测点污染指标数据完成耗时:{}", timer.intervalRestart());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MySql入表
|
||||
*/
|
||||
private void insertPolluctionMySql(List<RMpPollutionDPO> pollutionDayList, List<DictData> dictData, LocalDate local, LocalDate localEnd,Integer type){
|
||||
HttpResult<Map<String, List<String>>> substationOut = commTerminalGeneralClient.getLineBySubstationRelation(1);
|
||||
|
||||
Dept dept = deptFeignClient.getRootDept().getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(dept.getId());
|
||||
deptGetLineParam.setServerName(ServerInfo.HARMONIC);
|
||||
List<DeptGetChildrenDTO> deptGetChildrenDTOList = commTerminalGeneralClient.deptGetLineList(deptGetLineParam).getData();
|
||||
|
||||
Map<String, List<String>> substationMap = substationOut.getData();
|
||||
|
||||
insertSubstation(dictData,substationMap,pollutionDayList,local,localEnd,type);
|
||||
insertUnit(dictData,deptGetChildrenDTOList,pollutionDayList,local,localEnd,type);
|
||||
}
|
||||
|
||||
/*MySql入表 r_mp_pollution_d*/
|
||||
private void insertPollutionDayMySql(List<PollutionDTO> pollutionList,List<DictData> dictDataList, LocalDate local){
|
||||
@@ -432,155 +337,6 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
}
|
||||
}
|
||||
|
||||
/*MySql入表 r_stat_pollution_substation*/
|
||||
private void insertSubstation(List<DictData> dictDataList,Map<String, List<String>> substationMap,List<RMpPollutionDPO> pollutionDayList,LocalDate local,LocalDate localEnd, Integer type){
|
||||
if(Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(type)){
|
||||
for (String key : substationMap.keySet()){
|
||||
List<RMpPollutionDPO> processList = new ArrayList<>();
|
||||
List<String> substationList = substationMap.get(key);
|
||||
for(String lineid : substationList){
|
||||
for (RMpPollutionDPO pollution : pollutionDayList){
|
||||
if (lineid.equals(pollution.getLineId())){
|
||||
processList.add(pollution);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("substationId",key);
|
||||
inMap.put("dataDate",local);
|
||||
for (DictData dictData : dictDataList){
|
||||
processData(dictData, processList, inMap);
|
||||
if (!inMap.containsKey("pollutionType")){
|
||||
continue;
|
||||
}
|
||||
if (Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(type)){
|
||||
rStatPollutionSubstationDMapper.insertPollution(inMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH).equals(type)){
|
||||
List<RStatPollutionSubstationDPO> substationD = rStatPollutionSubstationDMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationDPO>()
|
||||
.ge(RStatPollutionSubstationDPO::getDataDate, local)
|
||||
.le(RStatPollutionSubstationDPO::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionSubstationDPO>> substationDMap = substationD.stream().collect(Collectors.groupingBy(temp -> temp.getSubstationId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("substationId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionSubstationDPO::getValue)).get().getValue());
|
||||
rStatPollutionSubstationMMapper.insertPollution(inMap);
|
||||
|
||||
});
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER).equals(type)){
|
||||
List<RStatPollutionSubstationM> substationM = rStatPollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
|
||||
.ge(RStatPollutionSubstationM::getDataDate, local)
|
||||
.le(RStatPollutionSubstationM::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionSubstationM>> substationDMap = substationM.stream().collect(Collectors.groupingBy(temp -> temp.getSubstationId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("substationId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionSubstationM::getValue)).get().getValue());
|
||||
rStatPollutionSubstationQMapper.insertPollution(inMap);
|
||||
|
||||
});
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR).equals(type)){
|
||||
List<RStatPollutionSubstationQPO> substationM = rStatPollutionSubstationQMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationQPO>()
|
||||
.ge(RStatPollutionSubstationQPO::getDataDate, local)
|
||||
.le(RStatPollutionSubstationQPO::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionSubstationQPO>> substationDMap = substationM.stream().collect(Collectors.groupingBy(temp -> temp.getSubstationId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("substationId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionSubstationQPO::getValue)).get().getValue());
|
||||
rStatPollutionSubstationYMapper.insertPollution(inMap);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*MySql入表 r_stat_pollution_org*/
|
||||
private void insertUnit(List<DictData> dictDataList,List<DeptGetChildrenDTO> deptGetChildrenDTOList,List<RMpPollutionDPO> pollutionDayList,LocalDate local, LocalDate localEnd, Integer type){
|
||||
if (Integer.valueOf(BizParamConstant.STAT_BIZ_DAY).equals(type)){
|
||||
for (DeptGetChildrenDTO deptGetChildrenDTO : deptGetChildrenDTOList){
|
||||
List<RMpPollutionDPO> processList = new ArrayList<>();
|
||||
for(String lineid : deptGetChildrenDTO.getLineIds()){
|
||||
for (RMpPollutionDPO pollution : pollutionDayList){
|
||||
if (lineid.equals(pollution.getLineId())){
|
||||
processList.add(pollution);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("orgId",deptGetChildrenDTO.getDeptId());
|
||||
inMap.put("dataDate",local);
|
||||
for (DictData dictData : dictDataList){
|
||||
processData(dictData, processList, inMap);
|
||||
if (!inMap.containsKey("pollutionType")){
|
||||
continue;
|
||||
}
|
||||
rStatPollutionOrgDMapper.insertPollution(inMap);
|
||||
}
|
||||
}
|
||||
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH).equals(type)){
|
||||
List<RStatPollutionOrgDPO> substationD = rStatPollutionOrgDMapper.selectList(new LambdaQueryWrapper<RStatPollutionOrgDPO>()
|
||||
.ge(RStatPollutionOrgDPO::getDataDate, local)
|
||||
.le(RStatPollutionOrgDPO::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionOrgDPO>> substationDMap = substationD.stream().collect(Collectors.groupingBy(temp -> temp.getOrgId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("orgId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionOrgDPO::getValue)).get().getValue());
|
||||
rStatPollutionOrgMMapper.insertPollution(inMap);
|
||||
});
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER).equals(type)){
|
||||
List<RStatPollutionOrgMPO> substationD = rStatPollutionOrgMMapper.selectList(new LambdaQueryWrapper<RStatPollutionOrgMPO>()
|
||||
.ge(RStatPollutionOrgMPO::getDataDate, local)
|
||||
.le(RStatPollutionOrgMPO::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionOrgMPO>> substationDMap = substationD.stream().collect(Collectors.groupingBy(temp -> temp.getOrgId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("orgId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionOrgMPO::getValue)).get().getValue());
|
||||
rStatPollutionOrgQMapper.insertPollution(inMap);
|
||||
});
|
||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR).equals(type)){
|
||||
List<RStatPollutionOrgQPO> substationD = rStatPollutionOrgQMapper.selectList(new LambdaQueryWrapper<RStatPollutionOrgQPO>()
|
||||
.ge(RStatPollutionOrgQPO::getDataDate, local)
|
||||
.le(RStatPollutionOrgQPO::getDataDate, localEnd)
|
||||
);
|
||||
Map<String, List<RStatPollutionOrgQPO>> substationDMap = substationD.stream().collect(Collectors.groupingBy(temp -> temp.getOrgId() +"_"+ temp.getPollutionType()));
|
||||
substationDMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
Map<String, Object> inMap = new HashMap<>();
|
||||
inMap.put("orgId",split[0]);
|
||||
inMap.put("dataDate",local);
|
||||
inMap.put("pollutionType",split[1]);
|
||||
inMap.put("value",value.stream().max(Comparator.comparing(RStatPollutionOrgQPO::getValue)).get().getValue());
|
||||
rStatPollutionOrgYMapper.insertPollution(inMap);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processDataLineId(DictData dictData, PollutionDTO pollution, Map<String, Object> map){
|
||||
if ("Freq_Dev".equals(dictData.getCode())){
|
||||
map.put("pollutionType",dictData.getId());
|
||||
@@ -620,19 +376,6 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
}
|
||||
}
|
||||
|
||||
private void processData(DictData dictData, List<RMpPollutionDPO> processList, Map<String, Object> map){
|
||||
List<RMpPollutionDPO> processDataList = new ArrayList<>();
|
||||
for (RMpPollutionDPO rMpPollution : processList){
|
||||
if (dictData.getId().equals(rMpPollution.getPollutionType())){
|
||||
processDataList.add(rMpPollution);
|
||||
}
|
||||
}
|
||||
if (!CollUtil.isEmpty(processDataList)){
|
||||
map.put("pollutionType",dictData.getId());
|
||||
map.put("value",processDataList.stream().max(Comparator.comparing(RMpPollutionDPO::getValue)).get().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 谐波电压:取监测点最新的A、B、C三相数据,再取电压总谐波畸变率、各次谐波电压含有率(2~25次)中的最大值,作为结果
|
||||
*/
|
||||
@@ -1094,11 +837,5 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
return outList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取限值表中的所有监测点信息
|
||||
*/
|
||||
private List<Overlimit> getAllLinesLimitData() {
|
||||
return commTerminalGeneralClient.getAllLineOverLimit().getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,36 +2,27 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
|
||||
import com.njcn.harmonic.pojo.po.RMpEventDetailMPO;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpEventDetailPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailMService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/23 13:50【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
@@ -43,15 +34,13 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
|
||||
private final RMpEventDetailDService rMpEventDetailDService;
|
||||
|
||||
private final RMpEventDetailMService rMpEventDetailMService;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
/***
|
||||
*监测点暂态指标明细--日表算法
|
||||
* 监测点暂态指标明细--日表算法
|
||||
*/
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
@@ -75,99 +64,7 @@ public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper,
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================================================================
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void eventdetailHandler(LineParam lineParam) {
|
||||
this.hanlderData(lineParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: hanlderOracleData
|
||||
* @Param: [lineParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2022/12/28
|
||||
*/
|
||||
private void hanlderData(LineParam lineParam) {
|
||||
Integer type = lineParam.getType();
|
||||
switch (type) {
|
||||
// case 1:
|
||||
// this.hanlderYear (lineParam);
|
||||
// break;
|
||||
// case 2:
|
||||
// this.hanlderQtr (lineParam);
|
||||
// break;
|
||||
case 3:
|
||||
this.hanlderMonth(lineParam);
|
||||
break;
|
||||
case 5:
|
||||
this.hanlderDay(lineParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void hanlderMonth(LineParam lineParam) {
|
||||
|
||||
List<String> lineIds = lineParam.getLineIds();
|
||||
String dataDate = lineParam.getDataDate();
|
||||
LocalDate tempDate = LocalDateTimeUtil.parseDate(dataDate,DatePattern.NORM_DATE_PATTERN);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOList = new ArrayList<>();
|
||||
lineIds.forEach(measurementPointId -> {
|
||||
/*查询day表数据生成月表数据*/
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOList = rMpEventDetailDService.queryOneMothData(measurementPointId, dataDate);
|
||||
int sagCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum();
|
||||
int riseCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum();
|
||||
int interruptCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum();
|
||||
|
||||
RMpEventDetailMPO rMpEventDetailMPO = new RMpEventDetailMPO();
|
||||
rMpEventDetailMPO.setMeasurementPointId(measurementPointId);
|
||||
rMpEventDetailMPO.setDataDate(tempDate);
|
||||
rMpEventDetailMPO.setSagTimes(sagCount);
|
||||
rMpEventDetailMPO.setSwellTimes(riseCount);
|
||||
rMpEventDetailMPO.setInterruptTimes(interruptCount);
|
||||
rMpEventDetailMPOList.add(rMpEventDetailMPO);
|
||||
|
||||
});
|
||||
|
||||
rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMPOList, 500);
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
private void hanlderDay(LineParam lineParam) {
|
||||
List<String> lineIds = lineParam.getLineIds();
|
||||
String dataDate = lineParam.getDataDate();
|
||||
LocalDate tempDate = LocalDateTimeUtil.parseDate(dataDate,DatePattern.NORM_DATE_PATTERN);
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOList = new ArrayList<>();
|
||||
lineIds.forEach(measurementPointId -> {
|
||||
Integer sagCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode()));
|
||||
Integer riseCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode()));
|
||||
Integer interruptCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode()));
|
||||
RMpEventDetailDPO rMpEventDetailDPO = new RMpEventDetailDPO();
|
||||
rMpEventDetailDPO.setMeasurementPointId(measurementPointId);
|
||||
rMpEventDetailDPO.setDataDate(tempDate);
|
||||
rMpEventDetailDPO.setSagTimes(sagCount);
|
||||
rMpEventDetailDPO.setSwellTimes(riseCount);
|
||||
rMpEventDetailDPO.setInterruptTimes(interruptCount);
|
||||
rMpEventDetailDPOList.add(rMpEventDetailDPO);
|
||||
});
|
||||
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDPOList, 500);
|
||||
}
|
||||
|
||||
public Integer queryByCondition(String measurementPointId, String dataDate, String eventType) {
|
||||
QueryWrapper<RMpEventDetailPO> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.select("1").
|
||||
eq("measurement_point_id", measurementPointId).
|
||||
eq("event_type", eventType).
|
||||
eq("DATE_FORMAT( start_time ,'%Y-%m-%d')", dataDate);
|
||||
return this.getBaseMapper().selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
public String getEventTypeId(String code) {
|
||||
String eventType = redisUtil.getStringByKey(code);
|
||||
|
||||
@@ -20,11 +20,8 @@ import com.njcn.prepare.harmonic.service.influxdb.DataIntegrityRateInfluxService
|
||||
import com.njcn.prepare.harmonic.service.influxdb.DataVInfluxdbService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RMpMonitorEvaluateDService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -51,54 +48,6 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
|
||||
private final PmsAbnormalRulesMapper pmsAbnormalRulesMapper;
|
||||
private final DataIntegrityRateInfluxService dataIntegrityRateInfluxService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
@SneakyThrows
|
||||
public void dayDataJobHandler(List<String> indexLists, String beginTime, String endTime) {
|
||||
//1、取出规则
|
||||
List<PmsAbnormalRules> pmsAbnormalRules = pmsAbnormalRulesMapper.selectList(null);
|
||||
List<RMpMonitorEvaluateDPO> rMpMonitorEvaluateDPOS = new ArrayList<>();
|
||||
indexLists.forEach(temp -> {
|
||||
LineDTO data = commLineClient.getLineDetail(temp).getData();
|
||||
if (ObjectUtil.isNotNull(data)) {
|
||||
/*todo 统计间隔,电压等级取值方式后期提供融合版本接口获取不然pms,pqs系统取值方式不一样*/
|
||||
/*统计间隔*/
|
||||
Integer statisticalInterval = data.getTimeInterval();
|
||||
/*电压等级*/
|
||||
Double voltage = Double.parseDouble(data.getVoltageLevel());
|
||||
|
||||
List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(temp, beginTime, endTime, statisticalInterval);
|
||||
RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
|
||||
|
||||
|
||||
rMpMonitorEvaluateDPO = calculateRMpMonitorEvaluateDPO(rMpMonitorEvaluateDPO, fiveItems, pmsAbnormalRules, voltage, data);
|
||||
Date date = DateUtil.parse(beginTime);
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(beginTime, DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
|
||||
DataFlicker twoFlickerData = dataIntegrityRateInfluxService.getTwoFlickerData(temp, date, 5);
|
||||
|
||||
if (Objects.isNull(twoFlickerData)) {
|
||||
rMpMonitorEvaluateDPO.setPltCount(0);
|
||||
rMpMonitorEvaluateDPO.setPstCount(0);
|
||||
} else {
|
||||
rMpMonitorEvaluateDPO.setPltCount(twoFlickerData.getPltCount());
|
||||
rMpMonitorEvaluateDPO.setPstCount(twoFlickerData.getPstCount());
|
||||
}
|
||||
rMpMonitorEvaluateDPO.setAllMinuteCount(fiveItems.size());
|
||||
rMpMonitorEvaluateDPO.setDeviceId(data.getDevId());
|
||||
rMpMonitorEvaluateDPO.setDataDate(localDate);
|
||||
rMpMonitorEvaluateDPO.setMeasurementPointId(temp);
|
||||
|
||||
rMpMonitorEvaluateDPOS.add(rMpMonitorEvaluateDPO);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(rMpMonitorEvaluateDPOS)) {
|
||||
this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDPOS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
* @author hongawen
|
||||
|
||||
@@ -8,9 +8,7 @@ import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpPartHarmonicDetailD;
|
||||
import com.njcn.harmonic.pojo.po.RMpSurplusHarmonicDetailD;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpPartHarmonicDetailDMapper;
|
||||
@@ -22,9 +20,7 @@ import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateDPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateMPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateQPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPassRateYPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.*;
|
||||
import com.njcn.prepare.harmonic.utils.PublicUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,7 +42,6 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class RMpPassRateDServiceImpl extends MppServiceImpl<RMpPassRateDMapper, RMpPassRateDPO> implements RMpPassRateDService {
|
||||
private final CommLineClient commLineClient;
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final RMpMonitorEvaluateDService rMpMonitorEvaluateDService;
|
||||
private final RMpPartHarmonicDetailDMapper rMpPartHarmonicDetailDMapper;
|
||||
private final RMpSurplusHarmonicDetailDMapper rMpSurplusHarmonicDetailDMapper;
|
||||
@@ -56,8 +51,6 @@ public class RMpPassRateDServiceImpl extends MppServiceImpl<RMpPassRateDMapper,
|
||||
private final RMpPassRateYService rMpPassRateYService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
|
||||
@@ -248,164 +241,6 @@ public class RMpPassRateDServiceImpl extends MppServiceImpl<RMpPassRateDMapper,
|
||||
}
|
||||
|
||||
|
||||
/**---------------------------------------------------------------------------------------------------------------------------------**/
|
||||
|
||||
|
||||
@Deprecated
|
||||
public void passRateHandlerD(LineParam lineParam) {
|
||||
List<String> lineIds = lineParam.getLineIds ( );
|
||||
String dataDate = lineParam.getDataDate ();
|
||||
Date date = DateUtil.parse (dataDate);
|
||||
List<RMpPassRateDPO> rMpPassRateDPOList = new ArrayList<> ( );
|
||||
QueryWrapper<RMpMonitorEvaluateDPO> rMpMonitorEvaluateDPOQueryWrapper = new QueryWrapper<>( );
|
||||
|
||||
QueryWrapper<RMpPartHarmonicDetailD> queryWrapper = new QueryWrapper<>( );
|
||||
QueryWrapper<RMpSurplusHarmonicDetailD> surplusHarmonicDetailDQueryWrapper = new QueryWrapper<>( );
|
||||
|
||||
lineIds.forEach (temp -> {
|
||||
LineDevGetDTO data = commTerminalGeneralClient.getMonitorDetail (temp).getData ( );
|
||||
Integer statisticalInterval = data.getInterval ();
|
||||
rMpMonitorEvaluateDPOQueryWrapper.clear ();
|
||||
rMpMonitorEvaluateDPOQueryWrapper.select ("effective_minute_count").
|
||||
eq ("measurement_point_id", temp).
|
||||
eq ("DATE_FORMAT( data_date ,'%Y-%m-%d')", lineParam.getDataDate ( ));
|
||||
RMpMonitorEvaluateDPO one = rMpMonitorEvaluateDService.getOne (rMpMonitorEvaluateDPOQueryWrapper);
|
||||
if (Objects.isNull(one)) {
|
||||
return;
|
||||
}
|
||||
queryWrapper.clear ( );
|
||||
queryWrapper.select ("freq_times", "v_dev_times").
|
||||
eq ("measurement_point_id", temp).
|
||||
eq ("DATE_FORMAT( data_date ,'%Y-%m-%d')", lineParam.getDataDate ( ));
|
||||
RMpPartHarmonicDetailD rMpPartHarmonicDetailD = rMpPartHarmonicDetailDMapper.selectOne (queryWrapper);
|
||||
if (Objects.isNull(rMpPartHarmonicDetailD)) {
|
||||
return;
|
||||
}
|
||||
surplusHarmonicDetailDQueryWrapper.clear ( );
|
||||
surplusHarmonicDetailDQueryWrapper.select ("flicker_times").
|
||||
eq ("measurement_point_id", temp).
|
||||
eq ("DATE_FORMAT( data_date ,'%Y-%m-%d')", lineParam.getDataDate ( ));
|
||||
RMpSurplusHarmonicDetailD rMpSurplusHarmonicDetailD = rMpSurplusHarmonicDetailDMapper.selectOne (surplusHarmonicDetailDQueryWrapper);
|
||||
if (Objects.isNull(rMpSurplusHarmonicDetailD)) {
|
||||
return;
|
||||
}
|
||||
RMpPassRateDPO rMpPassRateDPO = new RMpPassRateDPO ( );
|
||||
rMpPassRateDPO.setMeasurementPointId (temp);
|
||||
rMpPassRateDPO.setDataDate (LocalDate.parse(dataDate));
|
||||
rMpPassRateDPO.setEffectiveTime (statisticalInterval *one.getEffectiveMinuteCount ());
|
||||
rMpPassRateDPO.setFreqTime (statisticalInterval * rMpPartHarmonicDetailD.getFreqTimes ( ));
|
||||
rMpPassRateDPO.setVDevTime (statisticalInterval * rMpPartHarmonicDetailD.getVDevTimes ( ));
|
||||
rMpPassRateDPO.setFlickerTime (statisticalInterval * rMpSurplusHarmonicDetailD.getFlickerTimes ( ));
|
||||
|
||||
rMpPassRateDPOList.add (rMpPassRateDPO);
|
||||
|
||||
});
|
||||
this.saveOrUpdateBatchByMultiId(rMpPassRateDPOList, 500);
|
||||
}
|
||||
@Override
|
||||
public void passRateHandler(LineParam lineParam) {
|
||||
Integer type = lineParam.getType ( );
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.passRateHandlerY (lineParam);
|
||||
break;
|
||||
case 2:
|
||||
this.passRateHandlerQ (lineParam);
|
||||
break;
|
||||
case 3:
|
||||
this.passRateHandlerM (lineParam);
|
||||
break;
|
||||
case 5:
|
||||
this.passRateHandlerD (lineParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Deprecated
|
||||
private void passRateHandlerY(LineParam lineParam) {
|
||||
List<String> lineIds = lineParam.getLineIds ( );
|
||||
String dataDate = lineParam.getBeginTime ();
|
||||
Date date = DateUtil.parse (dataDate);
|
||||
List<RMpPassRateYPO> rMpPassRateYPOList = new ArrayList<> ( );
|
||||
|
||||
lineIds.forEach (temp -> {
|
||||
QueryWrapper<RMpPassRateDPO> queryWrapper = new QueryWrapper<> ();
|
||||
queryWrapper.eq ("measurement_point_id", temp).
|
||||
eq("YEAR( data_date )",dataDate.substring (0, 4));
|
||||
List<RMpPassRateDPO> rMpPassRateDPOList = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
RMpPassRateYPO rMpPassRateYPO = new RMpPassRateYPO();
|
||||
rMpPassRateYPO.setMeasurementPointId (temp);
|
||||
rMpPassRateYPO.setDataDate (LocalDate.parse(dataDate));
|
||||
int sumEffectiveTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getEffectiveTime).sum ( );
|
||||
int sumFreqTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFreqTime).sum ( );
|
||||
int sumDevTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getVDevTime).sum ( );
|
||||
int sumFlickerTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFlickerTime).sum ( );
|
||||
|
||||
rMpPassRateYPO.setFreqPassRate (calculatePassRate(sumEffectiveTime,sumFreqTime));
|
||||
rMpPassRateYPO.setVDevPassRate (calculatePassRate(sumEffectiveTime,sumDevTime));
|
||||
rMpPassRateYPO.setFlickerPassRate (calculatePassRate(sumEffectiveTime,sumFlickerTime));
|
||||
rMpPassRateYPOList.add (rMpPassRateYPO);
|
||||
});
|
||||
rMpPassRateYService.saveOrUpdateBatchByMultiId (rMpPassRateYPOList, 500);
|
||||
}
|
||||
@Deprecated
|
||||
private void passRateHandlerQ(LineParam lineParam) {
|
||||
|
||||
List<String> lineIds = lineParam.getLineIds ( );
|
||||
String dataDate = lineParam.getBeginTime ();
|
||||
Date date = DateUtil.parse (dataDate);
|
||||
List<RMpPassRateQPO> rMpPassRateQPOList = new ArrayList<> ( );
|
||||
|
||||
lineIds.forEach (temp -> {
|
||||
QueryWrapper<RMpPassRateDPO> queryWrapper = new QueryWrapper<> ();
|
||||
queryWrapper.eq ("measurement_point_id", temp).
|
||||
eq("QUARTER( data_date)", PublicUtil.getNowQuarter (dataDate));
|
||||
List<RMpPassRateDPO> rMpPassRateDPOList = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
RMpPassRateQPO rMpPassRateQPO = new RMpPassRateQPO();
|
||||
rMpPassRateQPO.setMeasurementPointId (temp);
|
||||
rMpPassRateQPO.setDataDate (LocalDate.parse(dataDate) );
|
||||
int sumEffectiveTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getEffectiveTime).sum ( );
|
||||
int sumFreqTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFreqTime).sum ( );
|
||||
int sumDevTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getVDevTime).sum ( );
|
||||
int sumFlickerTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFlickerTime).sum ( );
|
||||
|
||||
rMpPassRateQPO.setFreqPassRate (calculatePassRate(sumEffectiveTime,sumFreqTime));
|
||||
rMpPassRateQPO.setVDevPassRate (calculatePassRate(sumEffectiveTime,sumDevTime));
|
||||
rMpPassRateQPO.setFlickerPassRate (calculatePassRate(sumEffectiveTime,sumFlickerTime));
|
||||
rMpPassRateQPOList.add (rMpPassRateQPO);
|
||||
});
|
||||
rMpPassRateQService.saveOrUpdateBatchByMultiId (rMpPassRateQPOList, 500);
|
||||
}
|
||||
@Deprecated
|
||||
private void passRateHandlerM(LineParam lineParam) {
|
||||
|
||||
List<String> lineIds = lineParam.getLineIds ( );
|
||||
String dataDate = lineParam.getBeginTime ();
|
||||
Date date = DateUtil.parse (dataDate);
|
||||
List<RMpPassRateMPO> rMpPassRateMPOList = new ArrayList<> ( );
|
||||
|
||||
lineIds.forEach (temp -> {
|
||||
QueryWrapper<RMpPassRateDPO> queryWrapper = new QueryWrapper<> ();
|
||||
queryWrapper.eq ("measurement_point_id", temp).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring (0, 7));
|
||||
List<RMpPassRateDPO> rMpPassRateDPOList = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
RMpPassRateMPO rMpPassRateMPO = new RMpPassRateMPO();
|
||||
rMpPassRateMPO.setMeasurementPointId (temp);
|
||||
rMpPassRateMPO.setDataDate (LocalDate.parse(dataDate));
|
||||
int sumEffectiveTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getEffectiveTime).sum ( );
|
||||
int sumFreqTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFreqTime).sum ( );
|
||||
int sumDevTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getVDevTime).sum ( );
|
||||
int sumFlickerTime = rMpPassRateDPOList.stream ( ).mapToInt (RMpPassRateDPO::getFlickerTime).sum ( );
|
||||
|
||||
rMpPassRateMPO.setFreqPassRate (calculatePassRate(sumEffectiveTime,sumFreqTime));
|
||||
rMpPassRateMPO.setVDevPassRate (calculatePassRate(sumEffectiveTime,sumDevTime));
|
||||
rMpPassRateMPO.setFlickerPassRate (calculatePassRate(sumEffectiveTime,sumFlickerTime));
|
||||
rMpPassRateMPOList.add (rMpPassRateMPO);
|
||||
});
|
||||
rMpPassRateMService.saveOrUpdateBatchByMultiId (rMpPassRateMPOList, 500);
|
||||
}
|
||||
|
||||
private Double calculatePassRate(int sumEffectiveTime, int sumFreqTime) {
|
||||
Double result =0.00;
|
||||
if(sumEffectiveTime==0||sumEffectiveTime<=sumFreqTime){
|
||||
|
||||
@@ -15,9 +15,7 @@ import com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -54,70 +52,9 @@ public class ROperatingMonitorDServiceImpl extends MppServiceImpl<ROperatingMoni
|
||||
* 〖数据准确率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(有效值数据个数*5)*100%
|
||||
* 采用以下公式计算指标完整率
|
||||
* 〖指标完整率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(1440/interval*5)*100%
|
||||
* @Param: [indexLists, dataDate]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/21
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
public void handlerMonitorOperatingD(List<String> indexLists, String dataDate) {
|
||||
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// List<ROperatingMonitorDPO> rOperatingMonitorDPOList = new ArrayList<> ();
|
||||
// indexLists.forEach (temp -> {
|
||||
// ROperatingMonitorDPO rOperatingMonitorDPO = new ROperatingMonitorDPO();
|
||||
//
|
||||
// LineDTO data = commLineClient.getLineDetail(temp).getData();
|
||||
//
|
||||
// /*todo 统计间隔,电压等级取值方式,devid后期提供融合版本接口获取不然pms,pqs系统取值方式不一样*/
|
||||
// /*统计间隔*/
|
||||
// Integer statisticalInterval = data.getTimeInterval ();
|
||||
//
|
||||
// RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
|
||||
// rMpMonitorEvaluateDPO.setMeasurementPointId (temp);
|
||||
// rMpMonitorEvaluateDPO.setDataDate (date);
|
||||
// rMpMonitorEvaluateDPO = rMpMonitorEvaluateDMapper.selectByMultiId (rMpMonitorEvaluateDPO);
|
||||
// if (Objects.isNull(rMpMonitorEvaluateDPO)) {
|
||||
// return;
|
||||
// }
|
||||
// RStatAbnormalDPO rStatAbnormalDPO = new RStatAbnormalDPO();
|
||||
// rStatAbnormalDPO.setDataDate (date);
|
||||
// rStatAbnormalDPO.setMeasurementPointId (temp);
|
||||
// rStatAbnormalDPO = rStatAbnormalDMapper.selectByMultiId (rStatAbnormalDPO);
|
||||
// if (Objects.isNull(rStatAbnormalDPO)) {
|
||||
// return;
|
||||
// }
|
||||
// rOperatingMonitorDPO.setMeasurementPointId (temp);
|
||||
// rOperatingMonitorDPO.setDataDate (date);
|
||||
// rOperatingMonitorDPO.setIsUnusual (rStatAbnormalDPO.getValueAlarm ());
|
||||
// rOperatingMonitorDPO.setEffectiveMinuteCount (rMpMonitorEvaluateDPO.getEffectiveMinuteCount ());
|
||||
// rOperatingMonitorDPO.setDataIntegrityRate (BigDecimal.valueOf (rMpMonitorEvaluateDPO.getEffectiveMinuteCount ()*statisticalInterval/1440));
|
||||
// if(rMpMonitorEvaluateDPO.getEffectiveMinuteCount ()==0){
|
||||
// rOperatingMonitorDPO.setDataRightRate(BigDecimal.valueOf(0.00));
|
||||
// }else{
|
||||
// rOperatingMonitorDPO.setDataRightRate (BigDecimal.valueOf(
|
||||
// (rMpMonitorEvaluateDPO.getFreqCount ()+ rMpMonitorEvaluateDPO.getLineVoltageCount ()+
|
||||
// rMpMonitorEvaluateDPO.getPhaseVoltageCount ()+rMpMonitorEvaluateDPO.getUnbalanceCount ()+
|
||||
// rMpMonitorEvaluateDPO.getVThdCount ())/(5*rMpMonitorEvaluateDPO.getEffectiveMinuteCount ())
|
||||
// ));
|
||||
// }
|
||||
//
|
||||
// rOperatingMonitorDPO.setIndexIntegrityRate (
|
||||
// BigDecimal.valueOf(
|
||||
// (rMpMonitorEvaluateDPO.getFreqCount ()+ rMpMonitorEvaluateDPO.getLineVoltageCount ()+
|
||||
// rMpMonitorEvaluateDPO.getPhaseVoltageCount ()+rMpMonitorEvaluateDPO.getUnbalanceCount ()+
|
||||
// rMpMonitorEvaluateDPO.getVThdCount ())*statisticalInterval/(5*1440)
|
||||
// )
|
||||
// );
|
||||
// rOperatingMonitorDPO.setDevId (data.getDevId());
|
||||
// rOperatingMonitorDPO.setMonitorState("0");
|
||||
// rOperatingMonitorDPOList.add (rOperatingMonitorDPO);
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId (rOperatingMonitorDPOList,500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
@@ -12,13 +12,10 @@ import com.njcn.prepare.harmonic.mapper.mysql.line.ROperatingMonitorMMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorMPO;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorMService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -29,7 +26,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/21 15:41【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
@@ -40,40 +36,6 @@ import java.util.stream.Collectors;
|
||||
public class ROperatingMonitorMServiceImpl extends MppServiceImpl<ROperatingMonitorMMapper, ROperatingMonitorMPO> implements ROperatingMonitorMService {
|
||||
private final ROperatingMonitorDMapper rOperatingMonitorDMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
public void handlerMonitorOperatingM(List<String> indexLists,LineParam jobParam) {
|
||||
// List<ROperatingMonitorMPO> rOperatingMonitorMPOList = new ArrayList<>();
|
||||
// QueryWrapper<ROperatingMonitorDPO> queryWrapper = new QueryWrapper<>();
|
||||
// indexLists.forEach(temp -> {
|
||||
// queryWrapper.clear();
|
||||
// queryWrapper.eq("measurement_point_id", temp)
|
||||
// .ge("data_date", jobParam.getBeginTime())
|
||||
// .le("data_date", jobParam.getEndTime());
|
||||
// List<ROperatingMonitorDPO> list = rOperatingMonitorService.list(queryWrapper);
|
||||
//
|
||||
// if (CollectionUtils.isEmpty(list)) {
|
||||
// return;
|
||||
// }
|
||||
// ROperatingMonitorMPO rOperatingMonitorMPO = new ROperatingMonitorMPO();
|
||||
// BigDecimal dataIntegrityRate = BigDecimal.valueOf(list.stream().mapToDouble(po -> po.getDataIntegrityRate().doubleValue()).average().getAsDouble());
|
||||
// BigDecimal dataRightRate = BigDecimal.valueOf(list.stream().mapToDouble(po -> po.getDataRightRate().doubleValue()).average().getAsDouble());
|
||||
// BigDecimal indexIntegrityRate = BigDecimal.valueOf(list.stream().mapToDouble(po -> po.getIndexIntegrityRate().doubleValue()).average().getAsDouble());
|
||||
// rOperatingMonitorMPO.setMeasurementPointId(temp);
|
||||
// rOperatingMonitorMPO.setDataDate(DateUtil.parse(jobParam.getDataDate()));
|
||||
// rOperatingMonitorMPO.setDataIntegrityRate(dataIntegrityRate);
|
||||
// rOperatingMonitorMPO.setDataRightRate(dataRightRate);
|
||||
// rOperatingMonitorMPO.setIndexIntegrityRate(indexIntegrityRate);
|
||||
// rOperatingMonitorMPO.setDevId(list.get(0).getDevId());
|
||||
// List<Integer> collect = list.stream().map(ROperatingMonitorDPO::getIsUnusual).collect(Collectors.toList());
|
||||
// rOperatingMonitorMPO.setIsUnusual(collect.contains(Integer.valueOf(0)) ? 0 : 1);
|
||||
// rOperatingMonitorMPOList.add(rOperatingMonitorMPO);
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId(rOperatingMonitorMPOList, 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMonth(CalculatedParam calculatedParam) {
|
||||
DateTime beginMonth = DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
|
||||
@@ -9,9 +9,7 @@ import com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.RStatAbnormalDService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,35 +26,6 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class RStatAbnormalDServiceImpl extends MppServiceImpl<RStatAbnormalDMapper, RStatAbnormalDPO> implements RStatAbnormalDService{
|
||||
|
||||
|
||||
// private final RMpMonitorEvaluateDService rMpMonitorEvaluateDService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@Async("asyncExecutor")
|
||||
public void handlerMonitorAbnormal(List<String> indexLists, String dataDate) {
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// List<RStatAbnormalDPO> rStatAbnormalDPOS = new ArrayList<> ();
|
||||
// indexLists.forEach (temp -> {
|
||||
// RMpMonitorEvaluateDPO rMpMonitorEvaluateDPO = new RMpMonitorEvaluateDPO();
|
||||
// rMpMonitorEvaluateDPO.setMeasurementPointId (temp);
|
||||
// rMpMonitorEvaluateDPO.setDataDate (date);
|
||||
// rMpMonitorEvaluateDPO = rMpMonitorEvaluateDService.selectByMultiId (rMpMonitorEvaluateDPO);
|
||||
// RStatAbnormalDPO rStatAbnormalDPO = new RStatAbnormalDPO();
|
||||
//
|
||||
// if(Objects.isNull (rMpMonitorEvaluateDPO)){
|
||||
// rStatAbnormalDPO.setValueAlarm(0);
|
||||
// }else {
|
||||
// rStatAbnormalDPO.setValueAlarm (rMpMonitorEvaluateDPO.getEffectiveMinuteCount ()
|
||||
// <rMpMonitorEvaluateDPO.getAllMinuteCount ()?0:1);
|
||||
// }
|
||||
// rStatAbnormalDPO.setDataDate (date);
|
||||
// rStatAbnormalDPO.setMeasurementPointId (temp);
|
||||
//
|
||||
// rStatAbnormalDPOS.add (rStatAbnormalDPO);
|
||||
// });
|
||||
// this.saveOrUpdateBatchByMultiId (rStatAbnormalDPOS,500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMonitorAbnormal(CalculatedParam calculatedParam) {
|
||||
String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
|
||||
@@ -12,12 +12,6 @@ import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
*/
|
||||
public interface IRMpMonitorAlarmCountMService {
|
||||
|
||||
// /**
|
||||
// * @Description: 监测点指标告警月统计
|
||||
// * @author: xuyang
|
||||
// */
|
||||
// void alarmMonth(LineParam lineParam);
|
||||
|
||||
/**
|
||||
* @Description: 监测点指标告警月统计
|
||||
* @author: xuyang
|
||||
|
||||
@@ -14,16 +14,12 @@ import com.njcn.prepare.harmonic.pojo.param.PrimaryGridParam;
|
||||
public interface PrimaryGridDataService {
|
||||
/**
|
||||
* @Description: primaryGridDataHanlder
|
||||
* @Param: [primaryGridParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/25
|
||||
*/
|
||||
void primaryGridDataHanlder(PrimaryGridParam primaryGridParam);
|
||||
/**
|
||||
* @Description: 主网终端数据完整率月统计
|
||||
* @Param: [primaryGridDataIntegrityParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/30
|
||||
*/
|
||||
|
||||
@@ -15,11 +15,9 @@ import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
*/
|
||||
public interface RMpDevEvaluateDetailPOService extends IMppService<RMpDevEvaluateDetailPO> {
|
||||
|
||||
// void handler(DeviceParam deviceParam);
|
||||
|
||||
/**
|
||||
* 终端评价详情表_日统计
|
||||
* @param calculatedParam
|
||||
* @param calculatedParam 计算参数
|
||||
*/
|
||||
void devEvaluateDetail(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -17,30 +17,10 @@ import java.util.List;
|
||||
*/
|
||||
public interface RMpTargetWarnDService extends IMppService<RMpTargetWarnDPO> {
|
||||
|
||||
/**
|
||||
* @Description: 计算出当前机构累计稳态超标监测点数(当月)
|
||||
* @Param: [monitorIdList, dataDate]
|
||||
* @return: java.lang.Integer
|
||||
* @Author: clam
|
||||
* @Date: 2022/12/15
|
||||
*/
|
||||
Integer queryHarmonicMeasurementAccrued(List<String> monitorIdList, String dataDate);
|
||||
|
||||
// /**
|
||||
// * @Description: 监测点指标告警日统计
|
||||
// * @author: xuyang
|
||||
// */
|
||||
// void alarmDay(LineParam lineParam);
|
||||
|
||||
/**
|
||||
* @Description: 监测点指标告警日统计
|
||||
* @author: xuyang
|
||||
*/
|
||||
void alarmDay(CalculatedParam calculatedParam);
|
||||
|
||||
// /**
|
||||
// * @Description: 监测点指标告警月统计
|
||||
// * @author: xuyang
|
||||
// */
|
||||
// List<RMpMonitorAlarmCountMDTO> getDate(LineParam lineParam);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface RStatHarmonicOrgService {
|
||||
|
||||
void handler(OrgParam orgParam);
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.prepare.harmonic.service.mysql.area;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -13,7 +12,6 @@ import java.util.List;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface RStatHarmonicService {
|
||||
void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type);
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ import java.util.List;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface RStatOrgService
|
||||
{
|
||||
void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type);
|
||||
public interface RStatOrgService {
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.text.ParseException;
|
||||
|
||||
public interface DeviceAbnormalStatisticsService {
|
||||
|
||||
boolean dailyDeviceAbnormaStatistics(DeviceAbnormaStatisticsParam param);
|
||||
|
||||
/***
|
||||
* 终端异常通告功能-日表
|
||||
* @author xuyang
|
||||
|
||||
@@ -13,11 +13,10 @@ import com.njcn.prepare.harmonic.pojo.po.RStatDevSignalDPO;
|
||||
*/
|
||||
public interface RStatDevSignalDPOService extends IMppService<RStatDevSignalDPO> {
|
||||
|
||||
// void eventdetailHandler(DeviceParam deviceParam);
|
||||
|
||||
/**
|
||||
* 终端通信管理_日统计
|
||||
* @param calculatedParam
|
||||
* @param calculatedParam 计算参数
|
||||
*/
|
||||
void devSignalD(CalculatedParam calculatedParam);
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface AlarmDetailService {
|
||||
|
||||
//void alarmDetailAlarm(LineParam lineParam);
|
||||
|
||||
// void targetDiff(LineParam lineParam);
|
||||
|
||||
/**
|
||||
* 监测点指标告警日统计
|
||||
|
||||
@@ -10,11 +10,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface HarmonicGeneralService {
|
||||
|
||||
void generalData(LineParam lineParam);
|
||||
|
||||
@Deprecated
|
||||
void generalDataToMysql(LineParam lineParam,String time);
|
||||
|
||||
/**
|
||||
* @Description: 电能质量综合评估-日表
|
||||
*/
|
||||
|
||||
@@ -10,10 +10,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface HarmonicMetricService {
|
||||
|
||||
void metricData(LineParam lineParam);
|
||||
|
||||
@Deprecated
|
||||
void metricDataToMysql(LineParam lineParam,String time);
|
||||
|
||||
/**
|
||||
* @Description: 电能质量评估指标-日表
|
||||
|
||||
@@ -10,9 +10,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface IntegrityService {
|
||||
|
||||
@Deprecated
|
||||
void dataIntegrity(LineParam lineParam, String startTime, String endTime);
|
||||
|
||||
/***
|
||||
* 监测点数据完整性_日表
|
||||
* @author xuyang
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyao
|
||||
@@ -12,9 +10,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface LimitTargetService {
|
||||
|
||||
void getLimitTargetData(LineParam lineParam);
|
||||
|
||||
void limitTargetData(List<String> indexLists,String startTime,String endTime);
|
||||
|
||||
void limitTargetData(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface OnlineRateService {
|
||||
|
||||
void getOnlineRateData(LineParam lineParam);
|
||||
|
||||
void onlineRateData(LineParam lineParam,String time);
|
||||
|
||||
/***
|
||||
* 终端在线率_日表
|
||||
|
||||
@@ -13,8 +13,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface PollutionService {
|
||||
|
||||
void processPollutionData(LineParam lineParam);
|
||||
/***--------------------------新算法--------------------------------------------**/
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
|
||||
void handleOrgDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
@@ -15,14 +15,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
*/
|
||||
public interface RMpEventDetailService extends IService<RMpEventDetailPO> {
|
||||
|
||||
/**
|
||||
* @Description: eventdetailHandler
|
||||
* @Param: [lineParam]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/23
|
||||
*/
|
||||
void eventdetailHandler(LineParam lineParam);
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--日表算法
|
||||
|
||||
@@ -4,11 +4,9 @@ import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RMpMonitorEvaluateDPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/19 15:42【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
@@ -16,14 +14,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface RMpMonitorEvaluateDService extends IMppService<RMpMonitorEvaluateDPO> {
|
||||
|
||||
/**
|
||||
* @Description: dayDataJobHandler
|
||||
* @Param: [indexLists, startTime, endTime]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/19
|
||||
*/
|
||||
void dayDataJobHandler(List<String> indexLists, String beginTime, String endTime);
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
|
||||
@@ -17,8 +17,6 @@ import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||
public interface RMpPassRateDService extends IMppService<RMpPassRateDPO> {
|
||||
|
||||
|
||||
void passRateHandler(LineParam lineParam);
|
||||
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
|
||||
void handleMonth(CalculatedParam calculatedParam);
|
||||
|
||||
@@ -17,14 +17,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface ROperatingMonitorMService extends IMppService<ROperatingMonitorMPO> {
|
||||
|
||||
/**
|
||||
* @Description: handlerMonitorOperatingM
|
||||
* @Param: [indexLists, dataDate]
|
||||
* @return: void
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/21
|
||||
*/
|
||||
void handlerMonitorOperatingM(List<String> indexLists, LineParam jobParam);
|
||||
|
||||
void handleMonth(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/21 10:17【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
@@ -16,14 +15,21 @@ import java.util.List;
|
||||
*/
|
||||
public interface ROperatingMonitorService extends IMppService<ROperatingMonitorDPO> {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: handlerMonitorOperatingD
|
||||
* @Param: [indexLists, dataDate]
|
||||
* @return: void
|
||||
* @Description: 采用以下公式计算数据完整率:
|
||||
* 〖数据完整率〗_日统计=有效值数据个数/(1440/interval)*100%
|
||||
* 采用以下公式计算数据准确率
|
||||
* 〖数据准确率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(有效值数据个数*5)*100%
|
||||
* 采用以下公式计算指标完整率
|
||||
* 〖指标完整率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(1440/interval*5)*100% 采用以下公式计算数据完整率:
|
||||
* 〖数据完整率〗_日统计=有效值数据个数/(1440/interval)*100%
|
||||
* 采用以下公式计算数据准确率
|
||||
* 〖数据准确率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(有效值数据个数*5)*100%
|
||||
* 采用以下公式计算指标完整率
|
||||
* 〖指标完整率〗_日统计=(频率+相电压+线电压+畸变率+不平衡度)/(1440/interval*5)*100%
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/21
|
||||
*/
|
||||
void handlerMonitorOperatingD(List<String> indexLists, String dataDate);
|
||||
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -16,8 +15,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface RStatAbnormalDService extends IMppService<RStatAbnormalDPO> {
|
||||
|
||||
|
||||
void handlerMonitorAbnormal(List<String> indexLists, String dataDate);
|
||||
|
||||
void handlerMonitorAbnormal(CalculatedParam calculatedParam);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.List;
|
||||
|
||||
public interface RAlarmCountService {
|
||||
|
||||
void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type);
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
void handleMonth(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
|
||||
public interface RStatEventOrgService {
|
||||
|
||||
void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type);
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.prepare.harmonic.service.mysql.newalgorithm;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
@@ -12,8 +11,6 @@ import java.util.List;
|
||||
|
||||
public interface RStatEventService {
|
||||
|
||||
void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type);
|
||||
|
||||
void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
void handleMonth(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
|
||||
public interface RStatSubstationService {
|
||||
|
||||
// void handler(List<DeptGetSubStationDTO> data, String dataDate, Integer type);
|
||||
|
||||
/**
|
||||
* 3.4.10.1.变电站指标统计_日表
|
||||
|
||||
@@ -7,7 +7,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pms.pojo.po.RStatAreaAlarmCountM;
|
||||
import com.njcn.harmonic.pojo.po.*;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RMpMonitorAlarmCountMMapper;
|
||||
@@ -20,17 +19,13 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -679,122 +674,10 @@ public class RAlarmCountServiceImpl implements RAlarmCountService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
switch (type) {
|
||||
case 3:
|
||||
this.rAlarmCountMHandler(data, dataDate, type);
|
||||
break;
|
||||
case 4:
|
||||
this.rAlarmCountWHandler(data, dataDate, type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//周表
|
||||
public void rAlarmCountWHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
// List<RStatZwAlarmCountWPO> rStatZwAlarmCountWPOS = new ArrayList<>();
|
||||
// List<RStatPwAlarmCountWPO> rStatPwAlarmCountWPOS = new ArrayList<>();
|
||||
// //获取日期
|
||||
// Date localDate = DateUtil.parse(dataDate);
|
||||
//
|
||||
// //获取当前周的起始与结束日期
|
||||
// LocalDate date = LocalDate.parse(dataDate, DateTimeFormatter.ISO_DATE);
|
||||
// LocalDate startOfWeek = date.with(DayOfWeek.MONDAY);
|
||||
// LocalDate endOfWeek = date.with(DayOfWeek.SUNDAY);
|
||||
//
|
||||
// QueryWrapper<RMpTargetWarnDPO> rMpTargetWarnDPOQueryWrapper = new QueryWrapper<>();
|
||||
//
|
||||
// data.forEach(deptGetChildrenMoreDTO -> {
|
||||
//
|
||||
// /*主网*/
|
||||
// if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
// List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
//
|
||||
// List<String> collect1 = lineBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
//
|
||||
// rMpTargetWarnDPOQueryWrapper.clear();
|
||||
// rMpTargetWarnDPOQueryWrapper.
|
||||
// in("measurement_point_id", collect1).
|
||||
// eq("is_effective", "1").
|
||||
// between("data_date", startOfWeek, endOfWeek);
|
||||
//
|
||||
// List<RMpTargetWarnDPO> rMpTargetWarnDPOList = rMpTargetWarnDMapper.selectList(rMpTargetWarnDPOQueryWrapper);
|
||||
//
|
||||
// //告警4次及以上监测点数量
|
||||
// long count = rMpTargetWarnDPOList.stream()
|
||||
// .filter(obj -> obj.getIsWarn() == 1)
|
||||
// .collect(Collectors.groupingBy(RMpTargetWarnDPO::getMeasurementPointId, Collectors.counting()))
|
||||
// .entrySet().stream()
|
||||
// .filter(e -> e.getValue() >= 4)
|
||||
// .count();
|
||||
//
|
||||
// // 使用 Stream API 进行流式处理,选择 status 为 1 的告警,按照 id 进行分组并统计个数
|
||||
// Map<String, Double> avgStatusOneCountByAlarmId = rMpTargetWarnDPOList.stream()
|
||||
// .filter(alarm -> alarm.getIsWarn() == 1)
|
||||
// .collect(Collectors.groupingBy(RMpTargetWarnDPO::getMeasurementPointId, Collectors.counting()))
|
||||
// .entrySet().stream()
|
||||
// .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue() / 7.0));
|
||||
//
|
||||
// // 对 map 中的 value 进行从大到小的排序,并且排除 value 为 0 的元素
|
||||
// Map<String, Double> sortedAvgStatusOneCountByAlarmId = avgStatusOneCountByAlarmId.entrySet().stream()
|
||||
// .filter(e -> e.getValue() != 0)
|
||||
// .sorted(Map.Entry.<String, Double>comparingByValue(Comparator.reverseOrder()))
|
||||
// .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
|
||||
//
|
||||
// // 获取前 30% 的告警 id 数量
|
||||
// int top30PercentCount = (int) (sortedAvgStatusOneCountByAlarmId.size() * 0.3) + 1;
|
||||
//
|
||||
// RStatZwAlarmCountWPO rStatZwAlarmCountWPO = new RStatZwAlarmCountWPO();
|
||||
// rStatZwAlarmCountWPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
// rStatZwAlarmCountWPO.setDataDate(localDate);
|
||||
// rStatZwAlarmCountWPO.setMonitorEffectiveCount(rMpTargetWarnDPOList.size());
|
||||
// rStatZwAlarmCountWPO.setWarnMonitorCount(Integer.valueOf(count + ""));
|
||||
// rStatZwAlarmCountWPO.setMonitorGradeCount(top30PercentCount);
|
||||
// rStatZwAlarmCountWPOS.add(rStatZwAlarmCountWPO);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*配网*/
|
||||
// if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
// List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
// List<String> collect1 = pwMonitorIds.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
//
|
||||
// rMpTargetWarnDPOQueryWrapper.clear();
|
||||
// rMpTargetWarnDPOQueryWrapper.
|
||||
// in("measurement_point_id", collect1).
|
||||
// between("data_date", startOfWeek, endOfWeek);
|
||||
//
|
||||
// List<RMpTargetWarnDPO> rMpTargetWarnDPOList = rMpTargetWarnDMapper.selectList(rMpTargetWarnDPOQueryWrapper);
|
||||
//
|
||||
// //获取告警监测点数
|
||||
// long count = rMpTargetWarnDPOList.stream().filter(alarm -> alarm.getIsWarn() == 1).count();
|
||||
//
|
||||
// RStatPwAlarmCountWPO rStatPwAlarmCountWPO = new RStatPwAlarmCountWPO();
|
||||
// rStatPwAlarmCountWPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
// rStatPwAlarmCountWPO.setDataDate(localDate);
|
||||
// rStatPwAlarmCountWPO.setOnlineMonitorCount(rMpTargetWarnDPOList.size());
|
||||
// rStatPwAlarmCountWPO.setAlarmMonitorCount(Integer.valueOf(count + ""));
|
||||
//
|
||||
// rStatPwAlarmCountWPOS.add(rStatPwAlarmCountWPO);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
// if (!CollectionUtils.isEmpty(rStatZwAlarmCountWPOS)) {
|
||||
// rStatZwAlarmCountWPOService.saveOrUpdateBatchByMultiId(rStatZwAlarmCountWPOS, 500);
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(rStatZwAlarmCountWPOS)) {
|
||||
// rStatPwAlarmCountWPOService.saveOrUpdateBatchByMultiId(rStatPwAlarmCountWPOS, 500);
|
||||
// }
|
||||
}
|
||||
|
||||
//月表
|
||||
public void rAlarmCountMHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.harmonic.pojo.po.RStatOrgMPO;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgDMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgMMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgQMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.area.RStatOrgYMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.newalgorithm.*;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.pojo.mysql.po.RStatOrgQPO;
|
||||
@@ -26,9 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -48,18 +42,6 @@ public class RStatEventOrgServiceImpl implements RStatEventOrgService {
|
||||
|
||||
private final RStatEventDPOMapper rStatEventDPOMapper;
|
||||
|
||||
private final RStatOrgDMapper rStatOrgDMapper;
|
||||
|
||||
private final RStatOrgMMapper rStatOrgMMapper;
|
||||
|
||||
private final RStatOrgQMapper rStatOrgQMapper;
|
||||
|
||||
private final RStatOrgYMapper rStatOrgYMapper;
|
||||
|
||||
private final RStatEventOrgDPOMapper rStatEventOrgDPOMapper;
|
||||
|
||||
private final RStatEventOrgMPOMapper rStatEventOrgMPOMapper;
|
||||
|
||||
private final RStatEventMPOMapper rStatEventMPOMapper;
|
||||
|
||||
private final RStatEventQPOMapper rStatEventQPOMapper;
|
||||
@@ -74,25 +56,6 @@ public class RStatEventOrgServiceImpl implements RStatEventOrgService {
|
||||
|
||||
private final RStatEventOrgYPOService rStatEventOrgYPOService;
|
||||
|
||||
@Override
|
||||
public void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.rStartEventOrgYHandler(data, dataDate, type);
|
||||
break;
|
||||
case 2:
|
||||
this.rStartEventOrgQHandler(data, dataDate, type);
|
||||
break;
|
||||
case 3:
|
||||
this.rStartEventOrgMHandler(data, dataDate, type);
|
||||
break;
|
||||
case 5:
|
||||
this.rStartEventOrgDHandler(data, dataDate, type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
@@ -520,617 +483,6 @@ public class RStatEventOrgServiceImpl implements RStatEventOrgService {
|
||||
|
||||
}
|
||||
|
||||
//天表
|
||||
public void rStartEventOrgDHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventOrgDPO> rStatEventOrgDPOS = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
List<RStatEventDVO> rStatEventDVO = rStatEventDPOMapper.listAll(dataDate, deptGetChildrenMoreDTO.getUnitId());
|
||||
|
||||
List<RStatOrgDVO> rStatOrgDVOS = rStatOrgDMapper.listAll(dataDate, deptGetChildrenMoreDTO.getUnitId());
|
||||
|
||||
//集合判空
|
||||
if (!CollectionUtils.isEmpty(rStatEventDVO)) {
|
||||
//list转为map
|
||||
Map<String, Integer> emMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(rStatOrgDVOS)) {
|
||||
if (rStatOrgDVOS.size() == 1) {
|
||||
if (Objects.equals(rStatOrgDVOS.get(0).getDataType(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId())) {
|
||||
emMap.put(rStatOrgDVOS.get(0).getDataType(), rStatOrgDVOS.get(0).getEffectiveMeasurement());
|
||||
emMap.put(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId(), 0);
|
||||
} else {
|
||||
emMap.put(rStatOrgDVOS.get(0).getDataType(), rStatOrgDVOS.get(0).getEffectiveMeasurement());
|
||||
emMap.put(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId(), 0);
|
||||
}
|
||||
} else {
|
||||
emMap.put(rStatOrgDVOS.get(0).getDataType(), rStatOrgDVOS.get(0).getEffectiveMeasurement());
|
||||
emMap.put(rStatOrgDVOS.get(1).getDataType(), rStatOrgDVOS.get(1).getEffectiveMeasurement());
|
||||
}
|
||||
} else {
|
||||
emMap.put(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId(), 0);
|
||||
emMap.put(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
rStatEventDVO.forEach(o -> {
|
||||
RStatEventOrgDPO rStatEventOrgDPO = new RStatEventOrgDPO();
|
||||
rStatEventOrgDPO.setOrgNo(o.getOrgNo());
|
||||
rStatEventOrgDPO.setDataDate(localDate);
|
||||
rStatEventOrgDPO.setEventType(o.getEventType());
|
||||
rStatEventOrgDPO.setEventMeasurement(o.getEmSum());
|
||||
rStatEventOrgDPO.setEventCount(o.getEcSum());
|
||||
rStatEventOrgDPO.setDataType(o.getDataType());
|
||||
|
||||
if (Objects.equals(o.getDataType(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId())) {
|
||||
if (emMap.get(o.getDataType()) == 0) {
|
||||
rStatEventOrgDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
String value = df.format(o.getEmSum().floatValue() / emMap.get(o.getDataType()));
|
||||
rStatEventOrgDPO.setEventMeasurementRatio(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
if (emMap.get(o.getDataType()) == 0) {
|
||||
rStatEventOrgDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
String value = df.format(o.getEmSum().floatValue() / emMap.get(o.getDataType()));
|
||||
rStatEventOrgDPO.setEventMeasurementRatio(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventOrgDPOS.add(rStatEventOrgDPO);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventOrgDPOS)) {
|
||||
rStatEventOrgDPOService.saveOrUpdateBatchByMultiId(rStatEventOrgDPOS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//月表
|
||||
public void rStartEventOrgMHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventOrgMPO> rStatEventOrgMPOS = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
//传入字符串日期获取月的起始日期与结束日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1); // 将日期设置为当月的第一天
|
||||
String startTime = sdf.format(calendar.getTime()); // 获取当月的起始日期
|
||||
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); // 将日期设置为当月的最后一天
|
||||
String endTime = sdf.format(calendar.getTime());// 获取当月的结束日期
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventStatisMap = eventStatis.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
//主网天表
|
||||
List<RStatEventOrgDVO> zwList = rStatEventOrgDPOMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网天表
|
||||
List<RStatEventOrgDVO> pwList = rStatEventOrgDPOMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_event_m
|
||||
List<Map<String, Object>> zwEmaSum = rStatEventMPOMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_event_m
|
||||
List<Map<String, Object>> pwEmaSum = rStatEventMPOMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_org_m
|
||||
Map<String, Object> zwEfSum = rStatOrgMMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_org_m
|
||||
Map<String, Object> pwEfSum = rStatOrgMMapper.selectMlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
|
||||
//主网
|
||||
if (!CollectionUtils.isEmpty(zwList)) {
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(zwEmaSum)) {
|
||||
for (Map<String, Object> map : zwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
zwList.forEach(obj -> {
|
||||
RStatEventOrgMPO rStatEventOrgMPO = new RStatEventOrgMPO();
|
||||
rStatEventOrgMPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgMPO.setDataDate(localDate);
|
||||
rStatEventOrgMPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgMPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgMPO.setEventCount(obj.getEcSum());
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgMPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgMPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgMPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgMPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum().floatValue() / obj.getEmSum());
|
||||
rStatEventOrgMPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(zwEfSum)) {
|
||||
if (Integer.parseInt(zwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgMPO.getEventMeasurementAccrued() / Float.parseFloat(zwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgMPOS.add(rStatEventOrgMPO);
|
||||
});
|
||||
}
|
||||
|
||||
//配网
|
||||
if (!CollectionUtils.isEmpty(pwList)) {
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(pwEmaSum)) {
|
||||
for (Map<String, Object> map : pwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
pwList.forEach(obj -> {
|
||||
RStatEventOrgMPO rStatEventOrgMPO = new RStatEventOrgMPO();
|
||||
rStatEventOrgMPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgMPO.setDataDate(localDate);
|
||||
rStatEventOrgMPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgMPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgMPO.setEventCount(obj.getEcSum());
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgMPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgMPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgMPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgMPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum() / obj.getEmSum().floatValue());
|
||||
rStatEventOrgMPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(pwEfSum)) {
|
||||
if (Integer.parseInt(pwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgMPO.getEventMeasurementAccrued() / Float.parseFloat(pwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgMPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgMPOS.add(rStatEventOrgMPO);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventOrgMPOS)) {
|
||||
rStatEventOrgMPOService.saveOrUpdateBatchByMultiId(rStatEventOrgMPOS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//季表
|
||||
public void rStartEventOrgQHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventOrgQPO> rStatEventOrgQPOS = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
//计算季度的开始日期和结束日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
int quarter = (calendar.get(Calendar.MONTH) / 3) + 1; // 计算日期所在的季度
|
||||
calendar.set(Calendar.MONTH, (quarter - 1) * 3); // 设置季度开始的月份
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1); // 设置季度开始的日期
|
||||
String startTime = sdf.format(calendar.getTime()); // 季度开始日期
|
||||
calendar.add(Calendar.MONTH, 2); // 添加两个月,使其到季度结束的月份
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); // 设置季度结束的日期 - 月份最后一天
|
||||
String endTime = sdf.format(calendar.getTime()); // 季度结束日期
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventStatisMap = eventStatis.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
//主网月表
|
||||
List<RStatEventOrgDVO> zwMList = rStatEventOrgMPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网月表
|
||||
List<RStatEventOrgDVO> pwMList = rStatEventOrgMPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网天表
|
||||
List<RStatEventOrgDVO> zwDList = rStatEventOrgDPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网天表
|
||||
List<RStatEventOrgDVO> pwDList = rStatEventOrgDPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_event_q
|
||||
List<Map<String, Object>> zwEmaSum = rStatEventQPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_event_q
|
||||
List<Map<String, Object>> pwEmaSum = rStatEventQPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_org_q
|
||||
Map<String, Object> zwEfSum = rStatOrgQMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_org_q
|
||||
Map<String, Object> pwEfSum = rStatOrgQMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网
|
||||
if (!CollectionUtils.isEmpty(zwMList) && !CollectionUtils.isEmpty(zwDList)) {
|
||||
|
||||
for (RStatEventOrgDVO rStatEventOrgDVO : zwMList) {
|
||||
for (RStatEventOrgDVO statEventOrgDVO : zwDList) {
|
||||
if (Objects.equals(rStatEventOrgDVO.getEventType(), statEventOrgDVO.getEventType())) {
|
||||
rStatEventOrgDVO.setEcSum(statEventOrgDVO.getEcSum());
|
||||
rStatEventOrgDVO.setEmSum(statEventOrgDVO.getEmSum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(zwEmaSum)) {
|
||||
for (Map<String, Object> map : zwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
zwMList.forEach(obj -> {
|
||||
RStatEventOrgQPO rStatEventOrgQPO = new RStatEventOrgQPO();
|
||||
rStatEventOrgQPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgQPO.setDataDate(localDate);
|
||||
rStatEventOrgQPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgQPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgQPO.setEventCount(obj.getEcMSum());
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgQPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgQPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgQPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgQPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum().floatValue() / obj.getEmSum());
|
||||
rStatEventOrgQPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(zwEfSum)) {
|
||||
if (Integer.parseInt(zwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgQPO.getEventMeasurementAccrued() / Float.parseFloat(zwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgQPOS.add(rStatEventOrgQPO);
|
||||
});
|
||||
}
|
||||
|
||||
//配网
|
||||
if (!CollectionUtils.isEmpty(pwMList) && !CollectionUtils.isEmpty(pwDList)) {
|
||||
|
||||
for (RStatEventOrgDVO rStatEventOrgDVO : pwMList) {
|
||||
for (RStatEventOrgDVO statEventOrgDVO : pwDList) {
|
||||
if (Objects.equals(rStatEventOrgDVO.getEventType(), statEventOrgDVO.getEventType())) {
|
||||
rStatEventOrgDVO.setEcSum(statEventOrgDVO.getEcSum());
|
||||
rStatEventOrgDVO.setEmSum(statEventOrgDVO.getEmSum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(pwEmaSum)) {
|
||||
for (Map<String, Object> map : pwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
pwMList.forEach(obj -> {
|
||||
RStatEventOrgQPO rStatEventOrgQPO = new RStatEventOrgQPO();
|
||||
rStatEventOrgQPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgQPO.setDataDate(localDate);
|
||||
rStatEventOrgQPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgQPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgQPO.setEventCount(obj.getEcMSum());
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgQPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgQPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgQPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgQPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum() / obj.getEmSum().floatValue());
|
||||
rStatEventOrgQPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(pwEfSum)) {
|
||||
if (Integer.parseInt(pwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgQPO.getEventMeasurementAccrued() / Float.parseFloat(pwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgQPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgQPOS.add(rStatEventOrgQPO);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventOrgQPOS)) {
|
||||
rStatEventOrgQPOService.saveOrUpdateBatchByMultiId(rStatEventOrgQPOS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//年表
|
||||
public void rStartEventOrgYHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventOrgYPO> rStatEventOrgYPOS = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
//计算年度的开始日期和结束日期
|
||||
Calendar calendar = Calendar.getInstance(); // 获取Calendar实例
|
||||
calendar.setTime(date); // 设置Calendar对象的时间为传入的时间
|
||||
int year = calendar.get(Calendar.YEAR); // 获取本年度年份
|
||||
// 获取本年度的第一天
|
||||
Calendar firstDayOfYear = Calendar.getInstance();
|
||||
firstDayOfYear.set(Calendar.YEAR, year);
|
||||
firstDayOfYear.set(Calendar.MONTH, Calendar.JANUARY);
|
||||
firstDayOfYear.set(Calendar.DAY_OF_MONTH, 1);
|
||||
// 获取本年度的最后一天
|
||||
Calendar lastDayOfYear = Calendar.getInstance();
|
||||
lastDayOfYear.set(Calendar.YEAR, year);
|
||||
lastDayOfYear.set(Calendar.MONTH, Calendar.DECEMBER);
|
||||
lastDayOfYear.set(Calendar.DAY_OF_MONTH, 31);
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startTime = formatter.format(firstDayOfYear.getTime());
|
||||
String endTime = formatter.format(lastDayOfYear.getTime());
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventStatisMap = eventStatis.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
//主网月表
|
||||
List<RStatEventOrgDVO> zwMList = rStatEventOrgMPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网月表
|
||||
List<RStatEventOrgDVO> pwMList = rStatEventOrgMPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网天表
|
||||
List<RStatEventOrgDVO> zwDList = rStatEventOrgDPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网天表
|
||||
List<RStatEventOrgDVO> pwDList = rStatEventOrgDPOMapper.selectQlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_event_y
|
||||
List<Map<String, Object>> zwEmaSum = rStatEventYPOMapper.selectYlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_event_y
|
||||
List<Map<String, Object>> pwEmaSum = rStatEventYPOMapper.selectYlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网r_stat_org_y
|
||||
Map<String, Object> zwEfSum = rStatOrgYMapper.selectYlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
//配网r_stat_org_y
|
||||
Map<String, Object> pwEfSum = rStatOrgYMapper.selectYlist(startTime, endTime,
|
||||
deptGetChildrenMoreDTO.getUnitId(), dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
//主网
|
||||
if (!CollectionUtils.isEmpty(zwMList) && !CollectionUtils.isEmpty(zwDList)) {
|
||||
|
||||
for (RStatEventOrgDVO rStatEventOrgDVO : zwMList) {
|
||||
for (RStatEventOrgDVO statEventOrgDVO : zwDList) {
|
||||
if (Objects.equals(rStatEventOrgDVO.getEventType(), statEventOrgDVO.getEventType())) {
|
||||
rStatEventOrgDVO.setEcSum(statEventOrgDVO.getEcSum());
|
||||
rStatEventOrgDVO.setEmSum(statEventOrgDVO.getEmSum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(zwEmaSum)) {
|
||||
for (Map<String, Object> map : zwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
zwMList.forEach(obj -> {
|
||||
RStatEventOrgYPO rStatEventOrgYPO = new RStatEventOrgYPO();
|
||||
rStatEventOrgYPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgYPO.setDataDate(localDate);
|
||||
rStatEventOrgYPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgYPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgYPO.setEventCount(obj.getEcMSum());
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgYPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgYPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgYPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgYPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum().floatValue() / obj.getEmSum());
|
||||
rStatEventOrgYPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(zwEfSum)) {
|
||||
if (Integer.parseInt(zwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgYPO.getEventMeasurementAccrued() / Float.parseFloat(zwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgYPOS.add(rStatEventOrgYPO);
|
||||
});
|
||||
}
|
||||
|
||||
//配网
|
||||
if (!CollectionUtils.isEmpty(pwMList) && !CollectionUtils.isEmpty(pwDList)) {
|
||||
|
||||
for (RStatEventOrgDVO rStatEventOrgDVO : pwMList) {
|
||||
for (RStatEventOrgDVO statEventOrgDVO : pwDList) {
|
||||
if (Objects.equals(rStatEventOrgDVO.getEventType(), statEventOrgDVO.getEventType())) {
|
||||
rStatEventOrgDVO.setEcSum(statEventOrgDVO.getEcSum());
|
||||
rStatEventOrgDVO.setEmSum(statEventOrgDVO.getEmSum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//转map
|
||||
Map<String, Integer> emaMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(pwEmaSum)) {
|
||||
for (Map<String, Object> map : pwEmaSum) {
|
||||
emaMap.put(map.get("eventType").toString(), Integer.valueOf(map.get("emaSum").toString()));
|
||||
}
|
||||
} else {
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId(), 0);
|
||||
emaMap.put(eventStatisMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId(), 0);
|
||||
}
|
||||
|
||||
//循环
|
||||
pwMList.forEach(obj -> {
|
||||
RStatEventOrgYPO rStatEventOrgYPO = new RStatEventOrgYPO();
|
||||
rStatEventOrgYPO.setOrgNo(obj.getOrgNo());
|
||||
rStatEventOrgYPO.setDataDate(localDate);
|
||||
rStatEventOrgYPO.setEventType(obj.getEventType());
|
||||
rStatEventOrgYPO.setEventMeasurementAverage(obj.getEmrAvg());
|
||||
rStatEventOrgYPO.setEventCount(obj.getEcMSum());
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAverage(obj.getEmrAvg());
|
||||
rStatEventOrgYPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (emaMap.get(obj.getEventType()) == 0) {
|
||||
rStatEventOrgYPO.setEventMeasurementAccrued(0);
|
||||
} else {
|
||||
rStatEventOrgYPO.setEventMeasurementAccrued(emaMap.get(obj.getEventType()));
|
||||
}
|
||||
if (obj.getEmSum() == 0) {
|
||||
rStatEventOrgYPO.setEventFreq(0.00f);
|
||||
} else {
|
||||
String value = df.format(obj.getEcSum() / obj.getEmSum().floatValue());
|
||||
rStatEventOrgYPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(pwEfSum)) {
|
||||
if (Integer.parseInt(pwEfSum.get("efSum").toString()) == 0) {
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventOrgYPO.getEventMeasurementAccrued() / Float.parseFloat(pwEfSum.get("efSum").toString()));
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
} else {
|
||||
rStatEventOrgYPO.setEventMeasurementRatioAccrued(0.00f);
|
||||
}
|
||||
rStatEventOrgYPOS.add(rStatEventOrgYPO);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventOrgYPOS)) {
|
||||
rStatEventOrgYPOService.saveOrUpdateBatchByMultiId(rStatEventOrgYPOS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -929,878 +927,6 @@ public class RStatEventServiceImpl implements RStatEventService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.rStartEventYHandler (data, dataDate, type);
|
||||
break;
|
||||
case 2:
|
||||
this.rStartEventQHandler(data, dataDate, type);
|
||||
break;
|
||||
case 3:
|
||||
this.rStartEventMHandler(data, dataDate, type);
|
||||
break;
|
||||
case 5:
|
||||
this.rStartEventDHandler(data, dataDate, type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//天表
|
||||
public void rStartEventDHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventDPO> rStatEventDPOList = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
QueryWrapper<RMpEventDetailDPO> rMpEventDetailDPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<RStatOrgDPO> rStatOrgDPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailDPOQueryWrapper.clear();
|
||||
rMpEventDetailDPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
|
||||
|
||||
rStatOrgDPOQueryWrapper.clear();
|
||||
rStatOrgDPOQueryWrapper.select("effective_measurement").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
RStatOrgDPO rStatOrgDPO = rStatOrgDMapper.selectOne(rStatOrgDPOQueryWrapper);
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDPOS);
|
||||
RStatEventDPO rStatEventDPO = new RStatEventDPO();
|
||||
rStatEventDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventDPO.setDataDate(localDate);
|
||||
rStatEventDPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventDPO.setEventType(dictData.getId());
|
||||
rStatEventDPO.setEventMeasurement(transientStatisData.get(0));
|
||||
rStatEventDPO.setEventCount(transientStatisData.get(1));
|
||||
rStatEventDPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
if (Objects.isNull(rStatOrgDPO)) {
|
||||
rStatEventDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
if (rStatOrgDPO.getEffectiveMeasurement() == 0) {
|
||||
rStatEventDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventDPO.getEventMeasurement() / rStatOrgDPO.getEffectiveMeasurement().floatValue());
|
||||
rStatEventDPO.setEventMeasurementRatio(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
|
||||
rStatEventDPOList.add(rStatEventDPO);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/*配网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailDPOQueryWrapper.clear();
|
||||
rMpEventDetailDPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
List<RMpEventDetailDPO> rMpEventDetailDPOS = rMpEventDetailDMapper.selectList(rMpEventDetailDPOQueryWrapper);
|
||||
|
||||
rStatOrgDPOQueryWrapper.clear();
|
||||
rStatOrgDPOQueryWrapper.select("effective_measurement").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m-%d')", dataDate);
|
||||
RStatOrgDPO rStatOrgDPO = rStatOrgDMapper.selectOne(rStatOrgDPOQueryWrapper);
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
List<Integer> transientStatisData = getTransientStatisData(dictData, rMpEventDetailDPOS);
|
||||
RStatEventDPO rStatEventDPO = new RStatEventDPO();
|
||||
rStatEventDPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventDPO.setDataDate(localDate);
|
||||
rStatEventDPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventDPO.setEventType(dictData.getId());
|
||||
rStatEventDPO.setEventMeasurement(transientStatisData.get(0));
|
||||
rStatEventDPO.setEventCount(transientStatisData.get(1));
|
||||
rStatEventDPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
if (Objects.isNull(rStatOrgDPO)) {
|
||||
rStatEventDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
if (rStatOrgDPO.getEffectiveMeasurement() == 0) {
|
||||
rStatEventDPO.setEventMeasurementRatio(1.00f);
|
||||
} else {
|
||||
String value = df.format(rStatEventDPO.getEventMeasurement() / rStatOrgDPO.getEffectiveMeasurement().floatValue());
|
||||
rStatEventDPO.setEventMeasurementRatio(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventDPOList.add(rStatEventDPO);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventDPOList)) {
|
||||
rStatEventDPOService.saveOrUpdateBatchByMultiId(rStatEventDPOList, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//月表
|
||||
public void rStartEventMHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventMPO> rStatEventMPOList = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
//详情表
|
||||
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
|
||||
//org表
|
||||
QueryWrapper<RStatOrgMPO> rStatOrgMPOQueryWrapper = new QueryWrapper<>();
|
||||
//天表
|
||||
QueryWrapper<RStatEventDPO> rStatEventDPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
|
||||
RStatOrgMPO rStatOrgMPO = rStatOrgMMapper.selectOne(rStatOrgMPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7)).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
|
||||
//求各个类型的平均值
|
||||
Map<String, Double> avgEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.averagingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio
|
||||
Map<String, Double> avgEMR = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.averagingDouble(RStatEventDPO::getEventMeasurementRatio)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventMPO rStatEventMPO = new RStatEventMPO();
|
||||
rStatEventMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventMPO.setDataDate(localDate);
|
||||
rStatEventMPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventMPO.setEventType(dictData.getId());
|
||||
rStatEventMPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEM.get(dictData.getId()))));
|
||||
rStatEventMPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventMPO.setEventCount(sumEC.get(dictData.getId()));
|
||||
rStatEventMPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMR.get(dictData.getId()))));
|
||||
rStatEventMPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventMPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventMPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgMPO)) {
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgMPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgMPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventMPOList.add(rStatEventMPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*配网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
rStatOrgMPOQueryWrapper.clear();
|
||||
rStatOrgMPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7));
|
||||
RStatOrgMPO rStatOrgMPO = rStatOrgMMapper.selectOne(rStatOrgMPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("DATE_FORMAT( data_date ,'%Y-%m')", dataDate.substring(0, 7)).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
|
||||
//求各个类型的平均值
|
||||
Map<String, Double> avgEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.averagingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio
|
||||
Map<String, Double> avgEMR = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.averagingDouble(RStatEventDPO::getEventMeasurementRatio)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventMPO rStatEventMPO = new RStatEventMPO();
|
||||
rStatEventMPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventMPO.setDataDate(localDate);
|
||||
rStatEventMPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventMPO.setEventType(dictData.getId());
|
||||
rStatEventMPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEM.get(dictData.getId()))));
|
||||
rStatEventMPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventMPO.setEventCount(sumEC.get(dictData.getId()));
|
||||
rStatEventMPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMR.get(dictData.getId()))));
|
||||
rStatEventMPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventMPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventMPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgMPO)) {
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgMPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgMPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventMPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventMPOList.add(rStatEventMPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventMPOList)) {
|
||||
rStatEventMPOService.saveOrUpdateBatchByMultiId(rStatEventMPOList, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//季表
|
||||
public void rStartEventQHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventQPO> rStatEventQPOList = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 计算季度的开始日期和结束日期
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
int quarter = (calendar.get(Calendar.MONTH) / 3) + 1; // 计算日期所在的季度
|
||||
calendar.set(Calendar.MONTH, (quarter - 1) * 3); // 设置季度开始的月份
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1); // 设置季度开始的日期
|
||||
Date startDate = calendar.getTime(); // 季度开始日期
|
||||
calendar.add(Calendar.MONTH, 2); // 添加两个月,使其到季度结束的月份
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); // 设置季度结束的日期 - 月份最后一天
|
||||
Date endDate = calendar.getTime(); // 季度结束日期
|
||||
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
//详情表
|
||||
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
|
||||
//org季表
|
||||
QueryWrapper<RStatOrgQPO> rStatOrgQPOQueryWrapper = new QueryWrapper<>();
|
||||
//天表
|
||||
QueryWrapper<RStatEventDPO> rStatEventDPOQueryWrapper = new QueryWrapper<>();
|
||||
//月表
|
||||
QueryWrapper<RStatEventMPO> rStatEventMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
between("data_date", startDate, endDate);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
//季表
|
||||
rStatOrgQPOQueryWrapper.clear();
|
||||
rStatOrgQPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
between("data_date", startDate, endDate);
|
||||
;
|
||||
RStatOrgQPO rStatOrgQPO = rStatOrgQMapper.selectOne(rStatOrgQPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
//月表
|
||||
rStatEventMPOQueryWrapper.clear();
|
||||
rStatEventMPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
List<RStatEventMPO> rStatEventMPO = rStatEventMPOMapper.selectList(rStatEventMPOQueryWrapper);
|
||||
|
||||
//求各个类型的平均值(月表)
|
||||
Map<String, Double> avgEMM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementAverage)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count(天表)
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_count(月表)
|
||||
Map<String, Integer> sumECM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.summingInt(RStatEventMPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio_average(月表)
|
||||
Map<String, Double> avgEMRM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementRatioAverage)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventQPO rStatEventQPO = new RStatEventQPO();
|
||||
rStatEventQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventQPO.setDataDate(localDate);
|
||||
rStatEventQPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventQPO.setEventType(dictData.getId());
|
||||
rStatEventQPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEMM.get(dictData.getId()))));
|
||||
// todo
|
||||
rStatEventQPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventQPO.setEventCount(sumECM.get(dictData.getId()));
|
||||
rStatEventQPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMRM.get(dictData.getId()))));
|
||||
rStatEventQPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventQPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventQPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgQPO)) {
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgQPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgQPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventQPOList.add(rStatEventQPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*配网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
between("data_date", startDate, endDate);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
//季表
|
||||
rStatOrgQPOQueryWrapper.clear();
|
||||
rStatOrgQPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
between("data_date", startDate, endDate);
|
||||
;
|
||||
RStatOrgQPO rStatOrgQPO = rStatOrgQMapper.selectOne(rStatOrgQPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
//月表
|
||||
rStatEventMPOQueryWrapper.clear();
|
||||
rStatEventMPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
List<RStatEventMPO> rStatEventMPO = rStatEventMPOMapper.selectList(rStatEventMPOQueryWrapper);
|
||||
|
||||
//求各个类型的平均值(月表)
|
||||
Map<String, Double> avgEMM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementAverage)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count(天表)
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_count(月表)
|
||||
Map<String, Integer> sumECM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.summingInt(RStatEventMPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio_average(月表)
|
||||
Map<String, Double> avgEMRM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementRatioAverage)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventQPO rStatEventQPO = new RStatEventQPO();
|
||||
rStatEventQPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventQPO.setDataDate(localDate);
|
||||
rStatEventQPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventQPO.setEventType(dictData.getId());
|
||||
rStatEventQPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEMM.get(dictData.getId()))));
|
||||
// todo
|
||||
rStatEventQPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventQPO.setEventCount(sumECM.get(dictData.getId()));
|
||||
rStatEventQPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMRM.get(dictData.getId()))));
|
||||
rStatEventQPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventQPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventQPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgQPO)) {
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgQPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgQPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventQPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventQPOList.add(rStatEventQPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventQPOList)) {
|
||||
rStatEventQPOService.saveOrUpdateBatchByMultiId(rStatEventQPOList, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//年表
|
||||
public void rStartEventYHandler(List<DeptGetChildrenMoreDTO> data, String dataDate, Integer type) {
|
||||
List<RStatEventYPO> rStatEventYPOList = new ArrayList<>();
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
Date date = DateUtil.parse(dataDate);
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 获取当前年的起始日期和结束日期
|
||||
LocalDate date1 = LocalDate.parse(dataDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
LocalDate startDate = date1.withDayOfYear(1);
|
||||
LocalDate endDate = date1.withDayOfYear(365).plusDays(1);
|
||||
/*获取暂态统计指标*/
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
/*获取数据类型*/
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
/*获取监测点类型类型*/
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));
|
||||
|
||||
//详情表
|
||||
QueryWrapper<RMpEventDetailMPO> rMpEventDetailMPOQueryWrapper = new QueryWrapper<>();
|
||||
//org年表
|
||||
QueryWrapper<RStatOrgYPO> rStatOrgYPOQueryWrapper = new QueryWrapper<>();
|
||||
//天表
|
||||
QueryWrapper<RStatEventDPO> rStatEventDPOQueryWrapper = new QueryWrapper<>();
|
||||
//月表
|
||||
QueryWrapper<RStatEventMPO> rStatEventMPOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
data.forEach(deptGetChildrenMoreDTO -> {
|
||||
|
||||
/*主网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getLineBaseList())) {
|
||||
List<LineDevGetDTO> lineBaseList = deptGetChildrenMoreDTO.getLineBaseList();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = lineBaseList.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
between("data_date", startDate, endDate);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
//年表
|
||||
rStatOrgYPOQueryWrapper.clear();
|
||||
rStatOrgYPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId()).
|
||||
between("data_date", startDate, endDate);
|
||||
|
||||
RStatOrgYPO rStatOrgYPO = rStatOrgYMapper.selectOne(rStatOrgYPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
//月表
|
||||
rStatEventMPOQueryWrapper.clear();
|
||||
rStatEventMPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
List<RStatEventMPO> rStatEventMPO = rStatEventMPOMapper.selectList(rStatEventMPOQueryWrapper);
|
||||
|
||||
//求各个类型的平均值(月表)
|
||||
Map<String, Double> avgEMM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementAverage)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count(天表)
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_count(月表)
|
||||
Map<String, Integer> sumECM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.summingInt(RStatEventMPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio_average(月表)
|
||||
Map<String, Double> avgEMRM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementRatioAverage)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventYPO rStatEventYPO = new RStatEventYPO();
|
||||
rStatEventYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventYPO.setDataDate(localDate);
|
||||
rStatEventYPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventYPO.setEventType(dictData.getId());
|
||||
rStatEventYPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEMM.get(dictData.getId()))));
|
||||
// todo
|
||||
rStatEventYPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventYPO.setEventCount(sumECM.get(dictData.getId()));
|
||||
rStatEventYPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMRM.get(dictData.getId()))));
|
||||
rStatEventYPO.setDataType(dataTypeMap.get(DicDataEnum.MAINNET_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventYPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventYPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgYPO)) {
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgYPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgYPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventYPOList.add(rStatEventYPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*配网*/
|
||||
if (!CollectionUtils.isEmpty(deptGetChildrenMoreDTO.getPwMonitorIds())) {
|
||||
List<LineDevGetDTO> pwMonitorIds = deptGetChildrenMoreDTO.getPwMonitorIds();
|
||||
Map<Integer, List<LineDevGetDTO>> collect = pwMonitorIds.stream().collect(Collectors.groupingBy(LineDevGetDTO::getLineType));
|
||||
collect.forEach((k, v) -> {
|
||||
List<String> collect1 = v.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
rMpEventDetailMPOQueryWrapper.clear();
|
||||
rMpEventDetailMPOQueryWrapper.
|
||||
in("measurement_point_id", collect1).
|
||||
between("data_date", startDate, endDate);
|
||||
List<RMpEventDetailMPO> rMpEventDetailMPOS = rMpEventDetailMMapper.selectList(rMpEventDetailMPOQueryWrapper);
|
||||
|
||||
//年表
|
||||
rStatOrgYPOQueryWrapper.clear();
|
||||
rStatOrgYPOQueryWrapper.select("effective_measurement_accrued").
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId()).
|
||||
between("data_date", startDate, endDate);
|
||||
|
||||
RStatOrgYPO rStatOrgYPO = rStatOrgYMapper.selectOne(rStatOrgYPOQueryWrapper);
|
||||
|
||||
//天表
|
||||
rStatEventDPOQueryWrapper.clear();
|
||||
rStatEventDPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
List<RStatEventDPO> rStatEventDPO = rStatEventDPOMapper.selectList(rStatEventDPOQueryWrapper);
|
||||
|
||||
//月表
|
||||
rStatEventMPOQueryWrapper.clear();
|
||||
rStatEventMPOQueryWrapper.
|
||||
eq("org_no", deptGetChildrenMoreDTO.getUnitId()).
|
||||
between("data_date", startDate, endDate).
|
||||
eq("measurement_type_class", getmeasurementType(k, lineSortMap)).
|
||||
eq("data_type", dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
List<RStatEventMPO> rStatEventMPO = rStatEventMPOMapper.selectList(rStatEventMPOQueryWrapper);
|
||||
|
||||
//求各个类型的平均值(月表)
|
||||
Map<String, Double> avgEMM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementAverage)));
|
||||
|
||||
//event_measurement的和
|
||||
Map<String, Integer> sumEM = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventMeasurement)));
|
||||
|
||||
//event_count(天表)
|
||||
Map<String, Integer> sumEC = rStatEventDPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventDPO::getEventType, Collectors.summingInt(RStatEventDPO::getEventCount)));
|
||||
|
||||
//event_count(月表)
|
||||
Map<String, Integer> sumECM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.summingInt(RStatEventMPO::getEventCount)));
|
||||
|
||||
//event_measurement_ratio_average(月表)
|
||||
Map<String, Double> avgEMRM = rStatEventMPO.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventMPO::getEventType, Collectors.averagingDouble(RStatEventMPO::getEventMeasurementRatioAverage)));
|
||||
|
||||
|
||||
eventStatis.forEach(dictData -> {
|
||||
if (Objects.equals(dictData.getCode(), DicDataEnum.DISTURBANCE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.OTHER.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.RECORDING_WAVE.getCode())
|
||||
|| Objects.equals(dictData.getCode(), DicDataEnum.TOTAL_INDICATORS.getCode())) {
|
||||
return;
|
||||
}
|
||||
//累计发生暂态监测点数
|
||||
Integer statisData = getStatisQData(dictData, rMpEventDetailMPOS);
|
||||
|
||||
RStatEventYPO rStatEventYPO = new RStatEventYPO();
|
||||
rStatEventYPO.setOrgNo(deptGetChildrenMoreDTO.getUnitId());
|
||||
rStatEventYPO.setDataDate(localDate);
|
||||
rStatEventYPO.setMeasurementTypeClass(getmeasurementType(k, lineSortMap));
|
||||
rStatEventYPO.setEventType(dictData.getId());
|
||||
rStatEventYPO.setEventMeasurementAverage(Float.parseFloat(df.format(avgEMM.get(dictData.getId()))));
|
||||
// todo
|
||||
rStatEventYPO.setEventMeasurementAccrued(statisData);
|
||||
rStatEventYPO.setEventCount(sumECM.get(dictData.getId()));
|
||||
rStatEventYPO.setEventMeasurementRatioAverage(Float.parseFloat(df.format(avgEMRM.get(dictData.getId()))));
|
||||
rStatEventYPO.setDataType(dataTypeMap.get(DicDataEnum.DISTRIBUTION_POINT.getCode()).getId());
|
||||
|
||||
if (sumEM.get(dictData.getId()) == 0) {
|
||||
rStatEventYPO.setEventFreq(1.00f);
|
||||
} else {
|
||||
String value = df.format(sumEC.get(dictData.getId()) / sumEM.get(dictData.getId()).floatValue());
|
||||
rStatEventYPO.setEventFreq(Float.parseFloat(value));
|
||||
}
|
||||
if (Objects.isNull(rStatOrgYPO)) {
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
if (rStatOrgYPO.getEffectiveMeasurementAccrued() == 0) {
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(1.00f);
|
||||
} else {
|
||||
String value = df.format(statisData*100 / rStatOrgYPO.getEffectiveMeasurementAccrued().floatValue());
|
||||
rStatEventYPO.setEventMeasurementRatioAccrued(Float.parseFloat(value));
|
||||
}
|
||||
}
|
||||
rStatEventYPOList.add(rStatEventYPO);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(rStatEventYPOList)) {
|
||||
rStatEventYPOService.saveOrUpdateBatchByMultiId(rStatEventYPOList, 500);
|
||||
}
|
||||
}
|
||||
|
||||
//获取监测点类型 1/2/3类字典id
|
||||
private String getmeasurementType(Integer k, Map<String, DictData> lineSortMap) {
|
||||
|
||||
@@ -70,26 +70,6 @@ public class RStatSubstationServiceImpl implements RStatSubstationService {
|
||||
|
||||
private final RStatSubstationMPOMapper rStatSubstationMPOMapper;
|
||||
|
||||
// @Override
|
||||
// public void handler(List<DeptGetSubStationDTO> data, String dataDate, Integer type) {
|
||||
// switch (type) {
|
||||
// case 1:
|
||||
// this.rStatSubstationYHandler(data, dataDate, type);
|
||||
// break;
|
||||
// case 2:
|
||||
// this.rStatSubstationQHandler(data, dataDate, type);
|
||||
// break;
|
||||
// case 3:
|
||||
// this.rStatSubstationMHandler(data, dataDate, type);
|
||||
// break;
|
||||
// case 5:
|
||||
// this.rStatSubstationDHandler(data, dataDate, type);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -697,704 +677,4 @@ public class RStatSubstationServiceImpl implements RStatSubstationService {
|
||||
}
|
||||
|
||||
|
||||
// //天表
|
||||
// @Async("asyncExecutor")
|
||||
// public void rStatSubstationDHandler(List<DeptGetSubStationDTO> data, String dataDate, Integer type) {
|
||||
// List<RStatSubstationDPO> rStatSubstationDPOS = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
//
|
||||
// List<String> zwList = new ArrayList<>();
|
||||
// List<String> pwList = new ArrayList<>();
|
||||
//
|
||||
// for (DeptGetSubStationDTO datum : data) {
|
||||
// if (!CollectionUtils.isEmpty(datum.getStationIds())) {
|
||||
// zwList.addAll(datum.getStationIds());
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(datum.getPwStationIds())) {
|
||||
// pwList.addAll(datum.getPwStationIds());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zwList.addAll(pwList);
|
||||
// List<String> resultL = zwList.stream().distinct().collect(Collectors.toList());
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(resultL)) {
|
||||
//
|
||||
// resultL.forEach(z -> {
|
||||
// //获取监测点对象集合
|
||||
// LineDevGetBandDTO lineDevGetDTOs = commTerminalGeneralClient.substationGetLine(z).getData();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList()) || Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// //获取监测点id集合
|
||||
// List<String> lineIds = new ArrayList<>();
|
||||
// List<String> pLineIds = new ArrayList<>();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList())) {
|
||||
// lineIds = lineDevGetDTOs.getZwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// }
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// pLineIds = lineDevGetDTOs.getPwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// lineIds.addAll(pLineIds);
|
||||
// }
|
||||
// //判空
|
||||
// if (!CollectionUtils.isEmpty(lineIds)) {
|
||||
// int sw = 0, sa = 0, in = 0, result = 0;
|
||||
//
|
||||
// //r_mp_target_warn_d 表中字段求和
|
||||
// Map<String, Object> warnSum = rMpTargetWarnDMapper.getSumDate(dataDate, dataDate, lineIds);
|
||||
// //r_mp_part_harmonic_detail_d 表中字段求和
|
||||
// Map<String, Object> partSum = rMpPartHarmonicDetailDMapper.getPartSum(dataDate, dataDate, lineIds);
|
||||
// //r_mp_surplus_harmonic_detail_d 表中字段求和
|
||||
// Map<String, Object> surplusSum = mpSurplusHarmonicDetailDMapper.getSurplusSum(dataDate, dataDate, lineIds);
|
||||
// //r_mp_event_detail_d 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCount = rMpEventDetailDMapper.getSumAndCount(dataDate, dataDate, lineIds);
|
||||
//
|
||||
// RStatSubstationDPO rStatSubstationDPO = new RStatSubstationDPO();
|
||||
// rStatSubstationDPO.setDataDate(localDate);
|
||||
// rStatSubstationDPO.setSubstationId(z);
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(warnSum)) {
|
||||
// rStatSubstationDPO.setEffectiveMeasurementCount(warnSum.containsKey("iECount") ?
|
||||
// Integer.parseInt(warnSum.get("iECount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationDPO.setEffectiveMeasurementCount(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(partSum)) {
|
||||
// rStatSubstationDPO.setHarmonicCount(partSum.containsKey("isHarmonicCount") ?
|
||||
// Integer.parseInt(partSum.get("isHarmonicCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setFreqCount(partSum.containsKey("isFreqCount") ?
|
||||
// Integer.parseInt(partSum.get("isFreqCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setVDevCount(partSum.containsKey("isVDevCount") ?
|
||||
// Integer.parseInt(partSum.get("isVDevCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setVCount(partSum.containsKey("isVCount") ?
|
||||
// Integer.parseInt(partSum.get("isVCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setICount(partSum.containsKey("isICount") ?
|
||||
// Integer.parseInt(partSum.get("isICount").toString()) : 0);
|
||||
// rStatSubstationDPO.setUnbalanceCount(partSum.containsKey("isUnbalanceCount") ?
|
||||
// Integer.parseInt(partSum.get("isUnbalanceCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setINegCount(partSum.containsKey("isINegCount") ?
|
||||
// Integer.parseInt(partSum.get("isINegCount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationDPO.setHarmonicCount(0);
|
||||
// rStatSubstationDPO.setFreqCount(0);
|
||||
// rStatSubstationDPO.setVDevCount(0);
|
||||
// rStatSubstationDPO.setVCount(0);
|
||||
// rStatSubstationDPO.setICount(0);
|
||||
// rStatSubstationDPO.setUnbalanceCount(0);
|
||||
// rStatSubstationDPO.setINegCount(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(surplusSum)) {
|
||||
// rStatSubstationDPO.setFlickerCount(surplusSum.containsKey("isFlickerCount") ?
|
||||
// Integer.parseInt(surplusSum.get("isFlickerCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setInuharmCount(surplusSum.containsKey("isInuharmCount") ?
|
||||
// Integer.parseInt(surplusSum.get("isInuharmCount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationDPO.setFlickerCount(0);
|
||||
// rStatSubstationDPO.setInuharmCount(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(eventDetailSumAndCount)) {
|
||||
// rStatSubstationDPO.setEventMeasurementCount(eventDetailSumAndCount.containsKey("resultCount") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("resultCount").toString()) : 0);
|
||||
//
|
||||
// if (eventDetailSumAndCount.containsKey("swellTimesSum")) {
|
||||
// sw = Integer.parseInt(eventDetailSumAndCount.get("swellTimesSum").toString());
|
||||
// }
|
||||
// if (eventDetailSumAndCount.containsKey("sagTimesSum")) {
|
||||
// sa = Integer.parseInt(eventDetailSumAndCount.get("sagTimesSum").toString());
|
||||
// }
|
||||
// if (eventDetailSumAndCount.containsKey("interruptTimesSum")) {
|
||||
// in = Integer.parseInt(eventDetailSumAndCount.get("interruptTimesSum").toString());
|
||||
// }
|
||||
// result = sw + sa + in;
|
||||
// rStatSubstationDPO.setEventCount(result);
|
||||
//
|
||||
// rStatSubstationDPO.setSwellMeasurementCount(eventDetailSumAndCount.containsKey("swellTimesCount") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("swellTimesCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setSwellCount(sw);
|
||||
// rStatSubstationDPO.setSagMeasurementCount(eventDetailSumAndCount.containsKey("sagTimesCount") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("sagTimesCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setSagCount(sa);
|
||||
// rStatSubstationDPO.setInterruptMeasurementCount(eventDetailSumAndCount.containsKey("interruptTimesCount") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("interruptTimesCount").toString()) : 0);
|
||||
// rStatSubstationDPO.setInterruptCount(in);
|
||||
// } else {
|
||||
// rStatSubstationDPO.setEventMeasurementCount(0);
|
||||
// rStatSubstationDPO.setEventCount(0);
|
||||
// rStatSubstationDPO.setSwellMeasurementCount(0);
|
||||
// rStatSubstationDPO.setSwellCount(0);
|
||||
// rStatSubstationDPO.setSagMeasurementCount(0);
|
||||
// rStatSubstationDPO.setSagCount(0);
|
||||
// rStatSubstationDPO.setInterruptMeasurementCount(0);
|
||||
// rStatSubstationDPO.setInterruptCount(0);
|
||||
// }
|
||||
// rStatSubstationDPOS.add(rStatSubstationDPO);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(rStatSubstationDPOS)) {
|
||||
// List<RStatSubstationDPO> collect = rStatSubstationDPOS.stream().distinct().collect(Collectors.toList());
|
||||
// rStatSubstationDPOService.saveOrUpdateBatchByMultiId(collect, 500);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
// //月表
|
||||
// @Async("asyncExecutor")
|
||||
// public void rStatSubstationMHandler(List<DeptGetSubStationDTO> data, String dataDate, Integer type) {
|
||||
// List<RStatSubstationMPO> rStatSubstationMPOS = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
//
|
||||
// //传入字符串日期获取月的起始日期与结束日期
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTime(date);
|
||||
//
|
||||
// calendar.set(Calendar.DAY_OF_MONTH, 1); // 将日期设置为当月的第一天
|
||||
// String startTime = sdf.format(calendar.getTime()); // 获取当月的起始日期
|
||||
//
|
||||
// calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); // 将日期设置为当月的最后一天
|
||||
// String endTime = sdf.format(calendar.getTime());// 获取当月的结束日期
|
||||
//
|
||||
// List<String> zwList = new ArrayList<>();
|
||||
// List<String> pwList = new ArrayList<>();
|
||||
//
|
||||
// for (DeptGetSubStationDTO datum : data) {
|
||||
// if (!CollectionUtils.isEmpty(datum.getStationIds())) {
|
||||
// zwList.addAll(datum.getStationIds());
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(datum.getPwStationIds())) {
|
||||
// pwList.addAll(datum.getPwStationIds());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zwList.addAll(pwList);
|
||||
// List<String> resultL = zwList.stream().distinct().collect(Collectors.toList());
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(resultL)) {
|
||||
//
|
||||
// resultL.forEach(z -> {
|
||||
// //获取监测点对象集合
|
||||
// LineDevGetBandDTO lineDevGetDTOs = commTerminalGeneralClient.substationGetLine(z).getData();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList()) || Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// //获取监测点id集合
|
||||
// List<String> lineIds = new ArrayList<>();
|
||||
// List<String> pLineIds = new ArrayList<>();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList())) {
|
||||
// lineIds = lineDevGetDTOs.getZwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// }
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// pLineIds = lineDevGetDTOs.getPwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// lineIds.addAll(pLineIds);
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(lineIds)) {
|
||||
// //r_mp_target_warn_d 表中字段求和
|
||||
// Map<String, Object> warnSum = rMpTargetWarnDMapper.getSumDate(startTime, endTime, lineIds);
|
||||
// //r_mp_part_harmonic_detail_m 表中字段求和
|
||||
// Map<String, Object> partSum = rMpPartHarmonicDetailMMapper.getPartSum(startTime, endTime, lineIds);
|
||||
// //r_mp_surplus_harmonic_detail_m 表中字段求和
|
||||
// Map<String, Object> surplusSum = mpSurplusHarmonicDetailMMapper.getSurplusSum(startTime, endTime, lineIds);
|
||||
// //r_stat_substation_d 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCount = rStatSubstationDPOMapper.getSumAndCount(startTime, endTime, z);
|
||||
//
|
||||
// RStatSubstationMPO rStatSubstationMPO = new RStatSubstationMPO();
|
||||
// rStatSubstationMPO.setDataDate(localDate);
|
||||
// rStatSubstationMPO.setSubstationId(z);
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(warnSum)) {
|
||||
// rStatSubstationMPO.setEffectiveMeasurementAccrued(warnSum.containsKey("iECount") ?
|
||||
// Integer.parseInt(warnSum.get("iECount").toString()) : 0);
|
||||
//
|
||||
// } else {
|
||||
// rStatSubstationMPO.setEffectiveMeasurementAccrued(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(partSum)) {
|
||||
// rStatSubstationMPO.setHarmonicCount(partSum.containsKey("measurementOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("measurementOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setFreqCount(partSum.containsKey("freqOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("freqOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setVDevCount(partSum.containsKey("vDevOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("vDevOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setVCount(partSum.containsKey("vOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("vOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setICount(partSum.containsKey("iOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("iOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setUnbalanceCount(partSum.containsKey("unbalanceOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("unbalanceOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setINegCount(partSum.containsKey("iNegOverDayCount") ?
|
||||
// Integer.parseInt(partSum.get("iNegOverDayCount").toString()) : 0);
|
||||
//
|
||||
// } else {
|
||||
// rStatSubstationMPO.setHarmonicCount(0);
|
||||
// rStatSubstationMPO.setFreqCount(0);
|
||||
// rStatSubstationMPO.setVDevCount(0);
|
||||
// rStatSubstationMPO.setVCount(0);
|
||||
// rStatSubstationMPO.setICount(0);
|
||||
// rStatSubstationMPO.setUnbalanceCount(0);
|
||||
// rStatSubstationMPO.setINegCount(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(surplusSum)) {
|
||||
// rStatSubstationMPO.setFlickerCount(surplusSum.containsKey("flickerOverDayCount") ?
|
||||
// Integer.parseInt(surplusSum.get("flickerOverDayCount").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setInuharmCount(surplusSum.containsKey("inuharmOverDayCount") ?
|
||||
// Integer.parseInt(surplusSum.get("inuharmOverDayCount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationMPO.setFlickerCount(0);
|
||||
// rStatSubstationMPO.setInuharmCount(0);
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(eventDetailSumAndCount)) {
|
||||
// rStatSubstationMPO.setEffectiveMeasurementAverage(eventDetailSumAndCount.containsKey("effectiveMeasurementCountAvg") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("effectiveMeasurementCountAvg").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setHarmonicOverDay(eventDetailSumAndCount.containsKey("harmonicCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("harmonicCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setFreqOverDay(eventDetailSumAndCount.containsKey("freqCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("freqCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setVDevOverDay(eventDetailSumAndCount.containsKey("vDevCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("vDevCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setVOverDay(eventDetailSumAndCount.containsKey("vCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("vCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setIOverDay(eventDetailSumAndCount.containsKey("iCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("iCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setUnbalanceOverDay(eventDetailSumAndCount.containsKey("unbalanceCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("unbalanceCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setINegOverDay(eventDetailSumAndCount.containsKey("iNegCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("iNegCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setFlickerOverDay(eventDetailSumAndCount.containsKey("flickerCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("flickerCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setInuharmOverDay(eventDetailSumAndCount.containsKey("inuharmCountCount") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("inuharmCountCount").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setEventCount(eventDetailSumAndCount.containsKey("eventCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("eventCountSum").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setEventFreq(eventDetailSumAndCount.containsKey("eventCountFrequency") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("eventCountFrequency").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setSagCount(eventDetailSumAndCount.containsKey("sagCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("sagCountSum").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setSagFreq(eventDetailSumAndCount.containsKey("sagCountFrequency") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("sagCountFrequency").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setSwellCount(eventDetailSumAndCount.containsKey("swellCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("swellCountSum").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setSwellFreq(eventDetailSumAndCount.containsKey("swellCountFrequency") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("swellCountFrequency").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationMPO.setInterruptCount(eventDetailSumAndCount.containsKey("interruptCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCount.get("interruptCountSum").toString()) : 0);
|
||||
//
|
||||
// rStatSubstationMPO.setInterruptFreq(eventDetailSumAndCount.containsKey("interruptCountFrequency") ?
|
||||
// Float.parseFloat(eventDetailSumAndCount.get("interruptCountFrequency").toString()) : 0.0f);
|
||||
//
|
||||
// } else {
|
||||
// rStatSubstationMPO.setEffectiveMeasurementAverage(0.0f);
|
||||
// rStatSubstationMPO.setHarmonicOverDay(0.0f);
|
||||
// rStatSubstationMPO.setFreqOverDay(0.0f);
|
||||
// rStatSubstationMPO.setVDevOverDay(0.0f);
|
||||
// rStatSubstationMPO.setVOverDay(0.0f);
|
||||
// rStatSubstationMPO.setIOverDay(0.0f);
|
||||
// rStatSubstationMPO.setUnbalanceOverDay(0.0f);
|
||||
// rStatSubstationMPO.setINegOverDay(0.0f);
|
||||
// rStatSubstationMPO.setFlickerOverDay(0.0f);
|
||||
// rStatSubstationMPO.setInuharmOverDay(0.0f);
|
||||
// rStatSubstationMPO.setEventCount(0);
|
||||
// rStatSubstationMPO.setEventFreq(0.0f);
|
||||
// rStatSubstationMPO.setSagCount(0);
|
||||
// rStatSubstationMPO.setSagFreq(0.0f);
|
||||
// rStatSubstationMPO.setSwellCount(0);
|
||||
// rStatSubstationMPO.setSwellFreq(0.0f);
|
||||
// rStatSubstationMPO.setInterruptCount(0);
|
||||
// rStatSubstationMPO.setInterruptFreq(0.0f);
|
||||
// }
|
||||
// rStatSubstationMPOS.add(rStatSubstationMPO);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(rStatSubstationMPOS)) {
|
||||
// List<RStatSubstationMPO> collect = rStatSubstationMPOS.stream().distinct().collect(Collectors.toList());
|
||||
// rStatSubstationMPOService.saveOrUpdateBatchByMultiId(collect, 500);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //季表
|
||||
// @Async("asyncExecutor")
|
||||
// public void rStatSubstationQHandler(List<DeptGetSubStationDTO> data, String dataDate, Integer type) {
|
||||
// List<RStatSubstationQPO> rStatSubstationQPOS = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// DecimalFormat df = new DecimalFormat("0.00");
|
||||
//
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// // 计算季度的开始日期和结束日期
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTime(date);
|
||||
// int quarter = (calendar.get(Calendar.MONTH) / 3) + 1; // 计算日期所在的季度
|
||||
// calendar.set(Calendar.MONTH, (quarter - 1) * 3); // 设置季度开始的月份
|
||||
// calendar.set(Calendar.DAY_OF_MONTH, 1); // 设置季度开始的日期
|
||||
// String startTime = sdf.format(calendar.getTime());// 季度开始日期
|
||||
// calendar.add(Calendar.MONTH, 2); // 添加两个月,使其到季度结束的月份
|
||||
// calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); // 设置季度结束的日期 - 月份最后一天
|
||||
// String endTime = sdf.format(calendar.getTime()); // 季度结束日期
|
||||
//
|
||||
// List<String> zwList = new ArrayList<>();
|
||||
// List<String> pwList = new ArrayList<>();
|
||||
//
|
||||
// for (DeptGetSubStationDTO datum : data) {
|
||||
// if (!CollectionUtils.isEmpty(datum.getStationIds())) {
|
||||
// zwList.addAll(datum.getStationIds());
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(datum.getPwStationIds())) {
|
||||
// pwList.addAll(datum.getPwStationIds());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zwList.addAll(pwList);
|
||||
// List<String> resultL = zwList.stream().distinct().collect(Collectors.toList());
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(resultL)) {
|
||||
//
|
||||
// resultL.forEach(z -> {
|
||||
// //获取监测点对象集合
|
||||
// LineDevGetBandDTO lineDevGetDTOs = commTerminalGeneralClient.substationGetLine(z).getData();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList()) || Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// //获取监测点id集合
|
||||
// List<String> lineIds = new ArrayList<>();
|
||||
// List<String> pLineIds = new ArrayList<>();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList())) {
|
||||
// lineIds = lineDevGetDTOs.getZwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// }
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// pLineIds = lineDevGetDTOs.getPwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// lineIds.addAll(pLineIds);
|
||||
// }
|
||||
// //判空
|
||||
// if (!CollectionUtils.isEmpty(lineIds)) {
|
||||
// //r_mp_target_warn_d 表中字段求和
|
||||
// Map<String, Object> warnSum = rMpTargetWarnDMapper.getSumDate(startTime, endTime, lineIds);
|
||||
// //r_stat_substation_d 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCountD = rStatSubstationDPOMapper.getSumAndCountQ(startTime, endTime, z);
|
||||
// //r_stat_substation_m 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCountM = rStatSubstationMPOMapper.getSumAndCount(startTime, endTime, z);
|
||||
//
|
||||
// RStatSubstationQPO rStatSubstationQPO = new RStatSubstationQPO();
|
||||
// rStatSubstationQPO.setDataDate(localDate);
|
||||
// rStatSubstationQPO.setSubstationId(z);
|
||||
// if (!CollectionUtils.isEmpty(warnSum)) {
|
||||
// rStatSubstationQPO.setEffectiveMeasurementAccrued(warnSum.containsKey("iECount") ?
|
||||
// Integer.parseInt(warnSum.get("iECount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationQPO.setEffectiveMeasurementAccrued(0);
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(eventDetailSumAndCountM)) {
|
||||
//
|
||||
// rStatSubstationQPO.setEffectiveMeasurementAverage(eventDetailSumAndCountM.containsKey("effectiveMeasurementCountAvg") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("effectiveMeasurementCountAvg").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setHarmonicAverageOverDay(eventDetailSumAndCountM.containsKey("harmonicAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("harmonicAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setFreqAverageOverDay(eventDetailSumAndCountM.containsKey("freqAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("freqAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setVDevAverageOverDay(eventDetailSumAndCountM.containsKey("vDevAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("vDevAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setVAverageOverDay(eventDetailSumAndCountM.containsKey("vAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("vAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setIAverageOverDay(eventDetailSumAndCountM.containsKey("iAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("iAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setUnbalanceAverageOverDay(eventDetailSumAndCountM.containsKey("unbalanceAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("unbalanceAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setINegAverageOverDay(eventDetailSumAndCountM.containsKey("iNegAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("iNegAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setFlickerAverageOverDay(eventDetailSumAndCountM.containsKey("flickerAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("flickerAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setInuharmAverageOverDay(eventDetailSumAndCountM.containsKey("inuharmAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("inuharmAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationQPO.setEventCount(eventDetailSumAndCountM.containsKey("eventCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("eventCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("eventMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("eventCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("eventMeasurementCountSum").toString()));
|
||||
// rStatSubstationQPO.setEventFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationQPO.setEventFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationQPO.setSagCount(eventDetailSumAndCountM.containsKey("sagCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("sagCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("sagMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("sagCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("sagMeasurementCountSum").toString()));
|
||||
// rStatSubstationQPO.setSagFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationQPO.setSagFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationQPO.setSwellCount(eventDetailSumAndCountM.containsKey("swellCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("swellCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("swellMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("swellCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("swellMeasurementCountSum").toString()));
|
||||
// rStatSubstationQPO.setSwellFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationQPO.setSwellFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationQPO.setInterruptCount(eventDetailSumAndCountM.containsKey("interruptCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("interruptCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("interruptMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("interruptCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("interruptMeasurementCountSum").toString()));
|
||||
// rStatSubstationQPO.setInterruptFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationQPO.setInterruptFreq(0.0f);
|
||||
// }
|
||||
// } else {
|
||||
// rStatSubstationQPO.setEffectiveMeasurementAverage(0.0f);
|
||||
// rStatSubstationQPO.setHarmonicAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setFreqAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setVDevAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setVAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setIAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setUnbalanceAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setINegAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setFlickerAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setInuharmAverageOverDay(0.0f);
|
||||
// rStatSubstationQPO.setEventCount(0);
|
||||
// rStatSubstationQPO.setEventFreq(0.0f);
|
||||
// rStatSubstationQPO.setSagCount(0);
|
||||
// rStatSubstationQPO.setSagFreq(0.0f);
|
||||
// rStatSubstationQPO.setSwellCount(0);
|
||||
// rStatSubstationQPO.setSwellFreq(0.0f);
|
||||
// rStatSubstationQPO.setInterruptCount(0);
|
||||
// rStatSubstationQPO.setInterruptFreq(0.0f);
|
||||
// }
|
||||
// rStatSubstationQPOS.add(rStatSubstationQPO);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(rStatSubstationQPOS)) {
|
||||
// List<RStatSubstationQPO> collect = rStatSubstationQPOS.stream().distinct().collect(Collectors.toList());
|
||||
// rStatSubstationQPOService.saveOrUpdateBatchByMultiId(collect, 500);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //年表
|
||||
// @Async("asyncExecutor")
|
||||
// public void rStatSubstationYHandler(List<DeptGetSubStationDTO> data, String dataDate, Integer type) {
|
||||
// List<RStatSubstationYPO> rStatSubstationYPOS = new ArrayList<>();
|
||||
// Date date = DateUtil.parse(dataDate);
|
||||
// LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// DecimalFormat df = new DecimalFormat("0.00");
|
||||
//
|
||||
// // 获取当前年的起始日期和结束日期
|
||||
// LocalDate date1 = LocalDate.parse(dataDate, DateTimeFormatter.ISO_DATE); // 将字符串解析为LocalDate对象
|
||||
//
|
||||
// // 获取当年的开始天
|
||||
// LocalDate yearStartDate = date1.withDayOfYear(1);
|
||||
// String startTime = yearStartDate.format(DateTimeFormatter.ISO_DATE); // 将LocalDate对象转换为字符串日期
|
||||
//
|
||||
// // 获取当年的结束天
|
||||
// LocalDate yearEndDate = date1.withDayOfYear(date1.lengthOfYear());
|
||||
// String endTime = yearEndDate.format(DateTimeFormatter.ISO_DATE); // 将LocalDate对象转换为字符串日期
|
||||
//
|
||||
// List<String> zwList = new ArrayList<>();
|
||||
// List<String> pwList = new ArrayList<>();
|
||||
//
|
||||
// for (DeptGetSubStationDTO datum : data) {
|
||||
// if (!CollectionUtils.isEmpty(datum.getStationIds())) {
|
||||
// zwList.addAll(datum.getStationIds());
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(datum.getPwStationIds())) {
|
||||
// pwList.addAll(datum.getPwStationIds());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zwList.addAll(pwList);
|
||||
// List<String> resultL = zwList.stream().distinct().collect(Collectors.toList());
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(resultL)) {
|
||||
//
|
||||
// resultL.forEach(z -> {
|
||||
// //获取监测点对象集合
|
||||
// LineDevGetBandDTO lineDevGetDTOs = commTerminalGeneralClient.substationGetLine(z).getData();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList()) || Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// //获取监测点id集合
|
||||
// List<String> lineIds = new ArrayList<>();
|
||||
// List<String> pLineIds = new ArrayList<>();
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getZwList())) {
|
||||
// lineIds = lineDevGetDTOs.getZwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// }
|
||||
// if (Objects.nonNull(lineDevGetDTOs.getPwList())) {
|
||||
// pLineIds = lineDevGetDTOs.getPwList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
// lineIds.addAll(pLineIds);
|
||||
// }
|
||||
// //判空
|
||||
// if (!CollectionUtils.isEmpty(lineIds)) {
|
||||
// //r_mp_target_warn_d 表中字段求和
|
||||
// Map<String, Object> warnSum = rMpTargetWarnDMapper.getSumDate(startTime, endTime, lineIds);
|
||||
// //r_stat_substation_d 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCountD = rStatSubstationDPOMapper.getSumAndCountQ(startTime, endTime, z);
|
||||
// //r_stat_substation_m 表中字段求和及计数
|
||||
// Map<String, Object> eventDetailSumAndCountM = rStatSubstationMPOMapper.getSumAndCount(startTime, endTime, z);
|
||||
//
|
||||
// RStatSubstationYPO rStatSubstationYPO = new RStatSubstationYPO();
|
||||
// rStatSubstationYPO.setDataDate(localDate);
|
||||
// rStatSubstationYPO.setSubstationId(z);
|
||||
// if (!CollectionUtils.isEmpty(warnSum)) {
|
||||
// rStatSubstationYPO.setEffectiveMeasurementAccrued(warnSum.containsKey("iECount") ?
|
||||
// Integer.parseInt(warnSum.get("iECount").toString()) : 0);
|
||||
// } else {
|
||||
// rStatSubstationYPO.setEffectiveMeasurementAccrued(0);
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(eventDetailSumAndCountM)) {
|
||||
//
|
||||
// rStatSubstationYPO.setEffectiveMeasurementAverage(eventDetailSumAndCountM.containsKey("effectiveMeasurementCountAvg") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("effectiveMeasurementCountAvg").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setHarmonicAverageOverDay(eventDetailSumAndCountM.containsKey("harmonicAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("harmonicAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setFreqAverageOverDay(eventDetailSumAndCountM.containsKey("freqAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("freqAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setVDevAverageOverDay(eventDetailSumAndCountM.containsKey("vDevAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("vDevAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setVAverageOverDay(eventDetailSumAndCountM.containsKey("vAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("vAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setIAverageOverDay(eventDetailSumAndCountM.containsKey("iAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("iAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setUnbalanceAverageOverDay(eventDetailSumAndCountM.containsKey("unbalanceAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("unbalanceAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setINegAverageOverDay(eventDetailSumAndCountM.containsKey("iNegAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("iNegAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setFlickerAverageOverDay(eventDetailSumAndCountM.containsKey("flickerAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("flickerAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setInuharmAverageOverDay(eventDetailSumAndCountM.containsKey("inuharmAverageOverDay") ?
|
||||
// Float.parseFloat(eventDetailSumAndCountM.get("inuharmAverageOverDay").toString()) : 0.0f);
|
||||
//
|
||||
// rStatSubstationYPO.setEventCount(eventDetailSumAndCountM.containsKey("eventCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("eventCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("eventMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("eventCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("eventMeasurementCountSum").toString()));
|
||||
// rStatSubstationYPO.setEventFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationYPO.setEventFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationYPO.setSagCount(eventDetailSumAndCountM.containsKey("sagCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("sagCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("sagMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("sagCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("sagMeasurementCountSum").toString()));
|
||||
// rStatSubstationYPO.setSagFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationYPO.setSagFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationYPO.setSwellCount(eventDetailSumAndCountM.containsKey("swellCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("swellCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("swellMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("swellCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("swellMeasurementCountSum").toString()));
|
||||
// rStatSubstationYPO.setSwellFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationYPO.setSwellFreq(0.0f);
|
||||
// }
|
||||
//
|
||||
// rStatSubstationYPO.setInterruptCount(eventDetailSumAndCountM.containsKey("interruptCountSum") ?
|
||||
// Integer.parseInt(eventDetailSumAndCountM.get("interruptCountSum").toString()) : 0);
|
||||
//
|
||||
// if (!Objects.equals("0", eventDetailSumAndCountD.get("interruptMeasurementCountSum").toString())) {
|
||||
// String value = df.format(Float.parseFloat(eventDetailSumAndCountM.get("interruptCountSum").toString())
|
||||
// / Float.parseFloat(eventDetailSumAndCountD.get("interruptMeasurementCountSum").toString()));
|
||||
// rStatSubstationYPO.setInterruptFreq(Float.parseFloat(value));
|
||||
// } else {
|
||||
// rStatSubstationYPO.setInterruptFreq(0.0f);
|
||||
// }
|
||||
// } else {
|
||||
// rStatSubstationYPO.setEffectiveMeasurementAverage(0.0f);
|
||||
// rStatSubstationYPO.setHarmonicAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setFreqAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setVDevAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setVAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setIAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setUnbalanceAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setINegAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setFlickerAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setInuharmAverageOverDay(0.0f);
|
||||
// rStatSubstationYPO.setEventCount(0);
|
||||
// rStatSubstationYPO.setEventFreq(0.0f);
|
||||
// rStatSubstationYPO.setSagCount(0);
|
||||
// rStatSubstationYPO.setSagFreq(0.0f);
|
||||
// rStatSubstationYPO.setSwellCount(0);
|
||||
// rStatSubstationYPO.setSwellFreq(0.0f);
|
||||
// rStatSubstationYPO.setInterruptCount(0);
|
||||
// rStatSubstationYPO.setInterruptFreq(0.0f);
|
||||
// }
|
||||
// rStatSubstationYPOS.add(rStatSubstationYPO);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (!CollectionUtils.isEmpty(rStatSubstationYPOS)) {
|
||||
// List<RStatSubstationYPO> collect = rStatSubstationYPOS.stream().distinct().collect(Collectors.toList());
|
||||
// rStatSubstationYPOService.saveOrUpdateBatchByMultiId(collect, 500);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user