hdy
2024-04-18 e2670e7912ea7316d1f9fb518d980b8a4ef94055
提交 | 用户 | 时间
38b150 1 package com.jcdm.main.em.inspectionPlan.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
f17d8c 5
6 import com.jcdm.common.exception.job.TaskException;
7 import com.jcdm.quartz.domain.SysJob;
8 import com.jcdm.quartz.service.ISysJobService;
9 import org.quartz.SchedulerException;
38b150 10 import org.springframework.security.access.prepost.PreAuthorize;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.PostMapping;
14 import org.springframework.web.bind.annotation.PutMapping;
15 import org.springframework.web.bind.annotation.DeleteMapping;
16 import org.springframework.web.bind.annotation.PathVariable;
17 import org.springframework.web.bind.annotation.RequestBody;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RestController;
20 import com.jcdm.common.annotation.Log;
21 import com.jcdm.common.core.controller.BaseController;
22 import com.jcdm.common.core.domain.AjaxResult;
23 import com.jcdm.common.enums.BusinessType;
24 import com.jcdm.main.em.inspectionPlan.domain.EmInspectionPlan;
25 import com.jcdm.main.em.inspectionPlan.service.IEmInspectionPlanService;
26 import com.jcdm.common.utils.poi.ExcelUtil;
27 import com.jcdm.common.core.page.TableDataInfo;
28
29 /**
30  * 点检保养计划Controller
31  * 
32  * @author Yi
33  * @date 2024-03-08
34  */
35 @RestController
36 @RequestMapping("/em/inspectionPlan")
37 public class EmInspectionPlanController extends BaseController
38 {
39     @Autowired
40     private IEmInspectionPlanService emInspectionPlanService;
f17d8c 41
42     @Autowired
43     private ISysJobService iSysJobService;
38b150 44
45     /**
46      * 查询点检保养计划列表
47      */
48     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:list')")
49     @GetMapping("/list")
50     public TableDataInfo list(EmInspectionPlan emInspectionPlan)
51     {
52         startPage();
53         List<EmInspectionPlan> list = emInspectionPlanService.selectEmInspectionPlanList(emInspectionPlan);
54         return getDataTable(list);
55     }
56
57     /**
58      * 导出点检保养计划列表
59      */
60     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:export')")
61     @Log(title = "点检保养计划", businessType = BusinessType.EXPORT)
62     @PostMapping("/export")
63     public void export(HttpServletResponse response, EmInspectionPlan emInspectionPlan)
64     {
65         List<EmInspectionPlan> list = emInspectionPlanService.selectEmInspectionPlanList(emInspectionPlan);
66         ExcelUtil<EmInspectionPlan> util = new ExcelUtil<EmInspectionPlan>(EmInspectionPlan.class);
67         util.exportExcel(response, list, "点检保养计划数据");
68     }
69
70     /**
71      * 获取点检保养计划详细信息
72      */
73     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:query')")
74     @GetMapping(value = "/{id}")
75     public AjaxResult getInfo(@PathVariable("id") Long id)
76     {
77         return success(emInspectionPlanService.selectEmInspectionPlanById(id));
78     }
79
80     /**
81      * 新增点检保养计划
82      */
83     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:add')")
84     @Log(title = "点检保养计划", businessType = BusinessType.INSERT)
85     @PostMapping
86     public AjaxResult add(@RequestBody EmInspectionPlan emInspectionPlan)
87     {
f17d8c 88 //        Long l = 4L;
89 //        SysJob sysJob = iSysJobService.selectJobById(l);
90 //        String invoke = "('"+emInspectionPlan.getPlanCode()+"')";
91 //        sysJob.setInvokeTarget("ryTask.inspectionPlanInfoHour"+invoke);
92 //        sysJob.setStatus("0");
93 //        try {
94 //            iSysJobService.updateJob(sysJob);
95 //        } catch (Exception e) {
96 //            throw new RuntimeException(e);
97 //        }
38b150 98         return toAjax(emInspectionPlanService.insertEmInspectionPlan(emInspectionPlan));
99     }
100
101     /**
102      * 修改点检保养计划
103      */
104     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:edit')")
105     @Log(title = "点检保养计划", businessType = BusinessType.UPDATE)
106     @PutMapping
107     public AjaxResult edit(@RequestBody EmInspectionPlan emInspectionPlan)
108     {
109         return toAjax(emInspectionPlanService.updateEmInspectionPlan(emInspectionPlan));
110     }
111
112     /**
113      * 删除点检保养计划
114      */
115     @PreAuthorize("@ss.hasPermi('em:inspectionPlan:remove')")
116     @Log(title = "点检保养计划", businessType = BusinessType.DELETE)
117     @DeleteMapping("/{ids}")
118     public AjaxResult remove(@PathVariable Long[] ids)
119     {
120         return toAjax(emInspectionPlanService.deleteEmInspectionPlanByIds(ids));
121     }
122 }