Authored by tanling

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
4 import com.yoho.message.sdk.common.model.SendMessageRspBo; 4 import com.yoho.message.sdk.common.model.SendMessageRspBo;
5 import com.yoho.message.sdk.service.ufo.IUFOSendService; 5 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.bo.DepositOrderStatisticInfo;
7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 8 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
8 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; 9 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.GoodsVo;
@@ -18,6 +19,7 @@ import com.yohoufo.inboxclient.model.InBoxResponse; @@ -18,6 +19,7 @@ import com.yohoufo.inboxclient.model.InBoxResponse;
18 import com.yohoufo.inboxclient.model.InboxReqVO; 19 import com.yohoufo.inboxclient.model.InboxReqVO;
19 import com.yohoufo.inboxclient.sdk.InBoxSDK; 20 import com.yohoufo.inboxclient.sdk.InBoxSDK;
20 import com.yohoufo.order.service.impl.function.BuyerNoticeSender; 21 import com.yohoufo.order.service.impl.function.BuyerNoticeSender;
  22 +import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
21 import com.yohoufo.order.utils.NamedThreadFactory; 23 import com.yohoufo.order.utils.NamedThreadFactory;
22 import com.yohoufo.order.utils.PaymentHelper; 24 import com.yohoufo.order.utils.PaymentHelper;
23 import lombok.NonNull; 25 import lombok.NonNull;
@@ -77,6 +79,9 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -77,6 +79,9 @@ public class InBoxFacade extends BaseNoticeFacade{
77 @Autowired 79 @Autowired
78 private BuyerNoticeFacade buyerNoticeFacade; 80 private BuyerNoticeFacade buyerNoticeFacade;
79 81
  82 + @Autowired
  83 + private SellerDepositOrderService sellerDepositOrderService;
  84 +
80 @Override 85 @Override
81 public Logger getLogger() { 86 public Logger getLogger() {
82 return log; 87 return log;
@@ -1032,6 +1037,8 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1032,6 +1037,8 @@ public class InBoxFacade extends BaseNoticeFacade{
1032 .build(); 1037 .build();
1033 } 1038 }
1034 1039
  1040 +
  1041 +
1035 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){ 1042 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
1036 log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus); 1043 log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
1037 try { 1044 try {
@@ -1111,11 +1118,15 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1111,11 +1118,15 @@ public class InBoxFacade extends BaseNoticeFacade{
1111 break; 1118 break;
1112 1119
1113 case FINISH: 1120 case FINISH:
  1121 + //订单编号{},申请{}件,实收{}件,鉴定通过{}件,鉴定为假{}件,无法鉴定{}件,鉴定瑕疵{}件
  1122 + DepositOrderStatisticInfo statisticInfo = sellerDepositOrderService.getAppraiseProgress(uid, orderCode);
1114 inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY; 1123 inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
1115 - inboxParams = new Object[]{orderCode}; 1124 + inboxParams = new Object[]{orderCode, statisticInfo.getApplyTotal(), statisticInfo.getReceiveTotal(),
  1125 + statisticInfo.getPassNum(), statisticInfo.getFakeNum(), statisticInfo.getUnsureNum(),
  1126 + statisticInfo.getFlawNum()};
1116 //sms 1127 //sms
1117 smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY; 1128 smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
1118 - smsParams = new Object[]{orderCode}; 1129 + smsParams = inboxParams;
1119 break; 1130 break;
1120 } 1131 }
1121 1132
1 package com.yohoufo.order.service.seller.deposit; 1 package com.yohoufo.order.service.seller.deposit;
2 2
3 import com.google.common.collect.Lists; 3 import com.google.common.collect.Lists;
  4 +import com.yohobuy.ufo.model.order.bo.DepositOrderStatisticInfo;
4 import com.yohobuy.ufo.model.order.bo.TimeoutBo; 5 import com.yohobuy.ufo.model.order.bo.TimeoutBo;
5 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 6 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
6 import com.yohobuy.ufo.model.order.common.OrderAttributes; 7 import com.yohobuy.ufo.model.order.common.OrderAttributes;
@@ -54,6 +55,9 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { @@ -54,6 +55,9 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
54 @Autowired 55 @Autowired
55 private IExpressInfoService expressInfoService; 56 private IExpressInfoService expressInfoService;
56 57
  58 + @Autowired
  59 + private SellerDepositOrderService sellerDepositOrderService;
  60 +
57 61
58 private static final List<Integer> showEXpressInfoStatusList = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode(), 62 private static final List<Integer> showEXpressInfoStatusList = Lists.newArrayList(AppraiseOrderStatus.SELLER_SEND_OUT.getCode(),
59 AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(), 63 AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
@@ -76,6 +80,10 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { @@ -76,6 +80,10 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
76 AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode() 80 AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()
77 ); 81 );
78 82
  83 + private static final List<Integer> showAppraiseProgress = Lists.newArrayList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode(),
  84 + AppraiseOrderStatus.FINISH.getCode()
  85 + );
  86 +
79 private static final List<Integer> addressUpgradableStatusList = Lists.newArrayList(AppraiseOrderStatus.HAS_PAYED.getCode()); 87 private static final List<Integer> addressUpgradableStatusList = Lists.newArrayList(AppraiseOrderStatus.HAS_PAYED.getCode());
80 88
81 89
@@ -107,6 +115,11 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { @@ -107,6 +115,11 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
107 if (showUserAddressStatusList.contains(pao.getStatus())){ 115 if (showUserAddressStatusList.contains(pao.getStatus())){
108 userAddress = appraiseOrderMetaService.getHidderUserAddress(orderCode); 116 userAddress = appraiseOrderMetaService.getHidderUserAddress(orderCode);
109 } 117 }
  118 + DepositOrderStatisticInfo orderStatisticInfo = null;
  119 + if (showAppraiseProgress.contains(pao.getStatus())){
  120 + orderStatisticInfo = sellerDepositOrderService.getAppraiseProgress(uid, orderCode);
  121 + }
  122 +
110 boolean addressUpgradable = addressUpgradableStatusList.contains(pao.getStatus()); 123 boolean addressUpgradable = addressUpgradableStatusList.contains(pao.getStatus());
111 SellerDepositOrderPrdListReq sknListReq = SellerDepositOrderPrdListReq.builder() 124 SellerDepositOrderPrdListReq sknListReq = SellerDepositOrderPrdListReq.builder()
112 .orderCode(orderCode) 125 .orderCode(orderCode)
@@ -125,6 +138,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { @@ -125,6 +138,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
125 .addressUpgradable(addressUpgradable) 138 .addressUpgradable(addressUpgradable)
126 .buttons(aos.detailButtons(oa)) 139 .buttons(aos.detailButtons(oa))
127 .lastExpressInfoDetail(expressInfoService.getLastExpressInfoDetail(pao)) 140 .lastExpressInfoDetail(expressInfoService.getLastExpressInfoDetail(pao))
  141 + .appraiseProgress(orderStatisticInfo)
128 .build() 142 .build()
129 ; 143 ;
130 } 144 }
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; @@ -4,6 +4,7 @@ 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.AppraiseOrderBo; 6 import com.yohobuy.ufo.model.order.bo.AppraiseOrderBo;
  7 +import com.yohobuy.ufo.model.order.bo.DepositOrderStatisticInfo;
7 import com.yohobuy.ufo.model.order.bo.OrderInfo; 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;
@@ -53,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -53,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
53 import org.springframework.stereotype.Service; 54 import org.springframework.stereotype.Service;
54 55
55 import java.math.BigDecimal; 56 import java.math.BigDecimal;
  57 +import java.util.ArrayList;
56 import java.util.List; 58 import java.util.List;
57 import java.util.Map; 59 import java.util.Map;
58 import java.util.Objects; 60 import java.util.Objects;
@@ -594,17 +596,77 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -594,17 +596,77 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
594 596
595 597
596 public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){ 598 public List<AppraiseOrderBo> getSubOrderStatistic(long orderCode){
  599 + List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
  600 + return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()
  601 + .parentOrderCode(pao.getParentOrderCode())
  602 + .orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())
  603 + .collect(Collectors.toList());
  604 + }
  605 +
  606 + private List<AppraiseOrder> buildSubOrderStatisticList(long orderCode){
597 AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode); 607 AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
598 if (Objects.isNull(appraiseOrder)){ 608 if (Objects.isNull(appraiseOrder)){
599 logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode); 609 logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
600 - return null; 610 + return new ArrayList<>(0);
601 } 611 }
602 long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode(); 612 long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
603 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ); 613 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
604 logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList); 614 logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
605 - return paoList.parallelStream().map(pao->AppraiseOrderBo.builder()  
606 - .parentOrderCode(pao.getParentOrderCode())  
607 - .orderCode(orderCode).status(pao.getStatus()).statusCnt(pao.getStatusCnt()).build())  
608 - .collect(Collectors.toList()); 615 + return paoList;
  616 + }
  617 +
  618 + public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){
  619 + List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
  620 +
  621 + //申请
  622 + int applyTotal = 0;
  623 + int shamNum = 0;
  624 + //鉴定为假
  625 + Integer fakeNum = 0;
  626 + //无法鉴定
  627 + Integer unsureNum = 0;
  628 + //鉴定通过
  629 + Integer passNum = 0;
  630 + //鉴定瑕疵
  631 + Integer flawNum = 0;
  632 + int waitingAppraiseNum = 0;
  633 + for (AppraiseOrder pao : paoList){
  634 + int cnt = pao.getStatusCnt();
  635 + AppraiseOrderStatus orderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
  636 + switch (orderStatus){
  637 + case SHAM_SEND_OUT:
  638 + shamNum = cnt;
  639 + break;
  640 + case PLATFORM_APPRAISE_UNSURE:
  641 + unsureNum = cnt;
  642 + break;
  643 + case JUDGE_PASS:
  644 + passNum = cnt;
  645 + break;
  646 + case CHECKING_FAKE:
  647 + fakeNum = cnt;
  648 + break;
  649 + case QUALITY_CHECK_FAKE:
  650 + flawNum = cnt;
  651 + break;
  652 + case PLATFORM_RECEIVE:
  653 + waitingAppraiseNum = cnt;
  654 + break;
  655 + }
  656 + applyTotal += cnt;
  657 + }
  658 + //实收
  659 + Integer receiveTotal = applyTotal - shamNum;
  660 + DepositOrderStatisticInfo dosi = DepositOrderStatisticInfo.builder()
  661 + .applyTotal(applyTotal)
  662 + .unsureNum(unsureNum)
  663 + .passNum(passNum)
  664 + .fakeNum(fakeNum)
  665 + .flawNum(flawNum)
  666 + .receiveTotal(receiveTotal)
  667 + .waitingAppraiseNum(waitingAppraiseNum)
  668 + .build();
  669 +
  670 + return dosi;
609 } 671 }
610 } 672 }