修改批处理

This commit is contained in:
hzj
2024-11-12 16:30:34 +08:00
parent 53debdf2ef
commit 49d42328ff

View File

@@ -2,7 +2,9 @@ package com.njcn.csreport.job;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.github.jeffreyning.mybatisplus.service.IMppService; import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.api.CsLedgerFeignClient; import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.csdevice.pojo.po.CsLedger;
@@ -73,7 +75,11 @@ public class ReportCovertJob {
*/ */
@Scheduled(cron = "0 0 1 * * ? ") @Scheduled(cron = "0 0 1 * * ? ")
public void executeEvent() throws ClassNotFoundException { public void executeEvent() throws ClassNotFoundException {
LocalDate today = LocalDate.now().minusDays(3); DateTimeFormatter formatter1 = DateTimeFormatter.ISO_DATE;
// 获取当前日期
LocalDate today = LocalDate.now();
// 计算前一天的日期 // 计算前一天的日期
LocalDate yesterday = today.minusDays(1); LocalDate yesterday = today.minusDays(1);
// 获取前一天的开始时间00:00:00 // 获取前一天的开始时间00:00:00
@@ -121,7 +127,9 @@ public class ReportCovertJob {
collect.forEach((tempPhase,byNameMap)->{ collect.forEach((tempPhase,byNameMap)->{
//最小值 //最小值
InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
@@ -150,7 +158,9 @@ public class ReportCovertJob {
//最大值 //最大值
InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
@@ -178,7 +188,9 @@ public class ReportCovertJob {
//平均值 //平均值
InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0); EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
@@ -206,7 +218,9 @@ public class ReportCovertJob {
//CP95 //CP95
InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz); InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz);
influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
byNameMap.forEach((name, eleEpdPqdList) -> { byNameMap.forEach((name, eleEpdPqdList) -> {
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0); EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
@@ -304,6 +318,7 @@ public class ReportCovertJob {
} }
} }
public String getPhase( String phase) { public String getPhase( String phase) {
@@ -329,4 +344,5 @@ public class ReportCovertJob {
return ""; return "";
} }
} }