|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.yoho.core.common.utils.YHMath;
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
|
|
|
import com.yohobuy.ufo.model.order.bo.SellerBo;
|
...
|
...
|
@@ -29,6 +30,7 @@ import com.yohoufo.order.service.proxy.InBoxFacade; |
|
|
import com.yohoufo.order.service.proxy.ProductProxyService;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.order.utils.MailSender;
|
|
|
import com.yohoufo.order.utils.MathUtils;
|
|
|
import com.yohoufo.order.utils.SellerHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -518,32 +520,59 @@ public class SellerEnterApplyService { |
|
|
return buildEntryLevelNode(sellerWrapper, bslfb);
|
|
|
}
|
|
|
|
|
|
private String getNoticeContent(SuperEnterStageLevel sesl){
|
|
|
String content;
|
|
|
switch (sesl){
|
|
|
case FULL:
|
|
|
content = "【UFO飞碟好物】您的账户保证金余额不足%s,为了不影响您的超级商家权限,请及时充值。";
|
|
|
break;
|
|
|
case PARTITION:
|
|
|
content = "【UFO飞碟好物】您的账户保证金余额不足%s,商品将不能正常上架,为了不影响您的超级商家权限,请及时充值。";
|
|
|
break;
|
|
|
case DISABLE:
|
|
|
content = "【UFO飞碟好物】您的账户保证金余额不足%s,平台将隐藏您所有出售中的商品,为了不影响您的超级商家权限,请及时充值";
|
|
|
break;
|
|
|
default:
|
|
|
content= null;
|
|
|
}
|
|
|
|
|
|
return content;
|
|
|
}
|
|
|
|
|
|
private void noticeLargeSettlementSuper(SellerLevelFuncBo bslfb, SellerBo sellerBo, BigDecimal left){
|
|
|
int uid = sellerBo.getUid();
|
|
|
Integer noticeCnt = null ;
|
|
|
SuperEnterStageLevel sesl = SuperEnterStageLevel.getSuperEnterStageLevel(bslfb.getLevel());
|
|
|
boolean walletNotEnough = (sesl != null && bslfb.getWalletThreshold().compareTo(left) > 0 );
|
|
|
boolean notNotice = (Objects.isNull(noticeCnt= storedSellerCacheService.getNoticeCntWhenWalletNotEnough(uid, bslfb.getLevel())) || noticeCnt<1);
|
|
|
if (notNotice && walletNotEnough){
|
|
|
String thresholdStr = MathUtils.formatCurrencyStr(bslfb.getWalletThreshold().doubleValue());
|
|
|
try {
|
|
|
logger.info("in processLargeSettlementSuperWhenWalletChange send mail uid {} sellerBo {} noticeCnt {}",
|
|
|
uid, sellerBo, noticeCnt);
|
|
|
String mailTo = configReader.getString("ufo.order.seller.noticeHKSellerEmailTo", "chao.chen@yoho.cn,xiuchun.luo@yoho.cn");
|
|
|
String content = String.format(getNoticeContent(sesl), thresholdStr);
|
|
|
MailSender.newMailSender()
|
|
|
.subject("卖家服务提醒")
|
|
|
.to(mailTo)
|
|
|
.body(content, "text/html;charset=utf-8")
|
|
|
.send();
|
|
|
storedSellerCacheService.setNoticeCntWhenWalletNotEnough(uid, bslfb.getLevel(), 1);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("processLargeSettlementSuperWhenWalletChange send mail fail, uid {} left wallet {}", uid, left, ex);
|
|
|
}
|
|
|
inBoxFacade.noticeLargeSettlementSuperDegrade(uid, sesl, thresholdStr,left );
|
|
|
}
|
|
|
logger.info("in processLargeSettlementSuperWhenWalletChange uid {} sellerBo {} noticeCnt {}",
|
|
|
uid, sellerBo, noticeCnt);
|
|
|
}
|
|
|
|
|
|
private void processLargeSettlementSuperWhenWalletChange(SellerWrapper sellerWrapper, BigDecimal left,Supplier<SellerLevelFuncBo> slfSupplier){
|
|
|
SellerBo sellerBo = sellerWrapper.buildSellerBo();
|
|
|
if (sellerBo.isLargeSettlementSuper() ){
|
|
|
SellerLevelFuncBo bslfb = slfSupplier.get();
|
|
|
int uid = sellerBo.getUid();
|
|
|
Integer noticeCnt = null ;
|
|
|
boolean walletNotEnough = (bslfb.getLevel() == SuperEnterStageLevel.FULL.getCode()
|
|
|
&& bslfb.getWalletThreshold().compareTo(left) > 0 );
|
|
|
boolean notNotice = (Objects.isNull(noticeCnt= storedSellerCacheService.getNoticeCntWhenWalletNotEnough(uid)) || noticeCnt<1);
|
|
|
if (notNotice && walletNotEnough){
|
|
|
try {
|
|
|
logger.info("in processLargeSettlementSuperWhenWalletChange send mail uid {} sellerBo {} noticeCnt {}",
|
|
|
uid, sellerBo, noticeCnt);
|
|
|
String mailTo = configReader.getString("ufo.order.seller.noticeHKSellerEmailTo", "chao.chen@yoho.cn,xiuchun.luo@yoho.cn");
|
|
|
MailSender.newMailSender()
|
|
|
.subject("UFO香港卖家结算")
|
|
|
.to(mailTo)
|
|
|
.body("您的钱包金额不足,请及时充值", "text/html;charset=utf-8")
|
|
|
.send();
|
|
|
storedSellerCacheService.setNoticeCntWhenWalletNotEnough(uid, 1);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("processLargeSettlementSuperWhenWalletChange send mail fail, uid {} left wallet {}", uid, left, ex);
|
|
|
}
|
|
|
}
|
|
|
logger.info("in processLargeSettlementSuperWhenWalletChange uid {} sellerBo {} noticeCnt {}",
|
|
|
uid, sellerBo, noticeCnt);
|
|
|
noticeLargeSettlementSuper(bslfb, sellerBo, left);
|
|
|
|
|
|
//hidden sale product
|
|
|
boolean needHiddenPrds = bslfb.getLevel() == SuperEnterStageLevel.DISABLE.getCode()
|
...
|
...
|
@@ -556,8 +585,10 @@ public class SellerEnterApplyService { |
|
|
if (needHiddenPrds || cancelHidden){
|
|
|
EntryLevelNode eln = buildEntryLevelNode(sellerWrapper, bslfb);
|
|
|
doUpgradeSuper(currentEST, eln.currentLevel, eln.targetLevel, uid);
|
|
|
SuperEnterStageLevel targetSESL = SuperEnterStageLevel.getSuperEnterStageLevel(eln.targetLevel);
|
|
|
inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold());
|
|
|
if (needHiddenPrds) {
|
|
|
SuperEnterStageLevel targetSESL = SuperEnterStageLevel.getSuperEnterStageLevel(eln.targetLevel);
|
|
|
inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|