From 6490d633c5b4fb793360c64e7000452112b13e70 Mon Sep 17 00:00:00 2001 From: guohb Date: Tue, 23 Apr 2024 17:01:16 +0800 Subject: [PATCH] fix --- .../impl/IntentAgreementServiceImpl.java | 59 +++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java index a267ab348..c4f4ffec4 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java @@ -1,6 +1,5 @@ package com.cool.store.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.LoginUserInfo; @@ -32,9 +31,9 @@ import java.util.Map; import java.util.Objects; -@Service("intentAgreementServiceImpl") +@Service @Slf4j -public class IntentAgreementServiceImpl extends LineFlowService implements IntentAgreementService,AuditResultService { +public class IntentAgreementServiceImpl extends LineFlowService implements IntentAgreementService, AuditResultService { @Resource @@ -119,7 +118,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten } @Override - protected Boolean auditPass(Long auditId, LineInfoDO lineInfo,String userId) { + protected Boolean auditPass(Long auditId, LineInfoDO lineInfo, String userId) { //校验是否是审核节点 if (!lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) && !lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())) { @@ -135,7 +134,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage()); WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage(); //更新线索阶段 - lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus(),userId); + lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus(), userId); } //更新auditId SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId()); @@ -148,7 +147,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten } @Override - protected Boolean auditReject(Long auditId, LineInfoDO lineInfo,String userId) { + protected Boolean auditReject(Long auditId, LineInfoDO lineInfo, String userId) { if ((!lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) && !lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))) { throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE); @@ -183,24 +182,24 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten InitiatingDO initiatingDO = request.toInitiatingDO(); // LoginUserInfo user = CurrentUserHolder.getUser(); LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId()); - initiatingDO.setKdzBusinessId(AuditEnum.CONTRACT_INTENTION.getCode() + "_" +lineInfoDO.getId() + "_" + lineInfoDO.getWorkflowSubStageStatus()); + initiatingDO.setKdzBusinessId(AuditEnum.CONTRACT_INTENTION.getCode() + "_" + lineInfoDO.getId() + "_" + lineInfoDO.getWorkflowSubStageStatus()); InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, initiatingDO, InitiatingResponse.class); - if (initiatingResponse.getCode() != 0L){ - return new ResponseResult(500,initiatingResponse.getMsg(),initiatingResponse.getData()); - }else { - String redisKey = "OA:"+request.getMobile()+request.getIdCardNo(); - redisUtilPool.setString(redisKey,JSONObject.toJSONString(request)); + if (initiatingResponse.getCode() != 0L) { + return new ResponseResult(500, initiatingResponse.getMsg(), initiatingResponse.getData()); + } else { + String redisKey = "OA:" + request.getMobile() + request.getIdCardNo(); + redisUtilPool.setString(redisKey, JSONObject.toJSONString(request)); lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()); lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO); - return new ResponseResult(200000,initiatingResponse.getMsg(),initiatingResponse.getData()); + return new ResponseResult(200000, initiatingResponse.getMsg(), initiatingResponse.getData()); } } @Override public InitiatingRequest getOaDetail(String mobile, String idCardNo) { - String redisKey = "OA:"+mobile+idCardNo; + String redisKey = "OA:" + mobile + idCardNo; String responseString = redisUtilPool.getString(redisKey); - if (StringUtils.isNotBlank(responseString)){ + if (StringUtils.isNotBlank(responseString)) { InitiatingRequest initiatingRequest = JSONObject.parseObject(responseString, InitiatingRequest.class); return initiatingRequest; } @@ -219,7 +218,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten FranchiseeDO franchiseeDO = request.toFranchiseeDO(); //查银行信息 LinePayDO linePayDO = linePayMapper.getLinePayByLineId(request.getLineId()); - if (Objects.isNull(linePayDO)){ + if (Objects.isNull(linePayDO)) { throw new ServiceException(ErrorCodeEnum.LINE_PAY_FALSE); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -230,7 +229,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten franchiseeDO.setBankSub(linePayDO.getBranchBankCode()); //查城市信息 LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId()); - if (Objects.isNull(lineInfoDO)){ + if (Objects.isNull(lineInfoDO)) { throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); } HyOpenAreaInfoDO openAreaInfoDO = openAreaInfoMapper.selectById(lineInfoDO.getWantShopAreaId()); @@ -241,7 +240,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten franchiseeDO.setOperator("22090043"); InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, franchiseeDO, InitiatingResponse.class); //更新线索(进入蓄水池并回填加盟商编码) - if (initiatingResponse.getCode() == 0){ + if (initiatingResponse.getCode() == 0) { LineInfoDO lineInfoParam = new LineInfoDO(); lineInfoParam.setId(request.getLineId()); //蓄水池 @@ -249,12 +248,12 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten lineInfoParam.setPartnerNum(initiatingResponse.getData()); lineInfoMapper.updateByPrimaryKeySelective(lineInfoParam); } - if (initiatingResponse.getCode() != 0){ + if (initiatingResponse.getCode() != 0) { lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()); lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO); - return new ResponseResult(500,initiatingResponse.getMessage(),initiatingResponse.getData()); - }else { - return new ResponseResult(200000,initiatingResponse.getMessage(),initiatingResponse.getData()); + return new ResponseResult(500, initiatingResponse.getMessage(), initiatingResponse.getData()); + } else { + return new ResponseResult(200000, initiatingResponse.getMessage(), initiatingResponse.getData()); } } @@ -263,35 +262,35 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten try { String kdzBusinessId = request.getKdzBusinessId(); String lineId = getLineId(kdzBusinessId); - if (StringUtil.isBlank(lineId)){ + if (StringUtil.isBlank(lineId)) { throw new ServiceException(ErrorCodeEnum.BUSINESS_ID_NOT_EXIST); } LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(Long.valueOf(lineId)); - if (Objects.isNull(lineInfoDO)){ + if (Objects.isNull(lineInfoDO)) { throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); } - if (request.getAuditResult() == 1){ + 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,null); - }else if (request.getAuditResult() == 0){ + commonService.getLineFlowService(auditPassRequest.getWorkflowSubStage()).auditPass(auditPassRequest, null); + } 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,null); + commonService.getLineFlowService(auditRejectRequest.getWorkflowSubStage()).auditReject(auditRejectRequest, null); } - }catch (Exception e){ + } catch (Exception e) { throw new ServiceException(ErrorCodeEnum.UNKNOWN); } return true; } private String getLineId(String kdzBusinessId) { - String lindId = kdzBusinessId.substring(kdzBusinessId.indexOf("_") + 1,kdzBusinessId.lastIndexOf("_")); + String lindId = kdzBusinessId.substring(kdzBusinessId.indexOf("_") + 1, kdzBusinessId.lastIndexOf("_")); return lindId; }