郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.gkhy.safePlatform.doublePrevention.service.baseService.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.commons.enums.E;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.AusinessException;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.doublePrevention.entity.PreventDangerManage;
import com.gkhy.safePlatform.doublePrevention.entity.PreventDangerRectify;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerRectifyQueryReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerRectifyUpdateReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventRectifyOverQueryReqDTO;
import com.gkhy.safePlatform.doublePrevention.repository.PreventDangerRectifyRepository;
import com.gkhy.safePlatform.doublePrevention.repository.param.*;
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventDangerRectifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service("PreventDangerRectifyService")
public class PreventDangerRectifyServiceImpl
        extends ServiceImpl<PreventDangerRectifyRepository, PreventDangerRectify> implements PreventDangerRectifyService {
 
    @Autowired
    private PreventDangerRectifyRepository preventDangerRectifyRepository;
 
    /**
     * 隐患整改清单-分页查询
     */
    @Override
    public IPage<PreventDangerRectify> getDangerRectifyPage(Page<Object> page, PreventDangerRectifyQueryReqDTO rectifyQueryReqDTO) {
        return preventDangerRectifyRepository.getDangerRectifyPage(page, rectifyQueryReqDTO);
    }
 
    /**
     * 隐患整改清单-已整改-分页查询
     */
    @Override
    public IPage<PreventDangerRectify> getRectifyOverPage(Page<Object> objectPage, PreventRectifyOverQueryReqDTO rectifyOverQueryReqDTO) {
        return preventDangerRectifyRepository.getRectifyOverPage(objectPage, rectifyOverQueryReqDTO);
    }
 
    /**
     * 隐患整改清单-新增
     */
    @Override
    public int saveDangerRectify(PreventDangerRectify dangerRectify) {
        int result = preventDangerRectifyRepository.insert(dangerRectify);
        if (result == 0) {
            throw new AusinessException(E.ADD_FAIL, "新增失败");
        }
        return result;
    }
 
    /**
     * 隐患整改清单-修改
     */
    @Override
    public int updateDangerRectify(PreventDangerRectifyUpdateParams updateParams) {
        int result = preventDangerRectifyRepository.updateDangerRectify(updateParams);
        return result;
    }
 
    /**
     * 隐患整改清单-删除
     */
    @Override
    public int deleteDangerRectify(PreventDeleteParams deleteParams) {
        int result = preventDangerRectifyRepository.deleteDangerRectify(deleteParams);
        if (result == 0) {
            throw new AusinessException(E.NOT_DELETE, "删除失败");
        }
        return result;
    }
 
    /**
     * 隐患整改清单-整改验收报告
     */
    @Override
    public int applyReport(PreventDangerReportRectifyUpdayeParams reportParams) {
        return preventDangerRectifyRepository.applyReport(reportParams);
    }
    /**
     * 隐患整改清单-验收
     */
    @Override
    public int reportRectify(PreventDangerReportRectifyUpdayeParams reportParams) {
        return preventDangerRectifyRepository.reportRectify(reportParams);
    }
 
    /**
     * 隐患整改清单-根据隐患单Code查询
     */
    @Override
    public PreventDangerRectify getRectifyByCode(String dangerCode) {
        return preventDangerRectifyRepository.getRectifyByCode(dangerCode);
    }
    /**
     * 隐患整改清单-延期
     */
    @Override
    public int updateRectifyTime(PreventDangerRectifyUpdateParams updateParams) {
        return preventDangerRectifyRepository.updateRectifyTime(updateParams);
    }
    /**
     * 隐患整改清单-根据ID查询
     */
    @Override
    public PreventDangerRectify getRectifyById(Long id) {
        return preventDangerRectifyRepository.getRectifyById(id);
    }
 
    /**
     * 隐患整改清单-关闭整改单
     */
    @Override
    public int closeDanger(CloseDangerParams closeDangerParams) {
        return preventDangerRectifyRepository.closeDanger(closeDangerParams);
    }
 
    /**
     * 隐患整改清单-根据ManageID查询
     */
    @Override
    public PreventDangerRectify getRectifyByManageId(Long manageId) {
        return preventDangerRectifyRepository.getRectifyByManageId(manageId);
    }
    /**
     * 隐患整改清单-根据ManageID查询-包含删除数据
     */
    @Override
    public PreventDangerRectify getRectifyByManageIdForReport(Long manageId) {
        return preventDangerRectifyRepository.getRectifyByManageIdForReport(manageId);
    }
    /**
     * 隐患整改清单-变更上报状态
     */
    @Override
    public void updateRectifyReportStatus(HandlerReportParam handlerReportParam) {
        int result = preventDangerRectifyRepository.updateRectifyReportStatus(handlerReportParam);
        if (result == 0) {
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
    }
 
    @Override
    public IPage<PreventDangerRectify> getDangerRectifyPageToOverRectify(Page<Object> objectPage, PreventRectifyOverQueryReqDTO rectifyOverQueryReqDTO) {
        return preventDangerRectifyRepository.getDangerRectifyPageToOverRectify(objectPage, rectifyOverQueryReqDTO);
    }
}