예제 #1
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);
 }
예제 #2
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);
  }