| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.security.ShiroUtils; |
| | | import com.ruoyi.doublePrevention.service.RiskService; |
| | | 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.project.tr.hiddenTroubleType.service.IHiddenTroubleTypeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private RiskService riskService; |
| | | |
| | | @GetMapping() |
| | | public String hiddenDangerCheck(ModelMap mmap) { |
| | |
| | | |
| | | /** |
| | | * 新增保存隐患上报 |
| | | * todo-2022 隐患上报 需要检查对分别对两张表做了什么,然后添加附属表(tr_hidden_danger_check_point) |
| | | */ |
| | | @Log(title = "隐患上报", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addDangerReportSave") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult addDangerReportSave(HiddenDangerCheckPoint hdcp) { |
| | | HiddenDangerCheck hiddenDangerCheck = new HiddenDangerCheck(); |
| | | hiddenDangerCheck.setCreateBy(ShiroUtils.getLoginName());//创建者 |
| | |
| | | |
| | | hdcp.setCompanyId(getSysUser().getCompanyId()); |
| | | int i = hiddenDangerCheckPointService.insertHiddenDangerCheckPoint(hdcp); |
| | | if (i< 1){ |
| | | throw new RuntimeException("添加隐患信息失败"); |
| | | } |
| | | |
| | | |
| | | // todo-2022 此处插入附属表 |
| | | //获取Id返回值 |
| | | hdcp.getId(); |
| | | int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | | if (result< 1){ |
| | | throw new RuntimeException("添加隐患附属信息失败"); |
| | | } |
| | | |
| | | hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送 |
| | | |
| | | return toAjax(i); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @Log(title = "隐患上报", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/editDangerReportSave") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult editDangerReportSave(HiddenDangerCheckPoint hiddenDangerCheckPoint) { |
| | | HiddenDangerCheckPoint hdcp = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(hiddenDangerCheckPoint.getId()); |
| | | if(hdcp!=null&&hdcp.getCheckId()!=null){ |
| | |
| | | hiddenDangerCheckPoint.setUpdateBy(ShiroUtils.getLoginName());//更新者 |
| | | hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());//设置更新时间 |
| | | hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint); |
| | | |
| | | // todo-2022 此处修改附属表 |
| | | int result = riskService.updateDangerInfo(hiddenDangerCheckPoint); |
| | | if (result < 1){ |
| | | throw new RuntimeException("修改失败"); |
| | | } |
| | | |
| | | hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送 |
| | | return AjaxResult.success(); |
| | |
| | | @Log(title = "隐患上报", businessType = BusinessType.DELETE) |
| | | @PostMapping("/removeDangerReport") |
| | | @ResponseBody |
| | | @Transactional |
| | | public AjaxResult removeDangerReport(String ids) { |
| | | if(StringUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("id不能为空"); |
| | |
| | | if(hdcp.getCheckId()!=null){ |
| | | hiddenDangerCheckPointService.deleteHiddenDangerCheckPointById(hdcp.getId()); |
| | | hiddenDangerCheckService.deleteHiddenDangerCheckById(hdcp.getCheckId()); |
| | | |
| | | // todo-2022 此处删除附属表 |
| | | int result = riskService.deleteDangerInfo(hdcp.getId()); |
| | | |
| | | if (result < 1){ |
| | | throw new RuntimeException("删除失败"); |
| | | } |
| | | |
| | | hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送 |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 隐患上报--提交 |
| | | * 隐患信息提交,此处不改。思路:使用stage 进行阶段判断。只有认定后的隐患,才需要上报。 |
| | | */ |
| | | @Log(title = "隐患上报--提交") |
| | | @PostMapping("/submitDangerReport") |