Authored by wujiexiang

Merge branch 'dev-detectnotpass' into hotfix-20190826

@@ -637,8 +637,9 @@ public class AppraiseService { @@ -637,8 +637,9 @@ public class AppraiseService {
637 throw new ServiceException(ServiceError.ORDER_NULL); 637 throw new ServiceException(ServiceError.ORDER_NULL);
638 } 638 }
639 639
  640 + Integer oldBuyerOrderStatus = buyerOrder.getStatus();
640 Set<Integer> expectStatus = Sets.newHashSet(OrderStatus.PLATFORM_APPRAISE_UNSURE.getCode(), OrderStatus.PLATFORM_DETECTION_NOT_PASS.getCode()); 641 Set<Integer> expectStatus = Sets.newHashSet(OrderStatus.PLATFORM_APPRAISE_UNSURE.getCode(), OrderStatus.PLATFORM_DETECTION_NOT_PASS.getCode());
641 - if (!expectStatus.contains(buyerOrder.getStatus())) { 642 + if (!expectStatus.contains(oldBuyerOrderStatus)) {
642 LOGGER.warn("returnBackOrderCauseOfUnsure expectStatus {}, actual status {}, orderCode {}", expectStatus, 643 LOGGER.warn("returnBackOrderCauseOfUnsure expectStatus {}, actual status {}, orderCode {}", expectStatus,
643 buyerOrder.getStatus(), orderCode); 644 buyerOrder.getStatus(), orderCode);
644 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); 645 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
@@ -657,8 +658,13 @@ public class AppraiseService { @@ -657,8 +658,13 @@ public class AppraiseService {
657 //发送消息 658 //发送消息
658 //清缓存 659 //清缓存
659 SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid()); 660 SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid());
  661 + if (oldBuyerOrderStatus == OrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()) {
  662 + //无法鉴定
660 inBoxFacade.sellerAppraiseUnsure_send_back(sellerOrderGoods, orderCode, wayBillCode); 663 inBoxFacade.sellerAppraiseUnsure_send_back(sellerOrderGoods, orderCode, wayBillCode);
661 - 664 + } else if (oldBuyerOrderStatus == OrderStatus.PLATFORM_DETECTION_NOT_PASS.getCode()) {
  665 + //检测不通过
  666 + inBoxFacade.sellerDetectionNotPass_send_back(sellerOrderGoods, orderCode, wayBillCode);
  667 + }
662 return apiResponse; 668 return apiResponse;
663 } 669 }
664 670
@@ -711,6 +711,47 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -711,6 +711,47 @@ public class InBoxFacade extends BaseNoticeFacade{
711 } 711 }
712 } 712 }
713 713
  714 + /**
  715 + * 检测不通过寄回,给卖家消息
  716 + */
  717 + public void sellerDetectionNotPass_send_back(SellerOrderGoods sog,long orderCode,String wayBillCode) {
  718 + Integer sellerUid = sog.getUid();
  719 + String prdName = sog.getProductName();
  720 + String sizeName = sog.getSizeName();
  721 + String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
  722 + try {
  723 + executorService.execute(() -> {
  724 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  725 + String productCode = product.getProductCode();
  726 + InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_DETECTION_NOT_PASS_SEND_BACK;
  727 + String params = buildParams(goodsTypeTag,prdName, sizeName,productCode);
  728 + InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
  729 +
  730 + InBoxResponse resp = inBoxSDK.addInbox(req);
  731 + log.info("record sellerDetectionNotPass_send_back inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {}, resp {}",
  732 + JSON.toJSONString(sog),sellerUid, prdName, sizeName , resp);
  733 +
  734 + //短信
  735 + String phone = userProxyService.getMobile(sellerUid);
  736 + if (StringUtils.isBlank(phone)){
  737 + log.warn("sellerDetectionNotPass_send_back sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
  738 + return;
  739 + }
  740 + List<String> mobileList = Arrays.asList(phone);
  741 + InboxBusinessTypeEnum sms = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_DETECTION_NOT_PASS_SEND_BACK;
  742 +
  743 + String content = getReplacedContent(sms.getContent(),goodsTypeTag,prdName,sizeName,productCode,orderCode,wayBillCode);
  744 + sendSmsService.smsSendByMobile(content, mobileList);
  745 + log.info("record sellerDetectionNotPass_send_back inbox sms msg,sellerUid {}, prdName {},orderCode {}",
  746 + sellerUid, prdName,orderCode);
  747 + });
  748 +
  749 + } catch (Exception e) {
  750 + log.warn("InBoxFacade sellerAppraiseUnsure_send_back error inbox msg, sellerUid {}, prdName {} ",
  751 + sellerUid, prdName, e);
  752 + }
  753 + }
  754 +
714 public void noticeSellerOfSellerShamSendOut(SellerOrderGoods sog,long orderCode){ 755 public void noticeSellerOfSellerShamSendOut(SellerOrderGoods sog,long orderCode){
715 Integer sellerUid = sog.getUid(); 756 Integer sellerUid = sog.getUid();
716 String prdName = sog.getProductName(); 757 String prdName = sog.getProductName();