| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.PreventRiskEventListQueryRespDTO; |
| | |
| | | import com.ruoyi.doublePrevention.enums.ResultCodes; |
| | | import com.ruoyi.doublePrevention.service.RiskService; |
| | | import com.ruoyi.doublePrevention.vo.ResultVO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | 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.system.user.domain.User; |
| | | import com.ruoyi.project.tr.riskType.domain.RiskType; |
| | | import com.ruoyi.project.tr.riskType.service.IRiskTypeService; |
| | | 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.util.List; |
| | | |
| | | import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser; |
| | | |
| | | @RestController |
| | | @RequestMapping("/riskEvent") |
| | | public class PreventRiskEventController { |
| | | @Controller |
| | | @RequestMapping("/tr/test") |
| | | public class PreventRiskEventController extends BaseController { |
| | | |
| | | private String prefix = ""; |
| | | |
| | | |
| | | @GetMapping() |
| | | public String riskEvent() |
| | | { |
| | | return prefix + "/riskEvent"; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private RiskService riskService; |
| | |
| | | public ResultVO<List<PreventRiskEventListQueryRespDTO>> listRiskEvent() { |
| | | return riskService.listRiskEvent(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IRiskTypeService riskTypeService; |
| | | /** |
| | | * 查询风险单元类型列表 |
| | | */ |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(RiskType riskType) |
| | | { |
| | | //只查询属于该公司下的 |
| | | riskType.setCompanyId(ShiroUtils.getSysUser().getCompanyId()); |
| | | |
| | | startPage(); |
| | | List<RiskType> list = riskTypeService.selectRiskTypeList(riskType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导出风险单元类型列表 |
| | | */ |
| | | @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() |
| | | { |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存风险单元类型 |
| | | */ |
| | | @Log(title = "风险单元类型", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(RiskType riskType) |
| | | { |
| | | User user = ShiroUtils.getSysUser(); |
| | | riskType.setCompanyId(user.getCompanyId()); |
| | | riskType.setCreateBy(user.getUserName()); |
| | | return toAjax(riskTypeService.insertRiskType(riskType)); |
| | | } |
| | | |
| | | /** |
| | | * 修改风险单元类型 |
| | | */ |
| | | @GetMapping("/edit/{riskTypeId}") |
| | | public String edit(@PathVariable("riskTypeId") Long riskTypeId, ModelMap mmap) |
| | | { |
| | | RiskType riskType = riskTypeService.selectRiskTypeById(riskTypeId); |
| | | mmap.put("riskType", riskType); |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存风险单元类型 |
| | | */ |
| | | @Log(title = "风险单元类型", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @ResponseBody |
| | | public AjaxResult editSave(RiskType riskType) |
| | | { |
| | | riskType.setUpdateBy(ShiroUtils.getSysUser().getUserName()); |
| | | return toAjax(riskTypeService.updateRiskType(riskType)); |
| | | } |
| | | |
| | | /** |
| | | * 删除风险单元类型 |
| | | */ |
| | | @Log(title = "风险单元类型", businessType = BusinessType.DELETE) |
| | | @PostMapping( "/remove") |
| | | @ResponseBody |
| | | public AjaxResult remove(String ids) |
| | | { |
| | | return toAjax(riskTypeService.deleteRiskTypeByIds(ids)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转至设备设施类型 |
| | | * @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"; |
| | | } |
| | | } |