|
@@ -3,6 +3,7 @@ package edp.davinci.controller;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import edp.core.annotation.CurrentUser;
|
|
|
+import edp.core.exception.ServerException;
|
|
|
import edp.davinci.common.controller.BaseController;
|
|
|
import edp.davinci.core.common.Constants;
|
|
|
import edp.davinci.core.common.ResultMap;
|
|
@@ -249,18 +250,20 @@ public class QualityTaskController extends BaseController {
|
|
|
cronJob.setDescription("质量稽核任务");
|
|
|
CronJobInfo jobInfo = cronJobService.createCronJob(cronJob, user);
|
|
|
|
|
|
- // 4. 更新定时规则id到任务中
|
|
|
- qualityTask.setCronJobId(jobInfo.getId());
|
|
|
- qualityTaskService.updateQualityTask(qualityTask);
|
|
|
-
|
|
|
- // 5. 执行
|
|
|
+ // 4. 执行
|
|
|
try {
|
|
|
CronJob cronJobStart = cronJobService.startCronJob(jobInfo.getId(), user);
|
|
|
}catch (Exception e)
|
|
|
{
|
|
|
- System.out.println("启动出错了");
|
|
|
+ log.info("定时任务启动失败"+ cronJob.getCronExpression());
|
|
|
+ cronJobService.deleteCronJob(cronJob.getId(),user);
|
|
|
+ throw new ServerException("定时任务启动失败"+ cronJob.getCronExpression());
|
|
|
}
|
|
|
|
|
|
+ // 5. 更新定时规则id到任务中
|
|
|
+ qualityTask.setCronJobId(jobInfo.getId());
|
|
|
+ qualityTaskService.updateQualityTask(qualityTask);
|
|
|
+
|
|
|
|
|
|
return ResponseEntity.ok(new ResultMap(tokenUtils).successAndRefreshToken(request));
|
|
|
}
|