Authored by qinchao

发消息

... ... @@ -441,7 +441,9 @@ public class AppraiseService {
//记录操作记录
orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_PASS);
//TODO 发消息
//TODO 发消息 瑕疵接收,只给卖家发消息
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}else{
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ... @@ -1182,8 +1184,9 @@ public class AppraiseService {
LOGGER.info("in judgeCenterPass record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
//TODO 鉴定通过,等待发货,消息
//inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
//TODO 鉴定通过,
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}catch (Exception ex){
LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "后台鉴定通过商品,订单"+ orderCode + "退还保证金失败";
... ... @@ -1346,7 +1349,8 @@ public class AppraiseService {
//平台已发货给买家
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods,product);
inBoxFacade.appraisePassNoticeBuyer(buyerUid, orderCode, sellerOrderGoods,product);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}catch (Exception ex){
LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败";
... ...
... ... @@ -183,7 +183,7 @@ public class InBoxFacade {
*
* @return
*/
public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
executorService.execute(()->{
... ... @@ -191,6 +191,7 @@ public class InBoxFacade {
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);
... ... @@ -200,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();
... ... @@ -208,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,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 {}",
logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
buyerUid, orderCode, psog, e);
}
});
... ...