双重预防项目-国泰新华二开定制版
heheng
2025-06-24 e98eeaaa5766511fdb8e6d5e412eb1c59d1f07ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package com.ruoyi.project.tr.specialCheck.controller;
 
import com.ruoyi.common.utils.BeanCopyUtils;
import com.ruoyi.doublePrevention.vo.ResultVO;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.tr.riskList.domain.RiskList;
import com.ruoyi.project.tr.riskList.service.IRiskListService;
import com.ruoyi.project.tr.specialCheck.domin.BO.*;
import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckTaskLogDTO;
import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckTaskLogDateDTO;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask;
import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog;
import com.ruoyi.project.tr.specialCheck.service.SpecialCheckTaskService;
import com.ruoyi.project.tr.specialCheck.service.TbBaseCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
 
import java.sql.Date;
import java.time.Instant;
import java.time.ZoneId;
import java.util.List;
 
/**
 * 隐患列表Controller
 *
 * @date 2020-05-08
 */
@Controller
@RequestMapping("/tr/specialCheckTaskLog")
public class TBSpecialCheckTaskLogController extends BaseController
{
    private String prefix = "tr/specialCheckTaskLog";
 
    @Autowired
    private SpecialCheckTaskService specialCheckTaskService;
 
    @Autowired
    private IRiskListService riskListService;
 
    @Autowired
    private TbBaseCheckService tbBaseCheckService;
 
 
 
//    @GetMapping()
//    public String selectTbBaseCheckTaskPage(ModelMap mmap)
//    {
//        return prefix + "/specialCheckTaskLog";
//    }
    @GetMapping("{id}")
    public String specialCheckTaskLog(@PathVariable("id")String id,ModelMap modelMap)
    {
        modelMap.put("id",id);
        return prefix + "/specialCheckTaskLog";
    }
 
 
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectSpecialCheckTaskLogPage(TbSpecialCheckTaskLogBO specialCheckTaskLogBO)
    {
 
        ResultVO<List<TbSpecialCheckTaskLog>> resultVO = specialCheckTaskService.selectSpecialCheckTaskLogPage(specialCheckTaskLogBO);
        List<TbSpecialCheckTaskLogDTO> data = (List<TbSpecialCheckTaskLogDTO>) resultVO.getData();
        TableDataInfo dataTable = getDataTable(data);
        dataTable.setTotal(resultVO.getCount());
 
        return dataTable;
    }
 
    /**
     * 新增任务
     */
    @GetMapping("/add")
    public String add(ModelMap mmap)
    {
        List<RiskList> riskList = riskListService.listHazardSource();
        mmap.put("hazardList", riskList);
        List<TbBaseCheckTask> listResult = tbBaseCheckService.listTbBaseCheckTask();
        mmap.put("tbBaseCheckTask", listResult);
        return prefix + "/add";
    }
 
 
    /**
     * 新增任务保存
     */
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSpecialTask(TbSpecialCheckTaskLogEditBO taskLogEditBO){
 
        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.addSpecialTask(taskLogEditBO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
    }
 
    @GetMapping("/edit/{indexId}")
    public String edit(@PathVariable("indexId") Long indexId, ModelMap mmap)
    {
        TbSpecialCheckTaskLog specialCheckTaskLog = specialCheckTaskService.getSpecialCheckTaskLogByIndexId(indexId);
 
        TbSpecialCheckTaskLogDateDTO tbSpecialCheckTaskLogDateDTO = BeanCopyUtils.copyBean(specialCheckTaskLog, TbSpecialCheckTaskLogDateDTO.class);
        Instant instant = specialCheckTaskLog.getCheckDate().atZone(ZoneId.systemDefault()).toInstant();
        tbSpecialCheckTaskLogDateDTO.setCheckDate(Date.from(instant));
        mmap.put("specialCheckTaskLog",tbSpecialCheckTaskLogDateDTO);
        List<RiskList> riskList = riskListService.listHazardSource();
        mmap.put("hazardList", riskList);
        List<TbBaseCheckTask> listResult = tbBaseCheckService.listTbBaseCheckTask();
        mmap.put("tbBaseCheckTask", listResult);
        return prefix + "/edit";
    }
 
    /**
     *
     */
    @GetMapping("/detail/{indexId}")
    public String detail(@PathVariable("indexId") Long indexId, ModelMap mmap)
    {
        TbSpecialCheckTaskLog specialCheckTaskLog = specialCheckTaskService.getSpecialCheckTaskLogByIndexId(indexId);
 
        TbSpecialCheckTaskLogDateDTO tbSpecialCheckTaskLogDateDTO = BeanCopyUtils.copyBean(specialCheckTaskLog, TbSpecialCheckTaskLogDateDTO.class);
        Instant instant = specialCheckTaskLog.getCheckDate().atZone(ZoneId.systemDefault()).toInstant();
        tbSpecialCheckTaskLogDateDTO.setCheckDate(Date.from(instant));
        mmap.put("specialCheckTaskLog",tbSpecialCheckTaskLogDateDTO);
        List<RiskList> riskList = riskListService.listHazardSource();
        mmap.put("hazardList", riskList);
        List<TbBaseCheckTask> listResult = tbBaseCheckService.listTbBaseCheckTask();
        mmap.put("tbBaseCheckTask", listResult);
        return prefix + "/detail";
    }
 
    /**
     * 修改保存
     */
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TbSpecialCheckTaskLogEditBO taskLogEditBO)
    {
        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.updateSpecialCheckTaskLog(taskLogEditBO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
    }
 
 
    @PostMapping("/remove")
    @ResponseBody
    public AjaxResult remove(TbSpecialCheckTaskLogUpdateBO updateBO){
        ResultVO<TbSpecialCheckTaskLog> resultVO = specialCheckTaskService.deleteTbSpecialCheckTaskLog(updateBO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
    }
 
 
//
//    @Autowired
//    private DealDataTask dealDataTask;
//
//    @GetMapping("/dealDataTask")
//    public AjaxResult dealDataTask()
//    {
//        dealDataTask.dealData();
//        return success();
//    }
 
}