16639036659
2023-12-11 56c84cd7fb04407536eb0135162313029828a81f
src/main/java/com/ruoyi/project/tr/hiddenDangerCheck/controller/DangerScheduleController.java
@@ -6,6 +6,7 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
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;
@@ -29,9 +30,11 @@
import com.ruoyi.project.tr.riskCheckPoint.service.IRiskCheckPointService;
import com.ruoyi.project.tr.riskEvaluationPlan.domain.RiskEvaluationPlan;
import com.ruoyi.project.tr.riskEvaluationPlan.service.IRiskEvaluationPlanService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.*;
@@ -72,6 +75,9 @@
    @Autowired
    private IRoleService roleService;
    @Autowired
    private RiskService riskService;
    @GetMapping()
    public String hiddenDangerCheck(ModelMap mmap) {
@@ -395,7 +401,7 @@
                //是隐患设置核查人ID、核查人名称
                if ((!StringUtils.isEmpty(hdcp.getWhetherDanger())) &&
                        (TrHiddenDangerCheckConstants.WHETHER_DANGER_YES.equals(hdcp.getWhetherDanger()))) {
                    hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查)
                    hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状8态(待核查)
                    hdcp.setExamineUserId(hiddenDangerCheck.getExamineUserId());//核查人ID
                    hdcp.setExamineUserName(hiddenDangerCheck.getExamineUserName());//核查人名称
                    hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//3隐患核查阶段(/** 更新者 */数据进入到3隐患核查阶段)
@@ -422,7 +428,9 @@
        hiddenDangerCheckPoint.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_NOT);//是否为隐患(正常)
//        hiddenDangerCheckPoint.setScheduleCheckStatus(TrHiddenDangerCheckConstants.CHECK_STATUS_ALREADY_CHECK);//排查状态(已排查)(定时任务生成的数据)
//        hiddenDangerCheckPoint.setCheckTime(DateUtils.getNowDate());//设置排查时间
        if(ObjectUtils.isEmpty(hiddenDangerCheckPoint.getMobileCode())){
            throw new RuntimeException("手机识别码为空,请使用终端机进行填写");
        }
        int i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -439,7 +447,9 @@
        //隐患排查检查点实体
        HiddenDangerCheckPoint hiddenDangerCheckPoint = hiddenDangerCheckPointService.selectHiddenDangerCheckPointById(Long.valueOf(id));
        mmap.put("hiddenDangerCheckPoint", hiddenDangerCheckPoint);
        if(ObjectUtils.isEmpty(hiddenDangerCheckPoint.getMobileCode())){
            throw new RuntimeException("手机识别码为空,请使用终端机进行填写");
        }
        //隐患类别
        User sysUser = getSysUser();
        HiddenTroubleType hiddenTroubleType = new HiddenTroubleType();
@@ -486,6 +496,9 @@
            hiddenDangerCheckPoint.setUpdateBy(getSysUser().getLoginName());
            hiddenDangerCheckPoint.setUpdateTime(DateUtils.getNowDate());
            i = hiddenDangerCheckPointService.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
        }
        if(ObjectUtils.isEmpty(hiddenDangerCheckPoint.getMobileCode())){
            throw new RuntimeException("手机识别码为空,请使用终端机进行填写");
        }
        hiddenDangerCheckPointService.getTaskCountTotal(getSysUser().getUserId());//查询未执行任务总数量并推送
@@ -536,8 +549,18 @@
    @Log(title = "删除定时隐患排查", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    @ResponseBody
    @Transactional
    public AjaxResult remove(String ids) {
        return toAjax(hiddenDangerCheckService.deleteHiddenDangerCheckByIds(ids));
        //老代码
        int result = hiddenDangerCheckService.deleteHiddenDangerCheckByIds(ids);
        // todo-2022 删除定时核查任务 新代码添加
        int result1 = riskService.deleteDangerCheck(ids);
        if (result1 < 1){
            throw new RuntimeException("删除核查任务附属表失败");
        }
        return toAjax(result);
    }