zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
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
package com.gkhy.safePlatform.incidentManage.service.baseService.impl;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.commons.utils.StringUtils;
import com.gkhy.safePlatform.incidentManage.entity.*;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportDBQuery;
import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportCountDBQuery;
import com.gkhy.safePlatform.incidentManage.repository.AccidentReportInfoRepository;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service("accidentReportInfoService")
public class AccidentReportInfoServiceImpl extends ServiceImpl<AccidentReportInfoRepository, AccidentReportInfo> implements AccidentReportInfoService {
 
    @Autowired
    private AccidentReportInfoRepository accidentReportInfoRepository;
 
    @Override
    public List<AccidentReportInfoPageDO> selectAccidentReportList(Page<AccidentReportInfoPageDO> page, AccidentReportDBQuery AccidentReportDBQuery) {
        return accidentReportInfoRepository.selectAccidentReportList(page,AccidentReportDBQuery);
    }
 
    @Override
    public void addAccidentReport(AccidentReportInfo AccidentReportInfo) {
        accidentReportInfoRepository.addAccidentReport(AccidentReportInfo);
    }
 
    @Override
    public AccidentReportInfoDetailDO selectAccidentReportById(Long id) {
        return accidentReportInfoRepository.selectAccidentReportById(id);
    }
 
    @Override
    public void updateAccidentReport(AccidentReportInfo AccidentReportInfo) {
        accidentReportInfoRepository.updateAccidentReport(AccidentReportInfo);
    }
 
    @Override
    public void deleteAccidentReportById(Long teamId) {
        accidentReportInfoRepository.deleteAccidentReportById(teamId);
    }
 
    @Override
    public List<AccidentReportCount> selectByTimeAndType(AccidentReportCountDBQuery dbQuery) {
        return accidentReportInfoRepository.selectByTimeAndType(dbQuery);
    }
 
    @Override
    public List<AccidentReportCountRPC> getCountForRPCByDeptIdAndMonth(String startTime, String endTime, Long deptId) {
        return accidentReportInfoRepository.getCountForRPCByDeptIdAndMonth(startTime,endTime,deptId);
    }
 
    @Override
    public List<AccidentReportCountRPC> getCountForRPCByDeptIdAndDay(String startTime, String endTime, Long deptId) {
        return accidentReportInfoRepository.getCountForRPCByDeptIdAndDay(startTime,endTime,deptId);
    }
 
    @Override
    public List<AccidentResultCountDO> getAccidentCountByDeptIdsAndTime(String startTime, String endTime, List<Long> deptIds) {
        if(StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime) || null == deptIds || deptIds.size() == 0){
            throw new AccidentException(AccidentResultCodes.SERVE_PARAM_NULL);
        }
        return accidentReportInfoRepository.getAccidentCountByDeptIdsAndTime(startTime,endTime,deptIds);
    }
 
    @Override
    public List<AccidentResultCountDO> getAccidentCountByDeptIdAndTime(String startTime, String endTime, Long deptId) {
        if(StringUtils.isBlank(startTime) || StringUtils.isBlank(endTime) || null == deptId ){
            throw new AccidentException(AccidentResultCodes.SERVE_PARAM_NULL);
        }
        return accidentReportInfoRepository.getAccidentCountByDeptIdAndTime(startTime,endTime,deptId);
    }
 
    @Override
    public List<AccidentStatisticCountDO> getCountByAccidentGrade(Integer year, Integer month) {
        return accidentReportInfoRepository.getCountByAccidentGrade(year,month);
    }
 
}