Authored by chenchao

fix qmc my bug 5675,5682,5683

... ... @@ -79,7 +79,7 @@ public class CacheKeyBuilder {
SELLER_GOODS_PLATFORM_FEE("ufo:order:seller:goods:platform:fee", ""),
BUYER_ORDER_FEE("ufo:order:buyer:order:fee",""),
BUYER_ORDER_CUT_POLICY("ufo:buyer:order:cut:policy:","type:{}"),
LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH("ufo:seller:largeSettlement:walletNotEnough:notice:","uid:{}:cnt")
LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH("ufo:seller:largeSettlement:walletNotEnough:notice:","uid:{}:funcLevel:{}:cnt")
;
private String fix;
... ... @@ -177,7 +177,7 @@ public class CacheKeyBuilder {
return KeyTemp.ORDER_DELIVER_NOTICE_TIMES.builderKey(new Object[]{orderCode, date});
}
public static RedisKeyBuilder noticeLargeSettlementSuperWalletNotEnoughKey(int uid){
return KeyTemp.LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH.builderKey(new Object[]{uid});
public static RedisKeyBuilder noticeLargeSettlementSuperWalletNotEnoughKey(int uid, int funcLevel){
return KeyTemp.LARGE_SETTLEMENT_SUPER_NOTICE_WALLET_NOT_ENOUGH.builderKey(new Object[]{uid, funcLevel});
}
}
... ...
... ... @@ -118,13 +118,13 @@ public class StoredSellerCacheService {
cacheClient.delete(cke.getCacheKey());
}
public void setNoticeCntWhenWalletNotEnough(int uid, int cnt){
RedisKeyBuilder ckb = CacheKeyBuilder.noticeLargeSettlementSuperWalletNotEnoughKey(uid);
public void setNoticeCntWhenWalletNotEnough(int uid, int funcLevel, int cnt){
RedisKeyBuilder ckb = CacheKeyBuilder.noticeLargeSettlementSuperWalletNotEnoughKey(uid, funcLevel);
set(ckb, cnt, 7, TimeUnit.DAYS);
}
public Integer getNoticeCntWhenWalletNotEnough(int uid){
RedisKeyBuilder ckb = CacheKeyBuilder.noticeLargeSettlementSuperWalletNotEnoughKey(uid);
public Integer getNoticeCntWhenWalletNotEnough(int uid, int funcLevel){
RedisKeyBuilder ckb = CacheKeyBuilder.noticeLargeSettlementSuperWalletNotEnoughKey(uid, funcLevel);
return get(ckb, Integer.class);
}
... ...
... ... @@ -122,13 +122,13 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
}
private String formatDetailDesc(BuyerOrder buyerOrder, String temp){
Object[] formatParms = new Object[1];
String detailDesc = temp;
Integer orderStatus = buyerOrder.getStatus();
try {
if (orderStatus == OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()
|| orderStatus == OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode()) {
Object[] formatParms = new Object[1];
formatParms[0] = tradeBillsService.queryBuyerPenaltyAmount(buyerOrder.getOrderCode());
detailDesc = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
}
... ... @@ -136,8 +136,7 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
if (orderStatus == OrderStatus.BUYER_BLOWN_CUSTOMS_CLEARANCE.getCode()){
CustomsClearanceResult ccr;
if(Objects.nonNull(ccr=buyerOrderMetaService.getCustomsClearanceResult(buyerOrder.getUid(), buyerOrder.getOrderCode()))){
formatParms[0] = ccr.getFailReason();
detailDesc = MessageFormatter.arrayFormat(temp, formatParms).getMessage();
detailDesc = String.format(temp, ccr.getFailReason());
}else{
detailDesc = "清关不通过,已自动取消订单";
}
... ...
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());
}
}
}
}
... ...
... ... @@ -1716,6 +1716,44 @@ public class InBoxFacade {
}
}
public void noticeLargeSettlementSuperDegrade(Integer uid, SuperEnterStageLevel sesl,String threshold, BigDecimal leftInWallet){
try {
executorService.execute(()->{
InboxBusinessTypeEnum smsIBT = null;
switch (sesl){
case FULL:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_WALLET_NOT_ENOUGH;
case PARTITION:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_PART_FUNC;
break;
case DISABLE:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_ALL_FUNC;
break;
}
if (smsIBT == null){
logger.warn("in noticeLargeSettlementSuperDegrade not match send condition, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",
uid, sesl, leftInWallet, threshold);
return;
}
//短信
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeLargeSettlementSuperDegrade sms fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold{}",
uid, sesl, leftInWallet, threshold);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(smsIBT.getContent(), threshold);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeLargeSettlementSuperDegrade inbox sms msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",
uid, sesl, leftInWallet, threshold);
});
} catch (Exception e) {
logger.warn("InBoxFacade noticeLargeSettlementSuperDegrade error inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",
uid, sesl, leftInWallet,threshold, e);
}
}
public void noticeWhenBuyerBlownCustomsClearance(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
... ...