双重预防项目-国泰新华二开定制版
马宇豪
2024-06-19 6d8304c25e9b732172de6f1597075612aa2950de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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.*;
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();
    }
 
 
}