Authored by chenchao

fix

... ... @@ -55,7 +55,7 @@ public class SellerEnterApplyService {
logger.info("in applySuperEntry uid {} orderCode {} targetEST {}", uid, orderCode, targetEST);
if (Objects.isNull(orderCode)){
logger.warn("in applySuperEntry uid {} orderCode is null targetEST {}", uid, targetEST);
throw new UfoServiceException(400, "orderCode is null");
//throw new UfoServiceException(400, "orderCode is null");
}
if (Objects.isNull(targetEST)){
logger.warn("in applySuperEntry uid {} orderCode {} targetEST is null", uid, orderCode);
... ... @@ -160,16 +160,27 @@ public class SellerEnterApplyService {
seac.setUid(uid);
seac.setOrderCode(orderCode);
List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac);
upgradeLevel(uid, orderCode, left, seaList);
}
public void upgradeLevel(int uid, Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
if (CollectionUtils.isEmpty(seaList)){
logger.warn("in audit SellerEnterApply no record so that it's only charge order, uid {} orderCode {}",
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 audit SellerEnterApply one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
logger.warn("in upgradeLevel one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
}
//卖家包装类
SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase();
upgradeLevel(sellerWrapper, orderCode, left, seaList);
}
public void upgradeLevel(SellerService.SellerWrapper sellerWrapper,
Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
int uid = sellerWrapper.getUid();
//持久化的入驻信息
StoredSeller pss = sellerWrapper.getStoredSeller();
SellerBo sellerBo = sellerWrapper.build();
... ... @@ -191,7 +202,7 @@ public class SellerEnterApplyService {
boolean isMatchedET = Objects.equals(preEnterType=msea.getPreEnterType(), currentEnterType);
boolean noStoredSeller = Objects.isNull(pss);
logger.info("in audit SellerEnterApply ready pass apply and add StoredSeller, uid {} orderCode {} currentEnterType {} PreEnterType {} noStoredSeller {} target Level {} isMatchedET {}",
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())){
//普通卖家 -> 普通入驻 ,1. apply 状态 ,2. enter_seller 从无到有
... ... @@ -204,7 +215,7 @@ public class SellerEnterApplyService {
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
}else{
logger.warn("in audit SellerEnterApply add StoredSeller fail, uid {} orderCode {}",
logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
uid, orderCode);
}
... ... @@ -216,13 +227,13 @@ public class SellerEnterApplyService {
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
}else{
logger.warn("in audit SellerEnterApply add StoredSeller fail, uid {} orderCode {}",
logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
uid, orderCode);
}
}else if (Objects.equals(currentEnterType, EntrySellerType.SPECIAL_SUPER.getCode())){
//白名单超级卖家
logger.warn("in audit SellerEnterApply SPECIAL_SUPER no need any action, uid {} orderCode {}",
logger.warn("in upgradeLevel SPECIAL_SUPER no need any action, uid {} orderCode {}",
uid, orderCode);
}else if (Objects.equals(currentEnterType, EntrySellerType.SUPER_ENTRY.getCode())){
//超级卖家
... ... @@ -232,15 +243,13 @@ public class SellerEnterApplyService {
boolean levelNeedUpgrade = Objects.nonNull(sesl)
&& Objects.nonNull(currentLevel = sesl.getCode())
&& !currentLevel.equals(level);
logger.warn("in audit SellerEnterApply update StoredSeller, uid {} orderCode {} currentLevel {} target level {}",
logger.warn("in upgradeLevel update StoredSeller, uid {} orderCode {} currentLevel {} target level {}",
uid, orderCode, currentLevel, level);
if (!noStoredSeller && isMatchedET && levelNeedUpgrade) {
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
storedSellerService.updateEnterSeller(uid, targetEst, slfb);
}
}
}
/**
... ...
... ... @@ -67,6 +67,8 @@ public class SellerService {
@Autowired
private SellerEnterApplyService sellerEnterApplyService;
private SellerEnterApplyMapper sellerEnterApplyMapper;
/**更低出价提醒
* 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
... ... @@ -117,7 +119,10 @@ public class SellerService {
public boolean isSuperEntrySeller(int uid){
if(storedSellerService.isStoredSeller(uid)){
return isSpecialSuper(uid);
EntrySellerType est = getEntrySellerType(uid);
boolean result = Objects.equals(est.getCode(), EntrySellerType.SPECIAL_SUPER)
|| Objects.equals(est.getCode(), EntrySellerType.SUPER_ENTRY);
return result;
}
return false;
}
... ... @@ -257,14 +262,40 @@ public class SellerService {
}
public Boolean applySuperEnter(Integer uid){
SellerService.SellerWrapper sellerWrapper = new SellerService()
.new SellerWrapper(uid).buildBase();
SellerBo sellerBo = sellerWrapper.build();
EntrySellerType currentEST = sellerBo.getEntrySellerType();
EntrySellerType targetEST = EntrySellerType.SUPER_ENTRY;
if (Objects.equals(targetEST, currentEST)
|| Objects.equals(EntrySellerType.SPECIAL_SUPER, currentEST)){
logger.info("applySuperEnter user was {} , uid {}", currentEST , uid);
return true;
}
//普通个人
if (Objects.equals(targetEST, EntrySellerType.NOT_ENTRY)){
logger.info("applySuperEnter user was {} , uid {}", currentEST , uid);
return false;
}
//left enter type is 入驻非超级
BigDecimal leftInWallet = merchantOrderPaymentService.getWalletLeftAmount(uid);
//TODO 前提:1. 当前卖家是 普通个人 or 入驻非超级 2. 钱包余额大于等于超级的阈值
//前提:1. 当前卖家是 普通个人 or 入驻非超级 2. 钱包余额大于等于超级的阈值
Map<EntrySellerType,EntryThreshold> entryThreshold = getEntryThreshold();
EntryThreshold set = entryThreshold.get(EntrySellerType.SUPER_ENTRY);
boolean isFatWallet = leftInWallet.compareTo(set.getPrepaymentAmount()) >= 0;
logger.info("applySuperEnter uid {} leftInWallet {} super EntryThreshold {} isFatWallet {}",
uid, leftInWallet, set, isFatWallet);
//TODO 申请记录(新增 or 修改) 入驻卖家(enter_type level_func 功能菜单)
//申请记录(新增 or 修改) 入驻卖家(enter_type level_func 功能菜单)
if (isFatWallet){
//insert apply
sellerEnterApplyService.applySuperEntry(uid, null, targetEST);
//
SellerEnterApply seac = new SellerEnterApply();
seac.setUid(uid);
seac.setEnterType(targetEST.getCode());
List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac);
sellerEnterApplyService.upgradeLevel(sellerWrapper, null, leftInWallet, seaList);
}
return isFatWallet;
}
}
... ...