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 implements PreventDangerCheckTaskService { @Autowired private PreventDangerCheckTaskRepository preventDangerCheckTaskRepository; /** * 隐患排查任务-分页查询 */ @Override public IPage getTaskPage(Page 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 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 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); } }