Authored by chenchao

fix nullpoint

... ... @@ -49,6 +49,23 @@ public class ActionStatusHold {
static {
canModifyAddressStatus = Arrays.asList(OrderStatus.HAS_PAYED.getCode(), OrderStatus.SELLER_SEND_OUT.getCode(),OrderStatus.PLATFORM_RECEIVE.getCode());
}
//has paid
static List<Integer> hasPaid ;
static {
hasPaid = Arrays.asList(OrderStatus.HAS_PAYED.getCode(),
OrderStatus.SELLER_SEND_OUT.getCode(),
OrderStatus.PLATFORM_CHECKING.getCode(),
OrderStatus.WAITING_RECEIVE.getCode(),
OrderStatus.PLATFORM_RECEIVE.getCode(),
OrderStatus.JUDGE_PASS.getCode(),
OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER.getCode(),
OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode());
}
}
public static boolean isBuyerPaid(Integer status){
return BuyerASH.hasPaid.contains(status);
}
public static boolean buyerCanModifyAddress(Integer status){
... ...
... ... @@ -15,6 +15,7 @@ import java.math.BigDecimal;
@AllArgsConstructor
@NoArgsConstructor
public class BuyerPenaltyCalResult {
private Integer uid;
private Long orderCode;
private BigDecimal orderActualAmount;
... ... @@ -22,4 +23,9 @@ public class BuyerPenaltyCalResult {
private BigDecimal penaltyAmount;
private BigDecimal leftAmount;
private BigDecimal penaltyRate;
private final static BuyerPenaltyCalResult defaultBPCR;
static {defaultBPCR = new BuyerPenaltyCalResult();}
public static BuyerPenaltyCalResult getDefault(){
return defaultBPCR;
}
}
... ...
... ... @@ -10,17 +10,15 @@ import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.OrdersPayMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.OrdersPay;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.model.dto.BuyerPenalty;
import com.yohoufo.order.model.dto.BuyerPenaltyCalResult;
import com.yohoufo.order.service.impl.MetaConfigService;
import com.yohoufo.order.service.impl.OrderDynamicConfig;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Objects;
... ... @@ -42,6 +40,9 @@ public class BuyerCancelCompensateComputeHandler {
public BuyerPenaltyCalResult calBuyerPenaltyCalResult(BuyerOrder buyerOrder){
Integer buyerUid = buyerOrder.getUid();
Long orderCode = buyerOrder.getOrderCode();
if(!ActionStatusHold.isBuyerPaid(buyerOrder.getStatus())){
return BuyerPenaltyCalResult.getDefault();
}
OrderStatus orderStatus = OrderStatus.getOrderStatus(buyerOrder.getStatus());
BigDecimal orderActualAmount = buyerOrder.getAmount();
BigDecimal shipFee = buyerOrder.getShipFee();
... ...
... ... @@ -7,14 +7,16 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.model.*;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.BuyerOrderMeta;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.GoodsInfo;
import com.yohoufo.order.model.response.OrderDetailInfo;
... ... @@ -36,9 +38,6 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private OrdersPayService ordersPayService;
@Autowired
protected IExpressInfoService expressInfoService;
abstract BuyerOrder getBuyerOrder(int uid, long orderCode);
... ...