Authored by qinchao

消息发送

@@ -521,8 +521,15 @@ public class AppraiseService { @@ -521,8 +521,15 @@ public class AppraiseService {
521 orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode()); 521 orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode());
522 522
523 //TODO 消息 523 //TODO 消息
524 - inBoxFacade.noticeSellerWhenAppraiseFail(sellerOrderGoods, orderCode, wayBillCode);  
525 - inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName()); 524 + if(type == 1){
  525 + //鉴定不通过 ,其余的情况不发消息,改成寄回的时候再发消息
  526 + inBoxFacade.noticeSellerWhenAppraiseFail(sellerOrderGoods, orderCode, wayBillCode);
  527 + inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName());
  528 + }else if(type==3 || type == 4){
  529 + //瑕疵不接受(用户不接受和超时不接受),只给买家发消息
  530 + inBoxFacade.buyerMiniFaultUnAccept(buyerUid,buyerOrder.getOrderCode(), sellerOrderGoods.getProductName());
  531 + }
  532 +
526 }catch(Exception ex) { 533 }catch(Exception ex) {
527 LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex); 534 LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
528 }finally { 535 }finally {
@@ -853,6 +853,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -853,6 +853,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
853 logger.info("in miniFaultCreate, push event uid {} ,order code {} ", miniFaultOuterTimeEvent.getUid(),miniFaultOuterTimeEvent.getOrderCode()); 853 logger.info("in miniFaultCreate, push event uid {} ,order code {} ", miniFaultOuterTimeEvent.getUid(),miniFaultOuterTimeEvent.getOrderCode());
854 EventBusPublisher.publishEvent(miniFaultOuterTimeEvent); 854 EventBusPublisher.publishEvent(miniFaultOuterTimeEvent);
855 855
  856 + //消息
  857 + inBoxFacade.buyerMiniFaultCreate(uid,orderCode);
  858 +
856 cleanCacheAfterUpdateStatus(orderCode,uid,sellerUid); 859 cleanCacheAfterUpdateStatus(orderCode,uid,sellerUid);
857 } 860 }
858 861
@@ -307,6 +307,72 @@ public class InBoxFacade { @@ -307,6 +307,72 @@ public class InBoxFacade {
307 } 307 }
308 } 308 }
309 309
  310 + /**
  311 + * 瑕疵提醒,给买家消息
  312 + */
  313 + public void buyerMiniFaultCreate(int buyerUid, long orderCode) {
  314 + try {
  315 + executorService.execute(() -> {
  316 + InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_PROBLEM_ORDER;
  317 + String params = buildParams(orderCode);
  318 + InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
  319 +
  320 + InBoxResponse resp = inBoxSDK.addInbox(req);
  321 + logger.info("record buyerMiniFaultCreate inbox msg, buyerUid {} ,orderCode {} ,resp {}",
  322 + buyerUid, orderCode ,resp);
  323 +
  324 + //短信
  325 + String phone = userProxyService.getMobile(buyerUid);
  326 + if (StringUtils.isBlank(phone)){
  327 + logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {}", buyerUid, orderCode);
  328 + return;
  329 + }
  330 + List<String> mobileList = Arrays.asList(phone);
  331 + String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),orderCode);
  332 + sendSmsService.smsSendByMobile(content, mobileList);
  333 + logger.info("record buyerMiniFaultCreate inbox sms msg,buyerUid {}, porderCode {}",
  334 + buyerUid ,orderCode);
  335 + });
  336 +
  337 + } catch (Exception e) {
  338 + logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {} ",
  339 + buyerUid, orderCode , e);
  340 + }
  341 + }
  342 + /**
  343 + * 不接受瑕疵,给买家消息
  344 + */
  345 + public void buyerMiniFaultUnAccept(int buyerUid, long orderCode,String prdName) {
  346 +
  347 + try {
  348 + executorService.execute(() -> {
  349 + InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT;
  350 + String params = buildParams(orderCode);
  351 + InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
  352 +
  353 + InBoxResponse resp = inBoxSDK.addInbox(req);
  354 + logger.info("record buyerQualityCheckNotPass inbox msg, buyerUid {} ,orderCode {},prdName {} ,resp {}",
  355 + buyerUid, orderCode, prdName ,resp);
  356 +
  357 + //短信
  358 + String phone = userProxyService.getMobile(buyerUid);
  359 + if (StringUtils.isBlank(phone)){
  360 + logger.warn("buyerQualityCheckNotPass sms send fail,buyerUid {} ,orderCode {}", buyerUid, orderCode);
  361 + return;
  362 + }
  363 + List<String> mobileList = Arrays.asList(phone);
  364 + String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT.getContent(),prdName,orderCode);
  365 + sendSmsService.smsSendByMobile(content, mobileList);
  366 + logger.info("record buyerQualityCheckNotPass inbox sms msg,buyerUid {}, prdName {},orderCode {}",
  367 + buyerUid , prdName,orderCode);
  368 + });
  369 +
  370 + } catch (Exception e) {
  371 + logger.warn("InBoxFacade sellerSkupPaidByBuyer error inbox msg, buyerUid {},orderCode {}, prdName {} ",
  372 + buyerUid, orderCode ,prdName, e);
  373 + }
  374 + }
  375 +
310 /********************************************************************* 376 /*********************************************************************
311 * 卖家消息 377 * 卖家消息
312 ********************************************************************/ 378 ********************************************************************/
@@ -403,6 +469,43 @@ public class InBoxFacade { @@ -403,6 +469,43 @@ public class InBoxFacade {
403 } 469 }
404 470
405 /** 471 /**
  472 + * 质检不通过,给卖家消息
  473 + */
  474 + public void sellerQualityCheckNotPass(SellerOrderGoods sog,long orderCode,String wayBillCode) {
  475 + Integer sellerUid = sog.getUid();
  476 + String prdName = sog.getProductName();
  477 + String sizeName = sog.getSizeName();
  478 + try {
  479 + executorService.execute(() -> {
  480 + InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_QUALITY_CHECK_REJECT;
  481 + String params = buildParams(prdName, sizeName);
  482 + InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
  483 +
  484 + InBoxResponse resp = inBoxSDK.addInbox(req);
  485 + logger.info("record sellerQualityCheckNotPass inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {},resp {}",
  486 + JSON.toJSONString(sog),sellerUid, prdName, sizeName, resp);
  487 +
  488 + //短信
  489 + String phone = userProxyService.getMobile(sellerUid);
  490 + if (StringUtils.isBlank(phone)){
  491 + logger.warn("sellerQualityCheckNotPass sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
  492 + return;
  493 + }
  494 + List<String> mobileList = Arrays.asList(phone);
  495 + String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_QUALITY_CHECK_REJECT.getContent(),prdName,orderCode,wayBillCode);
  496 + sendSmsService.smsSendByMobile(content, mobileList);
  497 + logger.info("record sellerQualityCheckNotPass inbox sms msg,sellerUid {}, prdName {},orderCode {}",
  498 + sellerUid, prdName,orderCode);
  499 + });
  500 +
  501 + } catch (Exception e) {
  502 + logger.warn("InBoxFacade sellerSkupPaidByBuyer error inbox msg, sellerUid {}, prdName {} ",
  503 + sellerUid, prdName, e);
  504 + }
  505 + }
  506 +
  507 +
  508 + /**
406 * 卖家发货提醒,买家支付购买后 509 * 卖家发货提醒,买家支付购买后
407 * 510 *
408 * @param sog SellerOrderGoods 511 * @param sog SellerOrderGoods