Authored by tanling

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

  1 +package com.yohoufo.order.event;
  2 +
  3 +import lombok.Getter;
  4 +import lombok.Setter;
  5 +import lombok.ToString;
  6 +
  7 +import java.util.function.Function;
  8 +@ToString(of = { "orderCode" })
  9 +public class SellerDepositOrderStatusConsistencyAsyncEvent
  10 + extends AsyncEvent{
  11 + @Getter@Setter
  12 + private Long orderCode;
  13 +
  14 + public SellerDepositOrderStatusConsistencyAsyncEvent(Function<SellerDepositOrderStatusConsistencyAsyncEvent,Integer> function) {
  15 + super(function);
  16 + }
  17 +
  18 + @Override
  19 + AsyncEvent getAsyncEvent() {
  20 + return this;
  21 + }
  22 +}
@@ -3,6 +3,8 @@ package com.yohoufo.order.mq.consumer; @@ -3,6 +3,8 @@ package com.yohoufo.order.mq.consumer;
3 import com.yohoufo.order.event.SellerCancelDeliverEvent; 3 import com.yohoufo.order.event.SellerCancelDeliverEvent;
4 import com.yohoufo.order.mq.TopicConstants; 4 import com.yohoufo.order.mq.TopicConstants;
5 import com.yohoufo.order.service.impl.BuyerOrderCancelService; 5 import com.yohoufo.order.service.impl.BuyerOrderCancelService;
  6 +import com.yohoufo.order.service.impl.ServiceOrderProcessor;
  7 +import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
6 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Component; 9 import org.springframework.stereotype.Component;
8 10
@@ -14,8 +16,14 @@ import org.springframework.stereotype.Component; @@ -14,8 +16,14 @@ import org.springframework.stereotype.Component;
14 public class SellerOrderCancelDeliverDelayMsgConsumer extends JsonObjectMessageConsumer<SellerCancelDeliverEvent> { 16 public class SellerOrderCancelDeliverDelayMsgConsumer extends JsonObjectMessageConsumer<SellerCancelDeliverEvent> {
15 17
16 @Autowired 18 @Autowired
  19 + private ServiceOrderProcessor serviceOrderProcessor;
  20 +
  21 + @Autowired
17 private BuyerOrderCancelService buyerOrderCancelService; 22 private BuyerOrderCancelService buyerOrderCancelService;
18 23
  24 + @Autowired
  25 + private SellerDepositOrderService sellerDepositOrderService;
  26 +
19 @Override 27 @Override
20 public String getTopic() { 28 public String getTopic() {
21 return TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER; 29 return TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER;
@@ -23,6 +31,11 @@ public class SellerOrderCancelDeliverDelayMsgConsumer extends JsonObjectMessageC @@ -23,6 +31,11 @@ public class SellerOrderCancelDeliverDelayMsgConsumer extends JsonObjectMessageC
23 31
24 @Override 32 @Override
25 public void handle(SellerCancelDeliverEvent event) { 33 public void handle(SellerCancelDeliverEvent event) {
26 - buyerOrderCancelService.cancelForSellerSendOutTimeout(event.getUid(), event.getOrderCode(), event.getSkup(), event.getSellerOrderGoods()); 34 + long orderCode = event.getOrderCode();
  35 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  36 + int rows = sellerDepositOrderService.cancelForSendOutTimeout(orderCode);
  37 + return;
  38 + }
  39 + buyerOrderCancelService.cancelForSellerSendOutTimeout(event.getUid(), orderCode, event.getSkup(), event.getSellerOrderGoods());
27 } 40 }
28 } 41 }
@@ -38,6 +38,7 @@ import com.yohoufo.order.utils.AddressHelper; @@ -38,6 +38,7 @@ import com.yohoufo.order.utils.AddressHelper;
38 import com.yohoufo.order.utils.LoggerUtils; 38 import com.yohoufo.order.utils.LoggerUtils;
39 import lombok.Builder; 39 import lombok.Builder;
40 import lombok.Data; 40 import lombok.Data;
  41 +import org.apache.commons.lang3.StringUtils;
41 import org.slf4j.Logger; 42 import org.slf4j.Logger;
42 import org.springframework.beans.factory.annotation.Autowired; 43 import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.stereotype.Service; 44 import org.springframework.stereotype.Service;
@@ -182,8 +183,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -182,8 +183,12 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
182 throw new UfoServiceException(400, "商品ID错误"); 183 throw new UfoServiceException(400, "商品ID错误");
183 } 184 }
184 final OrderAttributes orderAttributes = getOrderAttributes(); 185 final OrderAttributes orderAttributes = getOrderAttributes();
  186 + String addressIdstr=req.getAddressId();
  187 + if (StringUtils.isBlank(addressIdstr)){
  188 + throw new UfoServiceException(400, "请选择地址后提交");
  189 + }
185 190
186 - int addressId = AddressUtil.getDecryptStr(req.getAddressId()); 191 + int addressId = AddressUtil.getDecryptStr(addressIdstr);
187 if (addressId < 0){ 192 if (addressId < 0){
188 logger.warn("submit appraise order addressId invalidate, uid {}, productId {}, addressId {}", 193 logger.warn("submit appraise order addressId invalidate, uid {}, productId {}, addressId {}",
189 uid, productId, req.getAddressId()); 194 uid, productId, req.getAddressId());
@@ -424,16 +429,4 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -424,16 +429,4 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
424 inBoxFacade.paidAppraiseOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetStatus); 429 inBoxFacade.paidAppraiseOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetStatus);
425 } 430 }
426 431
427 -  
428 - public int platformFinishReceiveGoods(long orderCode, long parentCode){  
429 -  
430 - return 0;  
431 - }  
432 -  
433 -  
434 - public int detectAppraiseFinish(long orderCode){  
435 -  
436 -  
437 - return 0;  
438 - }  
439 } 432 }
@@ -523,7 +523,6 @@ public class DepositServiceImpl implements DepositService { @@ -523,7 +523,6 @@ public class DepositServiceImpl implements DepositService {
523 } 523 }
524 524
525 DepositDetailBo.DepositDetailBoBuilder depositDetailBoBuilder = DepositDetailBo.builder() 525 DepositDetailBo.DepositDetailBoBuilder depositDetailBoBuilder = DepositDetailBo.builder()
526 - .orderCode(storageDeposit.getOrderCode())  
527 .depositCode(storageDeposit.getDepositCode()) 526 .depositCode(storageDeposit.getDepositCode())
528 .skup(storageDeposit.getSkup()) 527 .skup(storageDeposit.getSkup())
529 .status(storageDeposit.getStatus()) 528 .status(storageDeposit.getStatus())
@@ -533,10 +532,12 @@ public class DepositServiceImpl implements DepositService { @@ -533,10 +532,12 @@ public class DepositServiceImpl implements DepositService {
533 Map<Long, List<String>> orderStatusStr = depositHelpService.queryAppraiseOrderStatusEx(storageDeposit.getOrderCode()); 532 Map<Long, List<String>> orderStatusStr = depositHelpService.queryAppraiseOrderStatusEx(storageDeposit.getOrderCode());
534 533
535 depositDetailBoBuilder.depositStatusName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(0) : "") 534 depositDetailBoBuilder.depositStatusName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(0) : "")
536 - .depositDescName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(1) : ""); 535 + .depositDescName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(1) : "")
  536 + .orderCode(storageDeposit.getParentOrderCode());
537 } else { // 正常的买家订单召回 537 } else { // 正常的买家订单召回
538 depositDetailBoBuilder.depositStatusName(StorageDepositStatusEnum.getAppStatusNameByCode(storageDeposit.getStatus())) 538 depositDetailBoBuilder.depositStatusName(StorageDepositStatusEnum.getAppStatusNameByCode(storageDeposit.getStatus()))
539 - .depositDescName(StorageDepositStatusEnum.getAppStatusDescByCode(storageDeposit.getStatus())); 539 + .depositDescName(StorageDepositStatusEnum.getAppStatusDescByCode(storageDeposit.getStatus()))
  540 + .orderCode(storageDeposit.getOrderCode());
540 } 541 }
541 542
542 return depositDetailBoBuilder.build(); 543 return depositDetailBoBuilder.build();
@@ -1150,10 +1150,11 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1150,10 +1150,11 @@ public class InBoxFacade extends BaseNoticeFacade{
1150 // 1150 //
1151 InboxBusinessTypeEnum inboxType = null; 1151 InboxBusinessTypeEnum inboxType = null;
1152 InboxBusinessTypeEnum smsType = null; 1152 InboxBusinessTypeEnum smsType = null;
1153 - 1153 + Object[] inboxParams = null;
1154 switch (targetStatus){ 1154 switch (targetStatus){
1155 case HAS_PAYED: 1155 case HAS_PAYED:
1156 inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PAID; 1156 inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PAID;
  1157 + inboxParams = new Object[]{orderCode};
1157 break; 1158 break;
1158 1159
1159 case PLATFORM_RECEIVE: 1160 case PLATFORM_RECEIVE:
@@ -1186,7 +1187,7 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1186,7 +1187,7 @@ public class InBoxFacade extends BaseNoticeFacade{
1186 break; 1187 break;
1187 } 1188 }
1188 boolean smsRequired = Objects.nonNull(smsType); 1189 boolean smsRequired = Objects.nonNull(smsType);
1189 - Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode); 1190 + inboxParams = Objects.nonNull(inboxParams) ? inboxParams : buildParams4PaidAppraiseOrder(orderCode);
1190 Object[] smsParams = smsRequired ? inboxParams : null; 1191 Object[] smsParams = smsRequired ? inboxParams : null;
1191 1192
1192 Notice notice = newNotice(uid).withLogPrefix("paid Appraise Order Notice 4 " + targetStatus.name()); 1193 Notice notice = newNotice(uid).withLogPrefix("paid Appraise Order Notice 4 " + targetStatus.name());
@@ -28,9 +28,7 @@ import com.yohoufo.dal.order.model.*; @@ -28,9 +28,7 @@ import com.yohoufo.dal.order.model.*;
28 import com.yohoufo.order.common.ClientType; 28 import com.yohoufo.order.common.ClientType;
29 import com.yohoufo.order.common.DelStatus; 29 import com.yohoufo.order.common.DelStatus;
30 import com.yohoufo.order.constants.MetaKey; 30 import com.yohoufo.order.constants.MetaKey;
31 -import com.yohoufo.order.event.OrderCancelEvent;  
32 -import com.yohoufo.order.event.PayConfirmEvent;  
33 -import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent; 31 +import com.yohoufo.order.event.*;
34 import com.yohoufo.order.model.PayQueryBo; 32 import com.yohoufo.order.model.PayQueryBo;
35 import com.yohoufo.order.model.dto.PlatformFeeDto; 33 import com.yohoufo.order.model.dto.PlatformFeeDto;
36 import com.yohoufo.order.model.dto.SellerDepositOrderContext; 34 import com.yohoufo.order.model.dto.SellerDepositOrderContext;
@@ -54,10 +52,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -54,10 +52,7 @@ import org.springframework.beans.factory.annotation.Autowired;
54 import org.springframework.stereotype.Service; 52 import org.springframework.stereotype.Service;
55 53
56 import java.math.BigDecimal; 54 import java.math.BigDecimal;
57 -import java.util.ArrayList;  
58 -import java.util.List;  
59 -import java.util.Map;  
60 -import java.util.Objects; 55 +import java.util.*;
61 import java.util.stream.Collectors; 56 import java.util.stream.Collectors;
62 57
63 @Service 58 @Service
@@ -343,6 +338,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -343,6 +338,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
343 if (rows == 0){ 338 if (rows == 0){
344 return rows; 339 return rows;
345 } 340 }
  341 + //
  342 + triggerStatusConsistencyCheck(orderCode);
  343 +
346 Long paidCode = pao.getParentOrderCode(); 344 Long paidCode = pao.getParentOrderCode();
347 inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus); 345 inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus);
348 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode); 346 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
@@ -405,6 +403,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -405,6 +403,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
405 if (rows == 0){ 403 if (rows == 0){
406 return rows; 404 return rows;
407 } 405 }
  406 + //
  407 + Long orderCode = appraiseOrder.getOrderCode();
  408 + triggerStatusConsistencyCheck(orderCode);
  409 + //
408 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE; 410 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
409 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 411 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
410 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 412 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
@@ -421,6 +423,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -421,6 +423,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
421 if (rows == 0){ 423 if (rows == 0){
422 return rows; 424 return rows;
423 } 425 }
  426 + //
  427 + Long orderCode = appraiseOrder.getOrderCode();
  428 + triggerStatusConsistencyCheck(orderCode);
424 //refund amount 429 //refund amount
425 new GoodsServiceRefundHandler() 430 new GoodsServiceRefundHandler()
426 .loadLogger(logger) 431 .loadLogger(logger)
@@ -447,6 +452,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -447,6 +452,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
447 if (rows == 0){ 452 if (rows == 0){
448 return rows; 453 return rows;
449 } 454 }
  455 + //
  456 + Long orderCode = appraiseOrder.getOrderCode();
  457 + triggerStatusConsistencyCheck(orderCode);
  458 + //
450 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT; 459 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
451 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 460 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
452 //refund amount 461 //refund amount
@@ -567,16 +576,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -567,16 +576,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
567 if (rows == 0){ 576 if (rows == 0){
568 return rows; 577 return rows;
569 } 578 }
  579 + Long orderCode = appraiseOrder.getOrderCode();
  580 + triggerStatusConsistencyCheck(orderCode);
570 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE; 581 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
571 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 582 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus);
572 new GoodsServiceRefundHandler() 583 new GoodsServiceRefundHandler()
573 .loadLogger(logger) 584 .loadLogger(logger)
574 .loadUser(appraiseOrder.getUid()) 585 .loadUser(appraiseOrder.getUid())
575 .loadActionCase(SellerWalletDetail.Type.FLAW) 586 .loadActionCase(SellerWalletDetail.Type.FLAW)
576 .loadRefundAction(payRefundService::refund) 587 .loadRefundAction(payRefundService::refund)
577 - .loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount()) 588 + .loadOrder(orderCode, appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
578 .refund(); 589 .refund();
579 - depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 590 + depositService.insertFakeDeposit(appraiseOrder.getUid(), orderCode, appraiseOrder.getParentOrderCode());
580 return rows; 591 return rows;
581 } 592 }
582 593
@@ -595,14 +606,20 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -595,14 +606,20 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
595 } 606 }
596 607
597 public void processAfterPay(OrderInfo orderInfo){ 608 public void processAfterPay(OrderInfo orderInfo){
  609 + Long orderCode = orderInfo.getOrderCode();
  610 + Integer uid = orderInfo.getUid();
598 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED; 611 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED;
599 inBoxFacade.sellerDepositOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetOrderStatus); 612 inBoxFacade.sellerDepositOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetOrderStatus);
600 SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent); 613 SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);
601 - event.setUid(orderInfo.getUid());  
602 - event.setOrderCode(orderInfo.getOrderCode()); 614 + event.setUid(uid);
  615 + event.setOrderCode(orderCode);
603 EventBusPublisher.publishEvent(event); 616 EventBusPublisher.publishEvent(event);
604 logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event); 617 logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
605 - 618 + SellerCancelDeliverEvent cancelDeliverEvent =
  619 + SellerCancelDeliverEvent.builder()
  620 + .uid(orderInfo.getUid())
  621 + .orderCode(orderCode).build();
  622 + EventBusPublisher.publishEvent(cancelDeliverEvent);
606 } 623 }
607 624
608 625
@@ -621,12 +638,23 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -621,12 +638,23 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
621 logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode); 638 logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
622 return new ArrayList<>(0); 639 return new ArrayList<>(0);
623 } 640 }
624 - long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode(); 641 + long occ = findoutParentOrderCode(orderCode);
625 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ); 642 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
626 logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList); 643 logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
627 return paoList; 644 return paoList;
628 } 645 }
629 646
  647 + private Long findoutParentOrderCode(long orderCode){
  648 + AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
  649 + if (Objects.isNull(appraiseOrder)){
  650 + logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
  651 + return orderCode;
  652 + }
  653 + return appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
  654 + }
  655 +
  656 +
  657 +
630 public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){ 658 public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){
631 List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode); 659 List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
632 660
@@ -681,4 +709,82 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -681,4 +709,82 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
681 709
682 return dosi; 710 return dosi;
683 } 711 }
  712 +
  713 + public int platformFinishReceiveGoods(long parentCode){
  714 + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH,
  715 + expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
  716 + return triggerStatusChange(parentCode,targetStatus,expectedStatus);
  717 + }
  718 +
  719 +
  720 + public int detectAppraiseFinish(SellerDepositOrderStatusConsistencyAsyncEvent event ){
  721 + logger.info("detectAppraiseFinish event {}", event);
  722 + long orderCode = event.getOrderCode();
  723 + long parentOrderCode = findoutParentOrderCode(orderCode);
  724 + int cnt =appraiseOrderMapper.selectSubOrderCntIncludeStatus(parentOrderCode,Arrays.asList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode()));
  725 + logger.info("detectAppraiseFinish event {},parentOrderCode {} PLATFORM_RECEIVE count {}", event, parentOrderCode, cnt);
  726 + if (cnt == 0){
  727 + int prows = platformFinishReceiveGoods(parentOrderCode);
  728 + logger.info("detectAppraiseFinish platformFinishReceiveGoods, orderCode {},parentOrderCode {} parent count {}",
  729 + orderCode, parentOrderCode, prows);
  730 + return prows;
  731 + }
  732 + return 0;
  733 + }
  734 +
  735 + public void triggerStatusConsistencyCheck(long orderCode){
  736 + SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
  737 + = new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
  738 + asyncEvent.setOrderCode(orderCode);
  739 + EventBusPublisher.publishEvent(asyncEvent);
  740 + }
  741 +
  742 + /**
  743 + * 发货超时取消
  744 + * @param orderCode
  745 + */
  746 + public int cancelForSendOutTimeout(long orderCode){
  747 + logger.info("in cancel seller deposit order For Send Out Timeout orderCode {}", orderCode);
  748 + ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
  749 +
  750 + if (!existenceNode.isExisted()){
  751 + logger.warn("auto cancel AppraiseOrder not exist, orderCode {}", orderCode);
  752 + throw new UfoServiceException(400, "订单已迷路");
  753 + }
  754 + AppraiseOrder pao = existenceNode.getAppraiseOrder();
  755 +
  756 + OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes());
  757 + if (!OrderAttributes.DEPOSITE.equals(oa)){
  758 + logger.warn("auto cancel AppraiseOrder not deposit Order, orderCode {}", orderCode);
  759 + throw new UfoServiceException(400, "订单已迷路");
  760 + }
  761 + int uid = pao.getUid();
  762 + AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
  763 + int rows = 0;
  764 + AppraiseOrderStatus targetOrderStatus = null;
  765 + switch (appraiseOrderStatus){
  766 + case HAS_PAYED:
  767 + targetOrderStatus= AppraiseOrderStatus.SEND_OUT_TIMEOUT;
  768 + rows = super.triggerStatusChange(orderCode, targetOrderStatus, appraiseOrderStatus);
  769 + if (rows>0){
  770 + new GoodsServiceRefundHandler()
  771 + .loadLogger(logger)
  772 + .loadUser(uid)
  773 + .loadActionCase(SellerWalletDetail.Type.SELLER_OVER_TIME)
  774 + .loadRefundAction(payRefundService::refund)
  775 + .loadOrder(orderCode, orderCode, pao.getPayment(), pao.getAmount())
  776 + .refund();
  777 + //notice
  778 + inBoxFacade.sellerDepositOrderNotice(uid, orderCode, targetOrderStatus);
  779 + }
  780 +
  781 +
  782 + break;
  783 + default:
  784 + throw new UfoServiceException(400, "订单不支持取消");
  785 + }
  786 +
  787 + return rows;
  788 +
  789 + }
684 } 790 }
@@ -44,9 +44,9 @@ public class CertificationController { @@ -44,9 +44,9 @@ public class CertificationController {
44 public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException { 44 public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException {
45 logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO); 45 logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO);
46 //若版本低于6.9.9, 提示升级版本 46 //若版本低于6.9.9, 提示升级版本
47 - if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0){ 47 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0){
48 logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid()); 48 logger.info("CertificationController.alipayCertification: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
49 - throw new VersionNotSupportException(); 49 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
50 } 50 }
51 //(1) 必要参数的校验 51 //(1) 必要参数的校验
52 if(reqVO == null || reqVO.getUid() <= 0){ 52 if(reqVO == null || reqVO.getUid() <= 0){
@@ -76,9 +76,9 @@ public class CertificationController { @@ -76,9 +76,9 @@ public class CertificationController {
76 public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { 76 public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
77 logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO); 77 logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO);
78 //若版本低于6.9.9提示升级版本 78 //若版本低于6.9.9提示升级版本
79 - if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.10") < 0 ){ 79 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
80 logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid()); 80 logger.info("CertificationController.alipayCertifyResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
81 - throw new VersionNotSupportException(); 81 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
82 } 82 }
83 //(1) 校验请求的参数 83 //(1) 校验请求的参数
84 if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){ 84 if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){
1 package com.yohoufo.user.controller.passport; 1 package com.yohoufo.user.controller.passport;
2 2
3 3
  4 +import com.yoho.core.config.ConfigReader;
4 import com.yoho.tools.common.beans.ApiResponse; 5 import com.yoho.tools.common.beans.ApiResponse;
5 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; 6 import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
6 import com.yohoufo.common.exception.GatewayException; 7 import com.yohoufo.common.exception.GatewayException;
@@ -32,6 +33,9 @@ public class RealNameAuthorizeController { @@ -32,6 +33,9 @@ public class RealNameAuthorizeController {
32 33
33 private final String yohoCardUrlPre= "http://yhgidcard.static.yhbimg.com/yohocard"; 34 private final String yohoCardUrlPre= "http://yhgidcard.static.yhbimg.com/yohocard";
34 35
  36 + @Autowired
  37 + private ConfigReader configReader;
  38 +
35 /*@Autowired 39 /*@Autowired
36 GraphVerifyService graphVerifyService;*/ 40 GraphVerifyService graphVerifyService;*/
37 41
@@ -166,6 +170,12 @@ public class RealNameAuthorizeController { @@ -166,6 +170,12 @@ public class RealNameAuthorizeController {
166 @RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit") 170 @RequestMapping(params = "method=ufo.user.zhiMaCertWithPhotoCheckInit")
167 public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException { 171 public ApiResponse zhiMaCertWithPhotoCheckInit(RealNameAuthorizeReqVO reqVO) throws GatewayException {
168 logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO); 172 logger.info("enter realNameAuthorize.zhiMaCertWithPhotoCheckInit param reqVO is {}", reqVO);
  173 + //若版本低于6.9.9提示升级版本
  174 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
  175 + logger.info("realNameAuthorize.zhiMaCertWithPhotoCheckInit: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
  176 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
  177 + }
  178 +
169 //(1) 优先校验请求的参数 179 //(1) 优先校验请求的参数
170 if (reqVO == null || reqVO.getUid()<=0){ 180 if (reqVO == null || reqVO.getUid()<=0){
171 throw new GatewayException(400, "uid不能为空!"); 181 throw new GatewayException(400, "uid不能为空!");
@@ -251,6 +261,12 @@ public class RealNameAuthorizeController { @@ -251,6 +261,12 @@ public class RealNameAuthorizeController {
251 public ApiResponse zhiMaCertResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { 261 public ApiResponse zhiMaCertResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException {
252 logger.info("enter realNameAuthorize.zhiMaCertResultQuery param reqVO is {}", reqVO); 262 logger.info("enter realNameAuthorize.zhiMaCertResultQuery param reqVO is {}", reqVO);
253 263
  264 + //若版本低于6.9.9提示升级版本
  265 + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && compareVersion(reqVO.getApp_version(), "6.9.9") < 0 ){
  266 + logger.info("realNameAuthorize.zhiMaCertResultQuery: version need update, version is {}, uid is {}", reqVO.getApp_version(), reqVO.getUid());
  267 + throw new GatewayException(400, "支付宝实名认证服务已升级,请升级有货APP最新版本后重新申请");
  268 + }
  269 +
254 //(1) 优先校验请求的参数 270 //(1) 优先校验请求的参数
255 if (reqVO == null || reqVO.getUid()<=0){ 271 if (reqVO == null || reqVO.getUid()<=0){
256 throw new GatewayException(400, "参数错误,uid不能为空!"); 272 throw new GatewayException(400, "参数错误,uid不能为空!");
@@ -266,4 +282,28 @@ public class RealNameAuthorizeController { @@ -266,4 +282,28 @@ public class RealNameAuthorizeController {
266 return result; 282 return result;
267 } 283 }
268 284
  285 + private int compareVersion(String curVersion,String sysVersion){
  286 + boolean isCurBlank = StringUtils.isBlank(curVersion);
  287 + boolean isSysBlank = StringUtils.isBlank(sysVersion);
  288 + if(isCurBlank && isSysBlank){
  289 + return 0;
  290 + }
  291 + if(isCurBlank){
  292 + return -1;
  293 + }
  294 + if(isSysBlank){
  295 + return 1;
  296 + }
  297 + String[] curArr = curVersion.split("\\.");
  298 + String[] sysArr = sysVersion.split("\\.");
  299 + for(int i=0;i<3;i++){
  300 + int cur = Integer.parseInt(curArr[i]);
  301 + int sys = Integer.parseInt(sysArr[i]);
  302 + if(cur != sys){
  303 + return cur-sys;
  304 + }
  305 + }
  306 + return 0;
  307 + }
  308 +
269 } 309 }
@@ -42,4 +42,4 @@ ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn @@ -42,4 +42,4 @@ ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn
42 ufo.user.idCertSwitch=false 42 ufo.user.idCertSwitch=false
43 43
44 #实名认证提示版本升级开关 44 #实名认证提示版本升级开关
45 -ufo.user.idCertUpdateVersionSwitch = true  
  45 +ufo.user.idCertUpdateVersionSwitch = false