bug修复
This commit is contained in:
parent
49008c6e8a
commit
7626d23f44
|
|
@ -40,6 +40,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.Executors;
|
||||
|
|
@ -129,6 +130,9 @@ public class MethodLogAop {
|
|||
Method method = null;
|
||||
method = methodSignature.getMethod();
|
||||
|
||||
//Field field= methodSignature.getClass().getDeclaredField("userName");
|
||||
//String str=String.valueOf(field.get(joinPoint.getThis()));
|
||||
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
MethodLog methodCache = method.getAnnotation(MethodLog.class);
|
||||
if (methodCache != null) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class TaskRunner implements CommandLineRunner {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(jobList)) {
|
||||
for (SysJob job : jobList) {
|
||||
SchedulingRunnable task = new SchedulingRunnable(job.getBeanName(), job.getMethodName(), job.getMethodParams());
|
||||
SchedulingRunnable task = new SchedulingRunnable(job.getBeanName(), job.getMethodName(), job.getMethodParams(),job.getJobId());
|
||||
cronTaskRegistrar.addCronTask(task, job.getCronExpression());
|
||||
}
|
||||
logger.info("定时任务已加载完毕...");
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TaskController {
|
|||
return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_CREATE, "执行失败");
|
||||
else {
|
||||
if (sysJob.getJobStatus().equals(SysJob.NORMAL)) {
|
||||
SchedulingRunnable task = new SchedulingRunnable(sysJob.getBeanName(), sysJob.getMethodName(), sysJob.getMethodParams());
|
||||
SchedulingRunnable task = new SchedulingRunnable(sysJob.getBeanName(), sysJob.getMethodName(), sysJob.getMethodParams(),sysJob.getJobId());
|
||||
cronTaskRegistrar.addCronTask(task, sysJob.getCronExpression());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.jeequan.jeepay.mgr.task;
|
||||
|
||||
import com.jeequan.jeepay.mgr.rqrs.EnumTime;
|
||||
import com.jeequan.jeepay.mgr.util.TimeUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
|
@ -7,27 +8,22 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
public abstract class AbstractAnalysisTask {
|
||||
|
||||
public static final byte CYCLE_DAY = 1; //按天
|
||||
public static final byte CYCLE_WEEK_ = 2; //按周
|
||||
public static final byte CYCLE_MONTH = 3; //按月
|
||||
public static final byte CYCLE_YEAR = 4; //按年
|
||||
protected abstract void process(String period) throws Exception;
|
||||
|
||||
protected abstract void process(int period) throws Exception;
|
||||
|
||||
protected MutablePair<String, String> getPeriod(int period) throws Exception {
|
||||
protected MutablePair<String, String> getPeriod(String period) throws Exception {
|
||||
String createTimeStart = "";//开始时间
|
||||
String createTimeEnd = "";//结束时间
|
||||
if (period==CYCLE_YEAR) {
|
||||
if (EnumTime.TIMETYPE.YEAR.key==period) {
|
||||
createTimeStart = TimeUtil.getBeforeFirstYearDate();
|
||||
createTimeEnd = TimeUtil.getBeforeLastYearDate();
|
||||
} else if (period==CYCLE_MONTH) {
|
||||
} else if (EnumTime.TIMETYPE.MONTH.key==period) {
|
||||
createTimeStart = TimeUtil.getBeforeFirstMonthDate();
|
||||
createTimeEnd = TimeUtil.getBeforeLastMonthDate();
|
||||
} else if (period==CYCLE_DAY) {
|
||||
} else if (EnumTime.TIMETYPE.DAY.key==period) {
|
||||
createTimeStart = TimeUtil.getBeforeFirstDayDate();
|
||||
createTimeEnd = TimeUtil.getBeforeLastDayDate();
|
||||
}
|
||||
else if (period==CYCLE_WEEK_) {
|
||||
else if (EnumTime.TIMETYPE.WEEK.key==period) {
|
||||
createTimeStart = TimeUtil.getBeforeFirstWeekDate();
|
||||
createTimeEnd = TimeUtil.getBeforeLastWeekDate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.jeequan.jeepay.mgr.task;
|
||||
|
||||
|
||||
import com.jeequan.jeepay.core.aop.MethodLog;
|
||||
import com.jeequan.jeepay.mgr.util.SpringContextUtils;
|
||||
import com.jeequan.jeepay.service.impl.SysJobService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -43,6 +44,7 @@ public class SchedulingRunnable implements Runnable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@MethodLog(remark = "fkdjfdk")
|
||||
public void run() {
|
||||
logger.info("定时任务开始执行 - bean:{},方法:{},参数:{}", beanName, methodName, params);
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ public class CompanyAnalysisTask extends AbstractAnalysisTask {
|
|||
//@Async
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@MethodLog(remark = "企业账单报表分析作业")
|
||||
protected void process(int period) throws Exception {
|
||||
protected void process(String period) throws Exception {
|
||||
|
||||
MutablePair<String, String> timePair = this.getPeriod(period);//时间段
|
||||
Long analyseId = System.currentTimeMillis(); //产生版本号
|
||||
|
|
|
|||
|
|
@ -36,11 +36,9 @@ public class MerchantAnalysisTask extends AbstractAnalysisTask {
|
|||
*
|
||||
* @param period 1表示天,2表示周 ,3表示月 4表示年
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@MethodLog(remark = "商户账单报表分析作业")
|
||||
protected void process(int period) throws Exception {
|
||||
protected void process(String period) throws Exception {
|
||||
|
||||
MutablePair<String, String> timePair = this.getPeriod(period);//时间段
|
||||
Long analyseId = System.currentTimeMillis();//产生版本号
|
||||
|
|
|
|||
Loading…
Reference in New Issue