示例#1
0
  /** 插入两条记录,一条是 买家付给平台,一条是平台付给卖家 */
  private boolean insertPaidOrder(Order order) {
    FinanceUnit unit = new FinanceUnit(order); // 买家付给平台
    unit.setReceiver(UserType.ADMIN);
    unit.setSender(contructID(order.getCustomerId(), UserType.CUSTOMER));
    unit.setMoney(order.getPriceRMB());
    unit.setFinanceDetailsType(FinanceType.Normal);
    insert(unit);

    FinanceUnit unit2 = new FinanceUnit(order); // 平台付给卖家
    unit2.setReceiver(contructID(order.getSellerId(), UserType.SELLER));
    unit2.setSender(UserType.ADMIN);
    unit2.setMoney(order.getOriginTotal());
    unit2.setFinanceDetailsType(FinanceType.Normal);
    insert(unit2);
    return true;
  }
示例#2
0
 /**
  * 插入该订单的佣金记录
  *
  * @param order
  */
 public void insertServiceMoney(Order order) {
   List<OrderItem> orderItems = order.getOrderItems();
   float moneySum = 0;
   for (OrderItem item : orderItems) {
     int productLineId = item.getProductLineId();
     ProductLine productLine = productLineService.getProductLineById(productLineId);
     float serviceRate = productLine.getCommission();
     float money = serviceRate * item.getPrice() * item.getNum();
     moneySum += money;
   }
   FinanceUnit unit = new FinanceUnit(order);
   unit.setMoney(moneySum);
   unit.setReceiver(UserType.ADMIN);
   unit.setSender(contructID(order.getSellerId(), UserType.SELLER));
   unit.setFinanceType(FinanceType.Service);
   unit.setFinanceDetailsType(FinanceType.ServiceNormal);
   insert(unit);
 }
示例#3
0
  /** 插入某订单的退货仓库费 */
  public void insertStoreMoney(int orderId) {
    Order order = orderService.getOrderById(orderId);
    FinanceUnit unit = new FinanceUnit(order);
    unit.setFinanceType(FinanceType.Store);
    float money = 0f;

    List<OrderItem> orderItems = order.getOrderItems();
    for (OrderItem orderItem : orderItems) {
      int productId = orderItem.getProductId();
      Product product = productService.getSimpleProductById(productId);
      String size = product.getSizeWithPackage();
      float moneyTmp = computeStoreFee(size);
      money += (moneyTmp * orderItem.getNum());
    }
    int coinage = order.getCoinage();
    money = Coinage.convertToAimCoinage(coinage, money, Coinage.Dollar);
    unit.setMoney(money);
    unit.setSender(UserType.SELLER + "-" + order.getSellerId());
    unit.setReceiver(UserType.ADMIN);
    insert(unit);
  }