|
|
@@ -0,0 +1,91 @@
|
|
|
+package com.xunmei.core.resumption.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.R;
|
|
|
+import com.xunmei.common.core.utils.DateHelper;
|
|
|
+import com.xunmei.common.core.web.domain.AjaxResult;
|
|
|
+import com.xunmei.core.resumption.task.ResumptionTaskBusiness;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.TimeZone;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author LuoJun
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/task")
|
|
|
+public class TaskController {
|
|
|
+ @Autowired
|
|
|
+ ResumptionTaskBusiness taskBusiness;
|
|
|
+
|
|
|
+ @GetMapping("/dayTask")
|
|
|
+ public AjaxResult dayTask() {
|
|
|
+// //执行周期为每周的履职计划Plan_cycle=0,6
|
|
|
+// DateTime datetime = new DateTime();
|
|
|
+// datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+// JobLog jobLog = JobLog.builder().id(IDHelper.id()).jobCode("dayTask").jobName("每小时每日履职任务生成job").jobDate(datetime).createTime(datetime).build();
|
|
|
+// boolean flag = jobLogService.isJobRunning(jobLog);
|
|
|
+// if(flag){
|
|
|
+// SCHEDULEDTASKSLOG.info("每小时每日履职任务生成job已执行,本次不执行");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// SCHEDULEDTASKSLOG.info("================开始执行每日每小时履职任务生成任务================");
|
|
|
+// taskBusiness.syncHour(datetime,6);
|
|
|
+// taskBusiness.syncDay(datetime,0);
|
|
|
+// SCHEDULEDTASKSLOG.info("================每日每小时履职任务生成任务执行结束================");
|
|
|
+ DateTime datetime = new DateTime();
|
|
|
+ datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+// SCHEDULEDTASKSLOG.info("================开始执行每日每小时履职任务生成任务================");
|
|
|
+ taskBusiness.syncHour(datetime,6);
|
|
|
+ taskBusiness.syncDay(datetime,0);
|
|
|
+// SCHEDULEDTASKSLOG.info("================每日每小时履职任务生成任务执行结束================");
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/weekTask")
|
|
|
+ public AjaxResult weekTask() {
|
|
|
+ DateTime datetime = new DateTime();
|
|
|
+ datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+// SCHEDULEDTASKSLOG.info("================开始执行每周履职任务生成任务================");
|
|
|
+ taskBusiness.syncWeek(datetime,1);
|
|
|
+// SCHEDULEDTASKSLOG.info("================每周履职任务生成任务执行结束================");
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/monthTask")
|
|
|
+ public AjaxResult monthTask() {
|
|
|
+ DateTime datetime = new DateTime();
|
|
|
+ datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+ DateHelper dateHelper = new DateHelper(datetime);
|
|
|
+ int month =dateHelper.getMonth();
|
|
|
+ int day = dateHelper.getDay();
|
|
|
+// SCHEDULEDTASKSLOG.info("================开始执行每月,每季,每半年,每年履职任务生成任务================");
|
|
|
+ if(month==1&&day==1){
|
|
|
+ //1.1日获取执行周期为每月,每季,每半年,每年的履职计划Plan_cycle=2,3,4,5
|
|
|
+ taskBusiness.syncMonth(datetime,2);
|
|
|
+ taskBusiness.syncQuarter(datetime,3);
|
|
|
+ taskBusiness.syncHalfYear(datetime,4);
|
|
|
+ taskBusiness.syncYear(datetime,5);
|
|
|
+ }else if((month==4&&day==1)||(month==10&&day==1)){
|
|
|
+ //4.1||10.1日获取执行周期为每月,每季的履职计划Plan_cycle=2,3
|
|
|
+ taskBusiness.syncMonth(datetime,2);
|
|
|
+ taskBusiness.syncQuarter(datetime,3);
|
|
|
+ }else if(month==7&&day==1){
|
|
|
+ //7.1日获取执行周期为每月,每季,每半年的履职计划Plan_cycle=2,3,4
|
|
|
+ taskBusiness.syncMonth(datetime,2);
|
|
|
+ taskBusiness.syncQuarter(datetime,3);
|
|
|
+ taskBusiness.syncHalfYear(datetime,4);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //其他获取每月履职计划Plan_cycle=2
|
|
|
+ taskBusiness.syncMonth(datetime,2);
|
|
|
+ }
|
|
|
+// SCHEDULEDTASKSLOG.info("================每月,每季,每半年,每年履职任务生成任务执行结束================");
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+}
|