コード例 #1
0
ファイル: Vender.java プロジェクト: humin11/bnbmg
  public static void zbAgain() {
    String id = params.get("toubiaoid");
    String againComments = params.get("againComments");
    Toubiao toubiao = Toubiao.findById(Long.valueOf(id));
    toubiao.again = true;
    toubiao.againComments = againComments;
    toubiao.save();

    Request req = toubiao.request;
    req.status = 2;
    req.save();
    redirect("/vender/tblist?id=" + id);
  }
コード例 #2
0
ファイル: Vender.java プロジェクト: humin11/bnbmg
  public static void zhongbiao(Long id) {
    Toubiao toubiao = Toubiao.findById(id);
    toubiao.status = "1";
    toubiao.save();
    Request request = toubiao.request;
    request.status = 1;
    request.zb = true;
    request.save();
    List<Toubiao> toubiaos = Toubiao.find("request.id=? and id!=?", request.id, id).fetch();
    for (Toubiao tb : toubiaos) {
      tb.status = "2";
      tb.save();
    }
    Config config = Config.find("1=1").first();
    String message = "";
    SendMessage m = new SendMessage();
    message = "您已中标" + toubiao.request.name + "项目,请按时发货";
    if (config.msg_request_invite != null && !"".equals(config.msg_request_invite)) {
      message = config.msg_request_notification.replace("{request}", toubiao.request.name);
    }
    Profile p = toubiao.profile;
    if (p.contact_phone != null && !"".equals(p.contact_phone))
      m.sendSms(p.contact_phone, message, "0000003");
    if (p.contact_email != null && !"".equals(p.contact_email))
      m.sendMail(p.contact_email, "[" + Messages.get("application.name") + "]中标通知", message);

    redirect("/admin/requests");
  }
コード例 #3
0
ファイル: Vender.java プロジェクト: humin11/bnbmg
  public static void toubiao() {
    String username = session.get("username");
    if (username != null) {
      User user = User.getByUserName(username);
      Profile profile = Profile.find("user.id=?", user.id).first();

      String payStyle = params.get("payStyle");
      String invoice = params.get("invoice");
      String comments = params.get("comments");
      String requestS = params.get("request");

      Request request = Request.findById(Long.valueOf(requestS));
      Toubiao toubiao = null;
      toubiao = Toubiao.find("request.id=? and profile.id=?", request.id, profile.id).first();
      if (toubiao == null) {
        toubiao = new Toubiao();
      }
      toubiao.profile = profile;
      toubiao.user = user;
      toubiao.request = request;
      toubiao.payStyle = payStyle;
      toubiao.invoice = invoice;
      toubiao.comments = comments;
      toubiao.again = false;
      toubiao.save();

      String price = "0";
      String price2 = "0";
      String price3 = "0";
      Baojia baojia = null;
      for (Specification spec : request.specifications) {
        price = params.get("price" + spec.id);
        price2 = params.get("price" + spec.id + "-2");
        price3 = params.get("price" + spec.id + "-3");
        baojia = Baojia.find("toubiao.id=? and specification.id=?", toubiao.id, spec.id).first();
        if (baojia == null) {
          baojia = new Baojia();
          baojia.toubiao = toubiao;
          baojia.specification = spec;
        }
        if (price != null && !"".equals(price) && !"0".equals(price))
          baojia.price = Double.valueOf(price);
        if (price2 != null && !"".equals(price2) && !"0".equals(price2))
          baojia.secondPrice = Double.valueOf(price2);
        if (price3 != null && !"".equals(price3) && !"0".equals(price3))
          baojia.thirdPrice = Double.valueOf(price3);
        baojia.save();

        if (!toubiao.baojias.contains(baojia)) {

          toubiao.baojias.add(baojia);
          toubiao.save();
        }
      }
    }
    redirect("/");
  }
コード例 #4
0
ファイル: Vender.java プロジェクト: humin11/bnbmg
 public static void tbList(Long id) {
   Request req = Request.findById(id);
   List<Toubiao> toubiaos = Toubiao.find("request.id", req.id).fetch();
   render(req, toubiaos);
 }
コード例 #5
0
ファイル: Vender.java プロジェクト: humin11/bnbmg
 public static void baojia2(Long id, Long tbid) {
   Request req = Request.findById(id);
   Toubiao toubiao = Toubiao.findById(tbid);
   render(req, toubiao);
 }