双重预防项目-国泰新华二开定制版
heheng
3 天以前 ac8870aae3ec2b5ec5315cc668b482858195cfa4
src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerAcceptController.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo;
import com.ruoyi.doublePrevention.service.RiskService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
@@ -13,6 +14,7 @@
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
@@ -44,7 +46,7 @@
    }
    /**
     * 查询隐患排查列表
     * 查询隐患排查列表头
     */
    @PostMapping("/list")
    @ResponseBody
@@ -52,6 +54,14 @@
        startPage();
        hiddenDangerCheckPoint.setAcceptUserId(getSysUser().getUserId());//验收人为本登录帐号userId的
        List<HiddenDangerCheckPoint> list = hiddenDangerCheckPointService.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
        for (HiddenDangerCheckPoint dangerCheckPoint : list) {
            PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoByDangerCheckPointId(dangerCheckPoint.getId());
            if (ObjectUtils.isNotEmpty(dangerInfo)){
                if (ObjectUtils.isNotEmpty(dangerInfo.getReportTime())){
                    dangerCheckPoint.setReportTime(dangerInfo.getReportTime());
                }
            }
        }
        return getDataTable(list);
    }
@@ -81,22 +91,24 @@
        User sysUser = getSysUser();
        hiddenDangerCheckPoint.setUpdateBy(ShiroUtils.getLoginName());
        hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
        if (ObjectUtils.isEmpty(hiddenDangerCheckPoint.getAcceptCreateTime())){
            throw new RuntimeException("请填写验收时间");
        }
        if (!StringUtils.isEmpty(hiddenDangerCheckPoint.getAcceptResult())) {
            //验收结果 (0不通过 打回上一级整改阶段  1通过)
            if ("0".equals(hiddenDangerCheckPoint.getAcceptResult())) {
                hiddenDangerCheckPoint.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());//设置验收时间 todo 改为使用前端传输的时间
                hiddenDangerCheckPoint.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_RECTIFY);//隐患整改阶段(数据进入到隐患整改阶段)
                hiddenDangerCheckPoint.setRectifyStatus(TrHiddenDangerCheckConstants.RECTIFY_STATUS_NOT_RECTIFY);//整改状态(未整改)
                hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_NOT_PASS);//验收状态(验收未通过)
            } else if ("1".equals(hiddenDangerCheckPoint.getAcceptResult())) {
                hiddenDangerCheckPoint.setAcceptCreateTime(DateUtils.getNowDate());//设置验收时间
                hiddenDangerCheckPoint.setAcceptCreateTime(hiddenDangerCheckPoint.getAcceptCreateTime());
                hiddenDangerCheckPoint.setAcceptStatus(TrHiddenDangerCheckConstants.ACCEPT_STATUS_ALREADY_ACCEPT_PASS);//验收状态(验收通过)
            }
        }
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
        // todo-2022  验收通过
        // todo-2022 验收通过,修改为已验收状态
        int result = riskService.updateDangerInfoAccept(hiddenDangerCheckPoint);
        if (result < 1){
            throw new RuntimeException("隐患验收信息保存失败");
@@ -115,6 +127,12 @@
    public String detailDangerAccept(@PathVariable("id") Long id, ModelMap mmap) {
        //隐患排查实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        PreventRiskDangerInfo dangerInfo = riskService.getDangerInfoByDangerCheckPointId(hiddenDangerCheckPoint.getId());
        if (ObjectUtils.isNotEmpty(dangerInfo)){
            if (ObjectUtils.isNotEmpty(dangerInfo.getReportTime())){
                hiddenDangerCheckPoint.setReportTime(dangerInfo.getReportTime());
            }
        }
        mmap.put("hdcp", hiddenDangerCheckPoint);
        return prefix + "/detailDangerAccept";
    }