diff --git a/ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java b/ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java index 275b458..cd16db1 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java +++ b/ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java @@ -39,15 +39,23 @@ import com.ruoyi.common.core.page.TableDataInfo; @Api(tags = "应用执行计划管理接口") @RestController @RequestMapping("/business/ctApplyPlan") -public class ApplyPlanController extends BaseController -{ +public class ApplyPlanController extends BaseController { @Autowired private IApplyPlanService applyPlanService; /** - * 查询应用执行计划管理列表 + * 重新运行 + */ + @ApiOperation(value = "重新运行", httpMethod = "POST", response = ApplyPlan.class) + @PostMapping("/appRetry") + public AjaxResult appRetry(@RequestBody JobQueryBO jobQueryBO) throws IllegalAccessException { + return toAjax(applyPlanService.appRetry(jobQueryBO)); + } + + /** + * 停止计划运行 */ - @ApiOperation(value="停止计划运行", httpMethod = "POST", response = ApplyPlan.class) + @ApiOperation(value = "停止计划运行", httpMethod = "POST", response = ApplyPlan.class) @PostMapping("/stopRun") public AjaxResult stopRun(@RequestBody JobQueryBO jobQueryBO) throws IllegalAccessException { return toAjax(applyPlanService.stopRun(jobQueryBO)); @@ -56,10 +64,9 @@ public class ApplyPlanController extends BaseController /** * 查询应用执行计划管理列表 */ - @ApiOperation(value="查询应用执行计划管理列表", httpMethod = "GET", response = ApplyPlan.class) + @ApiOperation(value = "查询应用执行计划管理列表", httpMethod = "GET", response = ApplyPlan.class) @GetMapping("/list") - public TableDataInfo list(ApplyPlan applyPlan) - { + public TableDataInfo list(ApplyPlan applyPlan) { startPage(); List list = applyPlanService.list(applyPlan); return getDataTable(list); @@ -68,11 +75,10 @@ public class ApplyPlanController extends BaseController /** * 导出应用执行计划管理列表 */ - @ApiOperation(value="导出应用执行计划管理列表", httpMethod = "POST") + @ApiOperation(value = "导出应用执行计划管理列表", httpMethod = "POST") @Log(title = "应用执行计划管理", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ApplyPlan applyPlan) - { + public void export(HttpServletResponse response, ApplyPlan applyPlan) { List list = applyPlanService.list(applyPlan); ExcelUtil util = new ExcelUtil(ApplyPlan.class); util.exportExcel(response, list, "应用执行计划管理数据"); @@ -81,43 +87,39 @@ public class ApplyPlanController extends BaseController /** * 获取应用执行计划管理详细信息 */ - @ApiOperation(value="获取应用执行计划管理详细信息", httpMethod = "GET", response = ApplyPlan.class) + @ApiOperation(value = "获取应用执行计划管理详细信息", httpMethod = "GET", response = ApplyPlan.class) @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(applyPlanService.getById(id)); } /** * 新增应用执行计划管理 */ - @ApiOperation(value="新增应用执行计划管理", httpMethod = "POST") + @ApiOperation(value = "新增应用执行计划管理", httpMethod = "POST") @Log(title = "应用执行计划管理", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody AddApplyPlanBO addApplyPlanBO) - { + public AjaxResult add(@RequestBody AddApplyPlanBO addApplyPlanBO) { return toAjax(applyPlanService.save(addApplyPlanBO)); } /** * 修改应用执行计划管理 */ - @ApiOperation(value="修改应用执行计划管理", httpMethod = "PUT") + @ApiOperation(value = "修改应用执行计划管理", httpMethod = "PUT") @Log(title = "应用执行计划管理", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody AddApplyPlanBO addApplyPlanBO) - { + public AjaxResult edit(@RequestBody AddApplyPlanBO addApplyPlanBO) { return toAjax(applyPlanService.update(addApplyPlanBO)); } /** * 删除应用执行计划管理 */ - @ApiOperation(value="删除应用执行计划管理", httpMethod = "DELETE") + @ApiOperation(value = "删除应用执行计划管理", httpMethod = "DELETE") @Log(title = "应用执行计划管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(applyPlanService.removeByIds(Arrays.asList(ids))); } } diff --git a/ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java b/ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java index 69bfaa5..feb5cc8 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java +++ b/ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java @@ -21,4 +21,9 @@ public interface ApplyPlanMapper extends BaseMapper */ List selectApplyPlanList(ApplyPlan applyPlan); + /** + * 重新运行 + * @return + */ + Integer appRetry(String taskUuid); } diff --git a/ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java b/ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java index 922200c..eb30498 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java +++ b/ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java @@ -17,6 +17,14 @@ import com.ruoyi.business.domain.vo.JobQueryVO; */ public interface IApplyPlanService extends IService { + /** + * 重新运行 + * + * @param + * @return + */ + boolean appRetry(JobQueryBO jobQueryBO) throws IllegalAccessException; + /** * 停止运行 * diff --git a/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java b/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java index 4de24a0..d5bc6ea 100644 --- a/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java +++ b/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java @@ -56,6 +56,23 @@ public class ApplyPlanServiceImpl extends ServiceImpl 0; + } else { + return false; + } + } + /** * 停止计划运行 * @@ -87,7 +104,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO); if (listRebotVos.isEmpty()) { - log.error("暂无空闲机器人"); + log.debug("暂无空闲机器人"); // 刷新机器人数据 // rebotService.syn(new Rebot()); return false; @@ -170,7 +187,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO); if (listRebotVos.isEmpty()) { - log.error("暂无空闲机器人"); + log.debug("暂无空闲机器人"); // 刷新机器人数据 // rebotService.syn(new Rebot()); return false; @@ -352,7 +369,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO); if (listRebotVos.isEmpty()) { - log.error("暂无空闲机器人"); + log.debug("暂无空闲机器人"); // 刷新机器人数据 // rebotService.syn(new Rebot()); return false; @@ -447,7 +464,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl data = BeanToMapUtil.convertEntityToMap(jobQueryBO); + BaseDTO baseDTO = sendPost(APP_RETRY, data); + return baseDTO; + } + /** * 查询应用运行结果 */ diff --git a/ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml b/ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml index 68b6c44..b59902a 100644 --- a/ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml +++ b/ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml @@ -22,7 +22,7 @@ - + @@ -38,25 +38,25 @@ - + - + - + - + - + - + - + - + - + - + @@ -120,26 +120,38 @@ and robot_name like concat(#{robotName}, '%') and app_type_name like concat(#{appTypeName}, '%') - and support_param = #{supportParam} + and support_param = #{supportParam} and app_name like concat(#{appName}, '%') and app_id = #{appId} - and exc_type = #{excType} - and exc_time = #{excTime} - and cron_expression = #{cronExpression} - and last_exec_time = #{lastExecTime} - and next_exec_time = #{nextExecTime} - and task_status = #{taskStatus} - and task_uuid = #{taskUuid} - and manual_time = #{manualTime} - and start_time = #{startTime} - and end_time = #{endTime} - and plan_time = #{planTime} - and time_saving = #{timeSaving} - and dept_id = #{deptId} - and dept_name like concat(#{deptName}, '%') + and exc_type = #{excType} + and exc_time = #{excTime} + and cron_expression = #{cronExpression} + and last_exec_time = #{lastExecTime} + and next_exec_time = #{nextExecTime} + and task_status = #{taskStatus} + and task_uuid = #{taskUuid} + and manual_time = #{manualTime} + and start_time = #{startTime} + and end_time = #{endTime} + and plan_time = #{planTime} + and time_saving = #{timeSaving} + and dept_id = #{deptId} + and dept_name like concat(#{deptName}, '%') ${params.dataScope} order by plan.priority asc,plan.create_time desc + + + update ct_apply_plan + set task_status = 'await_create', + start_time = null, + end_time = null, + plan_time = null, + time_saving = null, + last_exec_time = null, + next_exec_time = null + where task_uuid = #{taskUuid} + \ No newline at end of file