预处理兼容pq/pms处理

This commit is contained in:
2023-09-21 09:15:48 +08:00
parent 79865cc395
commit d868558c6e
22 changed files with 771 additions and 508 deletions

View File

@@ -0,0 +1,68 @@
package com.njcn.common.utils;
import lombok.extern.slf4j.Slf4j;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* pqs
*
* @author cdf
* @date 2023/9/20
*/
@Slf4j
public class NjcnDateUtils {
/**
* 传入两个时间范围,返回这两个时间范围内的所有日期,并保存在一个集合中
*
* @param beginTime
* @param endTime
* @return
* @throws Exception
*/
public static List<String> findEveryDay(String beginTime, String endTime) {
//创建一个放所有日期的集合
List<String> dates = new ArrayList<>();
//创建时间解析对象规定解析格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//将传入的时间解析成Date类型,相当于格式化
Date dBegin = null;
Date dEnd = null;
try {
dBegin = sdf.parse(beginTime);
dEnd = sdf.parse(endTime);
} catch (ParseException e) {
log.error("获取两个时间段范围异常,异常信息"+e.getMessage());
return new ArrayList<>();
}
//将格式化后的第一天添加进集合
dates.add(sdf.format(dBegin));
//使用本地的时区和区域获取日历
Calendar calBegin = Calendar.getInstance();
//传入起始时间将此日历设置为起始日历
calBegin.setTime(dBegin);
//判断结束日期前一天是否在起始日历的日期之后
while (dEnd.after(calBegin.getTime())) {
//根据日历的规则:月份中的每一天,为起始日历加一天
calBegin.add(Calendar.DAY_OF_MONTH, 1);
//得到的每一天就添加进集合
dates.add(sdf.format(calBegin.getTime()));
//如果当前的起始日历超过结束日期后,就结束循环
}
return dates;
}
}

View File

@@ -116,6 +116,9 @@ public interface CommTerminalGeneralClient {
@GetMapping("/getRunMonitorIds")
HttpResult<List<String>> getRunMonitorIds();
@PostMapping("/getMonitorDetailList")
HttpResult<List<LineDevGetDTO>> getMonitorDetailList(@RequestBody List<String> list);
/**
* 用于返回pq 还是pms系统
* @author cdf

View File

@@ -92,6 +92,12 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<LineDevGetDTO>> getMonitorDetailList(List<String> list) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点详细信息集合", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<String> isPqOrPms() {
log.error("{}异常,降级处理,异常为:{}", "返回pq还是pms系统", throwable.toString());

View File

@@ -63,6 +63,9 @@ public class LineDevGetDTO {
*/
private Integer comFlag;
/**
* 装置数据最新更新时间
*/
private LocalDateTime updateTime;

View File

@@ -21,6 +21,10 @@ import com.njcn.device.pms.pojo.po.TerminalLog;
import com.njcn.device.pms.pojo.vo.DoubleUserVO;
import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService;
import com.njcn.device.pms.service.majornetwork.ITerminalLogService;
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.web.utils.RequestUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -36,6 +40,7 @@ import com.njcn.web.controller.BaseController;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -58,6 +63,7 @@ public class PmsDistributionMonitorController extends BaseController {
private final ITerminalLogService iTerminalLogService;
/**
* 新增配网监测点表
* @author cdf
@@ -294,5 +300,20 @@ public class PmsDistributionMonitorController extends BaseController {
}
/**
* 批量给配网监测点录入单位id
* @author cdf
* @date 2023/9/20
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/disMonitorWriteOrgId")
@ApiOperation("批量修改配网里的单位")
public HttpResult<Boolean> disMonitorWriteOrgId() {
String methodDescribe = getMethodDescribe("disMonitorWriteOrgId");
iDistributionMonitorService.disMonitorWriteOrgId();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -115,4 +115,6 @@ public interface IDistributionMonitorService extends IMppService<DistributionMon
*/
Boolean batchOpDistributionArea();
Boolean disMonitorWriteOrgId();
}

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.TimeInterval;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -110,6 +111,7 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
distributionMonitor.setMonitorId(monitor.getId());
distributionMonitor.setCreatedDate(LocalDateTime.now());
distributionMonitor.setIfPowerUser(0);
distributionMonitor.setOrgId(monitor.getOrgId());
distributionMonitor.setMonitorState(monitor.getMonitorState());
distributionMonitor.setVoltageLevel(monitor.getVoltageLevel());
distributionMonitor.setStatus(DataStateEnum.ENABLE.getCode());
@@ -129,6 +131,7 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
}
PowerDistributionarea powerDistributionareaTem = powerDistributionareaMapper.selectById(powerDistributionarea.getId());
distributionMonitor.setMonitorId(powerDistributionarea.getId());
distributionMonitor.setOrgId(powerDistributionarea.getOrgId());
distributionMonitor.setCreatedDate(LocalDateTime.now());
distributionMonitor.setIfPowerUser(0);
distributionMonitor.setMonitorState(distributionMonitorParam.getMonitorState());
@@ -158,7 +161,7 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
}
distributionMonitor.setIfPowerUser(1);
distributionMonitor.setVoltageLevel(powerGenerationUser.getVoltageLevel());
distributionMonitor.setOrgId(powerGenerationUser.getOrgId());
} else {
//用电
PowerClient powerClient = powerClientMapper.selectById(distributionMonitorParam.getMonitorId());
@@ -167,6 +170,7 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
}
distributionMonitor.setIfPowerUser(0);
distributionMonitor.setVoltageLevel(powerClient.getVoltageLevel());
distributionMonitor.setOrgId(powerClient.getOrgId());
}
distributionMonitor.setMonitorId(distributionMonitorParam.getMonitorId());
@@ -486,6 +490,58 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
return true;
}
@Override
public Boolean disMonitorWriteOrgId() {
List<DistributionMonitor> distributionMonitorList = this.list();
if(CollectionUtil.isNotEmpty(distributionMonitorList)){
Map<String,List<DistributionMonitor>> map = distributionMonitorList.stream().collect(Collectors.groupingBy(DistributionMonitor::getMonitorSort));
List<DistributionMonitor> po = new ArrayList<>();
map.forEach((key,val)->{
if(key.equals("78a96acb276a5fe9d6eff737fdf1973f")){
List<DistributionMonitor> one = map.get("78a96acb276a5fe9d6eff737fdf1973f");
List<String> oneIds = one.stream().map(DistributionMonitor::getMonitorId).distinct().collect(Collectors.toList());
List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().in(Monitor::getId,oneIds));
for(Monitor monitor:monitorList){
DistributionMonitor distributionMonitor = new DistributionMonitor();
distributionMonitor.setMonitorId(monitor.getId());
distributionMonitor.setOrgId(monitor.getOrgId());
LambdaUpdateWrapper<DistributionMonitor> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(DistributionMonitor::getOrgId,distributionMonitor.getOrgId()).eq(DistributionMonitor::getMonitorId,distributionMonitor.getMonitorId());
this.update(updateWrapper);
}
}else if(key.equals("a5696acb276a5fe9d6eff74fdf1973f")){
List<DistributionMonitor> two = map.get("a5696acb276a5fe9d6eff74fdf1973f");
List<String> twoIds = two.stream().map(DistributionMonitor::getMonitorId).distinct().collect(Collectors.toList());
List<PowerDistributionarea> monitorList = powerDistributionareaMapper.selectList(new LambdaQueryWrapper<PowerDistributionarea>().in(PowerDistributionarea::getId,twoIds));
for(PowerDistributionarea monitor:monitorList){
DistributionMonitor distributionMonitor = new DistributionMonitor();
distributionMonitor.setMonitorId(monitor.getId());
distributionMonitor.setOrgId(monitor.getOrgId());
LambdaUpdateWrapper<DistributionMonitor> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(DistributionMonitor::getOrgId,distributionMonitor.getOrgId()).eq(DistributionMonitor::getMonitorId,distributionMonitor.getMonitorId());
this.update(updateWrapper);
}
}else {
List<DistributionMonitor> two = map.get("a5696acb276a5fe9d6eff74fdf1973f");
List<String> twoIds = two.stream().map(DistributionMonitor::getMonitorId).distinct().collect(Collectors.toList());
List<PowerDistributionarea> monitorList = powerDistributionareaMapper.selectList(new LambdaQueryWrapper<PowerDistributionarea>().in(PowerDistributionarea::getId,twoIds));
}
});
}
return true;
}
private void overLimitAdd(String voltageLevel, String id) {
DictData voltageDic = dicDataFeignClient.getDicDataById(voltageLevel).getData();
float voltageLevelValue = Float.parseFloat(voltageDic.getValue());

View File

@@ -7,10 +7,13 @@ 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.LogUtil;
import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.mapper.LineDetailMapper;
import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.LineDetail;
import com.njcn.device.pq.service.CommTerminalService;
import com.njcn.device.pq.service.LineService;
import com.njcn.web.controller.BaseController;
@@ -45,14 +48,16 @@ public class CommTerminalController extends BaseController {
private final LineMapper lineMapper;
/**
* 通过部门获取所有子集部门所拥有的监测点
* 通过部门获取所有子集部门所拥有的监测点基本信息
*
* @author cdf
* @date 2023/4/24
*/
@PostMapping("deptGetLineIds")
@ApiOperation("通过部门获取所有子集部门所拥有的监测点")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -68,6 +73,8 @@ public class CommTerminalController extends BaseController {
* @date 2023/5/10
*/
@PostMapping("getDeptChildrenByParent")
@ApiOperation("根据单位获取所有子单位信息")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetBase>> getDeptChildrenByParent(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -78,12 +85,13 @@ public class CommTerminalController extends BaseController {
}
/**
* 根据单位获取监测点信息
* 根据单位获取监测点详细信息
* @author cdf
* @date 2023/5/10
*/
@PostMapping("deptGetLine")
@ApiOperation("根据单位获取监测点信息")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -103,6 +111,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("deptGetSubStation")
@ApiOperation("根据单位获取所有变电站")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetSubStationDTO>> deptSubStation(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -119,6 +128,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("deptGetBusBar")
@ApiOperation("根据单位获取所有母线")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetBusBarDTO>> deptBusBar(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -137,6 +147,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("deptGetDevice")
@ApiOperation("根据单位获取所有装置")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -153,6 +164,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("deptGetDeviceAndMonitor")
@ApiOperation("根据单位获取装置以及监测点")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetDeviceDTO>> deptGetDeviceAndMonitor(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
@@ -169,6 +181,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("substationGetLine")
@ApiOperation("根据电站获取所有监测点")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "substationId", value = "请求体", required = true)
public HttpResult<LineDevGetBandDTO> substationGetLine(@RequestParam("substationId")String substationId) {
TimeInterval timer = new TimeInterval();
@@ -186,6 +199,7 @@ public class CommTerminalController extends BaseController {
*/
@PostMapping("busBarGetLine")
@ApiOperation("根据母线id获取监测点信息")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiImplicitParam(name = "busBarId", value = "请求体", required = true)
public HttpResult<LineDevGetBandDTO> busBarGetLine(@RequestParam("busBarId")String busBarId) {
TimeInterval timer = new TimeInterval();
@@ -229,4 +243,21 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据监测点集合获取监测点详情
* @author cdf
* @date 2023/9/21
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getMonitorDetailList")
@ApiOperation("根据监测点集合获取监测点详情")
@ApiImplicitParam(name = "list", value = "监测点集合")
public HttpResult<List<LineDevGetDTO>> getMonitorDetailList(@RequestBody List<String> list) {
String methodDescribe = getMethodDescribe("getMonitorDetailList");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineMapper.getMonitorListDetail(list), methodDescribe);
}
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.pojo.advanced.UpDevVO;
@@ -436,6 +437,13 @@ public interface LineMapper extends BaseMapper<Line> {
List<LineDevGetDTO> getLineBySubStation(@Param("subId") String subId);
/**
* 根据监测点集合获取监测详细信息
* @author cdf
* @date 2023/9/20
*/
List<LineDevGetDTO> getMonitorListDetail(@Param("monitorIds") List<String> monitorIds);
/**
* 根据条件进行监测筛选出监测点id
*

View File

@@ -1105,6 +1105,20 @@
</select>
<select id="getMonitorListDetail" resultType="LineDevGetDTO">
select line.id pointId,dev.id devId,0 type,1 lineType,lineDetail.Time_Interval interval
from pq_line line
inner join pq_line_detail lineDetail on line.id = lineDetail.id
inner join pq_line subv on line.pid = subv.id
inner join pq_line dev on subv.pid = dev.id
where line.id in
<foreach collection="monitorIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getLineByIDs" resultType="java.lang.String">
SELECT DISTINCT
line.id

View File

@@ -36,6 +36,11 @@ public interface CommTerminalService {
*/
List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam);
List<DeptGetChildrenMoreDTO> deptGetLineByIdList(List<String> monitorIds);
/**
* 根据单位获取所有变电站
* @author cdf

View File

@@ -18,9 +18,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -35,6 +33,7 @@ import java.util.stream.Stream;
@RequiredArgsConstructor
public class CommTerminalServiceImpl implements CommTerminalService {
//redis前缀
private final String commTerminal = "commTerminal#";
private final DeptLineService deptLineService;
@@ -94,13 +93,27 @@ public class CommTerminalServiceImpl implements CommTerminalService {
lineList.addAll(map.get(i));
}
});
deptGetChildrenMoreDTO.setLineBaseList(lineList);
//去重
ArrayList<LineDevGetDTO> collect = lineList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(LineDevGetDTO::getPointId)
)), ArrayList::new));
deptGetChildrenMoreDTO.setLineBaseList(collect);
}
result.add(deptGetChildrenMoreDTO);
});
return result;
}
@Override
public List<DeptGetChildrenMoreDTO> deptGetLineByIdList(List<String> monitorIds) {
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
lineMapper.getMonitorListDetail(monitorIds);
return null;
}
@Override
public List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam) {

View File

@@ -540,11 +540,9 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
this.mqttSendCount = 0;
this.mqttJsonMsg = json;
this.mqttSendTopic = topic;
flag = true;
while (flag) {
}
Thread.sleep(3000);
}
} else {
@@ -570,9 +568,7 @@ public class EleAirStrategyServiceImpl extends ServiceImpl<AirStrategyMapper, Ai
this.mqttJsonMsg = json;
this.mqttSendTopic = topic;
flag = true;
while (flag) {
}
Thread.sleep(3000);
}
}

View File

@@ -35,40 +35,7 @@ public class HarmPollutionJob {
lineParam.setDataSource(1);
String date = CommonExecutorUtils.prepareTimeDeal(command);
log.info("执行日期harmPollutionJob。。。。。。。。。。"+date);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date temDate = calendar.getTime();
String begin = null;
String end = null;
switch (command){
case BizParamConstant.STAT_BIZ_DAY:
begin = sdf.format(DateUtil.beginOfDay(temDate));
end = sdf.format(DateUtil.endOfDay(temDate));
case BizParamConstant.STAT_BIZ_WEEK:
begin = sdf.format(DateUtil.beginOfWeek(temDate));
end = sdf.format(DateUtil.endOfWeek(temDate));
case BizParamConstant.STAT_BIZ_MONTH:
begin = sdf.format(DateUtil.beginOfMonth(temDate));
end = sdf.format(DateUtil.endOfMonth(temDate));
case BizParamConstant.STAT_BIZ_QUARTER:
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
end = sdf.format(DateUtil.endOfQuarter(temDate));
case BizParamConstant.STAT_BIZ_YEAR:
begin = sdf.format(DateUtil.beginOfYear(temDate));
end = sdf.format(DateUtil.endOfYear(temDate));
default:
begin = sdf.format(DateUtil.beginOfDay(temDate));
end = sdf.format(DateUtil.endOfDay(temDate));
}
lineParam.setBeginTime(begin);
lineParam.setEndTime(end);
CommonExecutorUtils.commDefineDate(command,lineParam);
//测试数据部署时注释
//date = "2022-10-21";

View File

@@ -3,11 +3,13 @@ package com.njcn.executor.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
/**
@@ -35,4 +37,44 @@ public class CommonExecutorUtils {
log.info("job调度时间:"+sdf.format(calendar.getTime()));
return sdf.format(calendar.getTime());
}
/**
* 根据xxl-job的参数生成一个任务的起始时间和结束时间
* @author cdf
* @date 2023/9/20
*/
public static void commDefineDate(String command,LineParam lineParam){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String begin;
String end;
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date temDate = calendar.getTime();
switch (command){
case BizParamConstant.STAT_BIZ_DAY:
begin = sdf.format(DateUtil.beginOfDay(temDate));
end = sdf.format(DateUtil.endOfDay(temDate));
case BizParamConstant.STAT_BIZ_WEEK:
begin = sdf.format(DateUtil.beginOfWeek(temDate));
end = sdf.format(DateUtil.endOfWeek(temDate));
case BizParamConstant.STAT_BIZ_MONTH:
begin = sdf.format(DateUtil.beginOfMonth(temDate));
end = sdf.format(DateUtil.endOfMonth(temDate));
case BizParamConstant.STAT_BIZ_QUARTER:
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
end = sdf.format(DateUtil.endOfQuarter(temDate));
case BizParamConstant.STAT_BIZ_YEAR:
begin = sdf.format(DateUtil.beginOfYear(temDate));
end = sdf.format(DateUtil.endOfYear(temDate));
default:
begin = sdf.format(DateUtil.beginOfDay(temDate));
end = sdf.format(DateUtil.endOfDay(temDate));
}
lineParam.setBeginTime(begin);
lineParam.setEndTime(end);
}
}

View File

@@ -24,7 +24,7 @@ public class LineParam {
/**
* 区分配网I II III 类监测点
*/
@ApiModelProperty(name = "lineType",value = "监测点类")
@ApiModelProperty(name = "lineType",value = "监测点类")
private Integer lineType;
@ApiModelProperty(name = "type",value = "时间类型1年2季3月4周5日")
@@ -33,6 +33,7 @@ public class LineParam {
@ApiModelProperty(name = "dataDate",value = "时间日期")
@NotBlank(message = "时间不可为空")
@Deprecated
private String dataDate;
/**
@@ -52,4 +53,10 @@ public class LineParam {
*/
private String endTime;
/**
* 是否补招标识,默认false不补招
*/
private Boolean repairFlag = false;
}

View File

@@ -1,10 +1,12 @@
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;
@@ -23,8 +25,11 @@ 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.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
@@ -49,7 +54,7 @@ public class DayDataController extends BaseController {
private final CommTerminalGeneralClient commTerminalGeneralClient;
@Deprecated
/* @Deprecated
@ApiOperation("day表定时任务")
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
@PostMapping("dayDataHanlder")
@@ -73,7 +78,7 @@ public class DayDataController extends BaseController {
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
}
}*/
@ApiOperation("day表定时任务(MySQL库)")
@ApiImplicitParam(value = "jobParam",name = "jobParam",required = true)
@@ -89,22 +94,22 @@ public class DayDataController extends BaseController {
} else{
indexLists = jobParam.getLineIds();
}
if (jobParam.getType() == 3){
int year = Integer.parseInt(jobParam.getDataDate().split("-")[0]);
int month = Integer.parseInt(jobParam.getDataDate().split("-")[1]);
List<String> dayList = PublicUtil.getDayByMonth(year,month);
for (String item : dayList) {
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";
dayDataService.dataToDayHandler(indexLists,startTime,endTime);
}
} else {
startTime = jobParam.getDataDate()+" "+"00:00:00";
endTime = jobParam.getDataDate()+" "+"23:59:59";
log.info("统计时间范围:"+startTime+"----->"+endTime);
dayDataService.dataToDayHandler(indexLists,startTime,endTime);
dayDataService.dataToDayHandler(indexLists,jobParam.getBeginTime(),jobParam.getEndTime());
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
}

View File

@@ -5,6 +5,7 @@ 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.IntegrityService;
import com.njcn.prepare.harmonic.utils.PublicUtil;
@@ -56,16 +57,17 @@ public class IntegrityController extends BaseController {
public HttpResult<String> dataIntegrity(@RequestBody @Validated LineParam lineParam){
log.info(LocalDateTime.now()+"dataIntegrity开始执行");
String methodDescribe = getMethodDescribe("dataIntegrity");
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) {
String startTime,endTime;
if (lineParam.getRepairFlag()){
List<String> timeRange = NjcnDateUtils.findEveryDay(lineParam.getBeginTime(),lineParam.getEndTime());
for (String item : timeRange) {
log.info(item+"-->开始执行");
integrityService.dataIntegrity(lineParam,item);
startTime = item+" "+"00:00:00";
endTime = item+" "+"23:59:59";
integrityService.dataIntegrity(lineParam,startTime,endTime);
}
} else {
integrityService.dataIntegrity(lineParam,lineParam.getDataDate());
integrityService.dataIntegrity(lineParam,lineParam.getBeginTime(),lineParam.getEndTime());
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, CommonResponseEnum.SUCCESS.getMessage(), methodDescribe);
}

View File

@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class DayDataServiceImpl implements DayDataService {
private final RMpHarmonicVRateReportDPOService rMpHarmonicVRateReportDPOService;
/* private final RMpHarmonicVRateReportDPOService rMpHarmonicVRateReportDPOService;
private final RMpHarmonicIMagReportDPOService rMpHarmonicIMagReportDPOService;
private final RMpFlickerReportDPOService rMpFlickerReportDPOService;
private final RMpPltReportDPOService rMpPltReportDPOService;
@@ -59,7 +59,7 @@ public class DayDataServiceImpl implements DayDataService {
private final RMpInharmonicVRateReportDPOService rMpInharmonicVRateReportDPOService;
private final RMpHarmonicPReportDPOService rMpHarmonicPReportDPOService;
private final RMpMeasurePhaseReportDPOService rMpMeasurePhaseReportDPOService;
private final RMpMeasureReportDPOService rMpMeasureReportDPOService;
private final RMpMeasureReportDPOService rMpMeasureReportDPOService;*/
//MySQL
private final IRStatDataFlickerDService statDataFlickerDService;
@@ -89,452 +89,452 @@ public class DayDataServiceImpl implements DayDataService {
* @Author: clam
* @Date: 2022/10/24
*/
@Override
@Transactional(
rollbackFor = {Exception.class}
)
@Async("asyncExecutor")
public void dayDataJobHandler(List<String> indexLists, String startTime, String endTime) {
Instant instant = null;
// influxDbUtils.setDbName ("pqsbase");
try {
instant = new SimpleDateFormat ("yyyy-MM-dd").parse (startTime).toInstant ( );
} catch (ParseException e) {
e.printStackTrace ( );
}
Long time= instant.toEpochMilli();
List<DataVPO> dataVPOList = new ArrayList<> ();
List<DataIPO> dataIPOList = new ArrayList<> ();
List<DataFlickerPO> dataFlickerPOList = new ArrayList<> ();
List<DataFlucPO> dataFlucPOList = new ArrayList<> ();
List<DataHarmPhasicIPO> dataHarmPhasicIPOList = new ArrayList<> ();
List<DataHarmPhasicVPO> dataHarmPhasicVPOList = new ArrayList<> ();
List<DataHarmPowerPPO> dataHarmPowerPPOList = new ArrayList<> ();
List<DataHarmPowerQPO> dataHarmPowerQPOList = new ArrayList<> ();
List<DataHarmPowerSPO> dataHarmPowerSPOList = new ArrayList<> ();
List<DataHarmRateIPO> dataHarmRateIPOList = new ArrayList<> ();
List<DataHarmRateVPO> dataHarmRateVPOList = new ArrayList<> ();
List<DataInHarmIPO> dataInHarmIPOList = new ArrayList<> ();
List<DataInHarmVPO> dataInHarmVPOList = new ArrayList<> ();
List<DataInHarmRateIPO> dataInHarmRateIPOList = new ArrayList<> ();
List<DataInHarmRateVPO> dataInHarmRateVPOList = new ArrayList<> ();
List<DataPltPO> dataPltPOList = new ArrayList<> ();
List<RMpHarmonicVRateReportD> rMpHarmonicVRateReportDPOList = new ArrayList<> ();
List<RMpHarmonicIMagReportD> rMpHarmonicIMagReportDPOList = new ArrayList<> ();
List<RMpFlickerReportDPO> rMpFlickerReportDPOList = new ArrayList<> ();
List<RMpPltReportDPO> rMpPltReportDPOList = new ArrayList<> ();
List<RMpHarmonicIRateReportD> rMpHarmonicIRateReportDPOList = new ArrayList<> ();
List<RMpInharmonicIRateReportD> rMpInharmonicIRateReportDPOList = new ArrayList<> ();
List<RMpInharmonicIMagReportDPO> rMpInharmonicIMagReportDPOList = new ArrayList<> ();
List<RMpInharmonicVRateReportD> rMpInharmonicVRateReportDPOList = new ArrayList<> ();
List<RMpHarmonicPReportDPO> rMpHarmonicPReportDPOList = new ArrayList<> ();
List<RMpMeasurePhaseReportD> rMpMeasurePhaseReportDPOArrayList = new ArrayList<> ();
List<RMpMeasureReportD> rMpMeasureReportDPOArrayList = new ArrayList<> ();
for (int i = 0; i <indexLists.size () ; i++) {
String lineIndex =indexLists.get (i);
/*生成dayV表*/
List<DataVPO> dataV = getDataV(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataV)){
dataVPOList.addAll (dataV);
}
/*生成dayI表*/
List<DataIPO> dataI = getDataI(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataI)){
dataIPOList.addAll (dataI);
}
List<DataFlickerPO> dataFlickerPO = getDataFlicker(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataFlickerPO)){
dataFlickerPOList.addAll (dataFlickerPO);
}
/*生成dayFluc表*/
List<DataFlucPO> dataFlucPO = getDataFluc(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataFlucPO)){
dataFlucPOList.addAll (dataFlucPO);
}
/*生成dayHarmphasicI表*/
List<DataHarmPhasicIPO> dataHarmphasicIPO = getDataHarmphasicI(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmphasicIPO)){
dataHarmPhasicIPOList.addAll (dataHarmphasicIPO);
}
/*生成dayHarmphasicV表*/
List<DataHarmPhasicVPO> dataHarmphasicVPO = getDataHarmphasicV(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmphasicVPO)){
dataHarmPhasicVPOList.addAll (dataHarmphasicVPO);
}
/*生成dayHarmPowerP表*/
List<DataHarmPowerPPO> dataHarmPowerPPO = getDataHarmPowerP(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmPowerPPO)){
dataHarmPowerPPOList.addAll (dataHarmPowerPPO);
}
/*生成dayHarmPowerQ表*/
List<DataHarmPowerQPO> dataHarmPowerQPO = getDataHarmPowerQ(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmPowerQPO)){
dataHarmPowerQPOList.addAll (dataHarmPowerQPO);
}
/*生成dayHarmPowerS表*/
List<DataHarmPowerSPO> dataHarmPowers = getDataHarmPowerS(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmPowers)){
dataHarmPowerSPOList.addAll (dataHarmPowers);
}
/*生成dayHarmRateI*/
List<DataHarmRateIPO> dataHarmRateI = getDataHarmRateI(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmRateI)){
dataHarmRateIPOList.addAll (dataHarmRateI);
}
/*生成dayHarmRateV*/
List<DataHarmRateVPO> dataHarmRateVPO = getDataHarmRateV(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataHarmRateVPO)){
dataHarmRateVPOList.addAll (dataHarmRateVPO);
}
/*生成dayInHarmI*/
List<DataInHarmIPO> dataInHarmIPO = getDataInHarmI(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataInHarmIPO)){
dataInHarmIPOList.addAll (dataInHarmIPO);
}
/*生成dayInHarmV*/
List<DataInHarmVPO> dataInHarmVPO = getDataInHarmV(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataInHarmVPO)){
dataInHarmVPOList.addAll (dataInHarmVPO);
}
/*生成dayInHarmRateI*/
List<DataInHarmRateIPO> dataInHarmRateIPO = getDataInHarmRateI(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataInHarmRateIPO)){
dataInHarmRateIPOList.addAll (dataInHarmRateIPO);
}
/*生成dayInHarmRateV*/
List<DataInHarmRateVPO> dataInHarmRateVPO = getDataInHarmRateV(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataInHarmRateVPO)){
dataInHarmRateVPOList.addAll (dataInHarmRateVPO);
}
/*生成dayPlt*/
List<DataPltPO> dataPlt = getDataPlt(lineIndex,startTime,endTime);
if(!CollectionUtils.isEmpty (dataPlt)){
dataPltPOList.addAll (dataPlt);
}
/*mysql数据转化 */
/*RMpHarmonicVRateReportDPO*/
// if(!CollectionUtils.isEmpty (dataV)&&!CollectionUtils.isEmpty (dataHarmRateVPO)){
// /*转成mysql对应po*/
// /*dataVPO.getPhaseType ()="A"数据*/
// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOA = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"A",instant);
// Optional.ofNullable (rMpHarmonicVRateReportDPOA).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
// /*dataVPO.getPhaseType ()="B"数据*/
// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOB = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"B",instant);
// Optional.ofNullable (rMpHarmonicVRateReportDPOB).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
//
// /*dataVPO.getPhaseType ()="C"数据*/
// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOC = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO, "C",instant);
// Optional.ofNullable (rMpHarmonicVRateReportDPOC).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
//
// /*dataVPO.getPhaseType ()="T"数据*/
// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOT = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"T",instant);
// Optional.ofNullable (rMpHarmonicVRateReportDPOT).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
// @Override
// @Transactional(
// rollbackFor = {Exception.class}
// )
// @Async("asyncExecutor")
// public void dayDataJobHandler(List<String> indexLists, String startTime, String endTime) {
//
//
// Instant instant = null;
//// influxDbUtils.setDbName ("pqsbase");
// try {
// instant = new SimpleDateFormat ("yyyy-MM-dd").parse (startTime).toInstant ( );
// } catch (ParseException e) {
// e.printStackTrace ( );
// }
// Long time= instant.toEpochMilli();
//
// List<DataVPO> dataVPOList = new ArrayList<> ();
// List<DataIPO> dataIPOList = new ArrayList<> ();
// List<DataFlickerPO> dataFlickerPOList = new ArrayList<> ();
// List<DataFlucPO> dataFlucPOList = new ArrayList<> ();
// List<DataHarmPhasicIPO> dataHarmPhasicIPOList = new ArrayList<> ();
// List<DataHarmPhasicVPO> dataHarmPhasicVPOList = new ArrayList<> ();
// List<DataHarmPowerPPO> dataHarmPowerPPOList = new ArrayList<> ();
// List<DataHarmPowerQPO> dataHarmPowerQPOList = new ArrayList<> ();
// List<DataHarmPowerSPO> dataHarmPowerSPOList = new ArrayList<> ();
// List<DataHarmRateIPO> dataHarmRateIPOList = new ArrayList<> ();
// List<DataHarmRateVPO> dataHarmRateVPOList = new ArrayList<> ();
// List<DataInHarmIPO> dataInHarmIPOList = new ArrayList<> ();
// List<DataInHarmVPO> dataInHarmVPOList = new ArrayList<> ();
// List<DataInHarmRateIPO> dataInHarmRateIPOList = new ArrayList<> ();
// List<DataInHarmRateVPO> dataInHarmRateVPOList = new ArrayList<> ();
// List<DataPltPO> dataPltPOList = new ArrayList<> ();
//
// List<RMpHarmonicVRateReportD> rMpHarmonicVRateReportDPOList = new ArrayList<> ();
// List<RMpHarmonicIMagReportD> rMpHarmonicIMagReportDPOList = new ArrayList<> ();
// List<RMpFlickerReportDPO> rMpFlickerReportDPOList = new ArrayList<> ();
// List<RMpPltReportDPO> rMpPltReportDPOList = new ArrayList<> ();
// List<RMpHarmonicIRateReportD> rMpHarmonicIRateReportDPOList = new ArrayList<> ();
// List<RMpInharmonicIRateReportD> rMpInharmonicIRateReportDPOList = new ArrayList<> ();
// List<RMpInharmonicIMagReportDPO> rMpInharmonicIMagReportDPOList = new ArrayList<> ();
// List<RMpInharmonicVRateReportD> rMpInharmonicVRateReportDPOList = new ArrayList<> ();
// List<RMpHarmonicPReportDPO> rMpHarmonicPReportDPOList = new ArrayList<> ();
// List<RMpMeasurePhaseReportD> rMpMeasurePhaseReportDPOArrayList = new ArrayList<> ();
// List<RMpMeasureReportD> rMpMeasureReportDPOArrayList = new ArrayList<> ();
//
//
//
//
//
//
//
//
// for (int i = 0; i <indexLists.size () ; i++) {
//
// String lineIndex =indexLists.get (i);
// /*生成dayV表*/
// List<DataVPO> dataV = getDataV(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataV)){
// dataVPOList.addAll (dataV);
// }
// /*RMpHarmonicIMagReportDPO*/
// /*生成dayI表*/
// List<DataIPO> dataI = getDataI(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataI)){
//
// /*转成mysql对应po*/
// /*dataI.getPhaseType ()="A"数据*/
// RMpHarmonicIMagReportD a = packageRMpHarmonicIMagReportDPO (dataI, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
// /*dataI.getPhaseType ()="B"数据*/
// RMpHarmonicIMagReportD b = packageRMpHarmonicIMagReportDPO(dataI,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
// /*dataI.getPhaseType ()="C"数据*/
// RMpHarmonicIMagReportD c = packageRMpHarmonicIMagReportDPO(dataI,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
// /*dataI.getPhaseType ()="T"数据*/
// RMpHarmonicIMagReportD t = packageRMpHarmonicIMagReportDPO(dataI,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
//
//
// dataIPOList.addAll (dataI);
// }
// /*生成dayFlicker表*/
// List<DataFlickerPO> dataFlickerPO = getDataFlicker(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataFlickerPO)){
// /*生成dayFlicker表*/
// /*dataFlickerPO.getPhaseType ()="A"数据*/
// RMpFlickerReportDPO a = packageRMpFlickerReportDPOPO (dataFlickerPO, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
//
// /*dataFlickerPO.getPhaseType ()="B"数据*/
// RMpFlickerReportDPO b = packageRMpFlickerReportDPOPO(dataFlickerPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
//
// /*dataFlickerPO.getPhaseType ()="C"数据*/
// RMpFlickerReportDPO c = packageRMpFlickerReportDPOPO(dataFlickerPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
// /*无T项数据*/
//// /*dataFlickerPO.getPhaseType ()="T"数据*/
//// RMpFlickerReportDPO t = packageRMpFlickerReportDPOPO(dataFlickerPO,"T");
//
//
// dataFlickerPOList.addAll (dataFlickerPO);
// }
// if(!CollectionUtils.isEmpty (dataPlt)){
// /*转成mysql对应po*/
// /*DataPltPO.getPhaseType ()="A"数据*/
// RMpPltReportDPO a = packageRMpPltReportDPO (dataPlt, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpPltReportDPOList.add (temp));
// /*DataPltPO.getPhaseType ()="B"数据*/
// RMpPltReportDPO b = packageRMpPltReportDPO(dataPlt,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpPltReportDPOList.add (temp));
// /*DataPltPO.getPhaseType ()="C"数据*/
// RMpPltReportDPO c = packageRMpPltReportDPO(dataPlt,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpPltReportDPOList.add (temp));
//// /*DataPltPO.getPhaseType ()="T"数据*/
//// RMpPltReportDPO t = packageRMpPltReportDPO(dataPlt,"T");
// }
// if(!CollectionUtils.isEmpty (dataHarmRateI)) {
// /*转成mysql对应po*/
// /*DataHarmRateIPO.getPhaseType ()="A"数据*/
// RMpHarmonicIRateReportD a = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "A",instant);
// Optional.ofNullable (a).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
//
// /*DataHarmRateIPO.getPhaseType ()="B"数据*/
// RMpHarmonicIRateReportD b = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "B",instant);
// Optional.ofNullable (b).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
//
// /*DataHarmRateIPO.getPhaseType ()="C"数据*/
// RMpHarmonicIRateReportD c = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "C",instant);
// Optional.ofNullable (c).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
//
// /*DataInHarmRateIPO.getPhaseType ()="T"数据*/
// RMpHarmonicIRateReportD t = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "T",instant);
// Optional.ofNullable (t).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
// /*生成dayFluc表*/
// List<DataFlucPO> dataFlucPO = getDataFluc(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataFlucPO)){
// dataFlucPOList.addAll (dataFlucPO);
// }
//
// if(!CollectionUtils.isEmpty (dataInHarmRateIPO)){
// /*转成mysql对应po*/
// /*DataInHarmRateIPO.getPhaseType ()="A"数据*/
// RMpInharmonicIRateReportD a = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
// /*生成dayHarmphasicI表*/
// List<DataHarmPhasicIPO> dataHarmphasicIPO = getDataHarmphasicI(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmphasicIPO)){
// dataHarmPhasicIPOList.addAll (dataHarmphasicIPO);
// }
//
// /*DataInHarmRateIPO.getPhaseType ()="B"数据*/
// RMpInharmonicIRateReportD b = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
// /*生成dayHarmphasicV表*/
// List<DataHarmPhasicVPO> dataHarmphasicVPO = getDataHarmphasicV(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmphasicVPO)){
// dataHarmPhasicVPOList.addAll (dataHarmphasicVPO);
// }
//
// /*DataInHarmRateIPO.getPhaseType ()="C"数据*/
// RMpInharmonicIRateReportD c = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
// /*生成dayHarmPowerP表*/
// List<DataHarmPowerPPO> dataHarmPowerPPO = getDataHarmPowerP(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmPowerPPO)){
// dataHarmPowerPPOList.addAll (dataHarmPowerPPO);
// }
// /*生成dayHarmPowerQ表*/
// List<DataHarmPowerQPO> dataHarmPowerQPO = getDataHarmPowerQ(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmPowerQPO)){
// dataHarmPowerQPOList.addAll (dataHarmPowerQPO);
// }
//
// /*DataInHarmRateIPO.getPhaseType ()="T"数据*/
// RMpInharmonicIRateReportD t = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
// /*生成dayHarmPowerS表*/
// List<DataHarmPowerSPO> dataHarmPowers = getDataHarmPowerS(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmPowers)){
// dataHarmPowerSPOList.addAll (dataHarmPowers);
// }
//
// /*生成dayHarmRateI*/
// List<DataHarmRateIPO> dataHarmRateI = getDataHarmRateI(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmRateI)){
// dataHarmRateIPOList.addAll (dataHarmRateI);
//
// }
//
// /*生成dayHarmRateV*/
// List<DataHarmRateVPO> dataHarmRateVPO = getDataHarmRateV(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataHarmRateVPO)){
// dataHarmRateVPOList.addAll (dataHarmRateVPO);
// }
//
// /*生成dayInHarmI*/
// List<DataInHarmIPO> dataInHarmIPO = getDataInHarmI(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataInHarmIPO)){
// /*转成mysql对应po*/
// /*dataInHarmIPO.getPhaseType ()="A"数据*/
// RMpInharmonicIMagReportDPO a = packageRMpInharmonicIMagReportDPO(dataInHarmIPO, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
// /*dataInHarmIPO.getPhaseType ()="B"数据*/
// RMpInharmonicIMagReportDPO b = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
// /*dataInHarmIPO.getPhaseType ()="C"数据*/
// RMpInharmonicIMagReportDPO c = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
// /*dataInHarmIPO.getPhaseType ()="T"数据*/
// RMpInharmonicIMagReportDPO t = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
//
// dataInHarmIPOList.addAll (dataInHarmIPO);
// }
//
// /*生成dayInHarmV*/
// List<DataInHarmVPO> dataInHarmVPO = getDataInHarmV(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataInHarmVPO)){
// dataInHarmVPOList.addAll (dataInHarmVPO);
// }
//
// /*生成dayInHarmRateI*/
// List<DataInHarmRateIPO> dataInHarmRateIPO = getDataInHarmRateI(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataInHarmRateIPO)){
// dataInHarmRateIPOList.addAll (dataInHarmRateIPO);
// }
//
// /*生成dayInHarmRateV*/
// List<DataInHarmRateVPO> dataInHarmRateVPO = getDataInHarmRateV(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataInHarmRateVPO)){
// /*转成mysql对应po*/
// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
// RMpInharmonicVRateReportD a = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
// RMpInharmonicVRateReportD b = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
// RMpInharmonicVRateReportD c = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
// RMpInharmonicVRateReportD t = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
//
// dataInHarmRateVPOList.addAll (dataInHarmRateVPO);
// }
//
// if(!CollectionUtils.isEmpty (dataHarmPowerPPO)&&!CollectionUtils.isEmpty (dataHarmPowerQPO)){
// /*转成mysql对应po*/
// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
// RMpHarmonicPReportDPO a = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO, "A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
// RMpHarmonicPReportDPO b = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
// RMpHarmonicPReportDPO c = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
// RMpHarmonicPReportDPO t = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
//
// /*生成dayPlt*/
// List<DataPltPO> dataPlt = getDataPlt(lineIndex,startTime,endTime);
// if(!CollectionUtils.isEmpty (dataPlt)){
// dataPltPOList.addAll (dataPlt);
// }
//
// /*mysql数据转化 */
// /*RMpHarmonicVRateReportDPO*/
//// if(!CollectionUtils.isEmpty (dataV)&&!CollectionUtils.isEmpty (dataHarmRateVPO)){
//// /*转成mysql对应po*/
//// /*dataVPO.getPhaseType ()="A"数据*/
//// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOA = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"A",instant);
//// Optional.ofNullable (rMpHarmonicVRateReportDPOA).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
//// /*dataVPO.getPhaseType ()="B"数据*/
//// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOB = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"B",instant);
//// Optional.ofNullable (rMpHarmonicVRateReportDPOB).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
////
//// /*dataVPO.getPhaseType ()="C"数据*/
//// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOC = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO, "C",instant);
//// Optional.ofNullable (rMpHarmonicVRateReportDPOC).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
////
//// /*dataVPO.getPhaseType ()="T"数据*/
//// RMpHarmonicVRateReportD rMpHarmonicVRateReportDPOT = packageRMpHarmonicVRateReportDPO (dataV, dataHarmRateVPO,"T",instant);
//// Optional.ofNullable (rMpHarmonicVRateReportDPOT).ifPresent (temp ->rMpHarmonicVRateReportDPOList.add (temp));
////
////
//// }
//// /*RMpHarmonicIMagReportDPO*/
//// if(!CollectionUtils.isEmpty (dataI)){
////
//// /*转成mysql对应po*/
//// /*dataI.getPhaseType ()="A"数据*/
//// RMpHarmonicIMagReportD a = packageRMpHarmonicIMagReportDPO (dataI, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
//// /*dataI.getPhaseType ()="B"数据*/
//// RMpHarmonicIMagReportD b = packageRMpHarmonicIMagReportDPO(dataI,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
//// /*dataI.getPhaseType ()="C"数据*/
//// RMpHarmonicIMagReportD c = packageRMpHarmonicIMagReportDPO(dataI,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
//// /*dataI.getPhaseType ()="T"数据*/
//// RMpHarmonicIMagReportD t = packageRMpHarmonicIMagReportDPO(dataI,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpHarmonicIMagReportDPOList.add (temp));
////
////
//// }
//// /*生成dayFlicker表*/
//// if(!CollectionUtils.isEmpty (dataFlickerPO)){
//// /*生成dayFlicker表*/
//// /*dataFlickerPO.getPhaseType ()="A"数据*/
//// RMpFlickerReportDPO a = packageRMpFlickerReportDPOPO (dataFlickerPO, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
////
//// /*dataFlickerPO.getPhaseType ()="B"数据*/
//// RMpFlickerReportDPO b = packageRMpFlickerReportDPOPO(dataFlickerPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
////
//// /*dataFlickerPO.getPhaseType ()="C"数据*/
//// RMpFlickerReportDPO c = packageRMpFlickerReportDPOPO(dataFlickerPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpFlickerReportDPOList.add (temp));
//// /*无T项数据*/
////// /*dataFlickerPO.getPhaseType ()="T"数据*/
////// RMpFlickerReportDPO t = packageRMpFlickerReportDPOPO(dataFlickerPO,"T");
////
////
//// }
//// if(!CollectionUtils.isEmpty (dataPlt)){
//// /*转成mysql对应po*/
//// /*DataPltPO.getPhaseType ()="A"数据*/
//// RMpPltReportDPO a = packageRMpPltReportDPO (dataPlt, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpPltReportDPOList.add (temp));
//// /*DataPltPO.getPhaseType ()="B"数据*/
//// RMpPltReportDPO b = packageRMpPltReportDPO(dataPlt,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpPltReportDPOList.add (temp));
//// /*DataPltPO.getPhaseType ()="C"数据*/
//// RMpPltReportDPO c = packageRMpPltReportDPO(dataPlt,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpPltReportDPOList.add (temp));
////// /*DataPltPO.getPhaseType ()="T"数据*/
////// RMpPltReportDPO t = packageRMpPltReportDPO(dataPlt,"T");
//// }
//// if(!CollectionUtils.isEmpty (dataHarmRateI)) {
//// /*转成mysql对应po*/
//// /*DataHarmRateIPO.getPhaseType ()="A"数据*/
//// RMpHarmonicIRateReportD a = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
////
//// /*DataHarmRateIPO.getPhaseType ()="B"数据*/
//// RMpHarmonicIRateReportD b = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "B",instant);
//// Optional.ofNullable (b).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
////
//// /*DataHarmRateIPO.getPhaseType ()="C"数据*/
//// RMpHarmonicIRateReportD c = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "C",instant);
//// Optional.ofNullable (c).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
////
//// /*DataInHarmRateIPO.getPhaseType ()="T"数据*/
//// RMpHarmonicIRateReportD t = packageRMpHarmonicIRateReportDPO (dataHarmRateI, "T",instant);
//// Optional.ofNullable (t).ifPresent (temp -> rMpHarmonicIRateReportDPOList.add (temp));
//// }
////
//// if(!CollectionUtils.isEmpty (dataInHarmRateIPO)){
//// /*转成mysql对应po*/
//// /*DataInHarmRateIPO.getPhaseType ()="A"数据*/
//// RMpInharmonicIRateReportD a = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
////
//// /*DataInHarmRateIPO.getPhaseType ()="B"数据*/
//// RMpInharmonicIRateReportD b = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
////
//// /*DataInHarmRateIPO.getPhaseType ()="C"数据*/
//// RMpInharmonicIRateReportD c = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
////
//// /*DataInHarmRateIPO.getPhaseType ()="T"数据*/
//// RMpInharmonicIRateReportD t = packageRMpInharmonicIRateReportDPO(dataInHarmRateIPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicIRateReportDPOList.add (temp));
////
////
//// }
////
//// if(!CollectionUtils.isEmpty (dataInHarmIPO)){
//// /*转成mysql对应po*/
//// /*dataInHarmIPO.getPhaseType ()="A"数据*/
//// RMpInharmonicIMagReportDPO a = packageRMpInharmonicIMagReportDPO(dataInHarmIPO, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
//// /*dataInHarmIPO.getPhaseType ()="B"数据*/
//// RMpInharmonicIMagReportDPO b = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
//// /*dataInHarmIPO.getPhaseType ()="C"数据*/
//// RMpInharmonicIMagReportDPO c = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
//// /*dataInHarmIPO.getPhaseType ()="T"数据*/
//// RMpInharmonicIMagReportDPO t = packageRMpInharmonicIMagReportDPO(dataInHarmIPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicIMagReportDPOList.add (temp));
////
//// }
//// if(!CollectionUtils.isEmpty (dataInHarmRateVPO)){
//// /*转成mysql对应po*/
//// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
//// RMpInharmonicVRateReportD a = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
//// RMpInharmonicVRateReportD b = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
//// RMpInharmonicVRateReportD c = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
//// RMpInharmonicVRateReportD t = packageRMpInharmonicVRateReportDPO(dataInHarmRateVPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpInharmonicVRateReportDPOList.add (temp));
////
//// }
////
//// if(!CollectionUtils.isEmpty (dataHarmPowerPPO)&&!CollectionUtils.isEmpty (dataHarmPowerQPO)){
//// /*转成mysql对应po*/
//// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
//// RMpHarmonicPReportDPO a = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO, "A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
//// RMpHarmonicPReportDPO b = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
//// RMpHarmonicPReportDPO c = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
//// RMpHarmonicPReportDPO t = packageRMpHarmonicPReportDPO(dataHarmPowerPPO,dataHarmPowerQPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpHarmonicPReportDPOList.add (temp));
////
//// }
////
////
//// if (!CollectionUtils.isEmpty (dataV) &&
//// !CollectionUtils.isEmpty (dataI) &&
//// !CollectionUtils.isEmpty (dataHarmPowerPPO) &&
//// !CollectionUtils.isEmpty (dataHarmPowers) &&
//// !CollectionUtils.isEmpty (dataHarmPowerQPO)) {
//// /*转成mysql对应po*/
//// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
//// RMpMeasurePhaseReportD a = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"A",instant);
//// Optional.ofNullable (a).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
//// RMpMeasurePhaseReportD b = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"B",instant);
//// Optional.ofNullable (b).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
//// RMpMeasurePhaseReportD c = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"C",instant);
//// Optional.ofNullable (c).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
//// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
//// RMpMeasurePhaseReportD t = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
////
//// }
//// /* todo
//// * r_mp_measure_report_d
//// * */
//// if (!CollectionUtils.isEmpty (dataV) &&
//// !CollectionUtils.isEmpty (dataI) &&
//// !CollectionUtils.isEmpty (dataHarmPowerPPO) &&
//// !CollectionUtils.isEmpty (dataHarmPowers) &&
//// !CollectionUtils.isEmpty (dataHarmPowerQPO)) {
//// /*转成mysql对应po*/
//// /*稳态监测点非谐波不带相位指标即是T项指标*/
//// RMpMeasureReportD t = packageRMpMeasureReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"T",instant);
//// Optional.ofNullable (t).ifPresent (temp ->rMpMeasureReportDPOArrayList.add (temp));
////
//// }
//
// if (!CollectionUtils.isEmpty (dataV) &&
// !CollectionUtils.isEmpty (dataI) &&
// !CollectionUtils.isEmpty (dataHarmPowerPPO) &&
// !CollectionUtils.isEmpty (dataHarmPowers) &&
// !CollectionUtils.isEmpty (dataHarmPowerQPO)) {
// /*转成mysql对应po*/
// /*dataInHarmRateVPO.getPhaseType ()="A"数据*/
// RMpMeasurePhaseReportD a = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"A",instant);
// Optional.ofNullable (a).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="B"数据*/
// RMpMeasurePhaseReportD b = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"B",instant);
// Optional.ofNullable (b).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="C"数据*/
// RMpMeasurePhaseReportD c = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"C",instant);
// Optional.ofNullable (c).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
// /*dataInHarmRateVPO.getPhaseType ()="T"数据*/
// RMpMeasurePhaseReportD t = packageRMpMeasurePhaseReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpMeasurePhaseReportDPOArrayList.add (temp));
//
// }
// /* todo
// * r_mp_measure_report_d
// * */
// if (!CollectionUtils.isEmpty (dataV) &&
// !CollectionUtils.isEmpty (dataI) &&
// !CollectionUtils.isEmpty (dataHarmPowerPPO) &&
// !CollectionUtils.isEmpty (dataHarmPowers) &&
// !CollectionUtils.isEmpty (dataHarmPowerQPO)) {
// /*转成mysql对应po*/
// /*稳态监测点非谐波不带相位指标即是T项指标*/
// RMpMeasureReportD t = packageRMpMeasureReportDPO(dataV,dataI,dataHarmPowerPPO,dataHarmPowers,dataHarmPowerQPO,"T",instant);
// Optional.ofNullable (t).ifPresent (temp ->rMpMeasureReportDPOArrayList.add (temp));
//
// }
}
/*插入mysql*/
// if (!CollectionUtils.isEmpty(rMpHarmonicVRateReportDPOList)){
// rMpHarmonicVRateReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicVRateReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpHarmonicIMagReportDPOList)){
// rMpHarmonicIMagReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicIMagReportDPOList, 50);
//
// /*插入mysql*/
//// if (!CollectionUtils.isEmpty(rMpHarmonicVRateReportDPOList)){
//// rMpHarmonicVRateReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicVRateReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpHarmonicIMagReportDPOList)){
//// rMpHarmonicIMagReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicIMagReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpFlickerReportDPOList)){
//// rMpFlickerReportDPOService.saveOrUpdateBatchByMultiId (rMpFlickerReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpPltReportDPOList)){
//// rMpPltReportDPOService.saveOrUpdateBatchByMultiId (rMpPltReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpHarmonicIRateReportDPOList)){
//// rMpHarmonicIRateReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicIRateReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpInharmonicIRateReportDPOList)){
//// rMpInharmonicIRateReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicIRateReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpInharmonicIMagReportDPOList)){
//// rMpInharmonicIMagReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicIMagReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpInharmonicVRateReportDPOList)){
//// rMpInharmonicVRateReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicVRateReportDPOList, 50);
//// }
////
//// if (!CollectionUtils.isEmpty(rMpMeasurePhaseReportDPOArrayList)){
//// rMpMeasurePhaseReportDPOService.saveOrUpdateBatchByMultiId (rMpMeasurePhaseReportDPOArrayList, 50);
//// }
//// if (!CollectionUtils.isEmpty(rMpMeasureReportDPOArrayList)){
//// rMpMeasureReportDPOService.saveOrUpdateBatchByMultiId (rMpMeasureReportDPOArrayList, 50);
//// }
//
//
//
// if (!CollectionUtils.isEmpty(dataVPOList)){
// insertDayV(dataVPOList,time);
// }
//
// if (!CollectionUtils.isEmpty(rMpFlickerReportDPOList)){
// rMpFlickerReportDPOService.saveOrUpdateBatchByMultiId (rMpFlickerReportDPOList, 50);
// if (!CollectionUtils.isEmpty(dataIPOList)){
// insertDayI(dataIPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataFlickerPOList)){
// insertDayFlicker(dataFlickerPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataFlucPOList)){
// insertDayFluc(dataFlucPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmPhasicIPOList)){
// insertDayHarmphasicI(dataHarmPhasicIPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmPhasicVPOList)){
// insertDayHarmphasicV(dataHarmPhasicVPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmPowerPPOList)){
// insertDayHarmPowerP(dataHarmPowerPPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmPowerQPOList)){
// insertDayHarmPowerQ(dataHarmPowerQPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmPowerSPOList)){
// insertDayHarmPowerS(dataHarmPowerSPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmRateIPOList)){
// insertDayHarmRateI(dataHarmRateIPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataHarmRateVPOList)){
// insertDayHarmRateV(dataHarmRateVPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataInHarmIPOList)){
// insertDayInHarmI(dataInHarmIPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataInHarmVPOList)){
// insertDayInHarmV(dataInHarmVPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataInHarmRateIPOList)){
// insertDayInHarmRateI(dataInHarmRateIPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataInHarmRateVPOList)){
// insertDayInHarmRateV(dataInHarmRateVPOList,time);
// }
// if (!CollectionUtils.isEmpty(dataPltPOList)){
// insertDayPlt(dataPltPOList,time);
// }
//
// if (!CollectionUtils.isEmpty(rMpPltReportDPOList)){
// rMpPltReportDPOService.saveOrUpdateBatchByMultiId (rMpPltReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpHarmonicIRateReportDPOList)){
// rMpHarmonicIRateReportDPOService.saveOrUpdateBatchByMultiId (rMpHarmonicIRateReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpInharmonicIRateReportDPOList)){
// rMpInharmonicIRateReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicIRateReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpInharmonicIMagReportDPOList)){
// rMpInharmonicIMagReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicIMagReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpInharmonicVRateReportDPOList)){
// rMpInharmonicVRateReportDPOService.saveOrUpdateBatchByMultiId (rMpInharmonicVRateReportDPOList, 50);
// }
//
// if (!CollectionUtils.isEmpty(rMpMeasurePhaseReportDPOArrayList)){
// rMpMeasurePhaseReportDPOService.saveOrUpdateBatchByMultiId (rMpMeasurePhaseReportDPOArrayList, 50);
// }
// if (!CollectionUtils.isEmpty(rMpMeasureReportDPOArrayList)){
// rMpMeasureReportDPOService.saveOrUpdateBatchByMultiId (rMpMeasureReportDPOArrayList, 50);
// }
if (!CollectionUtils.isEmpty(dataVPOList)){
insertDayV(dataVPOList,time);
}
if (!CollectionUtils.isEmpty(dataIPOList)){
insertDayI(dataIPOList,time);
}
if (!CollectionUtils.isEmpty(dataFlickerPOList)){
insertDayFlicker(dataFlickerPOList,time);
}
if (!CollectionUtils.isEmpty(dataFlucPOList)){
insertDayFluc(dataFlucPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmPhasicIPOList)){
insertDayHarmphasicI(dataHarmPhasicIPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmPhasicVPOList)){
insertDayHarmphasicV(dataHarmPhasicVPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmPowerPPOList)){
insertDayHarmPowerP(dataHarmPowerPPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmPowerQPOList)){
insertDayHarmPowerQ(dataHarmPowerQPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmPowerSPOList)){
insertDayHarmPowerS(dataHarmPowerSPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmRateIPOList)){
insertDayHarmRateI(dataHarmRateIPOList,time);
}
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)){
insertDayHarmRateV(dataHarmRateVPOList,time);
}
if (!CollectionUtils.isEmpty(dataInHarmIPOList)){
insertDayInHarmI(dataInHarmIPOList,time);
}
if (!CollectionUtils.isEmpty(dataInHarmVPOList)){
insertDayInHarmV(dataInHarmVPOList,time);
}
if (!CollectionUtils.isEmpty(dataInHarmRateIPOList)){
insertDayInHarmRateI(dataInHarmRateIPOList,time);
}
if (!CollectionUtils.isEmpty(dataInHarmRateVPOList)){
insertDayInHarmRateV(dataInHarmRateVPOList,time);
}
if (!CollectionUtils.isEmpty(dataPltPOList)){
insertDayPlt(dataPltPOList,time);
}
log.info(LocalDateTime.now()+"dayDataJobHandler执行完成!");
}
// log.info(LocalDateTime.now()+"dayDataJobHandler执行完成!");
// }
@Override
@Transactional(rollbackFor = {Exception.class})
@@ -563,6 +563,7 @@ public class DayDataServiceImpl implements DayDataService {
List<RStatDataInharmVDPO> dataInHarmVPOList = new ArrayList<> ();
List<RStatDataPltDPO> dataPltPOList = new ArrayList<> ();
for (String lineIndex : indexLists) {
/*生成dayV表*/

View File

@@ -3,6 +3,11 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.po.LineDetail;
import com.njcn.device.biz.pojo.po.Overlimit;
@@ -12,6 +17,8 @@ import com.njcn.prepare.harmonic.mapper.mysql.day.RStatIntegrityDMapper;
import com.njcn.prepare.harmonic.pojo.influxdb.po.DataVPO;
import com.njcn.prepare.harmonic.pojo.param.LineParam;
import com.njcn.prepare.harmonic.service.mysql.line.IntegrityService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.influxdb.InfluxDB;
@@ -48,6 +55,10 @@ public class IntegrityServiceImpl extends MppServiceImpl<RStatIntegrityDMapper,
private final LineFeignClient lineFeignClient;
private final DeptFeignClient deptFeignClient;
private final CommTerminalGeneralClient commTerminalGeneralClient;
/*@Override
@Async("asyncExecutor")
public String computeDataIntegrity(LineParam lineParam) {
@@ -83,33 +94,37 @@ public class IntegrityServiceImpl extends MppServiceImpl<RStatIntegrityDMapper,
*/
@Override
@Async("asyncExecutor")
public void dataIntegrity(LineParam lineParam,String time) {
public void dataIntegrity(LineParam lineParam,String startTime,String endTime) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String data = time + " 00:00:00";
LocalDateTime dateTime = LocalDateTime.parse(data,df);
List<LineDetail> lineDetailList = new ArrayList<>();
LocalDateTime dateTime = LocalDateTime.parse(startTime,df);
List<LineDevGetDTO> lineDevGetDTOList = new ArrayList<>();
if (CollUtil.isEmpty(lineParam.getLineIds())){
List<Overlimit> overLimitList = getAllLinesLimitData();
List<String> lineList = overLimitList.stream().map(Overlimit::getId).collect(Collectors.toList());
lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
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 {
lineDetailList = lineFeignClient.getLineDetail(lineParam.getLineIds()).getData();
lineDevGetDTOList = commTerminalGeneralClient.getMonitorDetailList(lineParam.getLineIds()).getData();
}
List<RStatIntegrityD> list = new ArrayList<>();
for (LineDetail lineDetail :lineDetailList){
int dataCount = getDataCount(lineDetail.getId(),time);
for (LineDevGetDTO lineDetail :lineDevGetDTOList){
int dataCount = getDataCount(lineDetail.getPointId(),startTime,endTime);
RStatIntegrityD integrityDpo = new RStatIntegrityD();
integrityDpo.setTimeId(dateTime);
integrityDpo.setLineIndex(lineDetail.getId());
integrityDpo.setDueTime(DAY_MINUTE/lineDetail.getTimeInterval());
integrityDpo.setLineIndex(lineDetail.getPointId());
integrityDpo.setDueTime(DAY_MINUTE/lineDetail.getInterval());
integrityDpo.setRealTime(dataCount);
list.add(integrityDpo);
}
this.saveOrUpdateBatchByMultiId(list,500);
}
private int getDataCount(String lineId,String date){
QueryResult sqlResult = influxDbUtils.query("SELECT * FROM data_v WHERE time >= '" + date + " 00:00:00' and time <= '" + date + " 23:59:59' and line_id = '" + lineId + "' and phasic_type = 'T' and value_type = 'MAX' tz('Asia/Shanghai')");
private int getDataCount(String lineId,String startTime,String endTime){
QueryResult sqlResult = influxDbUtils.query("SELECT * FROM data_v WHERE time >= '" + startTime + "' and time <= '" + endTime + "' and line_id = '" + lineId + "' and phasic_type = 'T' and value_type = 'MAX' tz('Asia/Shanghai')");
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
List<DataVPO> list = resultMapper.toPOJO(sqlResult, DataVPO.class);
if (CollectionUtils.isEmpty(list)){
@@ -119,7 +134,5 @@ public class IntegrityServiceImpl extends MppServiceImpl<RStatIntegrityDMapper,
}
}
private List<Overlimit> getAllLinesLimitData() {
return lineFeignClient.getAllLineOverLimit("harmonic-boot","").getData();
}
}

View File

@@ -11,14 +11,14 @@ import java.util.List;
* @version V1.0.0
*/
public interface DayDataService {
/**
* @Description: 生成day表相关数据
* @Param: [indexLists, startTime, endTime]
* @return: void
/**
* @Description: 生成day表相关数据
* @Param: [indexLists, startTime, endTime]
* @return: void
* @Author: clam
* @Date: 2022/10/24
*/
void dayDataJobHandler(List<String> indexLists, String startTime, String endTime);
* @Date: 2022/10/24
*/
//void dayDataJobHandler(List<String> indexLists, String startTime, String endTime);
/**
* 处理day表并将数据入MySQL库中

View File

@@ -11,5 +11,5 @@ public interface IntegrityService {
//String computeDataIntegrity(LineParam lineParam);
void dataIntegrity(LineParam lineParam,String time);
void dataIntegrity(LineParam lineParam,String startTime,String endTime);
}