| | |
| | | import com.ruoyi.project.tr.troubleshootType.service.ITroubleshootTypeService; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Log(title = "定时任务", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult remove(String ids) throws SchedulerException { |
| | | hiddenDangerCheckJobService.deleteJobByIds(ids); |
| | | |
| | | //todo-2022 删除job与措施的关联关系 |
| | | riskService.deleteJobAndMeasure(ids); |
| | | int result = riskService.deleteJobAndMeasure(ids); |
| | | if (result < 1){ |
| | | throw new RuntimeException("删除调度与管控措施的关联失败"); |
| | | } |
| | | |
| | | return success(); |
| | | } |
| | |
| | | @Log(title = "定时任务", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult addSave(@Validated HiddenDangerCheckJob hiddenDangerCheckJob) throws SchedulerException, TaskException { |
| | | if (!StringUtils.isEmpty(hiddenDangerCheckJob.getExecuteUserIdString())) { |
| | | String[] executeUserIdArray = hiddenDangerCheckJob.getExecuteUserIdString().split(","); |
| | |
| | | |
| | | //todo- 2022 保存job与管控措施的对应关系 |
| | | hiddenDangerCheckJob.getJobId(); |
| | | int result = riskService.insertJobAndMeasure(hiddenDangerCheckJob.getJobId());{ |
| | | int result = riskService.insertJobAndMeasure(hiddenDangerCheckJob.getJobId(),hiddenDangerCheckJob);{ |
| | | if (result < 0 ){ |
| | | throw new RuntimeException("保存job与管控措施的对应关系失败"); |
| | | } |
| | |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult editSave(@Validated HiddenDangerCheckJob hiddenDangerCheckJob) throws |
| | | SchedulerException, TaskException { |
| | | HiddenDangerCheckJob tempJob = hiddenDangerCheckJobService.selectJobById(hiddenDangerCheckJob.getJobId()); |
| | |
| | | |
| | | //todo- 2022 保存job与管控措施的对应关系 |
| | | //1、先查询基础清单是否有变更 |
| | | Long jobIds = hiddenDangerCheckJob.getJobId(); |
| | | HiddenDangerCheckJob jobById = hiddenDangerCheckJobService.getJobById(hiddenDangerCheckJob.getJobId()); |
| | | |
| | | if (!jobById.getRiskId().equals(hiddenDangerCheckJob.getRiskId())){ |
| | | // 2、若有变更,再次添加关联关系 |
| | | riskService.updateJobAndMeasure(hiddenDangerCheckJob); |