Authored by LUOXC

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

@@ -48,6 +48,11 @@ public interface AppraiseOrderMapper { @@ -48,6 +48,11 @@ public interface AppraiseOrderMapper {
48 @Param("expectedStatus")int expectedStatus, 48 @Param("expectedStatus")int expectedStatus,
49 @Param("updateTime")int updateTime); 49 @Param("updateTime")int updateTime);
50 50
  51 + int updateStatusByParentOrderCode(@Param("parentOrderCode") long parentOrderCode,
  52 + @Param("targetStatus")int targetStatus,
  53 + @Param("expectedStatus")int expectedStatus,
  54 + @Param("updateTime")int updateTime);
  55 +
51 // 修改订单的平台发货状态 56 // 修改订单的平台发货状态
52 int updatePlatformDeliveryStatusByOrderCode(@Param("orderCode")long orderCode, 57 int updatePlatformDeliveryStatusByOrderCode(@Param("orderCode")long orderCode,
53 @Param("uid")int uid, 58 @Param("uid")int uid,
@@ -16,5 +16,5 @@ public interface OrdersPayRefundMapper { @@ -16,5 +16,5 @@ public interface OrdersPayRefundMapper {
16 //查看部分退款记录是否存在 -- (新) 16 //查看部分退款记录是否存在 -- (新)
17 OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode); 17 OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode);
18 18
19 - List<OrdersPayRefund> selectByRefundCodes(@Param("refundCodes") Collection<String> refundCode); 19 + List<OrdersPayRefund> selectByRefundCodes(@Param("refundOrderCodes") Collection<String> refundCode);
20 } 20 }
@@ -261,6 +261,16 @@ @@ -261,6 +261,16 @@
261 where order_code =#{orderCode,jdbcType=BIGINT} and status = #{expectedStatus,jdbcType=TINYINT} 261 where order_code =#{orderCode,jdbcType=BIGINT} and status = #{expectedStatus,jdbcType=TINYINT}
262 </update> 262 </update>
263 263
  264 +
  265 + <update id="updateStatusByParentOrderCode">
  266 + update appraise_order
  267 + <set>
  268 + status = #{targetStatus,jdbcType=TINYINT},
  269 + update_time = #{updateTime,jdbcType=INTEGER}
  270 + </set>
  271 + where parent_order_code =#{parentOrderCode,jdbcType=BIGINT} and status = #{expectedStatus,jdbcType=TINYINT}
  272 + </update>
  273 +
264 <select id="selectByOrderCodeList" resultMap="BaseResultMap"> 274 <select id="selectByOrderCodeList" resultMap="BaseResultMap">
265 select 275 select
266 <include refid="Base_Column_List" /> 276 <include refid="Base_Column_List" />
@@ -42,8 +42,8 @@ @@ -42,8 +42,8 @@
42 select 42 select
43 <include refid="Base_Column_List" /> 43 <include refid="Base_Column_List" />
44 from orders_pay_refund 44 from orders_pay_refund
45 - where refund_order_code in  
46 - <foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundOrderCode"> 45 + where refund_code in
  46 + <foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundCode">
47 #{refundCode,jdbcType=VARCHAR} 47 #{refundCode,jdbcType=VARCHAR}
48 </foreach> 48 </foreach>
49 </select> 49 </select>
1 package com.yohoufo.order.service; 1 package com.yohoufo.order.service;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.google.common.collect.Lists;
4 import com.yoho.error.ServiceError; 5 import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 6 import com.yoho.error.exception.ServiceException;
6 import com.yohobuy.ufo.model.order.bo.OrderInfo; 7 import com.yohobuy.ufo.model.order.bo.OrderInfo;
@@ -137,18 +138,30 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { @@ -137,18 +138,30 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService {
137 } 138 }
138 return false; 139 return false;
139 } 140 }
  141 + private static final List<Integer> canRefundStatusListOfPaidAppraiseOrder = Lists.newArrayList(
  142 + AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()
  143 + );
140 144
141 - final static List<Integer> canRefundStatusList = Arrays.asList(AppraiseOrderStatus.WAITING_PAY.getCode(),  
142 - AppraiseOrderStatus.HAS_PAYED.getCode()); 145 +
  146 + private static final List<Integer> canRefundStatusListOfDepositOrder = Lists.newArrayList(
  147 + AppraiseOrderStatus.HAS_PAYED.getCode(),
  148 + AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode(),
  149 + AppraiseOrderStatus.JUDGE_PASS_WAIT_WAREHOUSE.getCode(),
  150 + AppraiseOrderStatus.SHAM_SEND_OUT.getCode(),
  151 + AppraiseOrderStatus.SEND_OUT_TIMEOUT.getCode()
  152 + );
143 153
144 @Override 154 @Override
145 public boolean canRefund(OrderInfo orderInfo) { 155 public boolean canRefund(OrderInfo orderInfo) {
146 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); 156 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes());
147 switch (oa){ 157 switch (oa){
148 case APPRAISE: 158 case APPRAISE:
  159 + if (canRefundStatusListOfPaidAppraiseOrder.contains(orderInfo.getStatus())){
  160 + return true;
  161 + }
149 throw new UfoServiceException(400, "鉴定订单暂不支持退款"); 162 throw new UfoServiceException(400, "鉴定订单暂不支持退款");
150 case DEPOSITE: 163 case DEPOSITE:
151 - if (orderInfo.getStatus() != null && canRefundStatusList.contains(orderInfo.getStatus().intValue())){ 164 + if (orderInfo.getStatus() != null && canRefundStatusListOfDepositOrder.contains(orderInfo.getStatus().intValue())){
152 return true; 165 return true;
153 } 166 }
154 break; 167 break;
@@ -62,6 +62,9 @@ public class GoodsServiceRefundHandler extends AbsRefundOrderHandler { @@ -62,6 +62,9 @@ public class GoodsServiceRefundHandler extends AbsRefundOrderHandler {
62 62
63 @Override 63 @Override
64 public boolean refund() { 64 public boolean refund() {
  65 +
  66 + logger.info("{}.refund uid {} orderCode {} paidOrderCode {}",
  67 + getClass().getSimpleName(), uid, orderCode, paidOrderCode);
65 if (paidOrderCode == null){ 68 if (paidOrderCode == null){
66 throw new UfoServiceException(400, "退款订单不存在"); 69 throw new UfoServiceException(400, "退款订单不存在");
67 } 70 }
@@ -42,6 +42,17 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -42,6 +42,17 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
42 return rows; 42 return rows;
43 } 43 }
44 44
  45 +
  46 + protected int triggerStatusChangeByParentCode(Long parentOrderCode, AppraiseOrderStatus targetStatus, AppraiseOrderStatus expectedStatus){
  47 + int cdt = DateUtil.getCurrentTimeSecond();
  48 + int rows = appraiseOrderMapper.updateStatusByParentOrderCode(parentOrderCode, targetStatus.getCode(), expectedStatus.getCode(), cdt);
  49 + if (rows==0){
  50 + logger.warn("appraise order triggerStatusChange no need update status, parentOrderCode {}", parentOrderCode);
  51 + return 0;
  52 + }
  53 + return rows;
  54 + }
  55 +
45 public int triggerStatusChange(Long orderCode, AppraiseOrderStatus targetStatus, AppraiseOrderStatus expectedStatus){ 56 public int triggerStatusChange(Long orderCode, AppraiseOrderStatus targetStatus, AppraiseOrderStatus expectedStatus){
46 int cdt = DateUtil.getCurrentTimeSecond(); 57 int cdt = DateUtil.getCurrentTimeSecond();
47 int rows = appraiseOrderMapper.updateStatusByOrderCode(orderCode, targetStatus.getCode(), expectedStatus.getCode(), cdt); 58 int rows = appraiseOrderMapper.updateStatusByOrderCode(orderCode, targetStatus.getCode(), expectedStatus.getCode(), cdt);
@@ -111,7 +122,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -111,7 +122,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
111 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; 122 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
112 123
113 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); 124 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
114 - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); 125 + logger.info("appraise order unsure update status, orderCode {} rows {}", orderCode, rows);
115 return rows; 126 return rows;
116 } 127 }
117 128
@@ -122,7 +133,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -122,7 +133,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
122 expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT; 133 expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
123 134
124 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); 135 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
125 - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); 136 + logger.info("appraise order shamDeliver update status, orderCode {} rows {}", orderCode, rows);
126 return rows; 137 return rows;
127 } 138 }
128 139
@@ -133,7 +144,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -133,7 +144,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
133 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; 144 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
134 145
135 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); 146 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
136 - logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); 147 + logger.info("appraise order findFlaw update status, orderCode {} rows {}", orderCode, rows);
137 return rows; 148 return rows;
138 } 149 }
139 } 150 }
@@ -19,10 +19,7 @@ import com.yohoufo.common.utils.DateUtil; @@ -19,10 +19,7 @@ import com.yohoufo.common.utils.DateUtil;
19 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; 19 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
20 import com.yohoufo.dal.order.AppraiseOrderMapper; 20 import com.yohoufo.dal.order.AppraiseOrderMapper;
21 import com.yohoufo.dal.order.AppraiseOrderMetaMapper; 21 import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
22 -import com.yohoufo.dal.order.model.AppraiseOrder;  
23 -import com.yohoufo.dal.order.model.AppraiseOrderGoods;  
24 -import com.yohoufo.dal.order.model.AppraiseOrderMeta;  
25 -import com.yohoufo.dal.order.model.QiniuLiveRecord; 22 +import com.yohoufo.dal.order.model.*;
26 import com.yohoufo.order.common.ClientType; 23 import com.yohoufo.order.common.ClientType;
27 import com.yohoufo.order.constants.MetaKey; 24 import com.yohoufo.order.constants.MetaKey;
28 import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; 25 import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor;
@@ -30,6 +27,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor; @@ -30,6 +27,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor;
30 import com.yohoufo.order.model.dto.AppraiseOrderContext; 27 import com.yohoufo.order.model.dto.AppraiseOrderContext;
31 import com.yohoufo.order.service.IExpressInfoService; 28 import com.yohoufo.order.service.IExpressInfoService;
32 import com.yohoufo.order.service.IGoodsService; 29 import com.yohoufo.order.service.IGoodsService;
  30 +import com.yohoufo.order.service.handler.GoodsServiceRefundHandler;
33 import com.yohoufo.order.service.proxy.InBoxFacade; 31 import com.yohoufo.order.service.proxy.InBoxFacade;
34 import com.yohoufo.order.service.proxy.ProductProxyService; 32 import com.yohoufo.order.service.proxy.ProductProxyService;
35 import com.yohoufo.order.service.proxy.UserProxyService; 33 import com.yohoufo.order.service.proxy.UserProxyService;
@@ -86,6 +84,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -86,6 +84,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
86 @Autowired 84 @Autowired
87 private InBoxFacade inBoxFacade; 85 private InBoxFacade inBoxFacade;
88 86
  87 + @Autowired
  88 + private PayRefundService payRefundService;
  89 +
89 90
90 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ 91 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
91 logger.info("in AppraiseOrderService.compute req {}", req); 92 logger.info("in AppraiseOrderService.compute req {}", req);
@@ -410,6 +411,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -410,6 +411,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
410 return rows; 411 return rows;
411 } 412 }
412 413
  414 +
413 /** 415 /**
414 * 无法鉴别 416 * 无法鉴别
415 * @param appraiseOrder 417 * @param appraiseOrder
@@ -418,8 +420,20 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -418,8 +420,20 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
418 public int unsure(AppraiseOrder appraiseOrder){ 420 public int unsure(AppraiseOrder appraiseOrder){
419 int rows; 421 int rows;
420 if ((rows=super.unsure(appraiseOrder))>0){ 422 if ((rows=super.unsure(appraiseOrder))>0){
  423 + Integer uid = appraiseOrder.getUid();
  424 + Long orderCode = appraiseOrder.getOrderCode();
  425 +
  426 + new GoodsServiceRefundHandler()
  427 + .loadLogger(logger)
  428 + .loadUser(uid)
  429 + .loadActionCase(SellerWalletDetail.Type.APPRAISE_UNSURE)
  430 + .loadRefundAction(payRefundService::refund)
  431 + .loadOrder(orderCode, orderCode, appraiseOrder.getPayment(), appraiseOrder.getAmount())
  432 + .refund();
  433 +
  434 +
421 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE; 435 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
422 - inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus); 436 + inBoxFacade.paidAppraiseOrderNotice(uid, orderCode, targetStatus);
423 } 437 }
424 return rows; 438 return rows;
425 } 439 }
@@ -184,9 +184,11 @@ public class DepositHelpService { @@ -184,9 +184,11 @@ public class DepositHelpService {
184 184
185 List<AppraiseOrder> appraiseOrders = appraiseOrderMapper.selectByOrderCodeList(appraiseOrderList); 185 List<AppraiseOrder> appraiseOrders = appraiseOrderMapper.selectByOrderCodeList(appraiseOrderList);
186 186
187 -  
188 return appraiseOrders.stream().collect(Collectors.toMap(AppraiseOrder::getOrderCode, 187 return appraiseOrders.stream().collect(Collectors.toMap(AppraiseOrder::getOrderCode,
189 - item -> AppraiseOrderStatus.getStatusStrByCode(item.getStatus()))); 188 + item -> {
  189 + AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(item.getStatus());
  190 + return aos.statusStr(OrderAttributes.DEPOSITE);
  191 + }));
190 } 192 }
191 193
192 194
@@ -146,6 +146,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -146,6 +146,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
146 private final String last_seller_un_accept = "。"; 146 private final String last_seller_un_accept = "。";
147 private final String last_seller_confirm = ",等待买家确认。"; 147 private final String last_seller_confirm = ",等待买家确认。";
148 148
  149 +
  150 + private final static String DEFAULT_EXPRESS_TITLE = "订单跟踪";
  151 + private final static String APPRAISE_EXPRESS_TITLE = "物流详情";
  152 +
149 @Autowired 153 @Autowired
150 private SkupService skupService; 154 private SkupService skupService;
151 155
@@ -494,7 +498,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -494,7 +498,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
494 } 498 }
495 499
496 //1.物流单号信息 500 //1.物流单号信息
497 - constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo); 501 + constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo, DEFAULT_EXPRESS_TITLE);
498 502
499 // 构造物流信息 503 // 构造物流信息
500 if (expressTypeList.size() == 1) { 504 if (expressTypeList.size() == 1) {
@@ -600,7 +604,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -600,7 +604,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
600 } 604 }
601 605
602 // 物流单号信息 606 // 物流单号信息
603 - constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo); 607 + constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo, APPRAISE_EXPRESS_TITLE);
604 608
605 // 根据订单号and物流类型 返回物流信息 609 // 根据订单号and物流类型 返回物流信息
606 List<ExpressInfoDetail> expressInfoDetailList = getExpressInfoDetailListByOrderCodeExpressType(orderCode, expressTypeList); 610 List<ExpressInfoDetail> expressInfoDetailList = getExpressInfoDetailListByOrderCodeExpressType(orderCode, expressTypeList);
@@ -629,7 +633,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -629,7 +633,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
629 } 633 }
630 634
631 // 物流单号信息 635 // 物流单号信息
632 - constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo); 636 + constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo, DEFAULT_EXPRESS_TITLE);
633 637
634 // 根据订单号and物流类型 返回物流信息 638 // 根据订单号and物流类型 返回物流信息
635 List<ExpressInfoDetail> expressInfoDetailList = getExpressInfoDetailListByOrderCodeExpressType(orderCode, expressTypeList); 639 List<ExpressInfoDetail> expressInfoDetailList = getExpressInfoDetailListByOrderCodeExpressType(orderCode, expressTypeList);
@@ -650,7 +654,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -650,7 +654,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
650 } 654 }
651 655
652 // 物流单号信息 656 // 物流单号信息
653 - constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo); 657 + constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo, DEFAULT_EXPRESS_TITLE);
654 658
655 // 其中是否包含了 鉴定中心内部调拨信息 659 // 其中是否包含了 鉴定中心内部调拨信息
656 if (expressTypeList.contains(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode())){ 660 if (expressTypeList.contains(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode())){
@@ -694,7 +698,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -694,7 +698,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
694 //如果还没有新的物流信息,卖家显示上一个阶段的物流 698 //如果还没有新的物流信息,卖家显示上一个阶段的物流
695 if (StringUtils.isBlank(expressInfoRespBo.getExpressSender())) { 699 if (StringUtils.isBlank(expressInfoRespBo.getExpressSender())) {
696 //物流单号信息 700 //物流单号信息
697 - constructWayBillInfo(orderCode, Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()), expressInfoRespBo); 701 + constructWayBillInfo(orderCode, Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()), expressInfoRespBo, DEFAULT_EXPRESS_TITLE);
698 } 702 }
699 List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode()); 703 List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
700 constructExpressInfo(actor, previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList()); 704 constructExpressInfo(actor, previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
@@ -703,7 +707,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -703,7 +707,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
703 } 707 }
704 708
705 //物流单号信息 709 //物流单号信息
706 - private void constructWayBillInfo(Long orderCode, List<Integer> expressTypeList, ExpressInfoRespBo expressInfoRespBo) { 710 + private void constructWayBillInfo(Long orderCode, List<Integer> expressTypeList, ExpressInfoRespBo expressInfoRespBo, String expressTitle) {
707 Integer expressType = 0; 711 Integer expressType = 0;
708 for (Integer i : expressTypeList) { 712 for (Integer i : expressTypeList) {
709 if (EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(i)) { 713 if (EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(i)) {
@@ -720,7 +724,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -720,7 +724,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
720 //物流类型 724 //物流类型
721 expressInfoRespBo.setExpressType(expressType.byteValue()); 725 expressInfoRespBo.setExpressType(expressType.byteValue());
722 //物流发货方 726 //物流发货方
723 - expressInfoRespBo.setExpressSender(getSenderName(expressInfoRespBo.getExpressType().intValue())); 727 + expressInfoRespBo.setExpressSender(expressTitle);
724 // 快递公司名称 728 // 快递公司名称
725 expressInfoRespBo.setExpressCompanyName(expressCompanyService.getExpressName(expressRecord.getLogisticsType())); 729 expressInfoRespBo.setExpressCompanyName(expressCompanyService.getExpressName(expressRecord.getLogisticsType()));
726 } 730 }
@@ -3,13 +3,18 @@ package com.yohoufo.order.service.impl; @@ -3,13 +3,18 @@ package com.yohoufo.order.service.impl;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.yohoufo.common.alarm.CommonAlarmEventPublisher; 5 import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
  6 +import com.yohoufo.common.utils.BigDecimalHelper;
  7 +import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
6 import com.yohoufo.dal.order.SellerOrderMetaMapper; 8 import com.yohoufo.dal.order.SellerOrderMetaMapper;
7 import com.yohoufo.dal.order.TradeBillsMapper; 9 import com.yohoufo.dal.order.TradeBillsMapper;
  10 +import com.yohoufo.dal.order.model.AppraiseOrderMeta;
8 import com.yohoufo.dal.order.model.SellerOrder; 11 import com.yohoufo.dal.order.model.SellerOrder;
9 import com.yohoufo.dal.order.model.SellerOrderMeta; 12 import com.yohoufo.dal.order.model.SellerOrderMeta;
10 import com.yohoufo.dal.order.model.TradeBills; 13 import com.yohoufo.dal.order.model.TradeBills;
11 import com.yohobuy.ufo.model.order.common.Payment; 14 import com.yohobuy.ufo.model.order.common.Payment;
12 import com.yohoufo.order.common.BillTradeStatus; 15 import com.yohoufo.order.common.BillTradeStatus;
  16 +import com.yohoufo.order.constants.MetaKey;
  17 +import com.yohoufo.order.model.dto.SellerOrderComputeResult;
13 import org.slf4j.Logger; 18 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
15 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +38,12 @@ public class TradeBillsService { @@ -33,6 +38,12 @@ public class TradeBillsService {
33 @Autowired 38 @Autowired
34 TradeBillsMapper tradeBillsMapper; 39 TradeBillsMapper tradeBillsMapper;
35 40
  41 + @Autowired
  42 + private ServiceOrderProcessor serviceOrderProcessor;
  43 +
  44 + @Autowired
  45 + private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
  46 +
36 /** 47 /**
37 * 退保证金流水记录 48 * 退保证金流水记录
38 * 49 *
@@ -42,27 +53,59 @@ public class TradeBillsService { @@ -42,27 +53,59 @@ public class TradeBillsService {
42 * @param payType 53 * @param payType
43 * @param tradeStatus 54 * @param tradeStatus
44 */ 55 */
45 - public void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType, Integer tradeStatus) {  
46 - backPayEnsureRecord(uid, skup, orderCode, payType, tradeStatus, null, null);  
47 - } 56 + public void backPayEnsureRecord(Integer uid,
  57 + Integer skup,
  58 + Long orderCode,
  59 + Integer payType,
  60 + Integer tradeStatus) {
48 61
49 - public void backPayEnsureRecord(SellerOrder sellerOrder, Integer tradeStatus, BigDecimal backEarnestMoney, SellerOrderMeta meta) {  
50 - backPayEnsureRecord(sellerOrder.getUid(), sellerOrder.getSkup(), sellerOrder.getOrderCode(), sellerOrder.getPayment(), tradeStatus, backEarnestMoney, meta);  
51 - }  
52 62
53 - private void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType,  
54 - Integer tradeStatus,  
55 - BigDecimal backEarnestMoney, SellerOrderMeta meta) {  
56 - if (payType != null && Payment.WALLET.getCode() == payType) { 63 + String computeResultVal = null;
  64 +
  65 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  66 + AppraiseOrderMeta feeCondition = new AppraiseOrderMeta();
  67 + feeCondition.setOrderCode(orderCode);
  68 + feeCondition.setMetaKey(MetaKey.SELLER_FEE);
  69 + AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition);
  70 + computeResultVal = Objects.nonNull(feeMeta) ? feeMeta.getMetaValue() : null;
  71 + logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} computeResultVal {}", orderCode, computeResultVal);
  72 + }else {
  73 + SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
  74 + computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null;
  75 + logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal);
  76 + }
  77 +
  78 + if (Objects.isNull(computeResultVal)) {
  79 + logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup);
57 return; 80 return;
58 } 81 }
59 - if (Objects.isNull(meta)) {  
60 - meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, "fee"); 82 + try{
  83 + SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
  84 + BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
  85 + BigDecimal systemAmount = calSystemAmountByComputeResult(socr);
  86 + backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount);
  87 +
  88 + }catch (Exception ex){
  89 + logger.error("backPayEnsureRecord error, uid {},orderCode {} computeResultVal {}",
  90 + uid, orderCode, computeResultVal, ex);
61 } 91 }
62 - if (Objects.isNull(meta)) {  
63 - logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup); 92 +
  93 +
  94 + }
  95 +
  96 +
  97 + private void backPayEnsureRecord0(Integer uid,
  98 + Long orderCode,
  99 + Integer payType,
  100 + Integer tradeStatus,
  101 + BigDecimal earnestMoney,
  102 + BigDecimal systemAmount
  103 + ) {
  104 + if (payType != null && Payment.WALLET.getCode() == payType) {
64 return; 105 return;
65 } 106 }
  107 +
  108 +
66 // 增加流水记录 109 // 增加流水记录
67 TradeBills record = new TradeBills(); 110 TradeBills record = new TradeBills();
68 record.setUid(uid); 111 record.setUid(uid);
@@ -72,25 +115,26 @@ public class TradeBillsService { @@ -72,25 +115,26 @@ public class TradeBillsService {
72 record.setPayType(payType);// 1:支付宝; 2:微信 115 record.setPayType(payType);// 1:支付宝; 2:微信
73 record.setTradeType(1);//1:保证金;2:货款;3:补偿款 116 record.setTradeType(1);//1:保证金;2:货款;3:补偿款
74 record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出 117 record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出
75 - BigDecimal earnestMoney = backEarnestMoney;  
76 - BigDecimal amount = BigDecimal.ZERO;  
77 - try {  
78 - JSONObject metavalue = JSON.parseObject(meta.getMetaValue());  
79 - BigDecimal rate = metavalue.getJSONObject("serviceFeeRate").getBigDecimal("payChannelRate");  
80 - if (Objects.isNull(earnestMoney)) {  
81 - earnestMoney = metavalue.getJSONObject("earnestMoney").getBigDecimal("earnestMoney");  
82 - }  
83 - amount = earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).multiply(new BigDecimal("-1")).setScale(2, BigDecimal.ROUND_HALF_UP);  
84 - } catch (Exception e) {  
85 - logger.error("PayRecordErr计费信息不完整, uid is {}, skup is {}, err is {}", uid, skup, e.getMessage());  
86 - }  
87 record.setAmount(earnestMoney); 118 record.setAmount(earnestMoney);
88 - record.setSystemAmount(amount);// 有货收入 119 + record.setSystemAmount(systemAmount);// 有货收入
89 record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结 120 record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结
90 record.setCreateTime((int) (System.currentTimeMillis() / 1000)); 121 record.setCreateTime((int) (System.currentTimeMillis() / 1000));
91 addTradeBills(record); 122 addTradeBills(record);
92 } 123 }
93 124
  125 +
  126 + BigDecimal calSystemAmountByComputeResult(SellerOrderComputeResult socr){
  127 + BigDecimal amount = BigDecimal.ZERO;
  128 + try {
  129 + BigDecimal rate = socr.getServiceFeeRate().getPayChannelRate();
  130 + BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
  131 + amount = BigDecimalHelper.halfUp(earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).negate());
  132 + } catch (Exception e) {
  133 + logger.warn("calSystemAmountByComputeResult fail SellerOrderComputeResult {}", socr);
  134 + }
  135 + return amount;
  136 + }
  137 +
94 /** 138 /**
95 * 退付货款流水记录 139 * 退付货款流水记录
96 * 140 *
@@ -1039,7 +1039,7 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1039,7 +1039,7 @@ public class InBoxFacade extends BaseNoticeFacade{
1039 1039
1040 1040
1041 1041
1042 - public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){ 1042 + public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus, boolean isParent){
1043 log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus); 1043 log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
1044 try { 1044 try {
1045 // 1045 //
@@ -1089,9 +1089,16 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1089,9 +1089,16 @@ public class InBoxFacade extends BaseNoticeFacade{
1089 smsParams = new Object[]{orderCode}; 1089 smsParams = new Object[]{orderCode};
1090 break; 1090 break;
1091 case SHAM_SEND_OUT: 1091 case SHAM_SEND_OUT:
1092 - inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_MISS_GOODS;  
1093 - // get product info 「商品名称」「尺码」「货号」  
1094 - inboxParams = buildParams4SellerDepositOrder(orderCode); 1092 + if(isParent){
  1093 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_SHAM_DELIVER;
  1094 + inboxParams = new Object[]{orderCode};
  1095 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_SHAM_DELIVER;
  1096 + smsParams = inboxParams;
  1097 + }else {
  1098 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_MISS_GOODS;
  1099 + // get product info 「商品名称」「尺码」「货号」
  1100 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1101 + }
1095 break; 1102 break;
1096 case QUALITY_CHECK_FAKE: 1103 case QUALITY_CHECK_FAKE:
1097 inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FIND_FLAW_OR_BIGGER; 1104 inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FIND_FLAW_OR_BIGGER;
@@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo; @@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo;
16 import com.yohobuy.ufo.model.order.vo.ProductVo; 16 import com.yohobuy.ufo.model.order.vo.ProductVo;
17 import com.yohoufo.common.helper.ImageUrlAssist; 17 import com.yohoufo.common.helper.ImageUrlAssist;
18 import com.yohoufo.common.utils.BigDecimalHelper; 18 import com.yohoufo.common.utils.BigDecimalHelper;
  19 +import com.yohoufo.common.utils.DateUtil;
19 import com.yohoufo.dal.order.*; 20 import com.yohoufo.dal.order.*;
20 import com.yohoufo.dal.order.model.*; 21 import com.yohoufo.dal.order.model.*;
21 import com.yohoufo.order.constants.MetaKey; 22 import com.yohoufo.order.constants.MetaKey;
@@ -200,6 +201,8 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -200,6 +201,8 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
200 .orderCode(pao.getOrderCode()) 201 .orderCode(pao.getOrderCode())
201 .status(pao.getStatus()) 202 .status(pao.getStatus())
202 .statuStr(appraiseOrderStatus.statusStr(oa)) 203 .statuStr(appraiseOrderStatus.statusStr(oa))
  204 + .payTime(DateUtil.formatYYMMddHHmmssPoint(pao.getCreateTime()))
  205 + .payTime(DateUtil.formatYYMMddHHmmssPoint(ordersPayRefund.getCreateTime()))
203 .build(); 206 .build();
204 207
205 return resp; 208 return resp;
@@ -164,8 +164,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -164,8 +164,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
164 .orderAttributes(getOrderAttributes()) 164 .orderAttributes(getOrderAttributes())
165 .build(); 165 .build();
166 appraiseOrderCreateService.createSellerDepoistOrder(context); 166 appraiseOrderCreateService.createSellerDepoistOrder(context);
167 - //TODO notice  
168 - 167 + //
  168 + SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);
  169 + event.setUid(req.getUid());
  170 + event.setOrderCode(orderCode);
  171 + EventBusPublisher.publishEvent(event);
  172 + logger.info("submit seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event);
169 return SellerDepositOrderSubmitResp.builder().orderCode(orderCode).build(); 173 return SellerDepositOrderSubmitResp.builder().orderCode(orderCode).build();
170 } 174 }
171 175
@@ -208,12 +212,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -208,12 +212,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
208 case WAITING_PAY: 212 case WAITING_PAY:
209 targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_PAY; 213 targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_PAY;
210 super.triggerStatusChange(orderCode, targetOrderStatus, appraiseOrderStatus); 214 super.triggerStatusChange(orderCode, targetOrderStatus, appraiseOrderStatus);
211 - inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus); 215 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus, true);
212 break; 216 break;
213 case HAS_PAYED: 217 case HAS_PAYED:
214 targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_DELIVER; 218 targetOrderStatus = AppraiseOrderStatus.CANCEL_BEFORE_DELIVER;
215 super.triggerStatusChange(orderCode, targetOrderStatus , appraiseOrderStatus); 219 super.triggerStatusChange(orderCode, targetOrderStatus , appraiseOrderStatus);
216 - inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus); 220 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetOrderStatus, true);
217 //refund amount 221 //refund amount
218 new GoodsServiceRefundHandler() 222 new GoodsServiceRefundHandler()
219 .loadLogger(logger) 223 .loadLogger(logger)
@@ -231,6 +235,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -231,6 +235,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
231 } 235 }
232 236
233 public int cancelByTimeout(OrderCancelEvent orderCancelEvent){ 237 public int cancelByTimeout(OrderCancelEvent orderCancelEvent){
  238 + logger.info("in seller deposit order cancelByTimeout orderCancelEvent {}", orderCancelEvent);
234 Long orderCode = orderCancelEvent.getOrderCode(); 239 Long orderCode = orderCancelEvent.getOrderCode();
235 int uid = orderCancelEvent.getUid(); 240 int uid = orderCancelEvent.getUid();
236 if(!serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ 241 if(!serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
@@ -255,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -255,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
255 switch (appraiseOrderStatus){ 260 switch (appraiseOrderStatus){
256 case WAITING_PAY: 261 case WAITING_PAY:
257 Payment payment = Payment.getPayment(pao.getPayment()); 262 Payment payment = Payment.getPayment(pao.getPayment());
258 - AbstractPayService payService = paymentService.getPayService(payment.getCode());  
259 - PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());  
260 -  
261 - if (payQueryBo != null && payQueryBo.isPayStatus()){  
262 - logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);  
263 - PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());  
264 - EventBusPublisher.publishEvent(event);  
265 - }  
266 - // 如果近1分钟有预支付记录,则发送 自动取消延迟消息  
267 - if ( !orderCancelEvent.isFinalRetry()){  
268 - paymentService.checkPrePay(uid, orderCode); 263 + if (Objects.nonNull(payment)) {
  264 + AbstractPayService payService = paymentService.getPayService(payment.getCode());
  265 + PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
  266 +
  267 + if (payQueryBo != null && payQueryBo.isPayStatus()) {
  268 + logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
  269 + PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
  270 + EventBusPublisher.publishEvent(event);
  271 + }
  272 + // 如果近1分钟有预支付记录,则发送 自动取消延迟消息
  273 + if (!orderCancelEvent.isFinalRetry()) {
  274 + paymentService.checkPrePay(uid, orderCode);
  275 + }
269 } 276 }
270 rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus); 277 rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus);
271 break; 278 break;
@@ -287,7 +294,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -287,7 +294,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
287 Long orderCode = req.getOrderCode(); 294 Long orderCode = req.getOrderCode();
288 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SELLER_SEND_OUT; 295 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
289 // 296 //
290 - inBoxFacade.sellerDepositOrderNotice(req.getUid(), orderCode, targetOrderStatus); 297 + inBoxFacade.sellerDepositOrderNotice(req.getUid(), orderCode, targetOrderStatus, true);
291 //split sku 2 order 298 //split sku 2 order
292 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode); 299 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
293 SellerDepositOrderListService.OrderDataNode node = sellerDepositOrderListService.buildDataSourceOfParentOrder(orderCode, paogList); 300 SellerDepositOrderListService.OrderDataNode node = sellerDepositOrderListService.buildDataSourceOfParentOrder(orderCode, paogList);
@@ -339,7 +346,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -339,7 +346,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
339 triggerStatusConsistencyCheck(orderCode); 346 triggerStatusConsistencyCheck(orderCode);
340 347
341 Long paidCode = pao.getParentOrderCode(); 348 Long paidCode = pao.getParentOrderCode();
342 - inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus); 349 + inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus, false);
343 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode); 350 BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
344 if (left.compareTo(BigDecimal.ZERO)>0){ 351 if (left.compareTo(BigDecimal.ZERO)>0){
345 352
@@ -405,7 +412,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -405,7 +412,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
405 triggerStatusConsistencyCheck(orderCode); 412 triggerStatusConsistencyCheck(orderCode);
406 // 413 //
407 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE; 414 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
408 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 415 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, false);
409 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 416 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
410 return rows; 417 return rows;
411 } 418 }
@@ -433,7 +440,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -433,7 +440,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
433 .refund(); 440 .refund();
434 441
435 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE; 442 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
436 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 443 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus, false);
437 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode()); 444 depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
438 return rows; 445 return rows;
439 } 446 }
@@ -451,10 +458,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -451,10 +458,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
451 } 458 }
452 // 459 //
453 Long orderCode = appraiseOrder.getOrderCode(); 460 Long orderCode = appraiseOrder.getOrderCode();
454 - triggerStatusConsistencyCheck(orderCode);  
455 - // 461 + Long parentOrderCode;
  462 + boolean isParent = Objects.isNull(parentOrderCode=appraiseOrder.getParentOrderCode());
456 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT; 463 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
457 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus); 464 + AppraiseOrderStatus expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
  465 + if(isParent){
  466 + triggerStatusChangeByParentCode(parentOrderCode, targetOrderStatus, expectedStatus);
  467 + }else {
  468 + //no parent
  469 + triggerStatusConsistencyCheck(orderCode);
  470 + }
  471 + //notice
  472 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, isParent);
458 //refund amount 473 //refund amount
459 new GoodsServiceRefundHandler() 474 new GoodsServiceRefundHandler()
460 .loadLogger(logger) 475 .loadLogger(logger)
@@ -576,7 +591,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -576,7 +591,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
576 Long orderCode = appraiseOrder.getOrderCode(); 591 Long orderCode = appraiseOrder.getOrderCode();
577 triggerStatusConsistencyCheck(orderCode); 592 triggerStatusConsistencyCheck(orderCode);
578 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE; 593 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
579 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus); 594 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, false);
580 new GoodsServiceRefundHandler() 595 new GoodsServiceRefundHandler()
581 .loadLogger(logger) 596 .loadLogger(logger)
582 .loadUser(appraiseOrder.getUid()) 597 .loadUser(appraiseOrder.getUid())
@@ -606,12 +621,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -606,12 +621,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
606 Long orderCode = orderInfo.getOrderCode(); 621 Long orderCode = orderInfo.getOrderCode();
607 Integer uid = orderInfo.getUid(); 622 Integer uid = orderInfo.getUid();
608 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED; 623 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.HAS_PAYED;
609 - inBoxFacade.sellerDepositOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetOrderStatus);  
610 - SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(this::handleOrderCancelAsyncEvent);  
611 - event.setUid(uid);  
612 - event.setOrderCode(orderCode);  
613 - EventBusPublisher.publishEvent(event);  
614 - logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out, event {}", event); 624 + inBoxFacade.sellerDepositOrderNotice(uid, orderInfo.getOrderCode(), targetOrderStatus, true);
  625 +
  626 +
615 SellerCancelDeliverEvent cancelDeliverEvent = 627 SellerCancelDeliverEvent cancelDeliverEvent =
616 SellerCancelDeliverEvent.builder() 628 SellerCancelDeliverEvent.builder()
617 .uid(orderInfo.getUid()) 629 .uid(orderInfo.getUid())
@@ -722,7 +734,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -722,7 +734,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
722 734
723 if(rows>0){ 735 if(rows>0){
724 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; 736 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
725 - inBoxFacade.sellerDepositOrderNotice(uid, parentCode, targetOrderStatus); 737 + inBoxFacade.sellerDepositOrderNotice(uid, parentCode, targetOrderStatus, true);
726 738
727 } 739 }
728 return rows; 740 return rows;
@@ -750,7 +762,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -750,7 +762,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
750 orderCode, parentOrderCode, prows); 762 orderCode, parentOrderCode, prows);
751 if (prows>0){ 763 if (prows>0){
752 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH; 764 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH;
753 - inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), parentOrderCode, targetStatus); 765 + inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), parentOrderCode, targetStatus, true);
754 } 766 }
755 return prows; 767 return prows;
756 } 768 }
@@ -758,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -758,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
758 } 770 }
759 771
760 public void triggerStatusConsistencyCheck(long orderCode){ 772 public void triggerStatusConsistencyCheck(long orderCode){
  773 + logger.info("triggerStatusConsistencyCheck orderCode {}", orderCode);
761 SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent 774 SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
762 = new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish); 775 = new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
763 asyncEvent.setOrderCode(orderCode); 776 asyncEvent.setOrderCode(orderCode);
@@ -800,7 +813,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -800,7 +813,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
800 .loadOrder(orderCode, orderCode, pao.getPayment(), pao.getAmount()) 813 .loadOrder(orderCode, orderCode, pao.getPayment(), pao.getAmount())
801 .refund(); 814 .refund();
802 //notice 815 //notice
803 - inBoxFacade.sellerDepositOrderNotice(uid, orderCode, targetOrderStatus); 816 + inBoxFacade.sellerDepositOrderNotice(uid, orderCode, targetOrderStatus, true);
804 } 817 }
805 818
806 819