意向加盟合同审核结果回调

This commit is contained in:
guohb
2024-04-01 18:01:10 +08:00
parent 6759a4bcfc
commit 6593e7b605
11 changed files with 485 additions and 4 deletions

View File

@@ -0,0 +1,7 @@
package com.cool.store.service;
import com.cool.store.request.AuditResultRequest;
public interface KdzApiService {
boolean auditResult(AuditResultRequest request);
}

View File

@@ -89,8 +89,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Override
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
//校验是否是审核节点
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
if (!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) &&
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
@@ -104,14 +104,22 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
//更新auditId
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId());
if (Objects.nonNull(signingBaseInfoDO)){
intentAgreementMapper.updateAuditId(lineInfo.getId(),auditId);
}else {
throw new ServiceException("无法更新,没有对应的签约基本信息");
}
}
return Boolean.TRUE;
}
@Override
protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) {
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
if ((!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) &&
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
@@ -123,6 +131,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_80.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
//更新auditId
intentAgreementMapper.updateAuditId(lineInfo.getId(),auditId);
}
return Boolean.TRUE;
}

View File

@@ -0,0 +1,69 @@
package com.cool.store.service.impl;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.request.AuditPassRequest;
import com.cool.store.request.AuditRejectRequest;
import com.cool.store.request.AuditResultRequest;
import com.cool.store.service.KdzApiService;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
@Service
@Slf4j
public class KdzApiServiceImpl implements KdzApiService {
@Resource
LineInfoMapper lineInfoMapper;
@Resource
private CommonService commonService;
@Override
public boolean auditResult(AuditResultRequest request) {
if (Objects.isNull(request) || StringUtil.isBlank(request.getKdzBusinessId())){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
String kdzBusinessId = request.getKdzBusinessId();
String lineId = splitMethod(kdzBusinessId);
if (StringUtil.isBlank(lineId)){
throw new ServiceException("kdzBusinessId解析异常,请检查");
}
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(Long.valueOf(lineId));
try {
if (request.getAuditResult() == 1){
AuditPassRequest auditPassRequest = new AuditPassRequest();
auditPassRequest.setLineId(lineInfoDO.getId());
auditPassRequest.setPassReason(request.getCause());
auditPassRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
commonService.getLineFlowService(auditPassRequest.getWorkflowSubStage()).auditPass(auditPassRequest);
}else if (request.getAuditResult() == 0){
AuditRejectRequest auditRejectRequest = new AuditRejectRequest();
auditRejectRequest.setLineId(lineInfoDO.getId());
auditRejectRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
auditRejectRequest.setRejectPublicReason(request.getCause());
auditRejectRequest.setRejectRealReason(request.getFailureCause());
commonService.getLineFlowService(auditRejectRequest.getWorkflowSubStage()).auditReject(auditRejectRequest);
}
}catch (Exception e){
throw new ServiceException(e.getMessage());
}
return true;
}
public static String splitMethod(String kdzBusinessId){
String[] split = kdzBusinessId.split(Constants.D_LINE);
if (split.length >= 2){
return split[0];
}else {
return null;
}
}
}