Authored by chenchao

fix nullpoint

@@ -49,6 +49,23 @@ public class ActionStatusHold { @@ -49,6 +49,23 @@ public class ActionStatusHold {
49 static { 49 static {
50 canModifyAddressStatus = Arrays.asList(OrderStatus.HAS_PAYED.getCode(), OrderStatus.SELLER_SEND_OUT.getCode(),OrderStatus.PLATFORM_RECEIVE.getCode()); 50 canModifyAddressStatus = Arrays.asList(OrderStatus.HAS_PAYED.getCode(), OrderStatus.SELLER_SEND_OUT.getCode(),OrderStatus.PLATFORM_RECEIVE.getCode());
51 } 51 }
  52 +
  53 + //has paid
  54 + static List<Integer> hasPaid ;
  55 + static {
  56 + hasPaid = Arrays.asList(OrderStatus.HAS_PAYED.getCode(),
  57 + OrderStatus.SELLER_SEND_OUT.getCode(),
  58 + OrderStatus.PLATFORM_CHECKING.getCode(),
  59 + OrderStatus.WAITING_RECEIVE.getCode(),
  60 + OrderStatus.PLATFORM_RECEIVE.getCode(),
  61 + OrderStatus.JUDGE_PASS.getCode(),
  62 + OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode(),
  63 + OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode());
  64 + }
  65 + }
  66 +
  67 + public static boolean isBuyerPaid(Integer status){
  68 + return BuyerASH.hasPaid.contains(status);
52 } 69 }
53 70
54 public static boolean buyerCanModifyAddress(Integer status){ 71 public static boolean buyerCanModifyAddress(Integer status){
@@ -15,6 +15,7 @@ import java.math.BigDecimal; @@ -15,6 +15,7 @@ import java.math.BigDecimal;
15 @AllArgsConstructor 15 @AllArgsConstructor
16 @NoArgsConstructor 16 @NoArgsConstructor
17 public class BuyerPenaltyCalResult { 17 public class BuyerPenaltyCalResult {
  18 +
18 private Integer uid; 19 private Integer uid;
19 private Long orderCode; 20 private Long orderCode;
20 private BigDecimal orderActualAmount; 21 private BigDecimal orderActualAmount;
@@ -22,4 +23,9 @@ public class BuyerPenaltyCalResult { @@ -22,4 +23,9 @@ public class BuyerPenaltyCalResult {
22 private BigDecimal penaltyAmount; 23 private BigDecimal penaltyAmount;
23 private BigDecimal leftAmount; 24 private BigDecimal leftAmount;
24 private BigDecimal penaltyRate; 25 private BigDecimal penaltyRate;
  26 + private final static BuyerPenaltyCalResult defaultBPCR;
  27 + static {defaultBPCR = new BuyerPenaltyCalResult();}
  28 + public static BuyerPenaltyCalResult getDefault(){
  29 + return defaultBPCR;
  30 + }
25 } 31 }
@@ -10,17 +10,15 @@ import com.yohoufo.common.utils.DateUtil; @@ -10,17 +10,15 @@ import com.yohoufo.common.utils.DateUtil;
10 import com.yohoufo.dal.order.OrdersPayMapper; 10 import com.yohoufo.dal.order.OrdersPayMapper;
11 import com.yohoufo.dal.order.model.BuyerOrder; 11 import com.yohoufo.dal.order.model.BuyerOrder;
12 import com.yohoufo.dal.order.model.OrdersPay; 12 import com.yohoufo.dal.order.model.OrdersPay;
  13 +import com.yohoufo.order.common.ActionStatusHold;
13 import com.yohoufo.order.model.dto.BuyerPenalty; 14 import com.yohoufo.order.model.dto.BuyerPenalty;
14 import com.yohoufo.order.model.dto.BuyerPenaltyCalResult; 15 import com.yohoufo.order.model.dto.BuyerPenaltyCalResult;
15 import com.yohoufo.order.service.impl.MetaConfigService; 16 import com.yohoufo.order.service.impl.MetaConfigService;
16 -import com.yohoufo.order.service.impl.OrderDynamicConfig;  
17 import com.yohoufo.order.utils.LoggerUtils; 17 import com.yohoufo.order.utils.LoggerUtils;
18 import org.slf4j.Logger; 18 import org.slf4j.Logger;
19 -import org.slf4j.LoggerFactory;  
20 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.stereotype.Component; 20 import org.springframework.stereotype.Component;
22 21
23 -import javax.annotation.Resource;  
24 import java.math.BigDecimal; 22 import java.math.BigDecimal;
25 import java.util.Collection; 23 import java.util.Collection;
26 import java.util.Objects; 24 import java.util.Objects;
@@ -42,6 +40,9 @@ public class BuyerCancelCompensateComputeHandler { @@ -42,6 +40,9 @@ public class BuyerCancelCompensateComputeHandler {
42 public BuyerPenaltyCalResult calBuyerPenaltyCalResult(BuyerOrder buyerOrder){ 40 public BuyerPenaltyCalResult calBuyerPenaltyCalResult(BuyerOrder buyerOrder){
43 Integer buyerUid = buyerOrder.getUid(); 41 Integer buyerUid = buyerOrder.getUid();
44 Long orderCode = buyerOrder.getOrderCode(); 42 Long orderCode = buyerOrder.getOrderCode();
  43 + if(!ActionStatusHold.isBuyerPaid(buyerOrder.getStatus())){
  44 + return BuyerPenaltyCalResult.getDefault();
  45 + }
45 OrderStatus orderStatus = OrderStatus.getOrderStatus(buyerOrder.getStatus()); 46 OrderStatus orderStatus = OrderStatus.getOrderStatus(buyerOrder.getStatus());
46 BigDecimal orderActualAmount = buyerOrder.getAmount(); 47 BigDecimal orderActualAmount = buyerOrder.getAmount();
47 BigDecimal shipFee = buyerOrder.getShipFee(); 48 BigDecimal shipFee = buyerOrder.getShipFee();
@@ -7,14 +7,16 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo; @@ -7,14 +7,16 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
7 import com.yohobuy.ufo.model.order.bo.OrderInfo; 7 import com.yohobuy.ufo.model.order.bo.OrderInfo;
8 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; 8 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
9 import com.yohobuy.ufo.model.order.common.ButtonShow; 9 import com.yohobuy.ufo.model.order.common.ButtonShow;
10 -import com.yohobuy.ufo.model.order.common.SkupStatus;  
11 -import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;  
12 -import com.yohoufo.common.utils.DateUtil;  
13 -import com.yohoufo.dal.order.model.*;  
14 import com.yohobuy.ufo.model.order.common.OrderStatus; 10 import com.yohobuy.ufo.model.order.common.OrderStatus;
15 import com.yohobuy.ufo.model.order.common.TabType; 11 import com.yohobuy.ufo.model.order.common.TabType;
16 -import com.yohoufo.order.convert.GoodsInfoConvertor; 12 +import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
17 import com.yohobuy.ufo.model.order.vo.AddressInfo; 13 import com.yohobuy.ufo.model.order.vo.AddressInfo;
  14 +import com.yohoufo.common.utils.DateUtil;
  15 +import com.yohoufo.dal.order.model.BuyerOrder;
  16 +import com.yohoufo.dal.order.model.BuyerOrderGoods;
  17 +import com.yohoufo.dal.order.model.BuyerOrderMeta;
  18 +import com.yohoufo.dal.order.model.SellerOrderGoods;
  19 +import com.yohoufo.order.convert.GoodsInfoConvertor;
18 import com.yohoufo.order.model.request.OrderRequest; 20 import com.yohoufo.order.model.request.OrderRequest;
19 import com.yohoufo.order.model.response.GoodsInfo; 21 import com.yohoufo.order.model.response.GoodsInfo;
20 import com.yohoufo.order.model.response.OrderDetailInfo; 22 import com.yohoufo.order.model.response.OrderDetailInfo;
@@ -36,9 +38,6 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -36,9 +38,6 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
36 private final Logger logger = LoggerFactory.getLogger(getClass()); 38 private final Logger logger = LoggerFactory.getLogger(getClass());
37 39
38 @Autowired 40 @Autowired
39 - private OrdersPayService ordersPayService;  
40 -  
41 - @Autowired  
42 protected IExpressInfoService expressInfoService; 41 protected IExpressInfoService expressInfoService;
43 42
44 abstract BuyerOrder getBuyerOrder(int uid, long orderCode); 43 abstract BuyerOrder getBuyerOrder(int uid, long orderCode);