Authored by tanling

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10

@@ -7,7 +7,6 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; @@ -7,7 +7,6 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo;
7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
8 import com.yohobuy.ufo.model.order.common.OrderAttributes; 8 import com.yohobuy.ufo.model.order.common.OrderAttributes;
9 import com.yohobuy.ufo.model.order.common.OrderCodeType; 9 import com.yohobuy.ufo.model.order.common.OrderCodeType;
10 -import com.yohoufo.common.alarm.EventBusPublisher;  
11 import com.yohoufo.common.exception.UfoServiceException; 10 import com.yohoufo.common.exception.UfoServiceException;
12 import com.yohoufo.common.utils.DateUtil; 11 import com.yohoufo.common.utils.DateUtil;
13 import com.yohoufo.dal.order.AppraiseOrderMapper; 12 import com.yohoufo.dal.order.AppraiseOrderMapper;
@@ -15,11 +14,10 @@ import com.yohoufo.dal.order.AppraiseOrderMetaMapper; @@ -15,11 +14,10 @@ import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
15 import com.yohoufo.dal.order.model.AppraiseOrder; 14 import com.yohoufo.dal.order.model.AppraiseOrder;
16 import com.yohoufo.dal.order.model.AppraiseOrderMeta; 15 import com.yohoufo.dal.order.model.AppraiseOrderMeta;
17 import com.yohoufo.order.constants.MetaKey; 16 import com.yohoufo.order.constants.MetaKey;
18 -import com.yohoufo.order.event.EventHandlerContainer;  
19 -import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent;  
20 import com.yohoufo.order.model.request.PaymentRequest; 17 import com.yohoufo.order.model.request.PaymentRequest;
21 import com.yohoufo.order.model.response.PrepayResponse; 18 import com.yohoufo.order.model.response.PrepayResponse;
22 import com.yohoufo.order.mq.DelayTime; 19 import com.yohoufo.order.mq.DelayTime;
  20 +import com.yohoufo.order.service.impl.AppraiseOrderService;
23 import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService; 21 import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
24 import org.slf4j.Logger; 22 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory; 23 import org.slf4j.LoggerFactory;
@@ -42,6 +40,9 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { @@ -42,6 +40,9 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService {
42 @Autowired 40 @Autowired
43 private SellerDepositOrderService sellerDepositOrderService; 41 private SellerDepositOrderService sellerDepositOrderService;
44 42
  43 + @Autowired
  44 + private AppraiseOrderService appraiseOrderService;
  45 +
45 @Override 46 @Override
46 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) { 47 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
47 if (orderInfo.getStatus() != null 48 if (orderInfo.getStatus() != null
@@ -171,14 +172,10 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { @@ -171,14 +172,10 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService {
171 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); 172 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes());
172 switch (oa){ 173 switch (oa){
173 case APPRAISE: 174 case APPRAISE:
174 - 175 + appraiseOrderService.processAfterPay(orderInfo);
175 break; 176 break;
176 case DEPOSITE: 177 case DEPOSITE:
177 - SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(sellerDepositOrderService::handleOrderCancelAsyncEvent);  
178 - event.setUid(orderInfo.getUid());  
179 - event.setOrderCode(orderInfo.getOrderCode());  
180 - EventBusPublisher.publishEvent(event);  
181 - logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event); 178 + sellerDepositOrderService.processAfterPay(orderInfo);
182 break; 179 break;
183 } 180 }
184 } 181 }
@@ -15,9 +15,9 @@ public interface IGoodsService { @@ -15,9 +15,9 @@ public interface IGoodsService {
15 15
16 /** 16 /**
17 * 平台收货 17 * 平台收货
18 - * @param orderCode 18 + * @param appraiseOrder
19 */ 19 */
20 - int platformReceiveGoods(long orderCode); 20 + int platformReceiveGoods(AppraiseOrder appraiseOrder);
21 21
22 22
23 /** 23 /**
@@ -55,10 +55,11 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -55,10 +55,11 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
55 55
56 /** 56 /**
57 * 平台收货 57 * 平台收货
58 - * @param orderCode 58 + * @param appraiseOrder
59 */ 59 */
60 @Override 60 @Override
61 - public int platformReceiveGoods(long orderCode){ 61 + public int platformReceiveGoods(AppraiseOrder appraiseOrder){
  62 + long orderCode = appraiseOrder.getOrderCode();
62 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_RECEIVE, 63 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_RECEIVE,
63 expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT; 64 expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
64 65
@@ -5,6 +5,7 @@ import com.yoho.error.ServiceError; @@ -5,6 +5,7 @@ import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
6 import com.yohobuy.ufo.model.ProductInfo; 6 import com.yohobuy.ufo.model.ProductInfo;
7 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; 7 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
  8 +import com.yohobuy.ufo.model.order.bo.OrderInfo;
8 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 9 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
9 import com.yohobuy.ufo.model.order.common.OrderAttributes; 10 import com.yohobuy.ufo.model.order.common.OrderAttributes;
10 import com.yohobuy.ufo.model.order.common.OrderCodeType; 11 import com.yohobuy.ufo.model.order.common.OrderCodeType;
@@ -29,6 +30,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor; @@ -29,6 +30,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor;
29 import com.yohoufo.order.model.dto.AppraiseOrderContext; 30 import com.yohoufo.order.model.dto.AppraiseOrderContext;
30 import com.yohoufo.order.service.IExpressInfoService; 31 import com.yohoufo.order.service.IExpressInfoService;
31 import com.yohoufo.order.service.IGoodsService; 32 import com.yohoufo.order.service.IGoodsService;
  33 +import com.yohoufo.order.service.proxy.InBoxFacade;
32 import com.yohoufo.order.service.proxy.ProductProxyService; 34 import com.yohoufo.order.service.proxy.ProductProxyService;
33 import com.yohoufo.order.service.proxy.UserProxyService; 35 import com.yohoufo.order.service.proxy.UserProxyService;
34 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 36 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
@@ -80,6 +82,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -80,6 +82,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
80 @Autowired 82 @Autowired
81 private ProductProxyService productProxyService; 83 private ProductProxyService productProxyService;
82 84
  85 + @Autowired
  86 + private InBoxFacade inBoxFacade;
  87 +
83 88
84 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ 89 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
85 logger.info("in AppraiseOrderService.compute req {}", req); 90 logger.info("in AppraiseOrderService.compute req {}", req);
@@ -361,11 +366,15 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -361,11 +366,15 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
361 366
362 /** 367 /**
363 * 平台收货 368 * 平台收货
364 - * @param orderCode 369 + * @param appraiseOrder
365 */ 370 */
366 @Override 371 @Override
367 - public int platformReceiveGoods(long orderCode){  
368 - int rows = super.platformReceiveGoods(orderCode); 372 + public int platformReceiveGoods(AppraiseOrder appraiseOrder){
  373 + int rows;
  374 + if ((rows=super.platformReceiveGoods(appraiseOrder))>0){
  375 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
  376 + inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus);
  377 + }
369 return rows; 378 return rows;
370 } 379 }
371 380
@@ -375,7 +384,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -375,7 +384,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
375 */ 384 */
376 @Override 385 @Override
377 public int appraisePass(AppraiseOrder appraiseOrder){ 386 public int appraisePass(AppraiseOrder appraiseOrder){
378 - return super.appraisePass(appraiseOrder); 387 + int rows;
  388 + if ((rows=super.appraisePass(appraiseOrder))>0){
  389 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.JUDGE_PASS;
  390 + inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus);
  391 + }
  392 + return rows;
379 } 393 }
380 394
381 /** 395 /**
@@ -384,7 +398,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -384,7 +398,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
384 */ 398 */
385 @Override 399 @Override
386 public int appraiseFake(AppraiseOrder appraiseOrder){ 400 public int appraiseFake(AppraiseOrder appraiseOrder){
387 - return super.appraiseFake(appraiseOrder); 401 + int rows;
  402 + if ((rows=super.appraiseFake(appraiseOrder))>0){
  403 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.CHECKING_FAKE;
  404 + inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus);
  405 + }
  406 + return rows;
388 } 407 }
389 408
390 /** 409 /**
@@ -393,8 +412,17 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -393,8 +412,17 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
393 */ 412 */
394 @Override 413 @Override
395 public int unsure(AppraiseOrder appraiseOrder){ 414 public int unsure(AppraiseOrder appraiseOrder){
396 - return super.unsure(appraiseOrder); 415 + int rows;
  416 + if ((rows=super.unsure(appraiseOrder))>0){
  417 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
  418 + inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus);
  419 + }
  420 + return rows;
397 } 421 }
398 422
  423 + public void processAfterPay(OrderInfo orderInfo){
  424 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.HAS_PAYED;
  425 + inBoxFacade.paidAppraiseOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetStatus);
  426 + }
399 427
400 } 428 }
@@ -1285,7 +1285,7 @@ public class AppraiseService { @@ -1285,7 +1285,7 @@ public class AppraiseService {
1285 if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ 1285 if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
1286 LOGGER.info("qualityCheckReject isGoodsServiceOrder order code {}", orderCode); 1286 LOGGER.info("qualityCheckReject isGoodsServiceOrder order code {}", orderCode);
1287 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode); 1287 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode);
1288 - existenceNode.getGoodsService().appraiseFake(existenceNode.getAppraiseOrder()); 1288 + existenceNode.getGoodsService().findFlaw(existenceNode.getAppraiseOrder());
1289 apiResponse.setCode(200); 1289 apiResponse.setCode(200);
1290 return apiResponse; 1290 return apiResponse;
1291 } 1291 }
@@ -701,10 +701,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -701,10 +701,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
701 logger.info("in confirmReceive, orderCode {}", orderCode); 701 logger.info("in confirmReceive, orderCode {}", orderCode);
702 if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ 702 if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
703 logger.info("in confirmReceive isGoodsServiceOrder, orderCode {}", orderCode); 703 logger.info("in confirmReceive isGoodsServiceOrder, orderCode {}", orderCode);
704 - serviceOrderProcessor.findGoodsServiceInstance(orderCode).platformReceiveGoods(orderCode);  
705 704
706 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode); 705 ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(orderCode);
707 - 706 + existenceNode.getGoodsService().platformReceiveGoods(existenceNode.appraiseOrder);
708 // 确认收货过来的是子订单号 707 // 确认收货过来的是子订单号
709 Long parentOrderCode = existenceNode.getAppraiseOrder().getParentOrderCode(); 708 Long parentOrderCode = existenceNode.getAppraiseOrder().getParentOrderCode();
710 if (parentOrderCode == null){ 709 if (parentOrderCode == null){
@@ -136,7 +136,7 @@ public class DepositServiceImpl implements DepositService { @@ -136,7 +136,7 @@ public class DepositServiceImpl implements DepositService {
136 136
137 // 查询现货寄存订单的状态 137 // 查询现货寄存订单的状态
138 Map<Long, String> appraiseOrderStatusMap = depositHelpService.queryAppraiseOrderStatus(depositList.stream() 138 Map<Long, String> appraiseOrderStatusMap = depositHelpService.queryAppraiseOrderStatus(depositList.stream()
139 - .filter(item -> DepositSourceEnum.SOURCE_SPOT_GOODS.getCode().equals(item.getSource())).map(StorageDeposit::getOrderCode).collect(Collectors.toList())); 139 + .filter(item -> DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode().equals(item.getOutType())).map(StorageDeposit::getOrderCode).collect(Collectors.toList()));
140 140
141 Map<Long, BuyerOrder> buyerGoodsMap = buyerGoodsList.stream().map(Function.identity()).collect(Collectors.toMap(BuyerOrder::getOrderCode, Function.identity())); 141 Map<Long, BuyerOrder> buyerGoodsMap = buyerGoodsList.stream().map(Function.identity()).collect(Collectors.toMap(BuyerOrder::getOrderCode, Function.identity()));
142 142
@@ -6,11 +6,12 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService; @@ -6,11 +6,12 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService;
6 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 6 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
8 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; 8 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
  9 +import com.yohobuy.ufo.model.order.vo.GoodsVo;
  10 +import com.yohobuy.ufo.model.order.vo.ProductVo;
  11 +import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
  12 +import com.yohoufo.dal.order.AppraiseOrderStorageMapper;
9 import com.yohoufo.dal.order.SellerOrderMapper; 13 import com.yohoufo.dal.order.SellerOrderMapper;
10 -import com.yohoufo.dal.order.model.AppraiseOrder;  
11 -import com.yohoufo.dal.order.model.BuyerOrder;  
12 -import com.yohoufo.dal.order.model.SellerOrder;  
13 -import com.yohoufo.dal.order.model.SellerOrderGoods; 14 +import com.yohoufo.dal.order.model.*;
14 import com.yohoufo.dal.product.ProductMapper; 15 import com.yohoufo.dal.product.ProductMapper;
15 import com.yohoufo.dal.product.model.Product; 16 import com.yohoufo.dal.product.model.Product;
16 import com.yohoufo.inboxclient.model.InBoxResponse; 17 import com.yohoufo.inboxclient.model.InBoxResponse;
@@ -30,7 +31,7 @@ import java.math.BigDecimal; @@ -30,7 +31,7 @@ import java.math.BigDecimal;
30 import java.util.Arrays; 31 import java.util.Arrays;
31 import java.util.List; 32 import java.util.List;
32 import java.util.Map; 33 import java.util.Map;
33 -import java.util.Optional; 34 +import java.util.Objects;
34 import java.util.concurrent.ArrayBlockingQueue; 35 import java.util.concurrent.ArrayBlockingQueue;
35 import java.util.concurrent.ExecutorService; 36 import java.util.concurrent.ExecutorService;
36 import java.util.concurrent.ThreadPoolExecutor; 37 import java.util.concurrent.ThreadPoolExecutor;
@@ -62,6 +63,12 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -62,6 +63,12 @@ public class InBoxFacade extends BaseNoticeFacade{
62 private SellerOrderMapper sellerOrderMapper; 63 private SellerOrderMapper sellerOrderMapper;
63 64
64 @Autowired 65 @Autowired
  66 + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
  67 +
  68 + @Autowired
  69 + private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
  70 +
  71 + @Autowired
65 private IUFOSendService ufoSendService; 72 private IUFOSendService ufoSendService;
66 73
67 @Autowired 74 @Autowired
@@ -1016,52 +1023,233 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1016,52 +1023,233 @@ public class InBoxFacade extends BaseNoticeFacade{
1016 log.warn("notice user renew deposit goods fail, uid {}, sog {}", uid, sog, e); 1023 log.warn("notice user renew deposit goods fail, uid {}, sog {}", uid, sog, e);
1017 } 1024 }
1018 } 1025 }
1019 - 1026 + GoodsVo buildProductInfo(long orderCode){
  1027 + AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode);
  1028 + AppraiseOrderStorage paos = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
  1029 + return GoodsVo.builder()
  1030 + .productName(paog.getProductName())
  1031 + .productCode(paog.getProductCode())
  1032 + .sizeName(Objects.nonNull(paos) ? paos.getSizeName() : null)
  1033 + .build();
  1034 + }
1020 1035
1021 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){ 1036 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
1022 - switch (targetStatus){  
1023 - case WAITING_PAY:  
1024 -  
1025 - break; 1037 + log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1038 + try {
  1039 + //
  1040 + InboxBusinessTypeEnum inboxType = null;
  1041 + InboxBusinessTypeEnum smsType = null;
  1042 +
  1043 + Object[] inboxParams = null,
  1044 + smsParams = null;
  1045 + switch (targetStatus){
  1046 + case WAITING_PAY:
  1047 + //inbox
  1048 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_WAITING_PAY;
  1049 + inboxParams = new Object[]{orderCode};
  1050 + break;
1026 1051
1027 - case CANCEL_BEFORE_PAY: 1052 + case CANCEL_BEFORE_PAY:
  1053 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_SELF_CANCEL;
  1054 + inboxParams = new Object[]{orderCode};
  1055 + break;
1028 1056
1029 - break;  
1030 - case HAS_PAYED: 1057 + case HAS_PAYED:
  1058 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PAID;
  1059 + inboxParams = new Object[]{orderCode};
  1060 + //sms
  1061 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PAID;
  1062 + smsParams = new Object[]{orderCode};
  1063 + break;
  1064 + case CANCEL_BEFORE_DELIVER:
  1065 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
  1066 + inboxParams = new Object[]{orderCode};
  1067 + //sms
  1068 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
  1069 + smsParams = new Object[]{orderCode};
  1070 + break;
  1071 + case SEND_OUT_TIMEOUT:
  1072 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
  1073 + inboxParams = new Object[]{orderCode};
  1074 + //sms
  1075 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
  1076 + smsParams = new Object[]{orderCode};
  1077 + break;
  1078 + case PLATFORM_RECEIVE:
  1079 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
  1080 + inboxParams = new Object[]{orderCode};
  1081 + //sms
  1082 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
  1083 + smsParams = new Object[]{orderCode};
  1084 + break;
  1085 + case SHAM_SEND_OUT:
  1086 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_MISS_GOODS;
  1087 + // get product info 「商品名称」「尺码」「货号」
  1088 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1089 + break;
  1090 + case QUALITY_CHECK_FAKE:
  1091 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FIND_FLAW_OR_BIGGER;
  1092 + //get product info 「商品名称」「尺码」「货号」
  1093 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1094 + break;
1031 1095
1032 - break;  
1033 - case CANCEL_BEFORE_DELIVER: 1096 + case PLATFORM_APPRAISE_UNSURE:
  1097 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_UNSURE;
  1098 + //get product info 「商品名称」「尺码」「货号」
  1099 + inboxParams = buildParams4SellerDepositOrder(orderCode);
1034 1100
1035 - break;  
1036 - case SEND_OUT_TIMEOUT: 1101 + break;
  1102 + case JUDGE_PASS:
  1103 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_PASS;
  1104 + //get product info 「商品名称」「尺码」「货号」
  1105 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1106 + break;
1037 1107
1038 - break;  
1039 - case PLATFORM_RECEIVE: 1108 + case CHECKING_FAKE:
  1109 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_FAKE;
  1110 + //get product info 「商品名称」「尺码」「货号」
  1111 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1112 + break;
1040 1113
1041 - break;  
1042 - case SHAM_SEND_OUT: 1114 + case FINISH:
  1115 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
  1116 + inboxParams = new Object[]{orderCode};
  1117 + //sms
  1118 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
  1119 + smsParams = new Object[]{orderCode};
  1120 + break;
  1121 + }
1043 1122
1044 - break;  
1045 - case QUALITY_CHECK_FAKE:  
1046 1123
1047 - break; 1124 + Notice notice = newNotice(uid).withLogPrefix("seller Deposit Order Notice 4 " + targetStatus.name());
  1125 + if (Objects.nonNull(inboxType)){
  1126 + notice.withInBox(inboxType, inboxParams);
  1127 + }
  1128 + if (Objects.nonNull(smsType)) {
  1129 + notice.withSms(smsType, smsParams);
  1130 + }
  1131 + notice.send();
  1132 + } catch (Exception e) {
  1133 + log.warn("notice seller deposit order fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
  1134 + }
  1135 + }
1048 1136
1049 - case PLATFORM_APPRAISE_UNSURE: 1137 + public void paidAppraiseOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
  1138 + log.info("enter paidAppraiseOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1139 + try {
  1140 + //
  1141 + InboxBusinessTypeEnum inboxType = null;
  1142 + InboxBusinessTypeEnum smsType = null;
1050 1143
1051 - break;  
1052 - case JUDGE_PASS: 1144 + switch (targetStatus){
  1145 + case HAS_PAYED:
  1146 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PAID;
  1147 + break;
1053 1148
1054 - break; 1149 + case PLATFORM_RECEIVE:
  1150 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PLATFORM_RECEIVE;
  1151 + break;
  1152 + case SHAM_SEND_OUT:
  1153 + break;
  1154 + case QUALITY_CHECK_FAKE:
  1155 + break;
1055 1156
1056 - case CHECKING_FAKE: 1157 + case PLATFORM_APPRAISE_UNSURE:
  1158 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
  1159 + //get product info 「商品名称」「尺码」「货号」
  1160 + //sms
  1161 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
  1162 + break;
  1163 + case JUDGE_PASS:
  1164 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
  1165 + //sms
  1166 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
  1167 + break;
1057 1168
1058 - break; 1169 + case CHECKING_FAKE:
  1170 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
  1171 + //sms
  1172 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
  1173 + break;
1059 1174
1060 - case FINISH: 1175 + case FINISH:
  1176 + break;
  1177 + }
  1178 + boolean smsRequired = Objects.nonNull(smsType);
  1179 + Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
  1180 + Object[] smsParams = smsRequired ? inboxParams : null;
1061 1181
1062 - break; 1182 + Notice notice = newNotice(uid).withLogPrefix("paid Appraise Order Notice 4 " + targetStatus.name());
  1183 + if (Objects.nonNull(inboxType)){
  1184 + notice.withInBox(inboxType, inboxParams);
  1185 + }
  1186 + if (smsRequired) {
  1187 + notice.withSms(smsType, smsParams);
  1188 + }
  1189 + notice.send();
  1190 + } catch (Exception e) {
  1191 + log.warn("paidAppraiseOrderNotice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
1063 } 1192 }
1064 1193
1065 } 1194 }
  1195 + private Object[] buildParams4SellerDepositOrder(long orderCode){
  1196 + GoodsVo goodsVo;
  1197 + goodsVo = buildProductInfo(orderCode);
  1198 + return new Object[]{orderCode, goodsVo.getProductName(), goodsVo.getSizeName(), goodsVo.getProductCode()};
  1199 + }
1066 1200
  1201 + private Object[] buildParams4PaidAppraiseOrder(long orderCode){
  1202 + GoodsVo goodsVo;
  1203 + goodsVo = buildProductInfo(orderCode);
  1204 + //get product info 「商品名称」「货号」
  1205 + return new Object[]{ goodsVo.getProductName(), goodsVo.getProductCode()};
  1206 + }
  1207 +
  1208 + public void paidAppraiseOrderDeliverBackNotice(int uid,long orderCode, String expressNumber, AppraiseOrderStatus targetStatus){
  1209 + log.info("enter paidAppraiseOrderDeliverBackNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1210 + try {
  1211 + //
  1212 + InboxBusinessTypeEnum inboxType = null;
  1213 + InboxBusinessTypeEnum smsType = null;
  1214 +
  1215 + switch (targetStatus){
  1216 + case PLATFORM_APPRAISE_UNSURE:
  1217 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
  1218 + //sms
  1219 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
  1220 + break;
  1221 + case JUDGE_PASS:
  1222 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
  1223 + //sms
  1224 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
  1225 + break;
  1226 +
  1227 + case CHECKING_FAKE:
  1228 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
  1229 + //sms
  1230 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
  1231 + break;
  1232 +
  1233 + }
  1234 + boolean smsRequired = Objects.nonNull(smsType);
  1235 + Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
  1236 + Object[] smsParams = smsRequired ? inboxParams : null;
  1237 +
  1238 +
  1239 + Notice notice = newNotice(uid).withLogPrefix("paidAppraiseOrder Deliver Back Notice 4 " + targetStatus.name());
  1240 + if (Objects.nonNull(inboxType)){
  1241 + notice.withInBox(inboxType, inboxParams);
  1242 + }
  1243 + if (smsRequired) {
  1244 + //set expressNumber
  1245 + smsParams[2] = expressNumber;
  1246 +
  1247 + notice.withSms(smsType, smsParams);
  1248 + }
  1249 + notice.send();
  1250 + } catch (Exception e) {
  1251 + log.warn("paidAppraiseOrder Deliver Back Notice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
  1252 + }
  1253 +
  1254 + }
1067 } 1255 }
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.deposit; @@ -3,6 +3,7 @@ package com.yohoufo.order.service.seller.deposit;
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.yoho.error.ServiceError; 4 import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
  6 +import com.yohobuy.ufo.model.order.bo.OrderInfo;
6 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
7 import com.yohobuy.ufo.model.order.common.OrderAttributes; 8 import com.yohobuy.ufo.model.order.common.OrderAttributes;
8 import com.yohobuy.ufo.model.order.common.OrderCodeType; 9 import com.yohobuy.ufo.model.order.common.OrderCodeType;
@@ -42,6 +43,7 @@ import com.yohoufo.order.service.IPaymentService; @@ -42,6 +43,7 @@ import com.yohoufo.order.service.IPaymentService;
42 import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; 43 import com.yohoufo.order.service.handler.GoodsServiceRefundHandler;
43 import com.yohoufo.order.service.impl.*; 44 import com.yohoufo.order.service.impl.*;
44 import com.yohoufo.order.service.pay.AbstractPayService; 45 import com.yohoufo.order.service.pay.AbstractPayService;
  46 +import com.yohoufo.order.service.proxy.InBoxFacade;
45 import com.yohoufo.order.service.proxy.UserProxyService; 47 import com.yohoufo.order.service.proxy.UserProxyService;
46 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 48 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
47 import com.yohoufo.order.utils.LoggerUtils; 49 import com.yohoufo.order.utils.LoggerUtils;
@@ -99,6 +101,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -99,6 +101,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
99 @Autowired 101 @Autowired
100 private IPaymentService paymentService; 102 private IPaymentService paymentService;
101 103
  104 + @Autowired
  105 + private InBoxFacade inBoxFacade;
  106 +
102 107
103 108
104 public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){ 109 public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){
@@ -198,12 +203,17 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -198,12 +203,17 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
198 } 203 }
199 204
200 AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus()); 205 AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
  206 + AppraiseOrderStatus targetOrderStatus;
201 switch (appraiseOrderStatus){ 207 switch (appraiseOrderStatus){
202 case WAITING_PAY: 208 case WAITING_PAY:
203 - super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_BEFORE_PAY, appraiseOrderStatus); 209 + targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_PAY;
  210 + super.triggerStatusChange(orderCode, targetOrderStatus, appraiseOrderStatus);
  211 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
204 break; 212 break;
205 case HAS_PAYED: 213 case HAS_PAYED:
206 - super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_BEFORE_DELIVER, appraiseOrderStatus); 214 + targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_DELIVER;
  215 + super.triggerStatusChange(orderCode, targetOrderStatus , appraiseOrderStatus);
  216 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
207 //refund amount 217 //refund amount
208 new GoodsServiceRefundHandler() 218 new GoodsServiceRefundHandler()
209 .loadLogger(logger) 219 .loadLogger(logger)
@@ -275,6 +285,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -275,6 +285,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
275 return rows; 285 return rows;
276 } 286 }
277 Long orderCode = req.getOrderCode(); 287 Long orderCode = req.getOrderCode();
  288 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
  289 + //
  290 + inBoxFacade.sellerDepositOrderNotice(req.getUid(), orderCode, targetOrderStatus);
278 //split sku 2 order 291 //split sku 2 order
279 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode); 292 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
280 SellerDepositOrderListService.OrderDataNode node = sellerDepositOrderListService.buildDataSourceOfParentOrder(orderCode, paogList); 293 SellerDepositOrderListService.OrderDataNode node = sellerDepositOrderListService.buildDataSourceOfParentOrder(orderCode, paogList);
@@ -297,11 +310,16 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -297,11 +310,16 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
297 310
298 /** 311 /**
299 * 平台收货 312 * 平台收货
300 - * @param orderCode 313 + * @param appraiseOrder
301 */ 314 */
302 @Override 315 @Override
303 - public int platformReceiveGoods(long orderCode){  
304 - int rows = super.platformReceiveGoods(orderCode); 316 + public int platformReceiveGoods(AppraiseOrder appraiseOrder){
  317 + int rows = super.platformReceiveGoods(appraiseOrder);
  318 + if (rows>0) {
  319 +
  320 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
  321 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
  322 + }
305 return rows; 323 return rows;
306 } 324 }
307 325
@@ -317,7 +335,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -317,7 +335,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
317 } 335 }
318 Long orderCode = pao.getOrderCode(); 336 Long orderCode = pao.getOrderCode();
319 Long paidCode = pao.getParentOrderCode(); 337 Long paidCode = pao.getParentOrderCode();
320 - 338 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.JUDGE_PASS;
  339 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus);
321 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode); 340 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
322 if (left.compareTo(BigDecimal.ZERO)>0){ 341 if (left.compareTo(BigDecimal.ZERO)>0){
323 342
@@ -378,6 +397,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -378,6 +397,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
378 if (rows == 0){ 397 if (rows == 0){
379 return rows; 398 return rows;
380 } 399 }
  400 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
  401 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
381 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 402 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
382 return rows; 403 return rows;
383 } 404 }
@@ -392,6 +413,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -392,6 +413,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
392 if (rows == 0){ 413 if (rows == 0){
393 return rows; 414 return rows;
394 } 415 }
  416 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
  417 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
395 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 418 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
396 return rows; 419 return rows;
397 } 420 }
@@ -407,6 +430,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -407,6 +430,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
407 if (rows == 0){ 430 if (rows == 0){
408 return rows; 431 return rows;
409 } 432 }
  433 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
  434 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
410 //refund amount 435 //refund amount
411 new GoodsServiceRefundHandler() 436 new GoodsServiceRefundHandler()
412 .loadLogger(logger) 437 .loadLogger(logger)
@@ -525,6 +550,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -525,6 +550,8 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
525 if (rows == 0){ 550 if (rows == 0){
526 return rows; 551 return rows;
527 } 552 }
  553 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
  554 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
528 new GoodsServiceRefundHandler() 555 new GoodsServiceRefundHandler()
529 .loadLogger(logger) 556 .loadLogger(logger)
530 .loadUser(appraiseOrder.getUid()) 557 .loadUser(appraiseOrder.getUid())
@@ -550,4 +577,14 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -550,4 +577,14 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
550 return true; 577 return true;
551 } 578 }
552 579
  580 + public void processAfterPay(OrderInfo orderInfo){
  581 + AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED;
  582 + inBoxFacade.sellerDepositOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetOrderStatus);
  583 + SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);
  584 + event.setUid(orderInfo.getUid());
  585 + event.setOrderCode(orderInfo.getOrderCode());
  586 + EventBusPublisher.publishEvent(event);
  587 + logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
  588 +
  589 + }
553 } 590 }