Authored by chenchao

change inbox msg

1 package com.yohoufo.order.event; 1 package com.yohoufo.order.event;
2 2
3 import com.yohoufo.common.alarm.Event; 3 import com.yohoufo.common.alarm.Event;
  4 +import com.yohoufo.dal.order.model.SellerOrderGoods;
4 import lombok.AllArgsConstructor; 5 import lombok.AllArgsConstructor;
5 import lombok.Data; 6 import lombok.Data;
6 import lombok.NoArgsConstructor; 7 import lombok.NoArgsConstructor;
@@ -22,5 +23,7 @@ public class DeliverNoticeEvent extends Event{ @@ -22,5 +23,7 @@ public class DeliverNoticeEvent extends Event{
22 23
23 private String prdName; 24 private String prdName;
24 25
  26 + private SellerOrderGoods sellerOrderGoods;
  27 +
25 private long orderCode; 28 private long orderCode;
26 } 29 }
1 package com.yohoufo.order.event; 1 package com.yohoufo.order.event;
2 2
3 import com.yohoufo.common.alarm.Event; 3 import com.yohoufo.common.alarm.Event;
  4 +import com.yohoufo.dal.order.model.SellerOrderGoods;
4 import lombok.AllArgsConstructor; 5 import lombok.AllArgsConstructor;
5 import lombok.Data; 6 import lombok.Data;
6 import lombok.NoArgsConstructor; 7 import lombok.NoArgsConstructor;
@@ -24,4 +25,6 @@ public class SellerCancelDeliverEvent extends Event { @@ -24,4 +25,6 @@ public class SellerCancelDeliverEvent extends Event {
24 private String productName; 25 private String productName;
25 26
26 private long orderCode; 27 private long orderCode;
  28 +
  29 + private SellerOrderGoods sellerOrderGoods;
27 } 30 }
@@ -48,7 +48,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer { @@ -48,7 +48,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
48 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(orderCode, buyerUid); 48 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(orderCode, buyerUid);
49 if(OrderStatus.HAS_PAYED.getCode() == buyerOrder.getStatus().intValue()){ 49 if(OrderStatus.HAS_PAYED.getCode() == buyerOrder.getStatus().intValue()){
50 LOGGER.info("ready notice sellerDeliverNotice, msg {}", msg); 50 LOGGER.info("ready notice sellerDeliverNotice, msg {}", msg);
51 - inBoxFacade.sellerDeliverNotice(msg.getSellerUid(), msg.getPrdName(), 2); 51 + inBoxFacade.sellerDeliverNotice(msg.getSellerOrderGoods(), 2);
52 } 52 }
53 53
54 54
@@ -91,7 +91,7 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { @@ -91,7 +91,7 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer {
91 try{ 91 try{
92 payRefundService.refund(req, bleb); 92 payRefundService.refund(req, bleb);
93 // 93 //
94 - inBoxFacade.sellerDeliverNotice(event.getSellerUid(), event.getProductName(), 3); 94 + inBoxFacade.sellerDeliverNotice(event.getSellerOrderGoods(), 3);
95 }catch (Exception ex){ 95 }catch (Exception ex){
96 logger.warn("in topic {} , refund fail,req {}", getMessageTopic(), req, ex); 96 logger.warn("in topic {} , refund fail,req {}", getMessageTopic(), req, ex);
97 BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode()) 97 BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode())
@@ -89,14 +89,16 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -89,14 +89,16 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
89 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); 89 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
90 int skup = buyerOrderGoods.getSkup(); 90 int skup = buyerOrderGoods.getSkup();
91 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); 91 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
92 - inBoxFacade.sellerSkupPaidByBuyer(sellerUid, sellerOrderGoods.getProductName()); 92 + inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods);
93 93
94 DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId()) 94 DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId())
  95 + .sellerOrderGoods(sellerOrderGoods)
95 .sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build(); 96 .sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build();
96 EventBusPublisher.publishEvent(deliverNoticeEvent); 97 EventBusPublisher.publishEvent(deliverNoticeEvent);
97 98
98 //卖家36小时不发货取消 99 //卖家36小时不发货取消
99 SellerCancelDeliverEvent event = SellerCancelDeliverEvent.builder() 100 SellerCancelDeliverEvent event = SellerCancelDeliverEvent.builder()
  101 + .sellerOrderGoods(sellerOrderGoods)
100 .productName(sellerOrderGoods.getProductName()) 102 .productName(sellerOrderGoods.getProductName())
101 .uid(uid).sellerUid(sellerUid).skup(sellerOrderGoods.getId()) 103 .uid(uid).sellerUid(sellerUid).skup(sellerOrderGoods.getId())
102 .orderCode(orderInfo.getOrderCode()).build(); 104 .orderCode(orderInfo.getOrderCode()).build();
@@ -417,7 +417,7 @@ public class SellerOrderCancelService { @@ -417,7 +417,7 @@ public class SellerOrderCancelService {
417 417
418 //异步 418 //异步
419 inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog.getProductName()); 419 inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog.getProductName());
420 - inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName()); 420 + inBoxFacade.sellerCancelAfterBuyerPaid( psog);
421 }catch (Exception ex){ 421 }catch (Exception ex){
422 logger.warn("in cancelAfterPayExistBuyAction , refund fail,req {}", refundReq, ex); 422 logger.warn("in cancelAfterPayExistBuyAction , refund fail,req {}", refundReq, ex);
423 BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode()) 423 BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode())
@@ -380,33 +380,29 @@ public class InBoxFacade { @@ -380,33 +380,29 @@ public class InBoxFacade {
380 /** 380 /**
381 * 卖家发货提醒,买家支付购买后 381 * 卖家发货提醒,买家支付购买后
382 * 382 *
383 - * @param sellerUid  
384 - * @param prdName 383 + * @param sog SellerOrderGoods
385 */ 384 */
386 - public void sellerSkupPaidByBuyer(int sellerUid, String prdName) { 385 + public void sellerSkupPaidByBuyer(SellerOrderGoods sog) {
  386 + int sellerUid = sog.getUid();
  387 + String prdName = sog.getProductName();
  388 + String sizeName = sog.getSizeName();
387 try { 389 try {
388 executorService.execute(() -> { 390 executorService.execute(() -> {
389 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND; 391 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND;
390 - String params = buildParams(prdName); 392 + String params = buildParams(prdName, sizeName);
391 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt); 393 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
392 394
393 InBoxResponse resp = inBoxSDK.addInbox(req); 395 InBoxResponse resp = inBoxSDK.addInbox(req);
394 - logger.info("record sellerSkupPaidByBuyer inbox msg, sellerUid {}, prdName {}, resp {}",  
395 - sellerUid, prdName, resp); 396 + logger.info("record sellerSkupPaidByBuyer inbox msg, sellerUid {}, prdName {}, sizeName {},resp {}",
  397 + sellerUid, prdName, sizeName, resp);
396 398
397 //短信 399 //短信
398 - /*InboxBusinessTypeEnum smsIbt = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND;  
399 - String smsparams = buildParams(prdName);  
400 - InboxReqVO smsIbtReq = buildInboxReqVO(sellerUid, smsparams, smsIbt);  
401 - InBoxResponse smsresp = inBoxSDK.addInbox(smsIbtReq);*/  
402 String phone = userProxyService.getMobile(sellerUid); 400 String phone = userProxyService.getMobile(sellerUid);
403 if (StringUtils.isBlank(phone)){ 401 if (StringUtils.isBlank(phone)){
404 logger.warn("sellerSkupPaidByBuyer sms send fail,sellerUid {}, prdName {}", sellerUid, prdName); 402 logger.warn("sellerSkupPaidByBuyer sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
405 return; 403 return;
406 } 404 }
407 List<String> mobileList = Arrays.asList(phone); 405 List<String> mobileList = Arrays.asList(phone);
408 - //SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND;  
409 - //String content = smsIbt.getReplacedContent(prdName);  
410 String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName); 406 String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName);
411 sendSmsService.smsSendByMobile(content, mobileList); 407 sendSmsService.smsSendByMobile(content, mobileList);
412 logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {}", 408 logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {}",
@@ -422,14 +418,17 @@ public class InBoxFacade { @@ -422,14 +418,17 @@ public class InBoxFacade {
422 /** 418 /**
423 * 交易关闭:买家支付完成,卖家取消 419 * 交易关闭:买家支付完成,卖家取消
424 * 420 *
425 - * @param sellerUid  
426 - * @param prdName 421 + * @param sog
427 */ 422 */
428 - public void sellerCancelAfterBuyerPaid(int sellerUid, String prdName) { 423 + public void sellerCancelAfterBuyerPaid(SellerOrderGoods sog) {
  424 + int sellerUid = sog.getUid();
  425 + String prdName = sog.getProductName();
  426 + String sizeName = sog.getSizeName();
429 try { 427 try {
  428 +
430 executorService.execute(() -> { 429 executorService.execute(() -> {
431 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_CLOSED_SELLER; 430 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_CLOSED_SELLER;
432 - String params = buildParams(prdName); 431 + String params = buildParams(prdName, sizeName);
433 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt); 432 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
434 433
435 InBoxResponse resp = inBoxSDK.addInbox(req); 434 InBoxResponse resp = inBoxSDK.addInbox(req);
@@ -636,11 +635,22 @@ public class InBoxFacade { @@ -636,11 +635,22 @@ public class InBoxFacade {
636 } 635 }
637 } 636 }
638 637
639 - public void sellerDeliverNotice(int sellerUid, String prdName, int times) { 638 + public void sellerDeliverNotice(SellerOrderGoods sog, int times) {
  639 + int sellerUid = sog.getUid();
  640 + String prdName = sog.getProductName();
  641 + String sizeName = sog.getSizeName();
640 try { 642 try {
641 executorService.execute(() -> { 643 executorService.execute(() -> {
642 logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {}", 644 logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {}",
643 sellerUid, prdName, times); 645 sellerUid, prdName, times);
  646 + if (times == 2) {
  647 + InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS;
  648 + String params = buildParams(sizeName, sizeName);
  649 + InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
  650 + InBoxResponse resp = inBoxSDK.addInbox(req);
  651 + logger.info("record sellerDeliverNotice inbox msg,sellerUid {}, prdName {},sizeName {} times {},resp {}",
  652 + sellerUid, prdName, sizeName, times, resp);
  653 + }
644 654
645 String phone = userProxyService.getMobile(sellerUid); 655 String phone = userProxyService.getMobile(sellerUid);
646 if (StringUtils.isBlank(phone)){ 656 if (StringUtils.isBlank(phone)){
@@ -651,8 +661,7 @@ public class InBoxFacade { @@ -651,8 +661,7 @@ public class InBoxFacade {
651 List<String> mobileList = Arrays.asList(phone); 661 List<String> mobileList = Arrays.asList(phone);
652 if (times == 2) { 662 if (times == 2) {
653 663
654 - //SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND_SECOND;  
655 - //String content = smsIbt.getReplacedContent(prdName); 664 +
656 String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName); 665 String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName);
657 666
658 sendSmsService.smsSendByMobile(content, mobileList); 667 sendSmsService.smsSendByMobile(content, mobileList);