双重预防项目-国泰新华二开定制版
kongzy
2024-08-14 135a322f44708b1187d37ea4b6859b5d82113e89
src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/TbBaseCheckServiceImpl.java
@@ -1,120 +1,122 @@
package com.ruoyi.project.tr.specialCheck.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.doublePrevention.enums.ErrorCodes;
import com.ruoyi.doublePrevention.enums.ResultCodes;
import com.ruoyi.doublePrevention.vo.ResultVO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckItemBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckScoreBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckTaskBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckScore;
import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask;
import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog;
import com.ruoyi.project.tr.specialCheck.mapper.*;
import com.ruoyi.project.tr.specialCheck.service.TbBaseCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TbBaseCheckServiceImpl implements TbBaseCheckService {
    @Autowired
    private TbBaseCheckCompanyMapper companyTbRepository;
    @Autowired
    private TbBaseCheckItemMapper itemTbRepository;
    @Autowired
    private TbBaseCheckScoreMapper scoreTbRepository;
    @Autowired
    private TbBaseCheckTaskMapper taskTbRepository;
    @Autowired
    private TbSpecialCheckTaskLogMapper taskSpecialLogMapper;
    @Override
    public ResultVO<List<TbBaseCheckTask>> selectTbBaseCheckTaskPage(TbBaseCheckTaskBO tbBaseCheckTaskBO) {
        Integer pageIndex = tbBaseCheckTaskBO.getPageNum();
        Integer pageSize = tbBaseCheckTaskBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        Page<TbBaseCheckTask> page = PageHelper.startPage(pageIndex, pageSize);
        taskTbRepository.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckTask> pageResult = null;
        ResultVO<List<TbBaseCheckTask>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public ResultVO<List<TbBaseCheckItem>> selectTbBaseCheckItemPage(TbBaseCheckItemBO tbBaseCheckItemBO) {
        Integer pageIndex = tbBaseCheckItemBO.getPageNum();
        Integer pageSize = tbBaseCheckItemBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        Page<TbBaseCheckItem> page = PageHelper.startPage(pageIndex, pageSize);
        itemTbRepository.selectTbBaseCheckItemPage(tbBaseCheckItemBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckItem> pageResult = null;
        ResultVO<List<TbBaseCheckItem>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public ResultVO<List<TbBaseCheckScore>> selectTbBaseCheckScorePage(TbBaseCheckScoreBO tbBaseCheckScoreBO) {
        Integer pageIndex = tbBaseCheckScoreBO.getPageNum();
        Integer pageSize = tbBaseCheckScoreBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        Page<TbBaseCheckScore> page = PageHelper.startPage(pageIndex, pageSize);
        scoreTbRepository.selectTbBaseCheckScorePage(tbBaseCheckScoreBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckScore> pageResult = null;
        ResultVO<List<TbBaseCheckScore>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public List<TbBaseCheckTask> listTbBaseCheckTask() {
        return scoreTbRepository.listTbBaseCheckTask();
    }
}
package com.ruoyi.project.tr.specialCheck.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.doublePrevention.enums.ErrorCodes;
import com.ruoyi.doublePrevention.enums.ResultCodes;
import com.ruoyi.doublePrevention.vo.ResultVO;
import com.ruoyi.project.tr.specialCheck.domin.*;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckItemBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckScoreBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckTaskBO;
import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO;
import com.ruoyi.project.tr.specialCheck.mapper.*;
import com.ruoyi.project.tr.specialCheck.service.SpecialCheckItemDangerLogService;
import com.ruoyi.project.tr.specialCheck.service.TbBaseCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TbBaseCheckServiceImpl implements TbBaseCheckService {
    @Autowired
    private TbBaseCheckCompanyMapper companyTbRepository;
    @Autowired
    private TbBaseCheckItemMapper itemTbRepository;
    @Autowired
    private TbBaseCheckScoreMapper scoreTbRepository;
    @Autowired
    private TbBaseCheckTaskMapper taskTbRepository;
    @Autowired
    private TbSpecialCheckTaskLogMapper taskSpecialLogMapper;
    @Autowired
    private SpecialCheckItemDangerLogService itemDangerLogService;
    @Override
    public ResultVO<List<TbBaseCheckTask>> selectTbBaseCheckTaskPage(TbBaseCheckTaskBO tbBaseCheckTaskBO) {
        Integer pageIndex = tbBaseCheckTaskBO.getPageNum();
        Integer pageSize = tbBaseCheckTaskBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        Page<TbBaseCheckTask> page = PageHelper.startPage(pageIndex, pageSize);
        taskTbRepository.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckTask> pageResult = null;
        ResultVO<List<TbBaseCheckTask>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public ResultVO<List<TbBaseCheckItem>> selectTbBaseCheckItemPage(TbBaseCheckItemBO tbBaseCheckItemBO) {
        Integer pageIndex = tbBaseCheckItemBO.getPageNum();
        Integer pageSize = tbBaseCheckItemBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        Page<TbBaseCheckItem> page = PageHelper.startPage(pageIndex, pageSize);
        itemTbRepository.selectTbBaseCheckItemPage(tbBaseCheckItemBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckItem> pageResult = null;
        ResultVO<List<TbBaseCheckItem>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public ResultVO<List<TbBaseCheckScore>> selectTbBaseCheckScorePage(TbBaseCheckScoreBO tbBaseCheckScoreBO) {
        Integer pageIndex = tbBaseCheckScoreBO.getPageNum();
        Integer pageSize = tbBaseCheckScoreBO.getPageSize();
        if (pageIndex == 0 || pageSize == 0){
            return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
        }
        TbSpecialCheckItemLog specialCheckItemDangerLogById = itemDangerLogService.getSpecialCheckItemDangerLogById(tbBaseCheckScoreBO.getId());
        Page<TbBaseCheckScore> page = PageHelper.startPage(pageIndex, pageSize);
        tbBaseCheckScoreBO.setCheckItemId(specialCheckItemDangerLogById.getCheckItemId());
        scoreTbRepository.selectTbBaseCheckScorePage(tbBaseCheckScoreBO);
        Long total = page.getTotal();
        int count = total.intValue();
        List<TbBaseCheckScore> pageResult = null;
        ResultVO<List<TbBaseCheckScore>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
        resultVO.setData(page.getResult());
        resultVO.setCount(count);
        resultVO.setCount((int) page.getTotal());
        resultVO.setPageNum(page.getPageNum());
        resultVO.setPageSize(page.getPageSize());
        return resultVO;
    }
    @Override
    public List<TbBaseCheckTask> listTbBaseCheckTask() {
        return taskTbRepository.listTbBaseCheckTask();
    }
}