郑永安
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
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.ResultCodes;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckTask;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckTaskQueryReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventHandReportConfigReqDTO;
import com.gkhy.safePlatform.doublePrevention.repository.PreventDangerCheckTaskRepository;
import com.gkhy.safePlatform.doublePrevention.repository.param.HandlerReportParam;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventDangerCheckTaskUpdateParams;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventDeleteParams;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventTaskToUserParams;
import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventDangerCheckTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
 
@Service("PreventDangerCheckTaskService")
public class PreventDangerCheckTaskServiceImpl
        extends ServiceImpl<PreventDangerCheckTaskRepository, PreventDangerCheckTask> implements PreventDangerCheckTaskService {
 
    @Autowired
    private PreventDangerCheckTaskRepository preventDangerCheckTaskRepository;
 
    /**
     * 隐患排查任务-分页查询
     */
    @Override
    public IPage<PreventDangerCheckTask> getTaskPage(Page<Object> page, PreventDangerCheckTaskQueryReqDTO taskQueryReqDTO) {
        return preventDangerCheckTaskRepository.getTaskPage(page, taskQueryReqDTO);
    }
 
    /**
     * 隐患排查任务-
     */
    @Override
    public int saveTask(PreventDangerCheckTask checkTask) {
        int result = preventDangerCheckTaskRepository.insert(checkTask);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
        return result;
    }
 
    /**
     * 隐患排查任务-修改
     */
    @Override
    public int updateTask(PreventDangerCheckTaskUpdateParams updateParams) {
        int result = preventDangerCheckTaskRepository.updateTask(updateParams);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
        return result;
    }
 
    /**
     * 隐患排查任务-删除
     */
    @Override
    public int deleteTask(PreventDeleteParams deleteParams) {
        int result = preventDangerCheckTaskRepository.deleteTask(deleteParams);
        if (result == 0){
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
        return result;
    }
    /**
     * 隐患排查任务-通过id查询信息
     */
    @Override
    public PreventDangerCheckTask getTaskById(Long checkTaskId) {
        return preventDangerCheckTaskRepository.getTaskById(checkTaskId);
    }
 
    /**
     * 隐患排查任务-通过taskCode查询信息
     */
    @Override
    public PreventDangerCheckTask getTaskByCode(Long taskCode) {
        return preventDangerCheckTaskRepository.getTaskByCode(taskCode);
    }
 
    /**
     * 隐患排查任务-通过id修改任务状态
     */
    @Override
    public int updateTaskStatus(Long taskId, Byte taskStatus) {
        return preventDangerCheckTaskRepository.updateTaskStatus(taskId, taskStatus);
    }
    /**
     * 设置任务为超时
     * */
    @Override
    public int resetTaskStatus(Long taskId) {
        return preventDangerCheckTaskRepository.resetTaskStatus(taskId);
    }
 
    /**
     * 隐患排查任务-通过作业id查询
     */
    @Override
    public List<PreventDangerCheckTask> getTaskByCheckWorkId(Long checkWorkId) {
        return preventDangerCheckTaskRepository.getTaskByCheckWorkId(checkWorkId);
    }
    /**
     * 排查任务-手工上报-配置
     */
    @Override
    public int updateCheckTaskReport(PreventHandReportConfigReqDTO preventHandReportConfigReqDTO) {
        return preventDangerCheckTaskRepository.updateCheckTaskReport(preventHandReportConfigReqDTO);
    }
    /**
     * 排查任务-认领任务
     */
    @Override
    public int taskToUser(PreventTaskToUserParams taskToUserParams) {
        return preventDangerCheckTaskRepository.taskToUser(taskToUserParams);
    }
 
    /**
     * 排查任务-上报数据
     */
    @Override
    public List<PreventDangerCheckTask> listReportTask() {
        return preventDangerCheckTaskRepository.listReportTask();
    }
    /**
     * 排查任务-上报数据状态变更
     */
    @Override
    public void updateTaskReportStatus(HandlerReportParam handlerReportParam) {
        int result = preventDangerCheckTaskRepository.updateTaskReportStatus(handlerReportParam);
        if (result == 0) {
            throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR);
        }
    }
    /**
     * 排查任务-分布式锁期间,检查任务是否已经生成
     */
    @Override
    public PreventDangerCheckTask getTaskByCheckWorkIdAndStartTime(Long workId, Date checkTime) {
        return preventDangerCheckTaskRepository.getTaskByCheckWorkIdAndStartTime(workId, checkTime);
    }
}