This commit is contained in:
苏竹红
2024-06-19 09:31:09 +08:00
parent 2180c75a64
commit cc11f58a56
9 changed files with 85 additions and 143 deletions

View File

@@ -12,7 +12,7 @@ public enum WorkflowSubStageEnum{
*/
INTEND(1, "加盟意向申请", WorkflowSubStageStatusEnum.INTENT_0,"joinIntentionServiceImpl",0),
PAY_DEPOSIT(15, "缴纳意向金", WorkflowSubStageStatusEnum.PAY_DEPOSIT_45, "bankServiceImpl",4),
SIGN_INTENT_AGREEMENT(20, "签署意向协议", WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_60, "intentAgreementServiceImpl",6);
SIGN_INTENT_AGREEMENT(20, "签署意向协议", WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70, "intentAgreementServiceImpl",6);
private Integer code;

View File

@@ -18,12 +18,9 @@ public enum WorkflowSubStageStatusEnum {
PAY_FAIL_55(55,"审核未通过"),
//签署意向协议
SIGN_INTENT_AGREEMENT_60(60,"待补充"),
SIGN_INTENT_AGREEMENT_63(63,"待审核"),
SIGN_INTENT_AGREEMENT_65(65,"不通过"),
SIGN_INTENT_AGREEMENT_70(70,"待提交"),
SIGN_INTENT_AGREEMENT_75(75,"待OA审核"),
SIGN_INTENT_AGREEMENT_80(80,"签约失败"),
SIGN_INTENT_AGREEMENT_70(70,"待补充"),
SIGN_INTENT_AGREEMENT_75(75,"合同确定中"),
SIGN_INTENT_AGREEMENT_125(125,"已完成");

View File

@@ -25,7 +25,7 @@ public interface IntentAgreementService {
*/
SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId);
ResponseResult initiating(InitiatingRequest request,LoginUserInfo user);
Boolean initiating(IntentAgreementSubmitRequest request,LoginUserInfo user);
ResponseResult save(FranchiseeSaveRequest request, LoginUserInfo user) throws ApiException;

View File

@@ -205,9 +205,7 @@ public class DeskServiceImpl implements DeskService {
public PageInfo<SigningPendingVO> signingPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
PageHelper.startPage(pageNum, pageSize);
List<LineInfoDO> lineInfoDOS = lineInfoDAO.listByInvestmentManager(user.getUserId(),
Arrays.asList(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode(),
WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode(),
WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_80.getCode()));
Arrays.asList(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()));
PageInfo page = new PageInfo(lineInfoDOS);
Map<Long, HyPartnerLabelDO> userPortraitMap = this.getUserPortraitMap(lineInfoDOS);
List<Long> wantShopAreaIds = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());

View File

@@ -3,6 +3,7 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.HyPartnerUserChannelDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
@@ -14,8 +15,7 @@ import com.cool.store.request.*;
import com.cool.store.response.InitiatingResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.SigningBaseInfoResponse;
import com.cool.store.service.AliyunService;
import com.cool.store.service.IntentAgreementService;
import com.cool.store.service.*;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.SecureUtil;
import com.cool.store.utils.StringUtil;
@@ -73,6 +73,11 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Resource
AliyunService aliyunService;
@Resource
private UserAuthMappingService userAuthMappingService;
@Resource
private ShopService shopService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -84,16 +89,21 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
if (Objects.isNull(lineInfoDO)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("partnerUsername", lineInfoDO.getUsername());
requestMap.put("partnerMobile", lineInfoDO.getMobile());
requestMap.put("lineId", String.valueOf(lineInfoDO.getId()));
requestMap.put("submitTime", DateUtils.dateTimeNow(DateUtils.SPECIAL_DATE_START));
commonService.sendMessage(Collections.singletonList(lineInfoDO.getInvestmentManager()),
MessageEnum.MESSAGE_30,
requestMap);
AuditPassRequest auditPassRequest = new AuditPassRequest();
auditPassRequest.setLineId(lineInfoDO.getId());
auditPassRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
commonService.getLineFlowService(lineInfoDO.getWorkflowSubStage()).auditPass(auditPassRequest, null);
// TODO: 2024/6/18 企微工作通知
// Map<String, String> requestMap = new HashMap<>();
// requestMap.put("partnerUsername", lineInfoDO.getUsername());
// requestMap.put("partnerMobile", lineInfoDO.getMobile());
// requestMap.put("lineId", String.valueOf(lineInfoDO.getId()));
// requestMap.put("submitTime", DateUtils.dateTimeNow(DateUtils.SPECIAL_DATE_START));
// commonService.sendMessage(Collections.singletonList(lineInfoDO.getInvestmentManager()),
// MessageEnum.MESSAGE_30,
// requestMap);
return Boolean.TRUE;
}
@@ -125,119 +135,55 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Override
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())) {
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
//待OA审核code 75 处理逻辑
if (lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())) {
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
//更新线索阶段
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus(), userId);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("partnerUsername", lineInfo.getUsername());
requestMap.put("lineId", String.valueOf(lineInfo.getId()));
requestMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Collections.singletonList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_32, requestMap);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_PASS);
}
//更新auditId
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId());
if (Objects.nonNull(signingBaseInfoDO)) {
intentAgreementMapper.updateAuditId(lineInfo.getId(), auditId);
} else {
throw new ServiceException("无法更新,没有对应的签约基本信息");
}
LineInfoDO updateLine = new LineInfoDO();
updateLine.setId(lineInfo.getId());
updateLine.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
updateLine.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
EnterpriseUserDO enterpriseUser = userAuthMappingService.getUserByRoleEnumAndWantShopAreaId(UserRoleEnum.SELECT_SITE_COMMISSIONER, lineInfo.getWantShopAreaId());
String developmentManager = Optional.ofNullable(enterpriseUser).map(EnterpriseUserDO::getUserId).orElse(null);
updateLine.setDevelopmentManager(developmentManager);
updateLine.setUpdateUserId(userId);
lineInfoDAO.updateLineInfo(updateLine);
//初始化店铺
shopService.initShop(lineInfo);
return Boolean.TRUE;
}
@Override
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);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_65.getCode());
lineInfo.setUpdateUserId(userId);
lineInfoDAO.updateLineInfo(lineInfo);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PROTOCOL_FAIL);
}
//待OA审核code 75 处理逻辑
if (lineInfo.getWorkflowSubStageStatus().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_80.getCode());
lineInfo.setUpdateUserId(userId);
lineInfoDAO.updateLineInfo(lineInfo);
//message
Map<String, String> requestMap = new HashMap<>();
requestMap.put("partnerUsername", lineInfo.getUsername());
requestMap.put("lineId", String.valueOf(lineInfo.getId()));
requestMap.put("submitTime", DateUtils.dateTimeNow(DateUtils.SPECIAL_DATE_START));
commonService.sendMessage(Collections.singletonList(lineInfo.getInvestmentManager()),
MessageEnum.MESSAGE_31,
requestMap);
// commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_FAIL);
}
//更新auditId
intentAgreementMapper.updateAuditId(lineInfo.getId(), auditId);
return Boolean.TRUE;
return null;
}
@Override
public ResponseResult initiating(InitiatingRequest request, LoginUserInfo user) {
log.info("initiating request:{}", JSONObject.toJSONString(request));
if (Objects.isNull(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
verifyDate(request);
String lockKey = "submitSignFranchise:" + request.getLineId();
//流水
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap);
String url = xfsgUrl + Constants.INTENTION_CONTRACT_URL + "?timestamp=" + requestMap.get("timestamp") + "&signature=" + requestMap.get("signature");
InitiatingDO initiatingDO = request.toInitiatingDO();
initiatingDO.setApply_user(user.getJobNumber());
initiatingDO.setApply_user_name(user.getName());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId());
initiatingDO.setJmsxx(lineInfoDO.getPartnerNum());
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();
log.info("initiating redisKey:{},request:{}", redisKey, JSONObject.toJSONString(request));
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());
}
} else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
public Boolean initiating(IntentAgreementSubmitRequest request, LoginUserInfo user) {
log.info("initiating request:{}",JSONObject.toJSONString(request));
SigningBaseInfoDO signingBaseInfoDO = request.toSigningBaseInfoDO();
boolean submitStatus = intentAgreementMapper.insert(signingBaseInfoDO);
if (submitStatus) {
LineInfoDO lineInfoDO = lineInfoMapper.getByPartnerId(request.getPartnerId());
if (Objects.isNull(lineInfoDO)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
} finally {
if (Boolean.TRUE.equals(acquired)) {
String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) {
redisUtilPool.delKey(lockKey);
}
}
}
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
AuditPassRequest auditPassRequest = new AuditPassRequest();
auditPassRequest.setLineId(lineInfoDO.getId());
auditPassRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
commonService.getLineFlowService(lineInfoDO.getWorkflowSubStage()).auditPass(auditPassRequest, null);
// TODO: 2024/6/18 企微工作通知
// Map<String, String> requestMap = new HashMap<>();
// requestMap.put("partnerUsername", lineInfoDO.getUsername());
// requestMap.put("partnerMobile", lineInfoDO.getMobile());
// requestMap.put("lineId", String.valueOf(lineInfoDO.getId()));
// requestMap.put("submitTime", DateUtils.dateTimeNow(DateUtils.SPECIAL_DATE_START));
// commonService.sendMessage(Collections.singletonList(lineInfoDO.getInvestmentManager()),
// MessageEnum.MESSAGE_30,
// requestMap);
return Boolean.TRUE;
}
return false;
}
private void verifyDate(InitiatingRequest request) {
@@ -326,7 +272,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
lineInfoMapper.updateByPrimaryKeySelective(lineInfoParam);
}
if (initiatingResponse.getCode() != 0) {
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode());
// lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
return new ResponseResult(500, initiatingResponse.getMessage(), initiatingResponse.getData());
} else {
@@ -358,10 +304,10 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
String auditResult = redisUtilPool.getString(redisKey);
if (WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode().equals(lineInfoDO.getWorkflowSubStageStatus())) {
//鲜丰系统不稳定会出现调用成功但内部状态未更改的情况这时直接返回true即可
return true;
}
// if (WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode().equals(lineInfoDO.getWorkflowSubStageStatus())) {
// //鲜丰系统不稳定会出现调用成功但内部状态未更改的情况这时直接返回true即可
// return true;
// }
if (request.getAuditResult() == 1) {
AuditPassRequest auditPassRequest = new AuditPassRequest();
auditPassRequest.setLineId(lineInfoDO.getId());

View File

@@ -111,10 +111,10 @@ public class LinePayServiceImpl implements LinePayService {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
lineInfoDAO.insertOrUpdate(lineInfo);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("partnerUsername",lineInfo.getUsername());
requestMap.put("payTime",DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, linePayDO.getPayTime()));
requestMap.put("lineId",String.valueOf(lineInfo.getId()));
commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_5,requestMap);
// requestMap.put("partnerUsername",lineInfo.getUsername());
// requestMap.put("payTime",DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START, linePayDO.getPayTime()));
// requestMap.put("lineId",String.valueOf(lineInfo.getId()));
// commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_5,requestMap);
}
return payId == null ? null : payId;
}

View File

@@ -341,7 +341,7 @@ public class LineServiceImpl implements LineService {
LinePayDO linePay = linePayDAO.getByLineIdAndPayTypeAndShopId(lineId,PayBusinessTypeEnum.INTENT_MONEY.getCode(),null);
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(memberQuestionDO.getPartnerId(), lineId);
LeaseBaseInfoDO trainingExperience = trainingExperienceService.getTrainingExperience(lineId);
// LeaseBaseInfoDO trainingExperience = trainingExperienceService.getTrainingExperience(lineId);
HashMap<Integer, Date> map = new HashMap<>();

View File

@@ -70,13 +70,13 @@ public class ShopServiceImpl implements ShopService {
List<Long> shopIds = addShopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Integer result = shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds);
Map<String, String> requestMap = new HashMap<>();
for (Long shopId : shopIds) {
requestMap.put("partnerName",lineInfo.getUsername());
requestMap.put("partnerMobile",lineInfo.getMobile());
requestMap.put("lineId",String.valueOf(lineInfo.getId()));
requestMap.put("shopId",String.valueOf(shopId));
commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_23,requestMap);
}
// for (Long shopId : shopIds) {
// requestMap.put("partnerName",lineInfo.getUsername());
// requestMap.put("partnerMobile",lineInfo.getMobile());
// requestMap.put("lineId",String.valueOf(lineInfo.getId()));
// requestMap.put("shopId",String.valueOf(shopId));
// commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_23,requestMap);
// }
return result;
}

View File

@@ -5,6 +5,7 @@ import com.cool.store.context.LoginUserInfo;
import com.cool.store.exception.ApiException;
import com.cool.store.request.FranchiseeSaveRequest;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.InitiatingResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.SigningBaseInfoResponse;
@@ -36,9 +37,9 @@ public class PCIntentAgreementController {
@PostMapping(path = "/initiating")
@ApiOperation("kdz -> xfsg 发起意向协议流程")
public ResponseResult initiating(@RequestBody InitiatingRequest request) {
public ResponseResult initiating(@RequestBody IntentAgreementSubmitRequest request) {
LoginUserInfo user = CurrentUserHolder.getUser();
return intentAgreementService.initiating(request,user);
return ResponseResult.success(intentAgreementService.initiating(request,user));
}
@PostMapping(path = "/franchisee/save")