...
|
...
|
@@ -31,6 +31,7 @@ import com.yohoufo.order.constants.MetaKey; |
|
|
import com.yohoufo.order.event.OrderCancelEvent;
|
|
|
import com.yohoufo.order.event.PayConfirmEvent;
|
|
|
import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent;
|
|
|
import com.yohoufo.order.event.SellerDepositOrderStatusConsistencyAsyncEvent;
|
|
|
import com.yohoufo.order.model.PayQueryBo;
|
|
|
import com.yohoufo.order.model.dto.PlatformFeeDto;
|
|
|
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
|
...
|
...
|
@@ -54,10 +55,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
...
|
...
|
@@ -343,6 +341,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
//
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
|
|
|
Long paidCode = pao.getParentOrderCode();
|
|
|
inBoxFacade.sellerDepositOrderNotice(pao.getUid(), orderCode, targetStatus);
|
|
|
BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
|
...
|
...
|
@@ -405,6 +406,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
//
|
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
//
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.CHECKING_FAKE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
...
|
...
|
@@ -421,6 +426,9 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
//
|
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
...
|
...
|
@@ -447,6 +455,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
//
|
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
//
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.SHAM_SEND_OUT;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
//refund amount
|
...
|
...
|
@@ -567,16 +579,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
Long orderCode = appraiseOrder.getOrderCode();
|
|
|
triggerStatusConsistencyCheck(orderCode);
|
|
|
AppraiseOrderStatus targetOrderStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE;
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetOrderStatus);
|
|
|
inBoxFacade.sellerDepositOrderNotice(appraiseOrder.getUid(), orderCode, targetOrderStatus);
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(appraiseOrder.getUid())
|
|
|
.loadActionCase(SellerWalletDetail.Type.FLAW)
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
|
|
|
.loadOrder(orderCode, appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
|
|
|
.refund();
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), orderCode, appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -621,12 +635,23 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
|
|
|
return new ArrayList<>(0);
|
|
|
}
|
|
|
long occ = appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
|
|
|
long occ = findoutParentOrderCode(orderCode);
|
|
|
List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderStatistic(occ);
|
|
|
logger.info("getSubOrderStatistic orderCode {} ParentOrderCode {} AppraiseOrder list {}", orderCode, occ, paoList);
|
|
|
return paoList;
|
|
|
}
|
|
|
|
|
|
private Long findoutParentOrderCode(long orderCode){
|
|
|
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
if (Objects.isNull(appraiseOrder)){
|
|
|
logger.warn("in getSubOrderStatistic selectByOrderCode null, orderCode {}", orderCode);
|
|
|
return orderCode;
|
|
|
}
|
|
|
return appraiseOrder.getParentOrderCode()==null ? orderCode : appraiseOrder.getParentOrderCode();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DepositOrderStatisticInfo getAppraiseProgress(int uid, long orderCode){
|
|
|
List<AppraiseOrder> paoList = buildSubOrderStatisticList(orderCode);
|
|
|
|
...
|
...
|
@@ -681,4 +706,33 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
|
|
|
return dosi;
|
|
|
}
|
|
|
|
|
|
public int platformFinishReceiveGoods(long parentCode){
|
|
|
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FINISH,
|
|
|
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
|
|
|
return triggerStatusChange(parentCode,targetStatus,expectedStatus);
|
|
|
}
|
|
|
|
|
|
|
|
|
public int detectAppraiseFinish(SellerDepositOrderStatusConsistencyAsyncEvent event ){
|
|
|
logger.info("detectAppraiseFinish event {}", event);
|
|
|
long orderCode = event.getOrderCode();
|
|
|
long parentOrderCode = findoutParentOrderCode(orderCode);
|
|
|
int cnt =appraiseOrderMapper.selectSubOrderCntIncludeStatus(parentOrderCode,Arrays.asList(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode()));
|
|
|
logger.info("detectAppraiseFinish event {},parentOrderCode {} PLATFORM_RECEIVE count {}", event, parentOrderCode, cnt);
|
|
|
if (cnt == 0){
|
|
|
int prows = platformFinishReceiveGoods(parentOrderCode);
|
|
|
logger.info("detectAppraiseFinish platformFinishReceiveGoods, orderCode {},parentOrderCode {} parent count {}",
|
|
|
orderCode, parentOrderCode, prows);
|
|
|
return prows;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
public void triggerStatusConsistencyCheck(long orderCode){
|
|
|
SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
|
|
|
= new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
|
|
|
asyncEvent.setOrderCode(orderCode);
|
|
|
EventBusPublisher.publishEvent(asyncEvent);
|
|
|
}
|
|
|
} |
...
|
...
|
|