From 7e8d51b6a2d2892c8eca2c8cefd91f7d1b6f8f40 Mon Sep 17 00:00:00 2001 From: 16639036659 <577530412@qq.com> Date: 星期二, 11 十月 2022 09:33:29 +0800 Subject: [PATCH] 隐患上报,已经测过 --- src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java | 73 +++++++++++++++++++++++++++++++++++- 1 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java index fec933b..c132bab 100644 --- a/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java +++ b/src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerReportController.java @@ -5,6 +5,7 @@ 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; @@ -20,6 +21,7 @@ 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.*; @@ -49,6 +51,9 @@ @Autowired private IUserService userService; + + @Autowired + private RiskService riskService; @GetMapping() public String hiddenDangerCheck(ModelMap mmap) { @@ -130,10 +135,12 @@ /** * 新增保存隐患上报 + * 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());//创建者 @@ -154,13 +161,22 @@ 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); } - - /** @@ -192,6 +208,7 @@ @Log(title = "隐患上报全流程", businessType = BusinessType.INSERT) @PostMapping("/addDangerReportWholeProcessSave") @ResponseBody + @Transactional public AjaxResult addDangerReportWholeProcessSave(HiddenDangerCheckPoint hdcp) { //新增隐患上报 HiddenDangerCheck hiddenDangerCheck = new HiddenDangerCheck(); @@ -206,6 +223,9 @@ hiddenDangerCheck.setDangerPlaceId(hdcp.getDangerPlaceId()); hiddenDangerCheck.setDangerPlaceName(hdcp.getDangerPlaceName()); hiddenDangerCheckService.insertHiddenDangerCheck(hiddenDangerCheck);//构造隐患排查对象保存,主要保存隐患责任部门,隐患地点 + + // todo-2022 1.全流程隐患上报信息封装 + hdcp.setCheckId(hiddenDangerCheck.getCheckId()); hdcp.setCreateBy(ShiroUtils.getLoginName());//创建者 @@ -226,6 +246,7 @@ // hdcp.setRegisterSubmitTime(DateUtils.getNowDate());//设置隐患上报提交时间 + //隐患上报判定 // hdcp.setJudgeCreateTime(DateUtils.getNowDate());//设置隐患上报判定时间 if (!StringUtils.isEmpty(hdcp.getReportStatus())) { @@ -239,6 +260,7 @@ hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查) } } + // todo-2022 2.全流程隐患提交信息封装-未操作 //隐患核查 @@ -254,11 +276,17 @@ } } + // todo-2022 3.全流程隐患核查信息封装-未操作 + + //隐患整改 // hdcp.setRectifyCreateTime(DateUtils.getNowDate());//设置整改时间 hdcp.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_ALREADY_RECTIFY);//整改状态(已整改) hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_NOT_ACCEPT);//验收状态(未验收) hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_ACCEPT);//隐患验收阶段(数据进入到隐患验收阶段) + + + // todo-2022 4.全流程隐患整改信息封装-未操作 //隐患验收 if (!StringUtils.isEmpty(hdcp.getAcceptResult())) { @@ -269,8 +297,11 @@ hdcp.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_NOT_RECTIFY);//整改状态(未整改) hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_NOT_PASS);//验收状态(验收未通过) } else if ("1".equals(hdcp.getAcceptResult())) { -// hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间 +// hdcp.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间 hdcp.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过) + + // todo-2022 5.全流程隐患验收信息封装-未操作 + } } hdcp.setCompanyId(getSysUser().getCompanyId()); @@ -279,6 +310,14 @@ hdcp.setUpdateTime(hdcp.getAcceptCreateTime()); int i = hiddenDangerCheckPointService.insertHiddenDangerCheckPoint(hdcp); + + // todo-2022 全流程隐患附属信息插入 + //获取返回值id + hdcp.getId(); + int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); + if (result < 1){ + throw new RuntimeException("全流程隐患信息保存失败"); + } return toAjax(i); } @@ -317,6 +356,7 @@ @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){ @@ -332,6 +372,12 @@ 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(); @@ -372,10 +418,12 @@ /** * 修改判定隐患上报保存 + * todo-2022 隐患核查(判定隐患) 以判定的隐患,才需要上报 */ @Log(title = "修改判定隐患上报保存", businessType = BusinessType.UPDATE) @PostMapping("/editJudgeDangerReportSave") @ResponseBody + @Transactional public AjaxResult editJudgeDangerReportSave(HiddenDangerCheckPoint hiddenDangerCheckPoint) { hiddenDangerCheckPoint.setJudgeCreateTime(DateUtils.getNowDate());//设置隐患上报判定时间 if (!StringUtils.isEmpty(hiddenDangerCheckPoint.getReportStatus())) { @@ -388,10 +436,19 @@ hiddenDangerCheckPoint.setDangerLevel("0");//默认设置为一般隐患 hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//隐患核查阶段(数据进入到隐患核查阶段) hiddenDangerCheckPoint.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查) + + // todo-2022 隐患信息判定 + int result = riskService.updateDangerInfoJudge(hiddenDangerCheckPoint); + if (result < 1){ + throw new RuntimeException("整改信息保存失败"); + } + } } int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint); + hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送 + return toAjax(i); } @@ -402,6 +459,7 @@ @Log(title = "隐患上报", businessType = BusinessType.DELETE) @PostMapping("/removeDangerReport") @ResponseBody + @Transactional public AjaxResult removeDangerReport(String ids) { if(StringUtils.isEmpty(ids)){ return AjaxResult.error("id不能为空"); @@ -410,6 +468,14 @@ 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(); } @@ -419,6 +485,7 @@ /** * 隐患上报--提交 + * 隐患信息提交,此处不改。思路:使用stage 进行阶段判断。只有认定后的隐患,才需要上报。 */ @Log(title = "隐患上报--提交") @PostMapping("/submitDangerReport") -- Gitblit v1.9.2