Commit e682d724 authored by zhangsen's avatar zhangsen

巡检添加中心级/站端标识 -> 是否跑定时任务

parent 576fbc9b
...@@ -28,6 +28,7 @@ import io.swagger.annotations.ApiParam; ...@@ -28,6 +28,7 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -58,6 +59,9 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -58,6 +59,9 @@ public class PlanTaskController extends AbstractBaseController {
@Autowired @Autowired
private IRouteService routeService; private IRouteService routeService;
@Value("${params.isPush:false}")
private Boolean isZxj;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
...@@ -386,16 +390,19 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -386,16 +390,19 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "定时执行任务表生成(<font color='blue'>release</font>)", notes = "定时执行任务表生成") @ApiOperation(value = "定时执行任务表生成(<font color='blue'>release</font>)", notes = "定时执行任务表生成")
@RequestMapping(value = "/queryOmission", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/queryOmission", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse pushCarData() { public CommonResponse pushCarData() {
try { if (Boolean.TRUE.equals(!isZxj)) {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes(); try {
RequestContextHolder.setRequestAttributes(reqs, true); RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
planTaskService.taskExecution(null); RequestContextHolder.setRequestAttributes(reqs, true);
return CommonResponseUtil.success(); planTaskService.taskExecution(null);
} catch (Exception e) { return CommonResponseUtil.success();
e.printStackTrace(); } catch (Exception e) {
log.error(e.getMessage(), e); e.printStackTrace();
return CommonResponseUtil.failure(); log.error(e.getMessage(), e);
return CommonResponseUtil.failure();
}
} }
return CommonResponseUtil.success();
} }
/** /**
...@@ -403,9 +410,11 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -403,9 +410,11 @@ public class PlanTaskController extends AbstractBaseController {
*/ */
@Scheduled(cron = "${jobs.cron}") @Scheduled(cron = "${jobs.cron}")
public void taskMessage() { public void taskMessage() {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes(); if (Boolean.TRUE.equals(!isZxj)) {
RequestContextHolder.setRequestAttributes(reqs, true); RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
planTaskService.taskMessage(null); RequestContextHolder.setRequestAttributes(reqs, true);
planTaskService.taskMessage(null);
}
} }
/** /**
......
...@@ -95,4 +95,7 @@ emqx.max-inflight=1000 ...@@ -95,4 +95,7 @@ emqx.max-inflight=1000
file.url=http://172.16.11.201:9000/ file.url=http://172.16.11.201:9000/
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑 ##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false logic=false
\ No newline at end of file
#是否为中心级系统 true-中心级系统 false-站端系统
is.zxj=true
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment