...
|
...
|
@@ -106,7 +106,8 @@ public class BuyerOrderCancelService { |
|
|
BuyerPenaltyCalResult bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, targetOrderStatus);
|
|
|
logger.info("in buyer cancel BeforeSellerDeliver, event {} BuyerPenaltyCalResult {}", bsdEvent, bpcr);
|
|
|
//买家实付金额(货款+运费)小于赔偿金的额度,不够赔偿的,则不允许取消
|
|
|
if(bsdEvent.getAmount()==null||bsdEvent.getAmount().compareTo(bpcr.getPenaltyAmount()) < 0){
|
|
|
BigDecimal penaltyAmount;
|
|
|
if(bsdEvent.getAmount()==null||bsdEvent.getAmount().compareTo(penaltyAmount=bpcr.getPenaltyAmount()) < 0){
|
|
|
logger.warn("in buyer cancel BeforeSellerDeliver not allow cancel cause of buyer amount lower than BuyerCompensateMoney, event {} compensate {}", bsdEvent, bpcr);
|
|
|
throw new com.yohoufo.common.exception.UfoServiceException(400,"买家赔偿金低于商品售价,不允许取消");
|
|
|
}
|
...
|
...
|
@@ -116,8 +117,8 @@ public class BuyerOrderCancelService { |
|
|
int currentTime = DateUtil.getCurrentTimeSecond();
|
|
|
int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), targetOrderStatus.getCode(), currentTime);
|
|
|
if (rows>0) {
|
|
|
boolean noResponsibility = Objects.isNull(bpcr.getPenaltyAmount())
|
|
|
|| BigDecimal.ZERO.compareTo(bpcr.getPenaltyAmount()) == 0;
|
|
|
boolean noResponsibility = Objects.isNull(penaltyAmount)
|
|
|
|| BigDecimal.ZERO.compareTo(penaltyAmount) == 0;
|
|
|
//退还优惠券
|
|
|
refundCouponIfNeed(buyerUid, orderCode);
|
|
|
int skup = bsdEvent.getSkup();
|
...
|
...
|
@@ -136,7 +137,7 @@ public class BuyerOrderCancelService { |
|
|
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
|
|
|
}else {
|
|
|
inBoxFacade.buyerCancelBeforeSellerDeliver(buyerUid, orderCode,
|
|
|
bpcr.getPenaltyAmount().toPlainString(), psog);
|
|
|
penaltyAmount.toPlainString(), psog);
|
|
|
}
|
|
|
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
|
|
|
//(退费)退保证金给卖家
|
...
|
...
|
@@ -222,7 +223,8 @@ public class BuyerOrderCancelService { |
|
|
BuyerPenaltyCalResult bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, targetOrderStatus);
|
|
|
logger.info("in buyer cancel BeforeDepotReceive, event {} compensate {}", bdrEvent, bpcr);
|
|
|
//买家实付金额(货款+运费)小于赔偿金的额度,不够赔偿的,则不允许取消
|
|
|
if(bdrEvent.getAmount()==null||bdrEvent.getAmount().compareTo(bpcr.getPenaltyAmount()) < 0){
|
|
|
BigDecimal penaltyAmount;
|
|
|
if(bdrEvent.getAmount()==null||bdrEvent.getAmount().compareTo(penaltyAmount=bpcr.getPenaltyAmount()) < 0){
|
|
|
logger.warn("in buyer cancel BeforeDepotReceive not allow cancel cause of buyer amount lower than BuyerCompensateMoney, event {} compensate {}", bdrEvent, bpcr);
|
|
|
throw new com.yohoufo.common.exception.UfoServiceException(400,"买家赔偿金低于商品售价,不允许取消");
|
|
|
}
|
...
|
...
|
@@ -231,8 +233,8 @@ public class BuyerOrderCancelService { |
|
|
int currentTime = DateUtil.getCurrentTimeSecond();
|
|
|
int rows = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid, expected.getCode(), targetOrderStatus.getCode(), currentTime);
|
|
|
if (rows>0) {
|
|
|
boolean noResponsibility = Objects.isNull(bpcr.getPenaltyAmount())
|
|
|
|| BigDecimal.ZERO.compareTo(bpcr.getPenaltyAmount()) == 0;
|
|
|
boolean noResponsibility = Objects.isNull(penaltyAmount)
|
|
|
|| BigDecimal.ZERO.compareTo(penaltyAmount) == 0;
|
|
|
//退还优惠券
|
|
|
refundCouponIfNeed(buyerUid, orderCode);
|
|
|
|
...
|
...
|
@@ -252,7 +254,7 @@ public class BuyerOrderCancelService { |
|
|
inBoxFacade.noticeSellerWhenBuyerCancelNoResponsibility(psog, orderCode);
|
|
|
}else {
|
|
|
inBoxFacade.buyerCancelBeforeDepotReceive(buyerUid, orderCode,
|
|
|
bpcr.getPenaltyAmount().toPlainString(), psog);
|
|
|
penaltyAmount.toPlainString(), psog);
|
|
|
}
|
|
|
//整个过程异步去执行(考虑退费依赖订单状态)
|
|
|
//(退费)退保证金给卖家
|
...
|
...
|
|