Merge remote-tracking branch 'origin/cc_partner_init' into cc_partner_init

This commit is contained in:
zhangchenbiao
2024-04-02 16:05:10 +08:00
23 changed files with 480 additions and 38 deletions

View File

@@ -1,6 +1,8 @@
package com.cool.store.service;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.InitiatingResponse;
import com.cool.store.response.SigningBaseInfoResponse;
public interface IntentAgreementService {
@@ -18,4 +20,6 @@ public interface IntentAgreementService {
* @return
*/
SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId);
InitiatingResponse initiating(InitiatingRequest request);
}

View File

@@ -20,4 +20,6 @@ public interface TrainingExperienceService {
void experienceStatusChange(Long lineId, Integer status, String abandonCause);
LeaseBaseInfoDO getTrainingExperience(Long lineId);
}

View File

@@ -1,24 +1,33 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.MemberQuestionDO;
import com.cool.store.entity.SigningBaseInfoDO;
import com.cool.store.enums.*;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.JoinIntentionMapper;
import com.cool.store.mapper.LineAuditInfoMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.InitiatingResponse;
import com.cool.store.response.SigningBaseInfoResponse;
import com.cool.store.service.IntentAgreementService;
import com.cool.store.utils.SecureUtil;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import static com.cool.store.enums.ErrorCodeEnum.PARAMS_VALIDATE_ERROR;
@@ -40,21 +49,30 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Resource
LineInfoDAO lineInfoDAO;
@Resource
private HttpRestTemplateService httpRestTemplateService;
@Value("${xfsg.url}")
private String xfsgUrl;
@Resource
LineAuditInfoMapper lineAuditInfoMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(IntentAgreementSubmitRequest request) {
SigningBaseInfoDO signingBaseInfoDO = request.toSigningBaseInfoDO();
if(Objects.nonNull(request.getIdCardNo()) || Objects.nonNull(request.getBusinessLicenseCode())){
if (Objects.nonNull(request.getIdCardNo()) || Objects.nonNull(request.getBusinessLicenseCode())) {
SigningBaseInfoDO isExist = intentAgreementMapper.judge(request);
if (Objects.nonNull(isExist)){
if (Objects.nonNull(isExist)) {
throw new ServiceException(ErrorCodeEnum.BUSINESS_LICENSE_OR_ID_CARD_REPEAT);
}
}
boolean submitStatus = intentAgreementMapper.insert(signingBaseInfoDO);
if (submitStatus){
if (submitStatus) {
LineInfoDO lineInfoDO = lineInfoMapper.getByPartnerId(request.getPartnerId());
if (Objects.isNull(lineInfoDO)){
if (Objects.isNull(lineInfoDO)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode());
@@ -67,17 +85,27 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Override
public SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId) {
if (StringUtil.isBlank(partnerId) && lineId == null){
if (StringUtil.isBlank(partnerId) && lineId == null) {
throw new ServiceException(PARAMS_VALIDATE_ERROR);
}
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(partnerId, lineId);
if (Objects.isNull(signingBaseInfoDO)){
if (Objects.isNull(signingBaseInfoDO)) {
log.info("getMiniIntentAgreement signingBaseInfoDO IS NULL......");
return null;
}
SigningBaseInfoResponse response = SigningBaseInfoResponse.from(signingBaseInfoDO);
MemberQuestionDO byLineId = joinIntentionMapper.getByLineId(lineId);
response.setType(byLineId.getJoinType());
if (Objects.nonNull(signingBaseInfoDO.getAuditId())){
LineAuditInfoDO lineAuditInfoDO = lineAuditInfoMapper.selectByPrimaryKey(signingBaseInfoDO.getAuditId());
if (Objects.isNull(lineAuditInfoDO)){
response.setRejectPublicReason(null);
}
response.setRejectPublicReason(lineAuditInfoDO.getRejectPublicReason());
}
return response;
}
@@ -90,25 +118,25 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
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())){
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())) {
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())){
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
//待OA审核code 75 处理逻辑
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())) {
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage());
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 {
if (Objects.nonNull(signingBaseInfoDO)) {
intentAgreementMapper.updateAuditId(lineInfo.getId(), auditId);
} else {
throw new ServiceException("无法更新,没有对应的签约基本信息");
}
@@ -119,20 +147,20 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@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()))){
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))) {
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
}
//待审核code 63 处理逻辑
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())){
if (lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode())) {
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_65.getCode());
lineInfoDAO.updateLineInfo(lineInfo);
}
//待OA审核code 75 处理逻辑
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
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);
intentAgreementMapper.updateAuditId(lineInfo.getId(), auditId);
}
return Boolean.TRUE;
}
@@ -141,4 +169,28 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
@Override
public InitiatingResponse initiating(InitiatingRequest request) {
log.info("initiating request:{}", JSONObject.toJSONString(request));
if (Objects.isNull(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
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();
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId());
initiatingDO.setKdzBusinessId(lineInfoDO.getId() + "_" + lineInfoDO.getWorkflowSubStageStatus());
InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, initiatingDO, InitiatingResponse.class);
return initiatingResponse;
}
private void fillSignatureInfo(Map<String, Object> requestMap) {
long timestamp = System.currentTimeMillis();
String signature = SecureUtil.getSignature(timestamp);
requestMap.put("timestamp", timestamp);
requestMap.put("signature", signature);
}
}

View File

@@ -114,8 +114,13 @@ public class LineServiceImpl implements LineService {
userId = loginUserInfo.getUserId();
}
}
String areaName = null;
if (lineListRequest.getWantShopAreaId() != null){
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(lineListRequest.getWantShopAreaId());
areaName = hyOpenAreaInfoDO.getAreaPath();
}
PageHelper.startPage(lineListRequest.getPageNum(), lineListRequest.getPageSize());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.lineList(lineListRequest, userId, wantShopAreaIds);
List<LineInfoDO> lineInfoDOS = lineInfoDAO.lineList(lineListRequest,areaName, userId, wantShopAreaIds);
PageInfo page = new PageInfo(lineInfoDOS);
Map<Long, HyPartnerLabelDO> userPortraitMap = deskService.getUserPortraitMap(lineInfoDOS);
List<Long> wantShopAreaIdList = lineInfoDOS.stream().filter(lineInfoDO -> lineInfoDO.getWantShopAreaId() != null).map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
@@ -191,7 +196,7 @@ public class LineServiceImpl implements LineService {
String areaName = null;
if (partnerRequest.getWantShopAreaId() != null){
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(partnerRequest.getWantShopAreaId());
areaName = hyOpenAreaInfoDO.getAreaName();
areaName = hyOpenAreaInfoDO.getAreaPath();
}
PageHelper.startPage(partnerRequest.getPageNum(), partnerRequest.getPageSize());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.partnerList(partnerRequest,areaName, userId, wantShopAreaIds);

View File

@@ -98,4 +98,5 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
return Boolean.TRUE;
}
}

View File

@@ -167,4 +167,9 @@ public class Constants
public static final String CONTENT_ENCODING = "Content-Encoding";
public static final String INTENTION_CONTRACT_URL = "/api/coolstore/start-flow/intention-contract";
}