...
|
...
|
@@ -3,7 +3,6 @@ package com.yohoufo.order.service.impl; |
|
|
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
|
|
|
import com.yohobuy.ufo.model.order.bo.SellerBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.SellerLevelFuncBo;
|
|
|
import com.yohobuy.ufo.model.order.common.CommonEnterStageLevel;
|
|
|
import com.yohobuy.ufo.model.order.common.EntrySellerType;
|
|
|
import com.yohobuy.ufo.model.order.common.SellerEnterApplyStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
|
...
|
...
|
@@ -166,19 +165,12 @@ public class SellerEnterApplyService { |
|
|
seac.setUid(uid);
|
|
|
seac.setOrderCode(orderCode);
|
|
|
List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac);
|
|
|
upgradeLevel(uid, orderCode, left, seaList);
|
|
|
doAudit(uid, orderCode, left, seaList);
|
|
|
}
|
|
|
|
|
|
|
|
|
public void upgradeLevel(int uid, Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
|
|
|
if (CollectionUtils.isEmpty(seaList)){
|
|
|
logger.warn("in upgradeLevel no record so that it's only charge order, uid {} orderCode {}",
|
|
|
uid, orderCode);
|
|
|
// return;
|
|
|
}
|
|
|
if (seaList.size()>1){
|
|
|
logger.warn("in upgradeLevel one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
|
|
|
}
|
|
|
public void doAudit(int uid, Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
|
|
|
|
|
|
//卖家包装类
|
|
|
SellerWrapper sellerWrapper = new SellerWrapper(uid,logger)
|
|
|
.storedSellerDataSource(storedSellerMapper::selectByUid)
|
...
|
...
|
@@ -190,10 +182,39 @@ public class SellerEnterApplyService { |
|
|
public void upgradeLevel(SellerWrapper sellerWrapper,
|
|
|
Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
|
|
|
int uid = sellerWrapper.getUid();
|
|
|
logger.info("in upgradeLevel uid {} orderCode {} left wallet {}",
|
|
|
uid, orderCode, left );
|
|
|
//是否有申请记录
|
|
|
//有两种:
|
|
|
// 1. 充值有订单号,根据订单号查询,
|
|
|
// 1.1 升级时充值有申请记录
|
|
|
// 1.2 普通充值没有申请记录
|
|
|
// 2. client 直接升级,根据请求的目标身份
|
|
|
//existApply 为false 只会是普通充值订单
|
|
|
boolean existApply = CollectionUtils.isNotEmpty(seaList);
|
|
|
logger.info("in upgradeLevel uid {} orderCode {} left wallet {} existApply {}",
|
|
|
uid, orderCode, left, existApply );
|
|
|
if (existApply){
|
|
|
processApplyOrder(sellerWrapper, left, orderCode, seaList);
|
|
|
}else {
|
|
|
processCommonChargeOrder(sellerWrapper, orderCode);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 充值订单处理
|
|
|
* @param sellerWrapper
|
|
|
* @param left
|
|
|
* @param orderCode
|
|
|
* @param seaList
|
|
|
*/
|
|
|
private void processApplyOrder(SellerWrapper sellerWrapper,BigDecimal left,
|
|
|
Long orderCode, List<SellerEnterApply> seaList){
|
|
|
int uid = sellerWrapper.getUid();
|
|
|
if (seaList.size() > 1) {
|
|
|
logger.warn("in upgradeLevel one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
|
|
|
}
|
|
|
//持久化的入驻信息
|
|
|
StoredSeller pss = sellerWrapper.getStoredSeller();
|
|
|
boolean noStoredSeller = Objects.isNull(pss);
|
|
|
SellerBo sellerBo = sellerWrapper.build();
|
|
|
//当前身份
|
|
|
EntrySellerType currentEST = sellerBo.getEntrySellerType();
|
...
|
...
|
@@ -211,8 +232,6 @@ public class SellerEnterApplyService { |
|
|
//当前身份和申请时身份是否一致
|
|
|
Integer preEnterType;
|
|
|
boolean isMatchedET = Objects.equals(preEnterType=msea.getPreEnterType(), currentEnterType);
|
|
|
boolean noStoredSeller = Objects.isNull(pss);
|
|
|
|
|
|
logger.info("in upgradeLevel ready pass apply and add StoredSeller, uid {} orderCode {} currentEnterType {} PreEnterType {} noStoredSeller {} target Level {} isMatchedET {}",
|
|
|
uid, orderCode, currentEnterType,preEnterType, noStoredSeller, level, isMatchedET);
|
|
|
if(Objects.equals(currentEnterType, EntrySellerType.NOT_ENTRY.getCode())){
|
...
|
...
|
@@ -221,7 +240,6 @@ public class SellerEnterApplyService { |
|
|
if (!isPassedApply){
|
|
|
passApply(msea);
|
|
|
}
|
|
|
|
|
|
if (noStoredSeller && isMatchedET){
|
|
|
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
|
|
|
storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
|
...
|
...
|
@@ -230,10 +248,10 @@ public class SellerEnterApplyService { |
|
|
uid, orderCode);
|
|
|
}
|
|
|
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.COMMON.getCode())) {
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.COMMON.getCode())) {
|
|
|
//普通入驻 -> 超级 ,1. apply 状态 ,2. enter_seller 修改type & func list
|
|
|
passApply(msea);
|
|
|
|
|
|
//
|
|
|
if (!noStoredSeller && isMatchedET){
|
|
|
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
|
|
|
storedSellerService.updateEnterSeller(uid, targetEst, slfb);
|
...
|
...
|
@@ -241,7 +259,6 @@ public class SellerEnterApplyService { |
|
|
logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
|
|
|
uid, orderCode);
|
|
|
}
|
|
|
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.SPECIAL_SUPER.getCode())){
|
|
|
//白名单超级卖家
|
|
|
logger.warn("in upgradeLevel SPECIAL_SUPER no need any action, uid {} orderCode {}",
|
...
|
...
|
@@ -252,6 +269,48 @@ public class SellerEnterApplyService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 普通充值订单处理
|
|
|
* @param sellerWrapper
|
|
|
* @param orderCode
|
|
|
*/
|
|
|
private void processCommonChargeOrder(SellerWrapper sellerWrapper,
|
|
|
Long orderCode){
|
|
|
int uid = sellerWrapper.getUid();
|
|
|
|
|
|
SellerBo sellerBo = sellerWrapper.build();
|
|
|
//当前身份
|
|
|
EntrySellerType currentEST = sellerBo.getEntrySellerType();
|
|
|
Integer currentEnterType = currentEST.getCode();
|
|
|
logger.warn("in upgradeLevel no record so that it's only common charge order, uid {} orderCode {}",
|
|
|
uid, orderCode);
|
|
|
|
|
|
if(Objects.equals(currentEnterType, EntrySellerType.NOT_ENTRY.getCode())){
|
|
|
//普通卖家 no way
|
|
|
logger.warn("in upgradeLevel no need any action, uid {} orderCode {} currentEnterType {}",
|
|
|
uid, orderCode, currentEnterType);
|
|
|
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.COMMON.getCode())) {
|
|
|
//普通入驻 -> 超级 ,1. apply 状态 ,2. enter_seller 修改type & func list
|
|
|
logger.warn("in upgradeLevel no need any action, uid {} orderCode {} currentEnterType {}",
|
|
|
uid, orderCode, currentEnterType);
|
|
|
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.SPECIAL_SUPER.getCode())){
|
|
|
//白名单超级卖家
|
|
|
logger.warn("in upgradeLevel no need any action, uid {} orderCode {} currentEnterType {}",
|
|
|
uid, orderCode, currentEnterType);
|
|
|
}else if (Objects.equals(currentEnterType, EntrySellerType.SUPER_ENTRY.getCode())){
|
|
|
//持久化的入驻信息
|
|
|
StoredSeller pss = sellerWrapper.getStoredSeller();
|
|
|
boolean isValid = Objects.equals(pss.getValidStatus(), StoredSellerStatusEnum.entered.getId());
|
|
|
if (isValid) {//身份等级配置
|
|
|
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFuncWithWallet(sellerWrapper);
|
|
|
//超级卖家
|
|
|
upgradeSuperLevel(sellerWrapper, slfb.getLevel(), orderCode, currentEST, true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private int upgradeSuperLevel(SellerWrapper sellerWrapper,Integer level, Long orderCode,
|
|
|
EntrySellerType targetEst, boolean isMatchedET){
|
|
|
|
...
|
...
|
|