yujian
2020-06-01 d48079c9eeec9c4f19f550a44d461275b4a31fd4
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/CommonOrderFactory.java
@@ -6,7 +6,9 @@
import com.yeshi.fanli.entity.jd.JDOrderItem;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.vipshop.VipShopOrderDetail;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
@@ -166,4 +168,74 @@
      return commonOrder;
   }
   public static CommonOrder create(VipShopOrderDetail order) {
      if (order.getOrder() == null)
         return null;
      CommonOrder commonOrder = new CommonOrder();
      commonOrder.setCount(order.getGoodsCount());
      commonOrder.setCreateTime(new Date());
      if (order.getStatus() == VipShopOrderDetail.STATUS_FINISH) {
         commonOrder.seteIncome(order.getCommission());
         commonOrder.setSettlement(order.getCommissionTotalCost());
         commonOrder.setSettleTime(new Date(order.getOrder().getCommissionEnterTime()));
      }
      commonOrder.setOrderNo(order.getOrderSn() + "");
      commonOrder.setPayment(order.getCommissionTotalCost());
      commonOrder.setSourcePosition(order.getOrder().getChannelTag());
      commonOrder.setSourceType(Constant.SOURCE_TYPE_VIP);
      int state = 0;
      if (order.getStatus() == VipShopOrderDetail.STATUS_FINISH)
         state = CommonOrder.STATE_JS;
      else if (order.getStatus() == VipShopOrderDetail.STATUS_INVALID)
         state = CommonOrder.STATE_SX;
      else if (order.getStatus() == VipShopOrderDetail.STATUS_UNKOWN)
         state = CommonOrder.STATE_FK;
      commonOrder.setOrderBy(1);
      commonOrder.setState(state);
      commonOrder.setThirdCreateTime(new Date(order.getOrder().getOrderTime()));
      commonOrder.setUpdateTime(new Date());
      commonOrder.setTradeId(order.getIdentifyCode());
      commonOrder.setEstimate(order.getCommission());
      commonOrder.setChildSourceType("唯品会");
      return commonOrder;
   }
   public static CommonOrder create(SuningOrderInfo order) {
      CommonOrder commonOrder = new CommonOrder();
      commonOrder.setCount(Integer.parseInt(order.getSaleNum()));
      commonOrder.setCreateTime(new Date());
      if ("确认收货".equalsIgnoreCase(order.getOrderLineStatusDesc())) {
         commonOrder.seteIncome(new BigDecimal(order.getPrePayCommission()));
         commonOrder.setSettlement(new BigDecimal(order.getPayAmount()));
         commonOrder.setSettleTime(
               new Date(TimeUtil.convertToTimeTemp(order.getOrderLineStatusChangeTime(), "yyyy-MM-dd HH:mm:ss")));
      }
      commonOrder.setOrderNo(order.getOrderCode() + "");
      commonOrder.setPayment(new BigDecimal(order.getPayAmount()));
      commonOrder.setSourcePosition(order.getPositionId());
      commonOrder.setSourceType(Constant.SOURCE_TYPE_SUNING);
      int state = 0;
      if ("等待付款".equalsIgnoreCase(order.getOrderLineStatusDesc()))
         state = CommonOrder.STATE_FK;
      else if ("支付完成".equalsIgnoreCase(order.getOrderLineStatusDesc()))
         state = CommonOrder.STATE_FK;
      else if ("退款".equalsIgnoreCase(order.getOrderLineStatusDesc()))
         state = CommonOrder.STATE_SX;
      else if ("订单已取消".equalsIgnoreCase(order.getOrderLineStatusDesc()))
         state = CommonOrder.STATE_SX;
      else if ("确认收货".equalsIgnoreCase(order.getOrderLineStatusDesc()))
         state = CommonOrder.STATE_JS;
      commonOrder.setOrderBy(1);
      commonOrder.setState(state);
      commonOrder.setThirdCreateTime(
            new Date(TimeUtil.convertToTimeTemp(order.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss")));
      commonOrder.setUpdateTime(new Date());
      commonOrder.setTradeId(order.getOrderLineNumber());
      commonOrder.setEstimate(new BigDecimal(order.getPrePayCommission()));
      commonOrder.setChildSourceType("苏宁");
      return commonOrder;
   }
}