Example #1
0
 public void reply() {
   String toUser = $V("ToUser");
   if (!StringUtil.checkID(toUser)) {
     this.Response.setLogInfo(0, "传入参数错误!");
     return;
   }
   if (MessageCache.addMessage($V("Subject"), $V("Content"), toUser))
     this.Response.setLogInfo(1, "添加回复成功!");
   else this.Response.setLogInfo(0, "添加回复失败!");
 }
Example #2
0
  public void add() {
    String toUser = $V("ToUser");
    if (!StringUtil.checkID(toUser)) {
      this.Response.setLogInfo(0, "传入参数错误!");
      return;
    }
    String[] userList = toUser.split(",");

    String toRole = $V("ToRole");
    if (!StringUtil.checkID(toRole)) {
      this.Response.setLogInfo(0, "传入参数错误!");
      return;
    }
    String[] roleList = toRole.split(",");

    if (roleList.length > 0) {
      String roleStr = "";
      for (int j = 0; j < roleList.length; ++j) {
        if (StringUtil.isNotEmpty(roleList[j])) {
          if (j == 0) roleStr = roleStr + "'" + roleList[j] + "'";
          else {
            roleStr = roleStr + ",'" + roleList[j] + "'";
          }
        }
      }
      if (StringUtil.isNotEmpty(roleStr)) {
        DataTable dt =
            new QueryBuilder("select UserName from zduserRole where rolecode in (" + roleStr + ")")
                .executeDataTable();
        for (int k = 0; k < dt.getRowCount(); ++k) {
          String userName = dt.getString(k, "UserName");
          if ((!User.getUserName().equals(userName))
              && (!ArrayUtils.contains(userList, userName))) {
            userList = (String[]) ArrayUtils.add(userList, userName);
          }
        }
      }
    }

    if (MessageCache.addMessage($V("Subject"), $V("Content"), userList, User.getUserName()))
      this.Response.setLogInfo(1, "新建成功!");
    else this.Response.setLogInfo(0, "新建失败!");
  }
Example #3
0
 public void setReadFlag() {
   String ids = $V("IDs");
   if (!StringUtil.checkID(ids)) {
     this.Response.setLogInfo(0, "传入ID时发生错误");
     return;
   }
   ZCMessageSet set =
       new ZCMessageSchema().query(new QueryBuilder("where ReadFlag=0 and id in (" + ids + ")"));
   QueryBuilder qb = new QueryBuilder("update ZCMessage set ReadFlag=1 where id in (" + ids + ")");
   qb.executeNoQuery();
   this.Response.setLogInfo(1, "标记成功");
   MessageCache.removeIDs(set);
   qb =
       new QueryBuilder(
           "select count(1) from ZCMessage where ReadFlag=0 and ToUser=?", User.getUserName());
   CacheManager.set("Message", "Count", User.getUserName(), qb.executeInt());
 }
Example #4
0
  public void del() {
    String ids = $V("IDs");
    if (!StringUtil.checkID(ids)) {
      this.Response.setLogInfo(0, "传入ID时发生错误");
      return;
    }
    Transaction trans = new Transaction();

    ZCMessageSchema message = new ZCMessageSchema();
    ZCMessageSet set = message.query(new QueryBuilder("where id in (" + ids + ")"));
    trans.add(set, 5);

    if (trans.commit()) {
      MessageCache.removeIDs(set);
      QueryBuilder qb =
          new QueryBuilder(
              "select count(1) from ZCMessage where ReadFlag=0 and ToUser=?", User.getUserName());
      CacheManager.set("Message", "Count", User.getUserName(), qb.executeInt());
      this.Response.setLogInfo(1, "删除成功");
    } else {
      this.Response.setLogInfo(0, "删除失败");
    }
  }