双重预防项目-国泰新华二开定制版
heheng
2025-06-25 fa3f2aa6154d2434ffb49ed80854cec3e70aa8a5
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
package com.ruoyi.project.tr.riskEvent.controller;
 
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.doublePrevention.entity.PreventRiskEvent;
import com.ruoyi.doublePrevention.entity.dto.req.*;
import com.ruoyi.doublePrevention.entity.dto.resp.PreventRiskEventPageQueryRespDTO;
import com.ruoyi.doublePrevention.entity.dto.resp.PreventRiskEventRespDTO;
import com.ruoyi.doublePrevention.entity.dto.resp.PreventRiskUnitCodeAndNameListQueryRespDTO;
import com.ruoyi.doublePrevention.service.RiskService;
import com.ruoyi.doublePrevention.vo.ResultVO;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.system.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.tr.riskType.domain.RiskType;
import com.ruoyi.project.tr.riskType.service.IRiskTypeService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
 
/**
 * 风险单元类型Controller
 *
 * @author wm
 * @date 2020-05-05
 */
@Controller
@RequestMapping("/tr/riskEvent")
public class RiskEventController extends BaseController
{
 
    private String prefix = "tr/riskEvent";
 
    @Autowired
    private IRiskTypeService riskTypeService;
 
    @Autowired
    private RiskService riskService;
 
    @GetMapping()
    public String riskEvent(ModelMap mmap)
    {
        List<PreventRiskUnitCodeAndNameListQueryRespDTO> respDTOS = riskService.listRiskUnitCodeAndName();
        mmap.put("riskUnits", respDTOS);
        return prefix + "/riskEvent";
    }
 
    /**
     * 查询安全风险事件
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PreventRiskEventPageQueryReqDTO riskEventQueryReqDTO)
    {
        ResultVO<List<PreventRiskEventPageQueryRespDTO>> resultVO = riskService.listRiskEventPage(riskEventQueryReqDTO);
        List<PreventRiskEventPageQueryRespDTO> data = (List<PreventRiskEventPageQueryRespDTO>) resultVO.getData();
 
        //只查询属于该公司下的
//        riskType.setCompanyId(ShiroUtils.getSysUser().getCompanyId());
//        startPage();
//        List<RiskType> list = riskTypeService.selectRiskTypeList(riskType);
//        return getDataTable(list);
        TableDataInfo dataTable = getDataTable(data);
        dataTable.setTotal(resultVO.getCount());
        return dataTable;
    }
 
    /**
     * 导出风险单元类型列表
     */
    @Log(title = "风险单元类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(RiskType riskType)
    {
        List<RiskType> list = riskTypeService.selectRiskTypeList(riskType);
        ExcelUtil<RiskType> util = new ExcelUtil<RiskType>(RiskType.class);
        return util.exportExcel(list, "riskType");
    }
 
    /**
     * 新增风险单元类型
     */
    @GetMapping("/add")
    public String add(ModelMap mmap)
    {
        List<PreventRiskUnitCodeAndNameListQueryRespDTO> respDTOS = riskService.listRiskUnitCodeAndName();
        mmap.put("riskUnits", respDTOS);
        return prefix + "/add";
    }
 
    /**
     * 新增保存风险单元类型
     */
    @Log(title = "风险单元类型", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PreventRiskEventSaveReqDTO riskEventSaveReqDTO)
    {
        ResultVO<PreventRiskEvent> resultVO = riskService.saveRiskEvent(riskEventSaveReqDTO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
//        User user = ShiroUtils.getSysUser();
//        riskType.setCompanyId(user.getCompanyId());
//        riskType.setCreateBy(user.getUserName());
//        return toAjax(riskTypeService.insertRiskType(riskType));
    }
 
    /**
     * 修改风险单元类型
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        PreventRiskEventGetReqDTO riskEventGetReqDTO = new PreventRiskEventGetReqDTO();
        riskEventGetReqDTO.setId(id);
        ResultVO<PreventRiskEventRespDTO> riskEventById = riskService.getRiskEventById(riskEventGetReqDTO);
        Object data = riskEventById.getData();
//        RiskType riskType = riskTypeService.selectRiskTypeById(id);
        mmap.put("riskType", data);
//        System.out.println(prefix + "/edit");
        List<PreventRiskUnitCodeAndNameListQueryRespDTO> respDTOS = riskService.listRiskUnitCodeAndName();
        mmap.put("riskUnits", respDTOS);
        return prefix + "/edit";
    }
 
    /**
     * 修改保存风险单元类型
     */
    @Log(title = "风险单元类型", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PreventRiskEventUpdateReqDTO riskEventUpdateReqDTO)
    {
        ResultVO<PreventRiskEvent> resultVO = riskService.updateRiskEvent(riskEventUpdateReqDTO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
//        riskType.setUpdateBy(ShiroUtils.getSysUser().getUserName());
//        return toAjax(riskTypeService.updateRiskType(riskType));
    }
 
    /**
     * 删除风险单元类型
     */
    @Log(title = "风险单元类型", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(Long ids)
    {
        PreventRiskEventDeleteReqDTO riskEventDeleteReqDTO = new PreventRiskEventDeleteReqDTO();
        riskEventDeleteReqDTO.setId(ids);
        ResultVO<PreventRiskEvent> resultVO = riskService.deleteRiskEvent(riskEventDeleteReqDTO);
        String code = resultVO.getCode();
        if ("200".equals(code)){
            return toAjax(1);
        }else {
            return AjaxResult.error(resultVO.getMsg());
        }
    }
 
 
 
 
    /**
     * 跳转至设备设施类型
     * @return
     */
    @GetMapping("/riskTypeByDevice")
    public String riskTypeByDevice()
    {
        return prefix + "/riskTypeByDevice";
    }
 
    /**
     * 新增风险单元类型
     */
    @GetMapping("/addByDevice")
    public String addByDevice()
    {
        return prefix + "/addByDevice";
    }
 
    @GetMapping("/editByDevice/{riskTypeId}")
    public String editByDevice(@PathVariable("riskTypeId") Long riskTypeId, ModelMap mmap)
    {
        RiskType riskType = riskTypeService.selectRiskTypeById(riskTypeId);
        mmap.put("riskType", riskType);
        return prefix + "/editByDevice";
    }
 
 
    /**
     * 跳转至作业活动类型
     * @return
     */
    @GetMapping("/riskTypeByWork")
    public String riskTypeByWork()
    {
        return prefix + "/riskTypeByWork";
    }
 
    /**
     * 新增风险单元类型
     */
    @GetMapping("/addByWork")
    public String addByWork()
    {
        return prefix + "/addByWork";
    }
 
    @GetMapping("/editByWork/{riskTypeId}")
    public String editByWork(@PathVariable("riskTypeId") Long riskTypeId, ModelMap mmap)
    {
        RiskType riskType = riskTypeService.selectRiskTypeById(riskTypeId);
        mmap.put("riskType", riskType);
        return prefix + "/editByWork";
    }
 
 
    /**
     * 跳转至工艺节点类型
     * @return
     */
    @GetMapping("/riskTypeByCrafts")
    public String riskTypeByCrafts(){
        return prefix + "/riskTypeByCrafts";
    }
 
    /**
     * 新增风险单元类型
     */
    @GetMapping("/addByCrafts")
    public String addByCrafts()
    {
        return prefix + "/addByCrafts";
    }
 
    @GetMapping("/editByCrafts/{riskTypeId}")
    public String editByCrafts(@PathVariable("riskTypeId") Long riskTypeId, ModelMap mmap)
    {
        RiskType riskType = riskTypeService.selectRiskTypeById(riskTypeId);
        mmap.put("riskType", riskType);
        return prefix + "/editByCrafts";
    }
 
    /**
     * 跳转至作业频率类型
     * @return
     */
    @GetMapping("/riskTypeByFrequency")
    public String riskTypeByFrequency()
    {
        return prefix + "/riskTypeByFrequency";
    }
 
    /**
     * 新增风险单元类型
     */
    @GetMapping("/addByFrequency")
    public String addByFrequency()
    {
        return prefix + "/addByFrequency";
    }
 
    @GetMapping("/editByFrequency/{riskTypeId}")
    public String editByFrequency(@PathVariable("riskTypeId") Long riskTypeId, ModelMap mmap)
    {
        RiskType riskType = riskTypeService.selectRiskTypeById(riskTypeId);
        mmap.put("riskType", riskType);
        return prefix + "/editByFrequency";
    }
 
}