package com.ycl.service.caseHandler.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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("未查询到该流程环节"); } //添加调度记录 DisposeRecord disposeRecord = new DisposeRecord(); disposeRecord.setBaseCaseId(baseCase.getId()); disposeRecord.setWorkflowConfigStepId(workflowConfigStep.getId()); disposeRecord.setStepName(workflowConfigStep.getName()); disposeRecord.setHandlerRoleId(workflowConfigStep.getRoleId()); disposeRecord.setHandlerId(chechParam.getCurrentUser()); disposeRecord.setState(1); disposeRecord.setStartTime(LocalDateTime.now()); disposeRecord.setEndTime(LocalDateTime.now()); disposeRecord.setResult(chechParam.getResult()); disposeRecord.setCreateUser(chechParam.getCurrentUser()); disposeRecord.setCreateTime(LocalDateTime.now()); disposeRecordMapper.insert(disposeRecord); 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.setHandlerId(chechParam.getCurrentUser()); //上传处置未结束 stepNextRecord.setState(0); stepNextRecord.setStartTime(LocalDateTime.now()); stepNextRecord.setCreateUser(chechParam.getCurrentUser()); stepNextRecord.setCreateTime(LocalDateTime.now()); disposeRecordMapper.insert(stepNextRecord); return true; } }