Authored by LUOXC

refactor

... ... @@ -10,7 +10,7 @@ import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.event.DeliverNoticeEvent;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -28,7 +28,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger();
@Autowired
private InBoxFacade inBoxFacade;
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
private BuyerOrderMapper buyerOrderMapper;
... ... @@ -62,8 +62,8 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
sog.setUid(msg.getSellerUid());
sog.setProductName(msg.getPrdName());
}
LOGGER.info("ready notice sellerDeliverNotice, msg {}", msg);
inBoxFacade.sellerDeliverNotice(sog,orderCode, 2, 12, DateUtil.UNIT_HOURS);
LOGGER.info("ready notice sellerDeliverWithTimes, msg {}", msg);
sellerNoticeFacade.sellerDeliverWithTimes(sog,orderCode, 2, 12, DateUtil.UNIT_HOURS);
}
... ...
... ... @@ -1502,7 +1502,7 @@ public class AppraiseService {
.refundCase(RefundCase.BUYER_GOODS_MONEY)
.and()
// 通知卖家商品无法鉴定
.withNoticeSeller((soa, code) -> inBoxFacade.noticeSellerAppraiseUnsure(soa, code)).and()
.withNoticeSeller((soa, code) -> sellerNoticeFacade.appraiseUnsure(soa, code)).and()
// 通知买家商品无法鉴定(并发券)
.withNoticeBuyer(this::noticeBuyerAndSendCouponForAppraiseUnsure).and()
// 记录一条补充物流
... ...
... ... @@ -107,6 +107,9 @@ public class BuyerOrderCancelService {
private InBoxFacade inBoxFacade;
@Autowired
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
... ... @@ -230,7 +233,7 @@ public class BuyerOrderCancelService {
// 退买家货款
.withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).and()
// 通知卖家商品发货超时
.withNoticeSeller((soa, code) -> inBoxFacade.sellerDeliverNotice(soa, code, 3, 0, null)).and()
.withNoticeSeller((soa, code) -> sellerNoticeFacade.sellerDeliverWithTimes(soa, code, 3, 0, null)).and()
// 通知买家卖家商品发货超时
.withNoticeBuyer(inBoxFacade::noticeBuyerOfSellerSendOutTimeout).and()
// 退优惠券
... ...
... ... @@ -9,7 +9,6 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.DepositOrder;
import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.order.model.request.PaymentRequest;
... ... @@ -23,7 +22,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.html.Option;
import java.util.Objects;
import java.util.Optional;
... ... @@ -171,7 +169,7 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
inBoxFacade.recallDepositNotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
} catch (Exception e) {
logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo);
}
... ...
... ... @@ -19,7 +19,7 @@ import com.yohoufo.order.common.SuperEntrySellerStatus;
import com.yohoufo.order.service.IStoredSellerService;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.cache.StoredSellerCacheService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.service.seller.setting.SellerService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -29,7 +29,6 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Objects;
@Service
... ... @@ -40,7 +39,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
private StoredSellerMapper storedSellerMapper;
@Autowired
private InBoxFacade inBoxFacade;
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
UfoServiceCaller ufoServiceCaller;
... ... @@ -258,7 +257,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
storedSellerCacheService.setStoredSeller( storedSeller);
//发送消息
inBoxFacade.sendMsg4EntySeller(uid);
sellerNoticeFacade.sendMsg4EntrySeller(uid);
}
private ZhiMaCert getZhiMaCertInfo(int targetUid) {
... ...
... ... @@ -32,6 +32,7 @@ import com.yohoufo.order.service.IStoredSellerService;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.cache.StoredSellerCacheService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.setting.SellerEnterApplyService;
import com.yohoufo.order.service.seller.setting.SellerService;
... ... @@ -78,7 +79,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
private StoredSellerMapper storedSellerMapper;
@Autowired
private InBoxFacade inBoxFacade;
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
private IStoredSellerService storedSellerService;
... ... @@ -421,7 +422,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
logger.info("StoredSellerServiceImpl updateStoredSellerQuitStatus end ,uid is {} ,update num {}",uid,num);
if(num >0){
inBoxFacade.sendMsg4QuitEntrySeller(uid);
sellerNoticeFacade.sendMsg4QuitEntrySeller(uid);
// 退驻的商户是邀请人的话,需要处理之前的绑定关系
InviteRecordEvent inviteRecordEvent = InviteRecordEvent.builder().uid(uid).eventType(EnterQuitEnum.QUIT).build();
... ...
... ... @@ -28,6 +28,7 @@ import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
... ... @@ -569,66 +570,6 @@ public class InBoxFacade extends BaseNoticeFacade{
}
}
/*********************************************************************
* 其他---短信
********************************************************************/
public void sendMsg4EntySeller(Integer uid){
log.info("InBoxFacade sendMsg4EntySeller inbox msg, uid {}",uid);
try {
executorService.execute(() -> {
// 发送消息
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SYSTEM_ENTER_SETTLED;
String params = buildParams(null);
InboxReqVO inBoxReq = buildInboxReqVO(uid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(inBoxReq);
log.info("InBoxFacade sendMsg4enty inbox msg, uid {}, resp {}",
uid, resp);
});
} catch (Exception e) {
log.warn("InBoxFacade sendMsg4EntySeller error inbox msg, sellerUid {}, prdName {} ",
uid, e);
}
}
public void sendMsg4QuitEntrySeller(Integer uid){
log.info("InBoxFacade sendMsg4QuitEntrySeller inbox msg, uid {}",uid);
try {
executorService.execute(() -> {
// 发送消息
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SYSTEM_EXIT_SETTLED;
String params = buildParams(null);
InboxReqVO inBoxReq = buildInboxReqVO(uid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(inBoxReq);
log.info("InBoxFacade sendMsg4quit inbox msg, uid {}, resp {}",
uid, resp);
// 发送短信
String content=InboxBusinessTypeEnum.SMS_EXIT_SETTLED.getContent();
String phone=userProxyService.getMobile(uid);
log.info("sendMsg4quit inbox sms, uid {}, phone {}",
uid, phone);
if (StringUtils.isBlank(phone)){
log.warn("endMsg4quit inbox sms fail cause of phone is empty, uid {} ", uid);
return;
}
List<String> mobileList = Arrays.asList(phone);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("sendMsg4quit inbox sms send end, uid {}, phone {}",
uid, phone);
});
} catch (Exception e) {
log.warn("InBoxFacade sendMsg4QuitEntrySeller error inbox msg, sellerUid {}, prdName {} ",
uid, e);
}
}
/**
* 鉴定中心把 买家取消(卖家已发货给中心)的物品,顺丰到付寄给卖家
*/
... ... @@ -844,101 +785,6 @@ public class InBoxFacade extends BaseNoticeFacade{
}
}
public void sellerDeliverNotice(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
InboxBusinessTypeEnum ibt;
InboxBusinessTypeEnum smsInboxBusinessTypeEnum;
String params ;
String content;
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
try {
if (times == 2) {
params = buildParams(goodsTypeTag,prdName, sizeName,productCode, leftTime, timeUnit);
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND;
content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag,prdName,sizeName,productCode,leftTime,timeUnit,orderCode);
} else if (times == 3) {
params = buildParams(goodsTypeTag,prdName, sizeName,productCode);
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS_FAIL;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED;
content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag,prdName,sizeName,productCode,orderCode);
} else {
return;
}
executorService.execute(() -> {
log.info("record sellerDeliverNotice inbox sms msg,sellerUid {},orderCode {}, prdName {}, times {}",
sellerUid,orderCode, prdName, times);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record sellerDeliverNotice inbox msg,sellerUid {}, orderCode {} ,prdName {},sizeName {} times {},resp {}",
sellerUid,orderCode, prdName, sizeName, times, resp);
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
log.warn("times {},sellerDeliverNotice sms send fail,sellerUid {}, orderCode {} ,prdName {}",
times, sellerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
sendSmsService.smsSendByMobile(content, mobileList);
log.info("record sellerDeliverNotice inbox sms msg,sellerUid {},orderCode, prdName {}, times {},resp {}",
sellerUid, orderCode,prdName, times);
});
} catch (Exception e) {
log.warn("InBoxFacade sellerDeliverNotice error inbox msg, sellerUid {}, orderCode,prdName {} ",
sellerUid,orderCode, prdName, e);
}
}
public void noticeSellerAppraiseUnsure(SellerOrderGoods sog, long orderCode) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
InboxBusinessTypeEnum ibt;
InboxBusinessTypeEnum smsInboxBusinessTypeEnum;
String params;
String content;
try {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
params = buildParams(goodsTypeTag,prdName, sizeName,productCode);
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_UNSURE;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_UNSURE;
content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag, prdName, sizeName,productCode,orderCode);
executorService.execute(() -> {
log.info("noticeSellerAppraiseUnsure inbox sms msg,sellerUid {}, prdName {}", sellerUid, prdName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("noticeSellerAppraiseUnsure inbox msg,sellerUid {}, prdName {},sizeName {},resp {}",
sellerUid, prdName, sizeName, resp);
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)) {
log.warn("noticeSellerAppraiseUnsure sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
sendSmsService.smsSendByMobile(content, mobileList);
log.info("noticeSellerAppraiseUnsure inbox sms msg,sellerUid {}, prdName {},resp {}",
sellerUid, prdName, resp);
});
} catch (Exception e) {
log.warn("noticeSellerAppraiseUnsure error inbox msg, sellerUid {}, prdName {} ",
sellerUid, prdName, e);
}
}
public void buyerCancelBeforeDepotReceive(@NonNull BuyerOrder buyerOrder, String compesant, SellerOrderGoods sog) {
buyerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, compesant, sog);
sellerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, sog);
... ... @@ -1004,12 +850,12 @@ public class InBoxFacade extends BaseNoticeFacade{
}
}
public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet){
public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet) {
String logPrefix = "notice super seller degrade";
try {
executorService.execute(()->{
InboxBusinessTypeEnum smsIBT = null;
InboxBusinessTypeEnum inboxIBT = null;
switch (sesl){
InboxBusinessTypeEnum smsIBT;
InboxBusinessTypeEnum inboxIBT;
switch (sesl) {
case PARTITION:
inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_PART_FUNC;
smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_PART_FUNC;
... ... @@ -1018,73 +864,46 @@ public class InBoxFacade extends BaseNoticeFacade{
inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_ALL_FUNC;
smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_ALL_FUNC;
break;
}
if (smsIBT == null || inboxIBT == null ){
log.warn("in noticeSuperSellerDegrade not match send condition, uid {}, SuperEnterStageLevel {},leftInWallet {}",
uid, sesl, leftInWallet);
default:
log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {}", logPrefix, uid, sesl, leftInWallet);
return;
}
String params = buildParams(leftInWallet);
InboxReqVO req = buildInboxReqVO(uid, params, inboxIBT);
newNotice(uid)
.withLogPrefix(logPrefix)
.withInBox(inboxIBT, leftInWallet)
.withSms(smsIBT, leftInWallet)
.send();
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record noticeSuperSellerDegrade to super seller inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {} resp {}",
uid, sesl, leftInWallet, resp);
//短信
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
log.warn("in noticeSuperSellerDegrade sms fail, uid {}, SuperEnterStageLevel {},leftInWallet {}",
uid, sesl, leftInWallet);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(smsIBT.getContent(), leftInWallet);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record noticeSuperSellerDegrade inbox sms msg, uid {}, SuperEnterStageLevel {},leftInWallet {}",
uid, sesl, leftInWallet);
});
} catch (Exception e) {
log.warn("InBoxFacade noticeSuperSellerDegrade error inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {}",
uid, sesl, leftInWallet, e);
log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {}",
logPrefix, uid, sesl, leftInWallet, e);
}
}
public void noticeLargeSettlementSuperDegrade(Integer uid, SuperEnterStageLevel sesl,String threshold, BigDecimal leftInWallet){
public void noticeLargeSettlementSuperDegrade(Integer uid, SuperEnterStageLevel sesl, String threshold, BigDecimal leftInWallet) {
String logPrefix = "notice large settlement super degrade";
try {
executorService.execute(()->{
InboxBusinessTypeEnum smsIBT = null;
switch (sesl){
InboxBusinessTypeEnum smsInboxBusinessTypeEnum;
switch (sesl) {
case FULL:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_WALLET_NOT_ENOUGH;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_WALLET_NOT_ENOUGH;
break;
case PARTITION:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_PART_FUNC;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_PART_FUNC;
break;
case DISABLE:
smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_ALL_FUNC;
smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_ALL_FUNC;
break;
}
if (smsIBT == null){
log.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)){
log.warn("in noticeLargeSettlementSuperDegrade sms fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold{}",
uid, sesl, leftInWallet, threshold);
default:
log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}", logPrefix, uid, sesl, leftInWallet, threshold);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(smsIBT.getContent(), threshold);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record noticeLargeSettlementSuperDegrade inbox sms msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",
uid, sesl, leftInWallet, threshold);
});
newNotice(uid)
.withLogPrefix(logPrefix)
.withSms(smsInboxBusinessTypeEnum, threshold)
.send();
} catch (Exception e) {
log.warn("InBoxFacade noticeLargeSettlementSuperDegrade error inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",
uid, sesl, leftInWallet,threshold, e);
log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}", logPrefix, uid, sesl, leftInWallet, threshold, e);
}
}
... ... @@ -1098,38 +917,32 @@ public class InBoxFacade extends BaseNoticeFacade{
sellerNoticeFacade.appraisePass(buyerUid, orderCode, sog);
}
// 召回的
public void recallDepositnotify(int uid, SellerOrderGoods sog) {
/**
* 召回寄存商品
*/
public void recallDepositNotify(int uid, SellerOrderGoods sog) {
if (null == sog) {
log.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid);
log.warn("notice user recall deposit goods fail, uid {}, sog is null", uid);
return;
}
try {
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
newNotice(uid)
.withLogPrefix("notice user recall deposit goods")
.withInBox(() -> {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;
String paramsOfSeller = buildParams(prdName, sizeName,productCode);
InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
log.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",
uid, sog, respOfSeller);
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
log.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);
});
return buildInboxContent(InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL, prdName, sizeName, productCode);
})
.withSms(() -> {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL, prdName, sizeName, productCode);
})
.send();
} catch (Exception e) {
log.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e);
log.warn("notice user recall deposit goods fail, uid {}, sog {}", uid, sog, e);
}
}
... ...
... ... @@ -6,12 +6,17 @@ import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@Service
... ... @@ -29,6 +34,31 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
return log;
}
public void sendMsg4EntrySeller(Integer uid) {
String logPrefix = "notice user entry seller";
try {
newNotice(uid)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.SYSTEM_ENTER_SETTLED)
.send();
} catch (Exception e) {
log.warn("{} fail, uid {}", logPrefix, uid, e);
}
}
public void sendMsg4QuitEntrySeller(Integer uid) {
String logPrefix = "notice user quit entry seller";
try {
newNotice(uid)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.SYSTEM_EXIT_SETTLED)
.withSms(InboxBusinessTypeEnum.SMS_EXIT_SETTLED)
.send();
} catch (Exception e) {
log.warn("{} fail, uid {}", logPrefix, uid, e);
}
}
/**
* 商品鉴定已通过
*
... ... @@ -207,8 +237,64 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
}
}
public void noticeSellerWhenPlatformOffShelve(SellerOrderGoods psog){
public void noticeSellerWhenPlatformOffShelve(SellerOrderGoods psog) {
}
/**
* 鉴定中心无法鉴定商品
*
* @param sog
* @param orderCode
*/
public void appraiseUnsure(SellerOrderGoods sog, long orderCode) {
String logPrefix = "notice seller appraise unsure";
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
try {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newNotice(sellerUid)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_UNSURE, goodsTypeTag, prdName, sizeName, productCode)
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_UNSURE, goodsTypeTag, prdName, sizeName, productCode, orderCode)
.send();
} catch (Exception e) {
log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
}
}
public void sellerDeliverWithTimes(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) {
String logPrefix = "notice seller seller deliver";
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
try {
if (times == 2) {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newNotice(sellerUid)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS, goodsTypeTag, prdName, sizeName, productCode, leftTime, timeUnit)
.withSms(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND, goodsTypeTag, prdName, sizeName, productCode, leftTime, timeUnit, orderCode)
.send();
} else if (times == 3) {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newNotice(sellerUid)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS_FAIL, goodsTypeTag, prdName, sizeName, productCode)
.withSms(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED, goodsTypeTag, prdName, sizeName, productCode, orderCode)
.send();
} else {
log.warn("{} fail, sellerUid {} orderCode {} unknown times {}", logPrefix, sellerUid, orderCode, times);
}
} catch (Exception e) {
log.warn("{} fail, sellerUid {} orderCode {} times {} ", logPrefix, sellerUid, orderCode, times, e);
}
}
}
... ...
... ... @@ -22,7 +22,7 @@ import com.yohoufo.order.model.dto.PreSaleOrderConfig;
import com.yohoufo.order.service.cache.OrderCacheService;
import com.yohoufo.order.service.impl.BuyerOrderCancelService;
import com.yohoufo.order.service.impl.MetaConfigService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.TimeUtils;
import lombok.Builder;
... ... @@ -65,7 +65,7 @@ public class PreSaleOrderJob implements YhJob {
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
private InBoxFacade inBoxFacade;
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
private MetaConfigService metaConfigService;
... ... @@ -137,7 +137,7 @@ public class PreSaleOrderJob implements YhJob {
int leftHours = node.days * 24 + node.hours + node.minutes/30;
BuyerOrderGoods bog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup());
inBoxFacade.sellerDeliverNotice(sog, orderCode, 2, leftHours, DateUtil.UNIT_HOURS);
sellerNoticeFacade.sellerDeliverWithTimes(sog, orderCode, 2, leftHours, DateUtil.UNIT_HOURS);
times = 1;
orderCacheService.cacheOrderDeliverNoticeTimes(orderCode, nowDateStr, times, CACHE_EXPIRED_TIME);
}else{
... ...