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.PreventDangerCheckWork; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckWorkQueryReqDTO; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventHandReportConfigReqDTO; import com.gkhy.safePlatform.doublePrevention.repository.PreventDangerCheckWorkRepository; import com.gkhy.safePlatform.doublePrevention.repository.param.CheckWorkAutoUpdateParams; import com.gkhy.safePlatform.doublePrevention.repository.param.HandlerReportParam; import com.gkhy.safePlatform.doublePrevention.repository.param.PreventDangerCheckWorkDeleteParams; import com.gkhy.safePlatform.doublePrevention.repository.param.PreventDangerCheckWorkUpdateParams; import com.gkhy.safePlatform.doublePrevention.service.baseService.PreventDangerCheckWorkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("preventDangerCheckWorkService") public class PreventDangerCheckWorkServiceImpl extends ServiceImpl implements PreventDangerCheckWorkService { @Autowired private PreventDangerCheckWorkRepository preventDangerCheckWorkRepository; /** * 隐患排查作业-分页查询 */ @Override public IPage getCheckWorkPage(Page page, PreventDangerCheckWorkQueryReqDTO workQueryReqDTO) { return preventDangerCheckWorkRepository.getCheckWorkPage(page, workQueryReqDTO); } /** * 隐患排查作业-新增 */ @Override public int saveCheckWork(PreventDangerCheckWork checkWorkParams) { return preventDangerCheckWorkRepository.insert(checkWorkParams); } /** * 隐患排查作业-修改 */ @Override public int updateCheckWork(PreventDangerCheckWorkUpdateParams updateParams) { return preventDangerCheckWorkRepository.updateCheckWork(updateParams); } /** * 隐患排查作业-删除 */ @Override public int deleteCheckWork(PreventDangerCheckWorkDeleteParams deleteParams) { int deleteResult = preventDangerCheckWorkRepository.deleteCheckWork(deleteParams); if (deleteResult == 0){ throw new BusinessException(ResultCodes.SERVER_DEL_ERROR); } return deleteResult; } /** * 隐患排查作业-根据作业名称查找 */ @Override public PreventDangerCheckWork getWorkByName(String checkWorkName) { return preventDangerCheckWorkRepository.getWorkByName(checkWorkName); } /** * 隐患排查作业-任务列表 */ @Override public List listCheckWork() { return preventDangerCheckWorkRepository.listCheckWork(); } /** * 隐患排查作业-根据任务单元查找 */ @Override public PreventDangerCheckWork getWorkByTaskUnitId(Long taskUnitId) { return preventDangerCheckWorkRepository.getWorkByTaskUnitId(taskUnitId); } /** * 隐患排查作业-根据Id查找 */ @Override public PreventDangerCheckWork getWorkById(Long workId) { return preventDangerCheckWorkRepository.getWorkById(workId); } /** * 隐患排查作业 下次调度时间--上传调度时间 * -根据Id */ @Override public int updateCheckWorkLastTimeAndNextTime(CheckWorkAutoUpdateParams updateWorkParams) { int result = preventDangerCheckWorkRepository.updateCheckWorkLastTimeAndNextTime(updateWorkParams); return result; } /** * 隐患排查作业 修改为调度中 * -根据Id */ @Override public void updateCheckWorkStatus(CheckWorkAutoUpdateParams updateParams) { preventDangerCheckWorkRepository.updateCheckWorkStatus(updateParams); } /** * 隐患排查作业 重置作业状态 */ @Override public int resetWorkStatus(Long workId) { return preventDangerCheckWorkRepository.resetWorkStatus(workId); } /** * 隐患排查作业 查询可调度的列表 */ @Override public List listScheduleCheckWork() { return preventDangerCheckWorkRepository.listScheduleCheckWork(); } /** * 排查作业-手工上报-配置 */ @Override public int updateCheckWorkReport(PreventHandReportConfigReqDTO preventHandReportConfigReqDTO) { return preventDangerCheckWorkRepository.updateCheckWorkReport(preventHandReportConfigReqDTO); } /** * 上报数据,任务配置检索 */ @Override public List listReportWork() { return preventDangerCheckWorkRepository.listReportWork(); } /** * 上报数据,任务配置上报状态变更 */ @Override public void updateWorkReportStatus(HandlerReportParam handlerReportParam) { int result = preventDangerCheckWorkRepository.updateWorkReportStatus(handlerReportParam); if (result == 0) { throw new BusinessException(ResultCodes.SERVER_UPDATE_ERROR); } } }