コード例 #1
0
  private long createCoupon(
      String title,
      String startDate,
      String endDate,
      int amount,
      CouponType type,
      String massage,
      double price) {

    System.out.println("creating coupon : " + title);

    Coupon coupon = new Coupon();
    try {
      coupon.setStartDate(Utils.string2Date(startDate));
      coupon.setEndDate(Utils.string2Date(endDate));

      coupon.setTitle(title);
      coupon.setAmount(amount);
      coupon.setPrice(price);
      coupon.setType(type);
      coupon.setMassage(massage);
      String image = title + ".img";
      coupon.setImage(image);

      compFacade.createCoupon(coupon);
      return coupon.getId();

    } catch (Exception e) {
      logger.error("create coupons " + title + "  failed : " + e.toString());
      return 0;
    }
  }