预处理兼容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

@@ -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);
}
}