Authored by LUOXC

refactor

@@ -10,7 +10,7 @@ import com.yohoufo.dal.order.model.BuyerOrder; @@ -10,7 +10,7 @@ import com.yohoufo.dal.order.model.BuyerOrder;
10 import com.yohoufo.dal.order.model.SellerOrderGoods; 10 import com.yohoufo.dal.order.model.SellerOrderGoods;
11 import com.yohoufo.order.event.DeliverNoticeEvent; 11 import com.yohoufo.order.event.DeliverNoticeEvent;
12 import com.yohoufo.order.mq.TopicConstants; 12 import com.yohoufo.order.mq.TopicConstants;
13 -import com.yohoufo.order.service.proxy.InBoxFacade; 13 +import com.yohoufo.order.service.proxy.SellerNoticeFacade;
14 import com.yohoufo.order.utils.LoggerUtils; 14 import com.yohoufo.order.utils.LoggerUtils;
15 import org.slf4j.Logger; 15 import org.slf4j.Logger;
16 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +28,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { @@ -28,7 +28,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
28 private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger(); 28 private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger();
29 29
30 @Autowired 30 @Autowired
31 - private InBoxFacade inBoxFacade; 31 + private SellerNoticeFacade sellerNoticeFacade;
32 32
33 @Autowired 33 @Autowired
34 private BuyerOrderMapper buyerOrderMapper; 34 private BuyerOrderMapper buyerOrderMapper;
@@ -62,8 +62,8 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { @@ -62,8 +62,8 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
62 sog.setUid(msg.getSellerUid()); 62 sog.setUid(msg.getSellerUid());
63 sog.setProductName(msg.getPrdName()); 63 sog.setProductName(msg.getPrdName());
64 } 64 }
65 - LOGGER.info("ready notice sellerDeliverNotice, msg {}", msg);  
66 - inBoxFacade.sellerDeliverNotice(sog,orderCode, 2, 12, DateUtil.UNIT_HOURS); 65 + LOGGER.info("ready notice sellerDeliverWithTimes, msg {}", msg);
  66 + sellerNoticeFacade.sellerDeliverWithTimes(sog,orderCode, 2, 12, DateUtil.UNIT_HOURS);
67 } 67 }
68 68
69 69
@@ -1502,7 +1502,7 @@ public class AppraiseService { @@ -1502,7 +1502,7 @@ public class AppraiseService {
1502 .refundCase(RefundCase.BUYER_GOODS_MONEY) 1502 .refundCase(RefundCase.BUYER_GOODS_MONEY)
1503 .and() 1503 .and()
1504 // 通知卖家商品无法鉴定 1504 // 通知卖家商品无法鉴定
1505 - .withNoticeSeller((soa, code) -> inBoxFacade.noticeSellerAppraiseUnsure(soa, code)).and() 1505 + .withNoticeSeller((soa, code) -> sellerNoticeFacade.appraiseUnsure(soa, code)).and()
1506 // 通知买家商品无法鉴定(并发券) 1506 // 通知买家商品无法鉴定(并发券)
1507 .withNoticeBuyer(this::noticeBuyerAndSendCouponForAppraiseUnsure).and() 1507 .withNoticeBuyer(this::noticeBuyerAndSendCouponForAppraiseUnsure).and()
1508 // 记录一条补充物流 1508 // 记录一条补充物流
@@ -107,6 +107,9 @@ public class BuyerOrderCancelService { @@ -107,6 +107,9 @@ public class BuyerOrderCancelService {
107 private InBoxFacade inBoxFacade; 107 private InBoxFacade inBoxFacade;
108 108
109 @Autowired 109 @Autowired
  110 + private SellerNoticeFacade sellerNoticeFacade;
  111 +
  112 + @Autowired
110 private BuyerNoticeFacade buyerNoticeFacade; 113 private BuyerNoticeFacade buyerNoticeFacade;
111 114
112 @Autowired 115 @Autowired
@@ -230,7 +233,7 @@ public class BuyerOrderCancelService { @@ -230,7 +233,7 @@ public class BuyerOrderCancelService {
230 // 退买家货款 233 // 退买家货款
231 .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).and() 234 .withRefundGoodsMoney(payRefundService::refund).refundCase(RefundCase.BUYER_GOODS_MONEY).and()
232 // 通知卖家商品发货超时 235 // 通知卖家商品发货超时
233 - .withNoticeSeller((soa, code) -> inBoxFacade.sellerDeliverNotice(soa, code, 3, 0, null)).and() 236 + .withNoticeSeller((soa, code) -> sellerNoticeFacade.sellerDeliverWithTimes(soa, code, 3, 0, null)).and()
234 // 通知买家卖家商品发货超时 237 // 通知买家卖家商品发货超时
235 .withNoticeBuyer(inBoxFacade::noticeBuyerOfSellerSendOutTimeout).and() 238 .withNoticeBuyer(inBoxFacade::noticeBuyerOfSellerSendOutTimeout).and()
236 // 退优惠券 239 // 退优惠券
@@ -9,7 +9,6 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; @@ -9,7 +9,6 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; 9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
10 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 10 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
11 import com.yohoufo.dal.order.model.DepositOrder; 11 import com.yohoufo.dal.order.model.DepositOrder;
12 -import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;  
13 import com.yohoufo.dal.order.model.SellerOrderGoods; 12 import com.yohoufo.dal.order.model.SellerOrderGoods;
14 import com.yohoufo.dal.order.model.StorageDeposit; 13 import com.yohoufo.dal.order.model.StorageDeposit;
15 import com.yohoufo.order.model.request.PaymentRequest; 14 import com.yohoufo.order.model.request.PaymentRequest;
@@ -23,7 +22,6 @@ import org.slf4j.LoggerFactory; @@ -23,7 +22,6 @@ import org.slf4j.LoggerFactory;
23 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
25 24
26 -import javax.swing.text.html.Option;  
27 import java.util.Objects; 25 import java.util.Objects;
28 import java.util.Optional; 26 import java.util.Optional;
29 27
@@ -171,7 +169,7 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService { @@ -171,7 +169,7 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
171 SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup) 169 SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
172 .map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null); 170 .map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
173 171
174 - inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知 172 + inBoxFacade.recallDepositNotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
175 } catch (Exception e) { 173 } catch (Exception e) {
176 logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo); 174 logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo);
177 } 175 }
@@ -19,7 +19,7 @@ import com.yohoufo.order.common.SuperEntrySellerStatus; @@ -19,7 +19,7 @@ import com.yohoufo.order.common.SuperEntrySellerStatus;
19 import com.yohoufo.order.service.IStoredSellerService; 19 import com.yohoufo.order.service.IStoredSellerService;
20 import com.yohoufo.order.service.MerchantOrderPaymentService; 20 import com.yohoufo.order.service.MerchantOrderPaymentService;
21 import com.yohoufo.order.service.cache.StoredSellerCacheService; 21 import com.yohoufo.order.service.cache.StoredSellerCacheService;
22 -import com.yohoufo.order.service.proxy.InBoxFacade; 22 +import com.yohoufo.order.service.proxy.SellerNoticeFacade;
23 import com.yohoufo.order.service.seller.setting.SellerService; 23 import com.yohoufo.order.service.seller.setting.SellerService;
24 import org.apache.commons.lang3.StringUtils; 24 import org.apache.commons.lang3.StringUtils;
25 import org.slf4j.Logger; 25 import org.slf4j.Logger;
@@ -29,7 +29,6 @@ import org.springframework.stereotype.Service; @@ -29,7 +29,6 @@ import org.springframework.stereotype.Service;
29 29
30 import java.time.LocalDateTime; 30 import java.time.LocalDateTime;
31 import java.time.ZoneOffset; 31 import java.time.ZoneOffset;
32 -import java.util.List;  
33 import java.util.Objects; 32 import java.util.Objects;
34 33
35 @Service 34 @Service
@@ -40,7 +39,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService { @@ -40,7 +39,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
40 private StoredSellerMapper storedSellerMapper; 39 private StoredSellerMapper storedSellerMapper;
41 40
42 @Autowired 41 @Autowired
43 - private InBoxFacade inBoxFacade; 42 + private SellerNoticeFacade sellerNoticeFacade;
44 43
45 @Autowired 44 @Autowired
46 UfoServiceCaller ufoServiceCaller; 45 UfoServiceCaller ufoServiceCaller;
@@ -258,7 +257,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService { @@ -258,7 +257,7 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
258 storedSellerCacheService.setStoredSeller( storedSeller); 257 storedSellerCacheService.setStoredSeller( storedSeller);
259 258
260 //发送消息 259 //发送消息
261 - inBoxFacade.sendMsg4EntySeller(uid); 260 + sellerNoticeFacade.sendMsg4EntrySeller(uid);
262 } 261 }
263 262
264 private ZhiMaCert getZhiMaCertInfo(int targetUid) { 263 private ZhiMaCert getZhiMaCertInfo(int targetUid) {
@@ -32,6 +32,7 @@ import com.yohoufo.order.service.IStoredSellerService; @@ -32,6 +32,7 @@ import com.yohoufo.order.service.IStoredSellerService;
32 import com.yohoufo.order.service.MerchantOrderPaymentService; 32 import com.yohoufo.order.service.MerchantOrderPaymentService;
33 import com.yohoufo.order.service.cache.StoredSellerCacheService; 33 import com.yohoufo.order.service.cache.StoredSellerCacheService;
34 import com.yohoufo.order.service.proxy.InBoxFacade; 34 import com.yohoufo.order.service.proxy.InBoxFacade;
  35 +import com.yohoufo.order.service.proxy.SellerNoticeFacade;
35 import com.yohoufo.order.service.seller.SkupService; 36 import com.yohoufo.order.service.seller.SkupService;
36 import com.yohoufo.order.service.seller.setting.SellerEnterApplyService; 37 import com.yohoufo.order.service.seller.setting.SellerEnterApplyService;
37 import com.yohoufo.order.service.seller.setting.SellerService; 38 import com.yohoufo.order.service.seller.setting.SellerService;
@@ -78,7 +79,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi @@ -78,7 +79,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
78 private StoredSellerMapper storedSellerMapper; 79 private StoredSellerMapper storedSellerMapper;
79 80
80 @Autowired 81 @Autowired
81 - private InBoxFacade inBoxFacade; 82 + private SellerNoticeFacade sellerNoticeFacade;
82 83
83 @Autowired 84 @Autowired
84 private IStoredSellerService storedSellerService; 85 private IStoredSellerService storedSellerService;
@@ -421,7 +422,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi @@ -421,7 +422,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
421 logger.info("StoredSellerServiceImpl updateStoredSellerQuitStatus end ,uid is {} ,update num {}",uid,num); 422 logger.info("StoredSellerServiceImpl updateStoredSellerQuitStatus end ,uid is {} ,update num {}",uid,num);
422 423
423 if(num >0){ 424 if(num >0){
424 - inBoxFacade.sendMsg4QuitEntrySeller(uid); 425 + sellerNoticeFacade.sendMsg4QuitEntrySeller(uid);
425 426
426 // 退驻的商户是邀请人的话,需要处理之前的绑定关系 427 // 退驻的商户是邀请人的话,需要处理之前的绑定关系
427 InviteRecordEvent inviteRecordEvent = InviteRecordEvent.builder().uid(uid).eventType(EnterQuitEnum.QUIT).build(); 428 InviteRecordEvent inviteRecordEvent = InviteRecordEvent.builder().uid(uid).eventType(EnterQuitEnum.QUIT).build();
@@ -28,6 +28,7 @@ import java.math.BigDecimal; @@ -28,6 +28,7 @@ import java.math.BigDecimal;
28 import java.util.Arrays; 28 import java.util.Arrays;
29 import java.util.List; 29 import java.util.List;
30 import java.util.Map; 30 import java.util.Map;
  31 +import java.util.Optional;
31 import java.util.concurrent.ArrayBlockingQueue; 32 import java.util.concurrent.ArrayBlockingQueue;
32 import java.util.concurrent.ExecutorService; 33 import java.util.concurrent.ExecutorService;
33 import java.util.concurrent.ThreadPoolExecutor; 34 import java.util.concurrent.ThreadPoolExecutor;
@@ -569,66 +570,6 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -569,66 +570,6 @@ public class InBoxFacade extends BaseNoticeFacade{
569 } 570 }
570 } 571 }
571 572
572 - /*********************************************************************  
573 - * 其他---短信  
574 - ********************************************************************/  
575 -  
576 - public void sendMsg4EntySeller(Integer uid){  
577 - log.info("InBoxFacade sendMsg4EntySeller inbox msg, uid {}",uid);  
578 - try {  
579 - executorService.execute(() -> {  
580 - // 发送消息  
581 - InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SYSTEM_ENTER_SETTLED;  
582 - String params = buildParams(null);  
583 - InboxReqVO inBoxReq = buildInboxReqVO(uid, params, ibt);  
584 -  
585 - InBoxResponse resp = inBoxSDK.addInbox(inBoxReq);  
586 - log.info("InBoxFacade sendMsg4enty inbox msg, uid {}, resp {}",  
587 - uid, resp);  
588 - });  
589 -  
590 - } catch (Exception e) {  
591 - log.warn("InBoxFacade sendMsg4EntySeller error inbox msg, sellerUid {}, prdName {} ",  
592 - uid, e);  
593 - }  
594 - }  
595 -  
596 - public void sendMsg4QuitEntrySeller(Integer uid){  
597 - log.info("InBoxFacade sendMsg4QuitEntrySeller inbox msg, uid {}",uid);  
598 - try {  
599 - executorService.execute(() -> {  
600 - // 发送消息  
601 - InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SYSTEM_EXIT_SETTLED;  
602 - String params = buildParams(null);  
603 - InboxReqVO inBoxReq = buildInboxReqVO(uid, params, ibt);  
604 -  
605 - InBoxResponse resp = inBoxSDK.addInbox(inBoxReq);  
606 - log.info("InBoxFacade sendMsg4quit inbox msg, uid {}, resp {}",  
607 - uid, resp);  
608 -  
609 - // 发送短信  
610 - String content=InboxBusinessTypeEnum.SMS_EXIT_SETTLED.getContent();  
611 - String phone=userProxyService.getMobile(uid);  
612 - log.info("sendMsg4quit inbox sms, uid {}, phone {}",  
613 - uid, phone);  
614 - if (StringUtils.isBlank(phone)){  
615 - log.warn("endMsg4quit inbox sms fail cause of phone is empty, uid {} ", uid);  
616 - return;  
617 - }  
618 - List<String> mobileList = Arrays.asList(phone);  
619 - sendSmsService.smsSendByMobile(content,mobileList);  
620 - log.info("sendMsg4quit inbox sms send end, uid {}, phone {}",  
621 - uid, phone);  
622 - });  
623 -  
624 - } catch (Exception e) {  
625 - log.warn("InBoxFacade sendMsg4QuitEntrySeller error inbox msg, sellerUid {}, prdName {} ",  
626 - uid, e);  
627 - }  
628 - }  
629 -  
630 -  
631 -  
632 /** 573 /**
633 * 鉴定中心把 买家取消(卖家已发货给中心)的物品,顺丰到付寄给卖家 574 * 鉴定中心把 买家取消(卖家已发货给中心)的物品,顺丰到付寄给卖家
634 */ 575 */
@@ -844,101 +785,6 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -844,101 +785,6 @@ public class InBoxFacade extends BaseNoticeFacade{
844 } 785 }
845 } 786 }
846 787
847 - public void sellerDeliverNotice(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) {  
848 - Integer sellerUid = sog.getUid();  
849 - String prdName = sog.getProductName();  
850 - String sizeName = sog.getSizeName();  
851 - String goodsTypeTag = buildGoodsTypeTagForSeller(sog);  
852 - InboxBusinessTypeEnum ibt;  
853 - InboxBusinessTypeEnum smsInboxBusinessTypeEnum;  
854 - String params ;  
855 - String content;  
856 - Product product = productMapper.selectByPrimaryKey(sog.getProductId());  
857 - String productCode = product.getProductCode();  
858 - try {  
859 - if (times == 2) {  
860 - params = buildParams(goodsTypeTag,prdName, sizeName,productCode, leftTime, timeUnit);  
861 - ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS;  
862 - smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND;  
863 - content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag,prdName,sizeName,productCode,leftTime,timeUnit,orderCode);  
864 - } else if (times == 3) {  
865 - params = buildParams(goodsTypeTag,prdName, sizeName,productCode);  
866 - ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS_FAIL;  
867 - smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED;  
868 - content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag,prdName,sizeName,productCode,orderCode);  
869 - } else {  
870 - return;  
871 - }  
872 - executorService.execute(() -> {  
873 - log.info("record sellerDeliverNotice inbox sms msg,sellerUid {},orderCode {}, prdName {}, times {}",  
874 - sellerUid,orderCode, prdName, times);  
875 - InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);  
876 - InBoxResponse resp = inBoxSDK.addInbox(req);  
877 - log.info("record sellerDeliverNotice inbox msg,sellerUid {}, orderCode {} ,prdName {},sizeName {} times {},resp {}",  
878 - sellerUid,orderCode, prdName, sizeName, times, resp);  
879 -  
880 - String phone = userProxyService.getMobile(sellerUid);  
881 - if (StringUtils.isBlank(phone)){  
882 - log.warn("times {},sellerDeliverNotice sms send fail,sellerUid {}, orderCode {} ,prdName {}",  
883 - times, sellerUid, orderCode,prdName);  
884 - return;  
885 - }  
886 - List<String> mobileList = Arrays.asList(phone);  
887 -  
888 - sendSmsService.smsSendByMobile(content, mobileList);  
889 - log.info("record sellerDeliverNotice inbox sms msg,sellerUid {},orderCode, prdName {}, times {},resp {}",  
890 - sellerUid, orderCode,prdName, times);  
891 - });  
892 - } catch (Exception e) {  
893 - log.warn("InBoxFacade sellerDeliverNotice error inbox msg, sellerUid {}, orderCode,prdName {} ",  
894 - sellerUid,orderCode, prdName, e);  
895 - }  
896 - }  
897 -  
898 - public void noticeSellerAppraiseUnsure(SellerOrderGoods sog, long orderCode) {  
899 - Integer sellerUid = sog.getUid();  
900 - String prdName = sog.getProductName();  
901 - String sizeName = sog.getSizeName();  
902 - String goodsTypeTag = buildGoodsTypeTagForSeller(sog);  
903 -  
904 - InboxBusinessTypeEnum ibt;  
905 - InboxBusinessTypeEnum smsInboxBusinessTypeEnum;  
906 - String params;  
907 - String content;  
908 - try {  
909 - Product product = productMapper.selectByPrimaryKey(sog.getProductId());  
910 - String productCode = product.getProductCode();  
911 - params = buildParams(goodsTypeTag,prdName, sizeName,productCode);  
912 - ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_UNSURE;  
913 - smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_UNSURE;  
914 - content = getReplacedContent(smsInboxBusinessTypeEnum.getContent(),goodsTypeTag, prdName, sizeName,productCode,orderCode);  
915 - executorService.execute(() -> {  
916 -  
917 -  
918 -  
919 - log.info("noticeSellerAppraiseUnsure inbox sms msg,sellerUid {}, prdName {}", sellerUid, prdName);  
920 - InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);  
921 - InBoxResponse resp = inBoxSDK.addInbox(req);  
922 - log.info("noticeSellerAppraiseUnsure inbox msg,sellerUid {}, prdName {},sizeName {},resp {}",  
923 - sellerUid, prdName, sizeName, resp);  
924 -  
925 - String phone = userProxyService.getMobile(sellerUid);  
926 - if (StringUtils.isBlank(phone)) {  
927 - log.warn("noticeSellerAppraiseUnsure sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);  
928 - return;  
929 - }  
930 - List<String> mobileList = Arrays.asList(phone);  
931 -  
932 - sendSmsService.smsSendByMobile(content, mobileList);  
933 - log.info("noticeSellerAppraiseUnsure inbox sms msg,sellerUid {}, prdName {},resp {}",  
934 - sellerUid, prdName, resp);  
935 - });  
936 - } catch (Exception e) {  
937 - log.warn("noticeSellerAppraiseUnsure error inbox msg, sellerUid {}, prdName {} ",  
938 - sellerUid, prdName, e);  
939 - }  
940 - }  
941 -  
942 public void buyerCancelBeforeDepotReceive(@NonNull BuyerOrder buyerOrder, String compesant, SellerOrderGoods sog) { 788 public void buyerCancelBeforeDepotReceive(@NonNull BuyerOrder buyerOrder, String compesant, SellerOrderGoods sog) {
943 buyerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, compesant, sog); 789 buyerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, compesant, sog);
944 sellerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, sog); 790 sellerNoticeFacade.buyerCancelBeforeDepotReceive(buyerOrder, sog);
@@ -1004,12 +850,12 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1004,12 +850,12 @@ public class InBoxFacade extends BaseNoticeFacade{
1004 } 850 }
1005 } 851 }
1006 852
1007 - public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet){ 853 + public void noticeSuperSellerDegrade(Integer uid, SuperEnterStageLevel sesl, BigDecimal leftInWallet) {
  854 + String logPrefix = "notice super seller degrade";
1008 try { 855 try {
1009 - executorService.execute(()->{  
1010 - InboxBusinessTypeEnum smsIBT = null;  
1011 - InboxBusinessTypeEnum inboxIBT = null;  
1012 - switch (sesl){ 856 + InboxBusinessTypeEnum smsIBT;
  857 + InboxBusinessTypeEnum inboxIBT;
  858 + switch (sesl) {
1013 case PARTITION: 859 case PARTITION:
1014 inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_PART_FUNC; 860 inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_PART_FUNC;
1015 smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_PART_FUNC; 861 smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_PART_FUNC;
@@ -1018,73 +864,46 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1018,73 +864,46 @@ public class InBoxFacade extends BaseNoticeFacade{
1018 inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_ALL_FUNC; 864 inboxIBT = InboxBusinessTypeEnum.SUPER_SELLER_DEGRADE_ALL_FUNC;
1019 smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_ALL_FUNC; 865 smsIBT = InboxBusinessTypeEnum.SMS_SUPER_SELLER_DEGRADE_ALL_FUNC;
1020 break; 866 break;
1021 - }  
1022 - if (smsIBT == null || inboxIBT == null ){  
1023 - log.warn("in noticeSuperSellerDegrade not match send condition, uid {}, SuperEnterStageLevel {},leftInWallet {}",  
1024 - uid, sesl, leftInWallet); 867 + default:
  868 + log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {}", logPrefix, uid, sesl, leftInWallet);
1025 return; 869 return;
1026 } 870 }
1027 - String params = buildParams(leftInWallet);  
1028 - InboxReqVO req = buildInboxReqVO(uid, params, inboxIBT); 871 + newNotice(uid)
  872 + .withLogPrefix(logPrefix)
  873 + .withInBox(inboxIBT, leftInWallet)
  874 + .withSms(smsIBT, leftInWallet)
  875 + .send();
1029 876
1030 - InBoxResponse resp = inBoxSDK.addInbox(req);  
1031 - log.info("record noticeSuperSellerDegrade to super seller inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {} resp {}",  
1032 - uid, sesl, leftInWallet, resp);  
1033 - //短信  
1034 - String phone = userProxyService.getMobile(uid);  
1035 - if (StringUtils.isBlank(phone)){  
1036 - log.warn("in noticeSuperSellerDegrade sms fail, uid {}, SuperEnterStageLevel {},leftInWallet {}",  
1037 - uid, sesl, leftInWallet);  
1038 - return;  
1039 - }  
1040 - List<String> mobileList = Arrays.asList(phone);  
1041 - String content = getReplacedContent(smsIBT.getContent(), leftInWallet);  
1042 - sendSmsService.smsSendByMobile(content,mobileList);  
1043 - log.info("record noticeSuperSellerDegrade inbox sms msg, uid {}, SuperEnterStageLevel {},leftInWallet {}",  
1044 - uid, sesl, leftInWallet);  
1045 - });  
1046 } catch (Exception e) { 877 } catch (Exception e) {
1047 - log.warn("InBoxFacade noticeSuperSellerDegrade error inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {}",  
1048 - uid, sesl, leftInWallet, e); 878 + log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {}",
  879 + logPrefix, uid, sesl, leftInWallet, e);
1049 } 880 }
1050 } 881 }
1051 882
1052 - public void noticeLargeSettlementSuperDegrade(Integer uid, SuperEnterStageLevel sesl,String threshold, BigDecimal leftInWallet){ 883 + public void noticeLargeSettlementSuperDegrade(Integer uid, SuperEnterStageLevel sesl, String threshold, BigDecimal leftInWallet) {
  884 + String logPrefix = "notice large settlement super degrade";
1053 try { 885 try {
1054 - executorService.execute(()->{  
1055 - InboxBusinessTypeEnum smsIBT = null;  
1056 - switch (sesl){ 886 + InboxBusinessTypeEnum smsInboxBusinessTypeEnum;
  887 + switch (sesl) {
1057 case FULL: 888 case FULL:
1058 - smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_WALLET_NOT_ENOUGH; 889 + smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_WALLET_NOT_ENOUGH;
1059 break; 890 break;
1060 case PARTITION: 891 case PARTITION:
1061 - smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_PART_FUNC; 892 + smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_PART_FUNC;
1062 break; 893 break;
1063 case DISABLE: 894 case DISABLE:
1064 - smsIBT = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_ALL_FUNC; 895 + smsInboxBusinessTypeEnum = InboxBusinessTypeEnum.SMS_LARGE_SETTLEMENT_SUPER_DEGRADE_ALL_FUNC;
1065 break; 896 break;
1066 - }  
1067 - if (smsIBT == null){  
1068 - log.warn("in noticeLargeSettlementSuperDegrade not match send condition, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",  
1069 - uid, sesl, leftInWallet, threshold);  
1070 - return;  
1071 - }  
1072 - //短信  
1073 - String phone = userProxyService.getMobile(uid);  
1074 - if (StringUtils.isBlank(phone)){  
1075 - log.warn("in noticeLargeSettlementSuperDegrade sms fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold{}",  
1076 - uid, sesl, leftInWallet, threshold); 897 + default:
  898 + log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}", logPrefix, uid, sesl, leftInWallet, threshold);
1077 return; 899 return;
1078 } 900 }
1079 - List<String> mobileList = Arrays.asList(phone);  
1080 - String content = getReplacedContent(smsIBT.getContent(), threshold);  
1081 - sendSmsService.smsSendByMobile(content,mobileList);  
1082 - log.info("record noticeLargeSettlementSuperDegrade inbox sms msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",  
1083 - uid, sesl, leftInWallet, threshold);  
1084 - }); 901 + newNotice(uid)
  902 + .withLogPrefix(logPrefix)
  903 + .withSms(smsInboxBusinessTypeEnum, threshold)
  904 + .send();
1085 } catch (Exception e) { 905 } catch (Exception e) {
1086 - log.warn("InBoxFacade noticeLargeSettlementSuperDegrade error inbox msg, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}",  
1087 - uid, sesl, leftInWallet,threshold, e); 906 + log.warn("{} fail, uid {}, SuperEnterStageLevel {},leftInWallet {} threshold {}", logPrefix, uid, sesl, leftInWallet, threshold, e);
1088 } 907 }
1089 } 908 }
1090 909
@@ -1098,38 +917,32 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1098,38 +917,32 @@ public class InBoxFacade extends BaseNoticeFacade{
1098 sellerNoticeFacade.appraisePass(buyerUid, orderCode, sog); 917 sellerNoticeFacade.appraisePass(buyerUid, orderCode, sog);
1099 } 918 }
1100 919
1101 - // 召回的  
1102 - public void recallDepositnotify(int uid, SellerOrderGoods sog) { 920 + /**
  921 + * 召回寄存商品
  922 + */
  923 + public void recallDepositNotify(int uid, SellerOrderGoods sog) {
1103 if (null == sog) { 924 if (null == sog) {
1104 - log.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid); 925 + log.warn("notice user recall deposit goods fail, uid {}, sog is null", uid);
1105 return; 926 return;
1106 } 927 }
  928 + try {
1107 String prdName = sog.getProductName(); 929 String prdName = sog.getProductName();
1108 String sizeName = sog.getSizeName(); 930 String sizeName = sog.getSizeName();
1109 - try {  
1110 - executorService.execute(()->{ 931 + newNotice(uid)
  932 + .withLogPrefix("notice user recall deposit goods")
  933 + .withInBox(() -> {
1111 Product product = productMapper.selectByPrimaryKey(sog.getProductId()); 934 Product product = productMapper.selectByPrimaryKey(sog.getProductId());
1112 String productCode = product.getProductCode(); 935 String productCode = product.getProductCode();
1113 -  
1114 - InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;  
1115 - String paramsOfSeller = buildParams(prdName, sizeName,productCode);  
1116 - InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);  
1117 - InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);  
1118 - log.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",  
1119 - uid, sog, respOfSeller);  
1120 -  
1121 - String phone = userProxyService.getMobile(uid);  
1122 - if (StringUtils.isBlank(phone)){  
1123 - log.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);  
1124 - return;  
1125 - }  
1126 - List<String> mobileList = Arrays.asList(phone);  
1127 - String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);  
1128 - sendSmsService.smsSendByMobile(content,mobileList);  
1129 - log.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);  
1130 - }); 936 + return buildInboxContent(InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL, prdName, sizeName, productCode);
  937 + })
  938 + .withSms(() -> {
  939 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  940 + String productCode = product.getProductCode();
  941 + return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL, prdName, sizeName, productCode);
  942 + })
  943 + .send();
1131 } catch (Exception e) { 944 } catch (Exception e) {
1132 - log.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e); 945 + log.warn("notice user recall deposit goods fail, uid {}, sog {}", uid, sog, e);
1133 } 946 }
1134 } 947 }
1135 948
@@ -6,12 +6,17 @@ import com.yohoufo.dal.order.model.BuyerOrder; @@ -6,12 +6,17 @@ import com.yohoufo.dal.order.model.BuyerOrder;
6 import com.yohoufo.dal.order.model.SellerOrderGoods; 6 import com.yohoufo.dal.order.model.SellerOrderGoods;
7 import com.yohoufo.dal.product.ProductMapper; 7 import com.yohoufo.dal.product.ProductMapper;
8 import com.yohoufo.dal.product.model.Product; 8 import com.yohoufo.dal.product.model.Product;
  9 +import com.yohoufo.inboxclient.model.InBoxResponse;
  10 +import com.yohoufo.inboxclient.model.InboxReqVO;
9 import lombok.NonNull; 11 import lombok.NonNull;
10 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
  13 +import org.apache.commons.lang3.StringUtils;
11 import org.slf4j.Logger; 14 import org.slf4j.Logger;
12 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
14 17
  18 +import java.util.Arrays;
  19 +import java.util.List;
15 import java.util.Optional; 20 import java.util.Optional;
16 21
17 @Service 22 @Service
@@ -29,6 +34,31 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -29,6 +34,31 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
29 return log; 34 return log;
30 } 35 }
31 36
  37 + public void sendMsg4EntrySeller(Integer uid) {
  38 + String logPrefix = "notice user entry seller";
  39 + try {
  40 + newNotice(uid)
  41 + .withLogPrefix(logPrefix)
  42 + .withInBox(InboxBusinessTypeEnum.SYSTEM_ENTER_SETTLED)
  43 + .send();
  44 + } catch (Exception e) {
  45 + log.warn("{} fail, uid {}", logPrefix, uid, e);
  46 + }
  47 + }
  48 +
  49 + public void sendMsg4QuitEntrySeller(Integer uid) {
  50 + String logPrefix = "notice user quit entry seller";
  51 + try {
  52 + newNotice(uid)
  53 + .withLogPrefix(logPrefix)
  54 + .withInBox(InboxBusinessTypeEnum.SYSTEM_EXIT_SETTLED)
  55 + .withSms(InboxBusinessTypeEnum.SMS_EXIT_SETTLED)
  56 + .send();
  57 + } catch (Exception e) {
  58 + log.warn("{} fail, uid {}", logPrefix, uid, e);
  59 + }
  60 + }
  61 +
32 /** 62 /**
33 * 商品鉴定已通过 63 * 商品鉴定已通过
34 * 64 *
@@ -207,8 +237,64 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -207,8 +237,64 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
207 } 237 }
208 } 238 }
209 239
210 - public void noticeSellerWhenPlatformOffShelve(SellerOrderGoods psog){ 240 + public void noticeSellerWhenPlatformOffShelve(SellerOrderGoods psog) {
211 241
212 } 242 }
213 243
  244 + /**
  245 + * 鉴定中心无法鉴定商品
  246 + *
  247 + * @param sog
  248 + * @param orderCode
  249 + */
  250 + public void appraiseUnsure(SellerOrderGoods sog, long orderCode) {
  251 + String logPrefix = "notice seller appraise unsure";
  252 + Integer sellerUid = sog.getUid();
  253 + String prdName = sog.getProductName();
  254 + String sizeName = sog.getSizeName();
  255 + String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
  256 + try {
  257 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  258 + String productCode = product.getProductCode();
  259 + newNotice(sellerUid)
  260 + .withLogPrefix(logPrefix)
  261 + .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_UNSURE, goodsTypeTag, prdName, sizeName, productCode)
  262 + .withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_UNSURE, goodsTypeTag, prdName, sizeName, productCode, orderCode)
  263 + .send();
  264 + } catch (Exception e) {
  265 + log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
  266 + }
  267 + }
  268 +
  269 + public void sellerDeliverWithTimes(SellerOrderGoods sog, long orderCode, int times, int leftTime, String timeUnit) {
  270 + String logPrefix = "notice seller seller deliver";
  271 + Integer sellerUid = sog.getUid();
  272 + String prdName = sog.getProductName();
  273 + String sizeName = sog.getSizeName();
  274 + String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
  275 + try {
  276 + if (times == 2) {
  277 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  278 + String productCode = product.getProductCode();
  279 + newNotice(sellerUid)
  280 + .withLogPrefix(logPrefix)
  281 + .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS, goodsTypeTag, prdName, sizeName, productCode, leftTime, timeUnit)
  282 + .withSms(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND, goodsTypeTag, prdName, sizeName, productCode, leftTime, timeUnit, orderCode)
  283 + .send();
  284 + } else if (times == 3) {
  285 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  286 + String productCode = product.getProductCode();
  287 + newNotice(sellerUid)
  288 + .withLogPrefix(logPrefix)
  289 + .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS_FAIL, goodsTypeTag, prdName, sizeName, productCode)
  290 + .withSms(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED, goodsTypeTag, prdName, sizeName, productCode, orderCode)
  291 + .send();
  292 + } else {
  293 + log.warn("{} fail, sellerUid {} orderCode {} unknown times {}", logPrefix, sellerUid, orderCode, times);
  294 + }
  295 + } catch (Exception e) {
  296 + log.warn("{} fail, sellerUid {} orderCode {} times {} ", logPrefix, sellerUid, orderCode, times, e);
  297 + }
  298 + }
  299 +
214 } 300 }
@@ -22,7 +22,7 @@ import com.yohoufo.order.model.dto.PreSaleOrderConfig; @@ -22,7 +22,7 @@ import com.yohoufo.order.model.dto.PreSaleOrderConfig;
22 import com.yohoufo.order.service.cache.OrderCacheService; 22 import com.yohoufo.order.service.cache.OrderCacheService;
23 import com.yohoufo.order.service.impl.BuyerOrderCancelService; 23 import com.yohoufo.order.service.impl.BuyerOrderCancelService;
24 import com.yohoufo.order.service.impl.MetaConfigService; 24 import com.yohoufo.order.service.impl.MetaConfigService;
25 -import com.yohoufo.order.service.proxy.InBoxFacade; 25 +import com.yohoufo.order.service.proxy.SellerNoticeFacade;
26 import com.yohoufo.order.utils.LoggerUtils; 26 import com.yohoufo.order.utils.LoggerUtils;
27 import com.yohoufo.order.utils.TimeUtils; 27 import com.yohoufo.order.utils.TimeUtils;
28 import lombok.Builder; 28 import lombok.Builder;
@@ -65,7 +65,7 @@ public class PreSaleOrderJob implements YhJob { @@ -65,7 +65,7 @@ public class PreSaleOrderJob implements YhJob {
65 private BuyerOrderGoodsMapper buyerOrderGoodsMapper; 65 private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
66 66
67 @Autowired 67 @Autowired
68 - private InBoxFacade inBoxFacade; 68 + private SellerNoticeFacade sellerNoticeFacade;
69 69
70 @Autowired 70 @Autowired
71 private MetaConfigService metaConfigService; 71 private MetaConfigService metaConfigService;
@@ -137,7 +137,7 @@ public class PreSaleOrderJob implements YhJob { @@ -137,7 +137,7 @@ public class PreSaleOrderJob implements YhJob {
137 int leftHours = node.days * 24 + node.hours + node.minutes/30; 137 int leftHours = node.days * 24 + node.hours + node.minutes/30;
138 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); 138 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
139 SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup()); 139 SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup());
140 - inBoxFacade.sellerDeliverNotice(sog, orderCode, 2, leftHours, DateUtil.UNIT_HOURS); 140 + sellerNoticeFacade.sellerDeliverWithTimes(sog, orderCode, 2, leftHours, DateUtil.UNIT_HOURS);
141 times = 1; 141 times = 1;
142 orderCacheService.cacheOrderDeliverNoticeTimes(orderCode, nowDateStr, times, CACHE_EXPIRED_TIME); 142 orderCacheService.cacheOrderDeliverNoticeTimes(orderCode, nowDateStr, times, CACHE_EXPIRED_TIME);
143 }else{ 143 }else{