Authored by chenchao

add need penalty 4 control client confirm

... ... @@ -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);
}
//整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
... ...
... ... @@ -920,11 +920,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER;
bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, targetStatus);
occr = bpcr2occr(bpcr);
occr.setNeedPenalty(true);
break;
case SELLER_SEND_OUT:
targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
bpcr = buyerCancelCompensateComputeHandler.calBuyerPenaltyCalResult(buyerOrder, targetStatus);
occr = bpcr2occr(bpcr);
occr.setNeedPenalty(true);
break;
}
return occr;
... ...
... ... @@ -884,15 +884,20 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
if (OrderCodeType.BUYER_TYPE.equals(codeType)){
String confirmDesc = getConfirmDesc4BuyerOrder(orderCode);
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
String confirmDesc = getConfirmDesc4BuyerOrder(buyerOrder);
occr.setConfirmDesc(confirmDesc);
//
if (buyerOrder !=null && OrderStatus.HAS_PAYED.getCode() == buyerOrder.getStatus()){
occr.setNeedPenalty(true);
}
}
return occr;
}
private String getConfirmDesc4BuyerOrder(long orderCode){
private String getConfirmDesc4BuyerOrder(BuyerOrder buyerOrder){
String confirmDesc = null;
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null){
return "订单不存在";
}
... ...