...
|
...
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.dal.product.model.Product;
|
|
|
import com.yohoufo.inboxclient.model.InBoxResponse;
|
|
|
import com.yohoufo.inboxclient.model.InboxReqVO;
|
|
|
import com.yohoufo.inboxclient.sdk.InBoxSDK;
|
...
|
...
|
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
...
|
...
|
@@ -129,18 +131,68 @@ public class InBoxFacade { |
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平台发货给买家
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public void noticeBuyerWhenDeliveryGoodsToBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
|
|
|
|
|
|
executorService.execute(()->{
|
|
|
|
|
|
try {
|
|
|
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
|
|
|
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
|
|
|
|
|
|
String prdName = psog.getProductName();
|
|
|
String sizeName = psog.getSizeName();
|
|
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
|
|
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
|
|
|
buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
|
|
|
|
|
|
//seller notice
|
|
|
|
|
|
|
|
|
//短信
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("in noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName,sizeName,productCode,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
buyerUid, orderCode,prdName, phone);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade noticeBuyerWhenDeliveryGoodsToBuyer error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
buyerUid, orderCode, psog, e);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平台已发货给买家
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
|
|
|
|
|
|
executorService.execute(()->{
|
|
|
|
|
|
try {
|
|
|
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
|
|
|
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
|
|
|
String prdName = psog.getProductName();
|
|
|
String sizeName = psog.getSizeName();
|
|
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
...
|
...
|
@@ -149,6 +201,35 @@ public class InBoxFacade { |
|
|
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
|
|
|
buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
|
|
|
|
|
|
//短信
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("in appraisePassNotice notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName,sizeName,productCode,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
logger.info("record appraisePassNotice notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
buyerUid, orderCode,prdName, phone);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade appraisePassNotice error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
buyerUid, orderCode, psog, e);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
|
|
|
|
|
|
executorService.execute(()->{
|
|
|
|
|
|
try {
|
|
|
logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
|
|
|
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
|
|
|
String prdName = psog.getProductName();
|
|
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
|
|
|
|
|
//seller notice
|
|
|
String sizeName = psog.getSizeName();
|
|
|
Integer sellerUid = psog.getUid();
|
...
|
...
|
@@ -157,32 +238,21 @@ public class InBoxFacade { |
|
|
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
|
|
|
|
|
|
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
|
|
|
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
|
|
|
logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
|
|
|
buyerUid, orderCode, prdName,sizeName, respOfSeller);
|
|
|
String phoneOfSeller = userProxyService.getMobile(sellerUid);
|
|
|
if (StringUtils.isBlank(phoneOfSeller)){
|
|
|
logger.warn("in appraisePassNotice sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
logger.warn("in appraisePassNoticeSeller sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phoneOfSeller);
|
|
|
String contentOfSeller = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS.getContent(), orderCode);
|
|
|
sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
|
|
|
logger.info("record appraisePassNotice sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
|
|
|
logger.info("record appraisePassNoticeSeller sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
|
|
|
sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
|
|
|
}
|
|
|
|
|
|
//短信
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("in appraisePassNotice notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
logger.info("record appraisePassNotice notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
buyerUid, orderCode,prdName, phone);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade appraisePassNotice error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
buyerUid, orderCode, psog, e);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -349,33 +419,39 @@ public class InBoxFacade { |
|
|
/**
|
|
|
* 瑕疵提醒,给买家消息
|
|
|
*/
|
|
|
public void buyerMiniFaultCreate(int buyerUid, long orderCode,String prdName) {
|
|
|
public void buyerMiniFaultCreate(int buyerUid, long orderCode,SellerOrderGoods psog,Product product) {
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
logger.info("record buyerMiniFaultCreate inbox enter, buyerUid {} ,orderCode {} ,psog {},product {}",
|
|
|
buyerUid, orderCode ,psog, JSON.toJSONString(product));
|
|
|
String prdName = psog.getProductName();
|
|
|
String sizeName = psog.getSizeName();
|
|
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
|
|
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_PROBLEM_ORDER;
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record buyerMiniFaultCreate inbox msg, buyerUid {} ,orderCode {} ,prdName {},resp {}",
|
|
|
buyerUid, orderCode ,prdName,resp);
|
|
|
logger.info("record buyerMiniFaultCreate inbox msg, buyerUid {} ,orderCode {} ,psog {},product {},resp {}",
|
|
|
buyerUid, orderCode ,psog,JSON.toJSONString(product),resp);
|
|
|
|
|
|
//短信
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {},prdName {}", buyerUid, orderCode,prdName);
|
|
|
logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {},psog {},product {}", buyerUid, orderCode,psog,JSON.toJSONString(product));
|
|
|
return;
|
|
|
}
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),prdName,orderCode);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),prdName,sizeName,productCode,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content, mobileList);
|
|
|
logger.info("record buyerMiniFaultCreate inbox sms msg,buyerUid {}, orderCode {},prdName {}",
|
|
|
buyerUid ,orderCode,prdName);
|
|
|
});
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {},prdName {} ",
|
|
|
buyerUid, orderCode,prdName , e);
|
|
|
logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {},psog {},product {} ",
|
|
|
buyerUid, orderCode,psog ,JSON.toJSONString(product), e);
|
|
|
}
|
|
|
}
|
|
|
/**
|
...
|
...
|
@@ -404,6 +480,9 @@ public class InBoxFacade { |
|
|
}
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
InboxBusinessTypeEnum sms = InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT;
|
|
|
if(outTimeFlag){
|
|
|
sms = InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT_OUT_TIME;
|
|
|
}
|
|
|
String content = getReplacedContent(sms.getContent(),prdName,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content, mobileList);
|
|
|
logger.info("record buyerQualityCheckNotPass inbox sms msg,buyerUid {}, prdName {},orderCode {}",
|
...
|
...
|
|