package com.ycl.service.caseHandler.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.common.constant.BaseCaseStatus; import com.ycl.common.constant.StepName; import com.ycl.dto.caseHandler.ChechParam; import com.ycl.entity.caseHandler.BaseCase; import com.ycl.entity.caseHandler.DisposeRecord; import com.ycl.entity.caseHandler.WorkflowConfigStep; import com.ycl.exception.ApiException; import com.ycl.mapper.caseHandler.BaseCaseMapper; import com.ycl.mapper.caseHandler.DisposeRecordMapper; import com.ycl.mapper.caseHandler.WorkflowConfigStepMapper; import com.ycl.service.caseHandler.ICheckHandleService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDateTime; /** *

* 审核处理 服务实现类 *

* * @author mg * @since 2022-10-02 */ @Service @Transactional public class CheckHandleServiceImpl extends ServiceImpl implements ICheckHandleService { @Resource BaseCaseMapper baseCaseMapper; @Resource DisposeRecordMapper disposeRecordMapper; @Resource WorkflowConfigStepMapper workflowConfigStepMapper; @Override public Boolean check(ChechParam chechParam) { //修改案件状态为审核 BaseCase baseCase = new BaseCase(); baseCase.setId(chechParam.getBaseCaseId()); baseCase.setState(BaseCaseStatus.CHECK); baseCase.setAuditOpinion(chechParam.getCheckOpinion()); baseCaseMapper.updateById(baseCase); QueryWrapper stepQurey = new QueryWrapper<>(); stepQurey.eq("name", StepName.CHECK.getName()); WorkflowConfigStep workflowConfigStep = workflowConfigStepMapper.selectOne(stepQurey); if (workflowConfigStep == null) { throw new ApiException("未查询到该流程环节"); } UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("base_case_id", baseCase.getId()).eq("workflow_config_step_id",workflowConfigStep.getId()); //修改核查记录 DisposeRecord disposeRecord = new DisposeRecord(); disposeRecord.setHandlerId(chechParam.getCurrentUser()); //核查已结束 disposeRecord.setState(1); disposeRecord.setEndTime(LocalDateTime.now()); disposeRecordMapper.update(disposeRecord, updateWrapper); QueryWrapper stepNextqurey = new QueryWrapper<>(); stepNextqurey.eq("workflow_config_id", workflowConfigStep.getWorkflowConfigId()); stepNextqurey.eq("seq", workflowConfigStep.getSeq() + 1); WorkflowConfigStep stepNext = workflowConfigStepMapper.selectOne(stepNextqurey); //添加下一步记录 DisposeRecord stepNextRecord = new DisposeRecord(); stepNextRecord.setBaseCaseId(baseCase.getId()); stepNextRecord.setWorkflowConfigStepId(stepNext.getId()); stepNextRecord.setStepName(stepNext.getName()); stepNextRecord.setHandlerRoleId(stepNext.getRoleId()); //上传处置未结束 stepNextRecord.setState(0); stepNextRecord.setStartTime(LocalDateTime.now()); stepNextRecord.setCreateUser(chechParam.getCurrentUser()); stepNextRecord.setCreateTime(LocalDateTime.now()); disposeRecordMapper.insert(stepNextRecord); return true; } }