双重预防项目-国泰新华二开定制版
16639036659
2024-07-17 ca2c7d63825d8bbe74978b365e8f978aaa489b34
src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckScoreAndDangerLogServiceImpl.java
@@ -2,18 +2,17 @@
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.BeanCopyUtils;
import com.ruoyi.doublePrevention.entity.CJReport.PreventCJReportDangerInfo;
import com.ruoyi.doublePrevention.enums.ErrorCodes;
import com.ruoyi.doublePrevention.enums.ResultCodes;
import com.ruoyi.doublePrevention.repository.PreventCJReportDangerInfoRepository;
import com.ruoyi.doublePrevention.vo.ResultVO;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckItemDangerLogUpdateBO;
import com.ruoyi.project.tr.specialCheck.domin.*;
import com.ruoyi.project.tr.specialCheck.domin.BO.HandlerSpecialCheckReportParam;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogEditBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogQueryBO;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckScore;
import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckItemDangerLog;
import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckScoreAndDangerLog;
import com.ruoyi.project.tr.specialCheck.mapper.*;
import com.ruoyi.project.tr.specialCheck.service.SpecialCheckScoreAndDangerDangerLogService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +20,7 @@
import org.springframework.util.ObjectUtils;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import java.util.UUID;
@@ -43,6 +43,9 @@
    @Autowired
    private PreventCJReportDangerInfoRepository preventCJReportDangerInfoRepository;
    @Autowired
    private TbSpecialCheckItemLogMapper specialCheckItemLogMapper;
@@ -72,20 +75,12 @@
    }
    @Override
    public ResultVO<TbSpecialCheckScoreAndDangerLog> addSpecialScoreAndDanger(TbSpecialCheckScoreAndDangerLog scoreAndDangerLog) {
    public ResultVO<TbSpecialCheckScoreAndDangerLog> addSpecialScoreAndDanger(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) {
        User sysUser = getSysUser();
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
        TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class);
        if (scoreAndDangerLog.getTaskId() == null){
            resultVO.setMsg("任务不能为空");
            return resultVO;
        }
        TbBaseCheckTaskMapper baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(scoreAndDangerLog.getTaskId());
        if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
            resultVO.setMsg("任务不存在");
            return resultVO;
        }
        if (scoreAndDangerLog.getCheckItemId() == null){
            resultVO.setMsg("检查项不能为空");
            return resultVO;
@@ -113,12 +108,17 @@
            resultVO.setMsg("隐患不存在");
            return resultVO;
        }
        if (scoreAndDangerLog.getCheckDate() == null){
        if (scoreAndDangerEditLog.getCheckDate() == null){
            resultVO.setMsg("检查时间不能为空");
            return resultVO;
        }
        if (scoreAndDangerLog.getCheckType() == null){
            resultVO.setMsg("检查类型不能为空");
            return resultVO;
        }
        TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId());
        if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
            resultVO.setMsg("专项任务不存在");
            return resultVO;
        }
@@ -138,7 +138,8 @@
        scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject());
        scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint());
        scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate());
        scoreAndDangerLog.setTaskId(baseCheckItemByItemId.getTaskId());
        scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault()));
@@ -149,6 +150,16 @@
            resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc());
            return resultVO;
        }
//        HandlerSpecialCheckReportParam specialCheckItemLog = new HandlerSpecialCheckReportParam();
//        specialCheckItemLog.setId();
//        specialCheckItemLog.setReportStatus((byte) 2);
//        specialCheckItemLog.setReportTime(dateTime);
//        int i = specialCheckItemLogMapper.updateItemDangerReportStatusById(specialCheckItemLog);
//        if (i == 0){
//            resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode());
//            resultVO.setMsg("修改检查项状态失败");
//            return resultVO;
//        }
        resultVO.setCode(ResultCodes.OK.getCode());
        resultVO.setMsg("新增检查成功");
        return resultVO;
@@ -160,20 +171,13 @@
    }
    @Override
    public ResultVO<TbSpecialCheckScoreAndDangerLog> updateSpecialCheckScoreAndDangerLog(TbSpecialCheckScoreAndDangerLog scoreAndDangerLog) {
    public ResultVO<TbSpecialCheckScoreAndDangerLog> updateSpecialCheckScoreAndDangerLog(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) {
        User sysUser = getSysUser();
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
        if (scoreAndDangerLog.getTaskId() == null){
            resultVO.setMsg("任务不能为空");
            return resultVO;
        }
        TbBaseCheckTaskMapper baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(scoreAndDangerLog.getTaskId());
        if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
            resultVO.setMsg("任务不存在");
            return resultVO;
        }
        TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class);
        if (scoreAndDangerLog.getCheckItemId() == null){
            resultVO.setMsg("检查项不能为空");
            return resultVO;
@@ -201,12 +205,17 @@
            resultVO.setMsg("隐患不存在");
            return resultVO;
        }
        if (scoreAndDangerLog.getCheckDate() == null){
        if (scoreAndDangerEditLog.getCheckDate() == null){
            resultVO.setMsg("检查时间不能为空");
            return resultVO;
        }
        if (scoreAndDangerLog.getCheckType() == null){
            resultVO.setMsg("检查类型不能为空");
            return resultVO;
        }
        TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId());
        if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
            resultVO.setMsg("专项任务不存在");
            return resultVO;
        }
@@ -220,6 +229,7 @@
        scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject());
        scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint());
        scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate());
        scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault()));
        int updateResult = scoreAndDangerLogMapper.updateSpecialCheckScoreAndDangerLogById(scoreAndDangerLog);
        if (updateResult == 0){