Exemple #1
0
  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");
  }
Exemple #2
0
  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);
  }
Exemple #3
0
  public static void removeSpec() {
    String id = params.get("id");
    Specification spec = Specification.findById(Long.valueOf(id));
    List<Request> requests =
        Request.em()
            .createQuery(
                "select r from Request r join fetch r.specifications s where s.id="
                    + Long.valueOf(id),
                Request.class)
            .getResultList();

    for (Request req : requests) {
      req.specifications.remove(spec);
      req.save();
    }
    if (spec != null) spec.delete();
    renderText(id);
  }