示例#1
0
 @Filters(@By(type = AjaxCheckSession.class, args = "me"))
 @At("/update")
 public Object updateInfo(
     String nickName, String passwd, @Attr("me") User me, HttpSession session) {
   if (!Strings.isBlank(nickName)
       && !nickName.startsWith("_") // 系统默认生成的nickName以_开头
       && me.getNickName().startsWith("_") // 只允许修改一次nickName
       && nickName.trim().length() > 1
       && nickName.trim().length() < 10
       && nickName.indexOf("<") < 0
       && nickName.indexOf(">") < 0
       && nickName.indexOf("@") < 0
       && nickName.indexOf("#") < 0
       && nickName.indexOf(" ") < 0
       && nickName.indexOf("&") < 0) {
     try {
       dao.update(
           User.class, Chain.make("nickName", nickName.trim()), Cnd.where("id", "=", me.getId()));
     } catch (Throwable e) {
       return Ajax.fail().setMsg("Nickname is dup or it is BAD!");
     }
   }
   if (!Strings.isBlank(passwd) && passwd.trim().length() > 5 && passwd.trim().length() < 40) {
     dao.update(
         User.class, Chain.make("passwd", xMD5(passwd.trim())), Cnd.where("id", "=", me.getId()));
   }
   session.setAttribute("me", dao.fetch(User.class, Cnd.where("id", "=", me.getId())));
   return Ajax.ok();
 }
示例#2
0
 /**
  * Test表根据name查询
  *
  * @param name
  * @param pageNumber
  * @param pageSize
  * @return 对应考试名称的考试信息
  */
 public QueryResult queryByName(String name, int pageNumber, int pageSize) {
   Pager pager = dao().createPager(pageNumber, pageSize);
   List<Test> listByName =
       dao().query(Test.class, Cnd.where("test_name", "like", "%" + name + "%"), pager);
   pager.setRecordCount(dao().count(Test.class, Cnd.where("test_name", "like", "%" + name + "%")));
   return new QueryResult(listByName, pager);
 }
示例#3
0
 /**
  * Test表查询一段时间的记录
  *
  * @param date1
  * @param date2
  * @param pageNumber
  * @param pageSize
  * @return 对应一段时间内的考试信息
  */
 public QueryResult queryByPeriodDate(Date date1, Date date2, int pageNumber, int pageSize) {
   Pager pager = dao().createPager(pageNumber, pageSize);
   List<Test> listByPeriodDate =
       dao().query(Test.class, Cnd.where("Date", ">=", date1).and("Date", "<=", date2), pager);
   pager.setRecordCount(
       dao().count(Test.class, Cnd.where("Date", ">=", date1).and("Date", "<=", date2)));
   return new QueryResult(listByPeriodDate, pager);
 }
示例#4
0
  public List<Topic> getRecentTopics(int userId, Pager pager) {
    List<Topic> recent_topics =
        dao.query(Topic.class, Cnd.where("userId", "=", userId).desc("createTime"), pager);

    Map<Integer, UserProfile> authors = new HashMap<Integer, UserProfile>();
    if (!recent_topics.isEmpty()) {
      for (Topic topic : recent_topics) {
        fillTopic(topic, authors);
      }
    }
    pager.setRecordCount(dao.count(Topic.class, Cnd.where("userId", "=", userId)));
    return recent_topics;
  }
示例#5
0
 @At("/passwd/reset")
 public void resetPassword(String email, HttpServletRequest req) {
   if (Strings.isBlank(email)) return;
   User user = dao.fetch(User.class, Cnd.where("email", "=", email));
   if (user == null) return;
   dao.clear(PasswordReset.class, Cnd.where("uid", "=", user.getId()));
   String token = R.UU64() + R.UU64();
   PasswordReset reset = new PasswordReset();
   reset.setUid(dao.fetch(User.class, Cnd.where("email", "=", email)).getId());
   reset.setToken(token);
   dao.insert(reset);
   String url = req.getRequestURL() + "/callback?token=" + token;
   mailService.add2Queue(email, "推爸 密码重置请求", "Reset URL --> " + url);
 }
 @Override
 public boolean updateImgCommentId(long userId, long skuId, List<Long> imgList, long commentId) {
   Chain chn = Chain.make("commentId", commentId);
   Condition cnd =
       Cnd.where("id", "in", imgList).and("userId", "=", userId).and("skuId", "=", skuId);
   return 1 == dao.update(SkuCommentImg.class, chn, cnd);
 }
 @At
 @Ok(">>:/admin/permission/category/list.rk")
 @RequiresPermissions({"permission:edit"})
 public boolean update(@Param("name") String name, @Param("id") String id) {
   permissionCategoryService.update(Chain.make("name", name), Cnd.where("id", "=", id));
   return true;
 }
示例#8
0
  @At
  @Ok("json")
  public JDataGrid list_grid(
      @Attr(scope = Scope.SESSION, value = "account") Account acc,
      @Param("::columns") List<?> columns,
      @Param("::search") Map<?, ?> search,
      int draw,
      int start,
      int length) {
    start = start / length;
    Pager pager = new Pager();
    pager.setPageNumber(start + 1);
    pager.setPageSize(length);

    Cnd cnd = Cnd.where("accountid", "=", acc.accountid);

    if (!Lang.isEmpty(search.get("value")) && !search.get("value").toString().equals("")) {
      cnd.and("name", "like", search.get("value"));
    }

    List<?> aaData = dao.query(Store.class, cnd);
    pager.setRecordCount(dao.count(Store.class, cnd));

    JDataGrid ret = new JDataGrid();
    ret.draw = draw;
    ret.data = aaData;
    ret.recordsTotal = pager.getRecordCount();
    ret.recordsFiltered = pager.getRecordCount();
    return ret;
  }
示例#9
0
  public List<Topic> getRecentReplyTopics(int userId, Pager pager) {

    Map<Integer, UserProfile> authors = new HashMap<Integer, UserProfile>();
    Cnd cnd = Cnd.where("userId", "=", userId);
    cnd.desc("createTime");

    Sql sql =
        Sqls.queryString("select DISTINCT topicId from t_topic_reply $cnd")
            .setEntity(dao.getEntity(TopicReply.class))
            .setVar("cnd", cnd);
    pager.setRecordCount(
        dao.execute(
                Sqls.fetchInt("select count(DISTINCT topicId) from t_topic_reply $cnd")
                    .setEntity(dao.getEntity(TopicReply.class))
                    .setVar("cnd", cnd))
            .getInt());
    sql.setPager(pager);
    String[] replies_topic_ids = dao.execute(sql).getObject(String[].class);
    List<Topic> recent_replies = new ArrayList<Topic>();
    for (String topic_id : replies_topic_ids) {
      Topic _topic = dao.fetch(Topic.class, topic_id);
      if (_topic == null) continue;
      recent_replies.add(_topic);
    }
    if (!recent_replies.isEmpty()) {
      for (Topic topic : recent_replies) {
        fillTopic(topic, authors);
      }
    }
    return recent_replies;
  }
示例#10
0
 @At
 @Ok("json")
 public Object list(@Attr(scope = Scope.SESSION, value = "account") Account acc) {
   Cnd cnd = Cnd.where("accountid", "=", acc.accountid);
   List<?> aaData = dao.query(Store.class, cnd);
   return aaData;
 }
示例#11
0
 @At("/passwd/reset/callback")
 public Object resetPasswdCallback(String token) {
   PasswordReset reset = dao.fetch(PasswordReset.class, Cnd.where("token", "=", token));
   if (reset != null) {
     dao.clear(PasswordReset.class, Cnd.where("token", "=", token));
     if (System.currentTimeMillis() - reset.getCreateTime().getTime() > 30 * 60 * 1000)
       return Ajax.fail().setMsg("token is expise");
     String passwd = R.sg(12).next();
     dao.update(
         User.class, Chain.make("passwd", xMD5(passwd)), Cnd.where("id", "=", reset.getUid()));
     String email = dao.fetch(User.class, Cnd.where("id", "=", reset.getUid())).getEmail();
     mailService.add2Queue(email, "推爸密码重置邮件", "Your password : "******"Reset success!! Check you email!");
   }
   return Ajax.fail().setMsg("Token not found!!");
 }
示例#12
0
  private void resourceRelationFull(Resource resource) {
    List<Tag> tags;
    Sql sql_resource =
        Sqls.create(
            "select * from tag as t, resource_tag as rt where rt.resource_id = "
                + resource.getId()
                + " and rt.tag_id = t.id");
    sql_resource.setCallback(Sqls.callback.entities());
    sql_resource.setEntity(dao.getEntity(Tag.class));
    dao.execute(sql_resource);
    tags = sql_resource.getList(Tag.class);
    List<UserInfo> user = dao.query(UserInfo.class, Cnd.where("id", "=", resource.getAuthor()));
    if (user.size() > 0) {
      resource.setUserInfo(user.get(0));
    } else {
      System.out.print("resourceservice:用户id无效");
    }

    String tagString = ""; // 资源tag回填
    for (int i = 0; i < tags.size(); i++) {
      if (i < (tags.size() - 1)) {
        tagString = tagString + tags.get(i).getName() + ",";
      } else {
        tagString = tagString + tags.get(i).getName();
      }
    }

    resource.setTags(tagString);
    resource.setTagEntityList(tags);
  }
示例#13
0
  /**
   * 分页查询
   *
   * @param phonenum
   * @param start
   * @param limit
   * @return
   */
  public List<TmpGprs> search(String phonenum, String loginName, int start, int limit)
      throws Exception {
    Cnd condition = null;
    if (null != phonenum && !"".equals(phonenum)) {
      condition =
          Cnd.where("d_phone_number", "=", phonenum)
              .and("d_uid", "=", loginName.replace("weinan2", "weinan1"));
      //			if(null != loginName && !"".equals(loginName)){
      //				if(loginName.equals("weinan1")){
      //					condition.and("d_id","<","2368");
      //				}else if(loginName.equals("weinan2")){
      //					condition.and("d_id",">","2367").and("d_id","<","4736");
      //				}else if(loginName.equals("weinan3")){
      //					condition.and("d_id",">","4735").and("d_id","<","7103");
      //				}else if(loginName.equals("weinan5")){
      //					condition.and("d_id",">","7102");
      //				}
      //			}

      start = start / limit + 1;
      if (start == 0) {
        start = 1;
      }
      List<TmpGprs> list = tmpGprsDao.searchByPage(TmpGprs.class, condition, start, limit);
      return list;
    } else {
      return null;
    }
  }
示例#14
0
  public void updateTacTerminal() {
    /**
     * List<String[]> list = CvsFileParser.getCSV("厂商数据_01.csv"); for(String[] ss:list){
     * if(ss.length < 3){ System.out.println(" >> "+ss[0]+"|"+ss[1]); } }
     */
    Cnd condition = Cnd.where("d_status", "=", "1");
    List<Tac> tlist = dao.search(Tac.class, condition.orderBy().asc("d_hsman_name"));
    for (Tac t : tlist) {
      List<String[]> list = CvsFileParser.getCSV("厂商数据_01.csv");
      for (String[] str : list) {
        if (t.getHsmanName().toLowerCase().equals(str[0].toLowerCase())) {
          if (!"0".equals(str[1])) {
            t.setHsmanNameEn(str[1].toLowerCase());
          }
          if (!"0".equals(str[2])) {
            t.setHsmanName(str[2].toLowerCase());
          }

          if (dao.update(t)) {
            System.out.println(
                " >> 更新成功["
                    + t.getId()
                    + "|"
                    + t.getTac()
                    + "|"
                    + t.getHsmanName()
                    + "|"
                    + t.getHsmanNameEn()
                    + "]");
            break;
          }
        }
      }
    }
  }
示例#15
0
 private void batchDeleteParameter(String table, List<Parameter> data) {
   for (Parameter p : data) {
     int c = baseService.dao.clear(table, Cnd.where("srcTimestr", "=", p.getSrcTimestr()));
   }
   /*if(null != data || data.size() > 0){
   }*/
 }
示例#16
0
  /**
   * @api {get} /yvr/api/v1/topic/:id 获取帖子的详细数据
   * @apiGroup Topic
   * @apiVersion 1.0.0
   * @apiParam {String} id 帖子id
   * @apiParam {boolean} [mdrender=true] 是否渲染Markdown
   * @apiSuccess {Object[]} data 帖子数据
   * @apiSuccess {String} data.id 唯一标示符
   * @apiSuccess {String} data.title 标题
   * @apiSuccess {String} data.tab 类型
   * @apiSuccess {String} data.content 内容
   * @apiSuccess {String} [data.last_reply_at] 最后回复时间
   * @apiSuccess {boolean} data.top 是否置顶
   * @apiSuccess {boolean} data.good 是否为精华帖
   * @apiSuccess {int} data.reply_count 总回复数量
   * @apiSuccess {int} data.visit_count 总浏览数量
   * @apiSuccess {Object} data.author 作者信息
   * @apiSuccess {String} data.author.id 作者id
   * @apiSuccess {String} data.author.loginname 作者登陆名
   * @apiSuccess {Object[]} [data.replies] 回复列表
   * @apiSuccess {String} data.replies.id 回复id
   * @apiSuccess {String} data.replies.author 回复的作者
   * @apiSuccess {String} data.replies.author.id 回复的作者的id
   * @apiSuccess {String} data.replies.author.loginname 回复的作者的登陆名称
   * @apiSuccess {String} data.replies.content 回复的内容
   * @apiSuccess {String[]} data.replies.ups 点赞数
   * @apiSuccess {Object} data.replies.author 回帖作者信息
   * @apiSuccess {String} data.replies.create_at 回帖时间
   * @apiSuccess {String} data.replies.author.id 作者id
   * @apiSuccess {String} data.replies.author.loginname 作者登陆名
   * @apiError 404 The <code>id</code> of the Topic was not found.
   */
  @Aop("redis")
  @GET
  @At("/topic/?")
  public Object topic(String id, @Param("mdrender") String mdrender) {
    Topic topic = dao.fetch(Topic.class, id);
    if (id == null) {
      return HttpStatusView.HTTP_404;
    }
    NutMap tp = _topic(topic, new HashMap<Integer, UserProfile>(), mdrender);

    List<NutMap> replies = new ArrayList<NutMap>();
    for (TopicReply reply :
        dao.query(TopicReply.class, Cnd.where("topicId", "=", id).asc("createTime"))) {
      dao.fetchLinks(reply, null);
      reply.setUps(jedis().zrange(RKEY_REPLY_LIKE + reply.getId(), 0, System.currentTimeMillis()));

      NutMap re = new NutMap();
      re.put("id", reply.getId());
      re.put("author", _author(reply.getAuthor()));

      re.put(
          "content",
          "false".equals(mdrender)
              ? reply.getContent()
              : Markdowns.toHtml(reply.getContent(), urlbase));
      re.put("ups", new ArrayList<String>(reply.getUps()));
      re.put("create_at", _time(reply.getCreateTime()));
      replies.add(re);
    }

    tp.put("replies", replies);

    jedis().zincrby(RKEY_TOPIC_VISIT, 1, topic.getId());
    return _map("data", tp);
  }
示例#17
0
  private void initData() {

    typeData.clear();
    typeData.addAll(ToolType.allToolTypes());

    List<ToolsTray> bandejaList =
        dao.query(ToolsTray.class, Cnd.where("toolType", "=", C.TOOL_TYPE_TRAY_FOLDER));

    superData.clear();
    ToolsTray bandeja1 = new ToolsTray();
    bandeja1.setId(C.ROOT_PARENT_ID);
    bandeja1.setTrayName("--无父目录--");
    superData.add(bandeja1);
    superData.addAll(bandejaList);

    searchData.clear();
    ToolsTray bandeja = new ToolsTray();
    bandeja.setTrayName("--全部--");
    searchData.add(bandeja);
    searchData.add(bandeja1);
    searchData.addAll(bandejaList);

    tableData.clear();
    tableData.addAll(dao.query(ToolsTray.class, null));
  }
示例#18
0
  /**
   * 根据多个id 查询数据
   *
   * @param <T>
   * @param ids 整形的id数组
   * @param c 要查询的表信息
   * @return List
   */
  public <T> List<T> searchByIds(Class<T> c, int[] ids, String orderby) {

    Entity<T> entity = dao.getEntity(c);

    String id = entity.getIdField().getColumnName();

    return dao.query(c, Cnd.where(id, "in", ids).desc(orderby), null);
  }
示例#19
0
  /**
   * 根据指定的字段模糊分页查询数据 记录总数
   *
   * @param <T>
   * @param c 查询的表
   * @param fieldName 字段名称
   * @param value 模糊条件
   * @param currentPage 当前页码
   * @param pageSize 每页数据量
   * @return List
   */
  public <T> int searchByPageLike(Class<T> c, String fieldName, String value) {

    Entity<T> entity = dao.getEntity(c);

    String column = entity.getField(fieldName).getColumnName();

    return dao.count(c, Cnd.where(column, "LIKE", "%" + value + "%"));
  }
示例#20
0
 @Aop("redis")
 public CResult add(Topic topic, int userId) {
   if (userId < 1) {
     return _fail("请先登录");
   }
   if (Strings.isBlank(topic.getTitle())
       || topic.getTitle().length() > 1024
       || topic.getTitle().length() < 5) {
     return _fail("标题长度不合法");
   }
   if (Strings.isBlank(topic.getContent())) {
     return _fail("内容不合法");
   }
   if (topic.getTags() != null && topic.getTags().size() > 10) {
     return _fail("最多只能有10个tag");
   }
   if (0 != dao.count(Topic.class, Cnd.where("title", "=", topic.getTitle().trim()))) {
     return _fail("相同标题已经发过了");
   }
   topic.setTitle(Strings.escapeHtml(topic.getTitle().trim()));
   topic.setUserId(userId);
   topic.setTop(false);
   topic.setTags(new HashSet<String>());
   if (topic.getType() == null) topic.setType(TopicType.ask);
   topic.setContent(Toolkit.filteContent(topic.getContent()));
   String oldContent = topic.getContent();
   topic.setContentId(bigContentService.put(topic.getContent()));
   topic.setContent(null);
   dao.insert(topic);
   try {
     topic.setContent(oldContent);
     topicSearchService.add(topic);
   } catch (Exception e) {
   }
   // 如果是ask类型,把帖子加入到 "未回复"列表
   Pipeline pipe = jedis().pipelined();
   if (TopicType.ask.equals(topic.getType())) {
     pipe.zadd(RKEY_TOPIC_NOREPLY, System.currentTimeMillis(), topic.getId());
   }
   pipe.zadd(RKEY_TOPIC_UPDATE + topic.getType(), System.currentTimeMillis(), topic.getId());
   if (topic.getType() != TopicType.shortit)
     pipe.zadd(RKEY_TOPIC_UPDATE_ALL, System.currentTimeMillis(), topic.getId());
   pipe.zincrby(RKEY_USER_SCORE, 100, "" + userId);
   pipe.sync();
   String replyAuthorName = dao.fetch(User.class, userId).getName();
   for (Integer watcherId : globalWatcherIds) {
     if (watcherId != userId)
       pushUser(
           watcherId,
           "新帖:" + topic.getTitle(),
           topic.getId(),
           replyAuthorName,
           topic.getTitle(),
           PushService.PUSH_TYPE_REPLY);
   }
   updateTopicTypeCount();
   return _ok(topic.getId());
 }
示例#21
0
 @At
 public Object login(String email, String passwd, HttpServletRequest req) {
   if (Strings.isBlank(email) || Strings.isBlank(passwd)) return Ajax.fail();
   User me =
       dao.fetch(User.class, Cnd.where("email", "=", email).and("passwd", "=", xMD5(passwd)));
   if (me == null) return Ajax.fail();
   req.getSession().setAttribute("me", me);
   return Ajax.ok();
 }
示例#22
0
 @At("/list_goodid/?")
 @Ok("json")
 public Object list_goodid(int id, @Attr(scope = Scope.SESSION, value = "account") Account acc) {
   Cnd cnd = Cnd.where("accountid", "=", acc.accountid);
   if (id != 0) {
     cnd.and(new Static("id in (select store_id from m_typelist where id=" + id + ")"));
   }
   List<?> aaData = dao.query(Store.class, cnd);
   return aaData;
 }
示例#23
0
  @Override
  public List<Item> listSameItems(long itemId) {
    Item item = dao.fetch(Item.class, itemId);
    if (null == item) {
      throw new AppRuntimeException("木有找到该item");
    }

    return dao.query(
        Item.class,
        Cnd.where("oid", "=", item.getOid()).and("skuMoreId", "=", item.getSkuMoreId()));
  }
示例#24
0
  /**
   * 根据某个条件分页查询数据
   *
   * @param <T>
   * @param c 查询的表
   * @param fieldName 匹配字段名
   * @param value 匹配的值
   * @param currentPage 当前页码
   * @param pageSize 每页数据量
   * @return List
   */
  public <T> List<T> searchByPage(
      Class<T> c, String fieldName, String value, int currentPage, int pageSize) {

    Entity<T> entity = dao.getEntity(c);

    String column = entity.getField(fieldName).getColumnName();

    Pager pager = dao.createPager(currentPage, pageSize);

    return dao.query(c, Cnd.where(column, "=", value), pager);
  }
示例#25
0
  /**
   * 分页查找 resource
   *
   * @param categoryId 分类id好好
   * @param order
   * @param pager
   * @return
   */
  public List<Resource> search(Integer categoryId, Integer tagId, String order, Pager pager) {
    List<Resource> query = null;

    if (categoryId != null) {
      query = dao.query(Resource.class, Cnd.where("categoryId", "=", categoryId).desc("id"), pager);
      if (pager != null) {
        pager.setRecordCount(dao.count(Resource.class, Cnd.where("categoryId", "=", categoryId)));
      }

    } else {
      query = dao.query(Resource.class, Cnd.orderBy().desc("id"), pager);
      if (pager != null) {
        pager.setRecordCount(dao.count(Resource.class));
      }
    }
    for (Resource resource : query) {
      resourceRelationFull(resource);
    }
    return query;
  }
示例#26
0
 public void test2() {
   Cnd condition = Cnd.where("d_hsman_name", "=", "apple");
   List<Tac> list = dao.search(Tac.class, condition);
   StringBuffer sb = new StringBuffer(" in (\t");
   for (Tac tac : list) {
     sb.append("\'" + tac.getTac() + "\'").append(",");
   }
   sb.append("\t)");
   //		ViewTerminal v = dao.findByCondition(ViewTerminal.class, condition);
   //		System.out.println(" >> "+Json.toJson(v));
   System.out.println("" + sb.toString());
 }
示例#27
0
 /**
  * 分页查询
  *
  * @param phonenum
  * @param start
  * @param limit
  * @return
  */
 public List<TmpGprs> search(String phonenum, int start, int limit) throws Exception {
   Cnd condition = null;
   if (null != phonenum && !"".equals(phonenum)) {
     condition = Cnd.where("d_phone_number", "=", phonenum);
   }
   start = start / limit + 1;
   if (start == 0) {
     start = 1;
   }
   List<TmpGprs> list = tmpGprsDao.searchByPage(TmpGprs.class, condition, start, limit);
   return list;
 }
示例#28
0
  public void search(ActionEvent event) {

    ToolsTray bandeja = (ToolsTray) searchCombo.getSelectionModel().getSelectedItem();
    List<ToolsTray> bandejaList;
    if (null == bandeja || null == bandeja.getId()) {
      bandejaList = dao.query(ToolsTray.class, null);
    } else {
      bandejaList = dao.query(ToolsTray.class, Cnd.where("parentId", "=", bandeja.getId()));
    }
    tableData.clear();
    tableData.addAll(bandejaList);
  }
示例#29
0
  @At
  @Ok("->:/private/sys/unitSort.html")
  public void sort(@Param("id") String id, HttpServletRequest req, HttpSession session)
      throws Exception {
    Sys_user user = (Sys_user) session.getAttribute("userSession");
    Condition c;
    if (user.getSysrole()) // 判断是否为系统管理员角色
    {
      c = Cnd.where("id", "is not", null).asc("location,id");
    } else {
      c = Cnd.where("id", "like", user.getUnitid() + "%'").asc("location,id");
    }
    List<Sys_unit> list = daoCtl.list(dao, Sys_unit.class, c);
    List<Object> array = new ArrayList<Object>();
    Map<String, Object> jsonroot = new HashMap<String, Object>();
    jsonroot.put("id", "");
    jsonroot.put("pId", "0");
    jsonroot.put("name", "机构列表");
    jsonroot.put("open", true);
    jsonroot.put("childOuter", false);
    jsonroot.put("icon", Globals.APP_BASE_NAME + "/images/icons/icon042a1.gif");
    array.add(jsonroot);
    for (int i = 0; i < list.size(); i++) {
      Map<String, Object> jsonobj = new HashMap<String, Object>();
      Sys_unit obj = list.get(i);
      jsonobj.put("id", obj.getId());
      String p = obj.getId().substring(0, obj.getId().length() - 4);
      jsonobj.put("pId", p == "" ? "0" : p);
      jsonobj.put("name", obj.getName());
      jsonobj.put("childOuter", false);
      if (obj.getId().length() < 12) {
        jsonobj.put("open", true);
      } else {
        jsonobj.put("open", false);
      }
      array.add(jsonobj);
    }

    req.setAttribute("str", Json.toJson(array));
  }
  public void loc(String runactkey) throws Exception {
    HttpSession session = Mvcs.getHttpSession(true);
    DynamicObject token =
        (DynamicObject)
            session.getAttribute(com.skynet.framework.spec.GlobalConstants.sys_login_token);
    String deptid = token.getFormatAttr(com.skynet.framework.spec.GlobalConstants.sys_login_dept);

    DynamicObject ract =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getActManager()
            .getRactService()
            .locate(runactkey);
    String id = ract.getFormatAttr("dataid");
    String tableid = ract.getFormatAttr("tableid");
    DynamicObject baseapprove = partyduebaseapproveService.locate(id);
    DynamicObject baseapprovedetail =
        partyduebaseapprovedetailService.locateBy(
            Cnd.where("suggestid", "=", id).and("deptid", "=", deptid));
    List<DynamicObject> baseapprovedetails =
        partyduebaseapprovedetailService.findByCond(Cnd.where("suggestid", "=", id)); // 汇总意见
    // 权限设置
    set_author();

    // 查询可选路由
    String actdefid = ract.getFormatAttr("actdefid");
    List<DynamicObject> routes =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getFlowManager()
            .getBrouteService()
            .getRoutes(actdefid);

    ro.put("tableid", tableid);
    ro.put("runactkey", runactkey);
    ro.put("baseapprove", baseapprove);
    ro.put("baseapprovedetail", baseapprovedetail);
    ro.put("baseapprovedetails", baseapprovedetails);
    ro.put("routes", routes);
  }