package com.gk.hotwork.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.gk.hotwork.Domain.Enum.ResultCodes; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTask; import com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskRectifyDO; import com.gk.hotwork.doublePrevention.entity.dto.req.PreventDangerCheckTaskQueryReqDTO; import com.gk.hotwork.doublePrevention.entity.dto.req.PreventHandReportConfigReqDTO; import com.gk.hotwork.doublePrevention.repository.PreventDangerCheckTaskRepository; import com.gk.hotwork.doublePrevention.repository.param.HandlerReportParam; import com.gk.hotwork.doublePrevention.repository.param.PreventDangerCheckTaskUpdateParams; import com.gk.hotwork.doublePrevention.repository.param.PreventDeleteParams; import com.gk.hotwork.doublePrevention.repository.param.PreventTaskToUserParams; import com.gk.hotwork.doublePrevention.service.baseService.PreventDangerCheckTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.Date; import java.util.Date; import java.util.List; import java.util.Map; @Service("PreventDangerCheckTaskService") public class PreventDangerCheckTaskServiceImpl extends ServiceImpl implements PreventDangerCheckTaskService { @Autowired private PreventDangerCheckTaskRepository preventDangerCheckTaskRepository; /** * 隐患排查任务-分页查询 */ @Override public IPage getTaskPage(Page page, PreventDangerCheckTaskQueryReqDTO taskQueryReqDTO) { return preventDangerCheckTaskRepository.getTaskPage(page, taskQueryReqDTO); } /** * 隐患排查任务-分页查询-手机端使用 */ @Override public IPage getTaskPageForMobile(Page page, PreventDangerCheckTaskQueryReqDTO taskQueryReqDTO) { return preventDangerCheckTaskRepository.getTaskPageForMobile(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 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 selectInspectorsStatistics(Long depId, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectorsStatistics(depId,list,startTime,endTime); } @Override public List selectInspectionCompleted(Long depId, Byte status, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectionCompleted(depId, status, list,startTime,endTime); } /** * 排查任务-上报数据 */ @Override public List 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); } /** * 排查任务-查询应该已经过期,但是还在执行中状态的任务 */ @Override public List listOverTask(Date startTime, Date endTime) { return preventDangerCheckTaskRepository.listOverTask(startTime, endTime); } /** * 排查任务-查询应该已经开始,但是还在待执行状态的任务 */ @Override public List listWaitExecTask(Date endTime) { return preventDangerCheckTaskRepository.listWaitExecTask(endTime); } /**查询应该已经结束,但是还在执行中状态的任务*/ @Override public List listTimeOutTask(Date endTime) { return preventDangerCheckTaskRepository.listTimeOutTask(endTime); } @Override public List selectInspectionTask(Long depId, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectionTask(depId, list,startTime,endTime); } @Override public List selectInspectionClaimedTask(Long depId, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectionClaimedTask(depId, list,startTime,endTime); } @Override public List selectInspectionCompletedTask(Long depId, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectionCompletedTask(depId, list,startTime,endTime); } @Override public List selectInspectionUnCompletedTask(Long depId, List list, LocalDateTime startTime, LocalDateTime endTime) { return preventDangerCheckTaskRepository.selectInspectionUnCompletedTask(depId, list,startTime,endTime); } @Override public List selectPreventDangerPage(Page page, Map params) { return preventDangerCheckTaskRepository.selectPreventDangerPage(page,params); } @Override public Map selectRectifyNum() { return preventDangerCheckTaskRepository.selectRectifyNum(); } }