Authored by chenchao

fix sham deliver

@@ -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,
@@ -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" />
@@ -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);
@@ -456,19 +456,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple @@ -456,19 +456,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
456 } 456 }
457 // 457 //
458 Long orderCode = appraiseOrder.getOrderCode(); 458 Long orderCode = appraiseOrder.getOrderCode();
459 - boolean isParent = Objects.isNull(appraiseOrder.getParentOrderCode()); 459 + Long parentOrderCode;
  460 + boolean isParent = Objects.isNull(parentOrderCode=appraiseOrder.getParentOrderCode());
460 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT; 461 AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
  462 + AppraiseOrderStatus expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
461 if(isParent){ 463 if(isParent){
462 - 464 + triggerStatusChangeByParentCode(parentOrderCode, targetOrderStatus, expectedStatus);
463 }else { 465 }else {
464 //no parent 466 //no parent
465 triggerStatusConsistencyCheck(orderCode); 467 triggerStatusConsistencyCheck(orderCode);
466 -  
467 } 468 }
  469 + //notice
468 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, isParent); 470 inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus, isParent);
469 -  
470 - //  
471 -  
472 //refund amount 471 //refund amount
473 new GoodsServiceRefundHandler() 472 new GoodsServiceRefundHandler()
474 .loadLogger(logger) 473 .loadLogger(logger)