Beispiel #1
0
  @Test
  public void test() {
    Ioc ioc = new NutIoc(new JsonLoader("ioc.js"));
    Dao dao = ioc.get(NutDao.class, "rDao");
    dao.create(Teacher.class, true);
    TeacherAction action = ioc.get(TeacherAction.class);
    action.add("20092009", "张三", "123456", 1L, "*****@*****.**", "13333333333", Teacher.ROLE_ADMIN);
    action.add(
        "20102010", "李四", "123456", 1L, "*****@*****.**", "13333333333", Teacher.ROLE_NORMAL);
    action.add(
        "20132013", "王五", "123456", 2L, "*****@*****.**", "13333333333", Teacher.ROLE_ADMIN);

    action.mod("20092009", "张三", "123456", 1L, "*****@*****.**", "13333333333", Teacher.ROLE_ADMIN);
    action.mod(
        "20102010", "李四", "123456", 1L, "*****@*****.**", "13333333333", Teacher.ROLE_NORMAL);
    action.mod(
        "20132013", "王五", "123456", 2L, "*****@*****.**", "13333333333", Teacher.ROLE_ADMIN);

    System.out.println(Json.toJson(action.list(1L, "", 1, 10)));
    System.out.println(Json.toJson(action.list(1L, "张", 1, 10)));
    System.out.println(Json.toJson(action.list(1L, "10", 1, 10)));
    //        System.out.println(Json.toJson(action.login("20092009","123456")));
    //        System.out.println(Json.toJson(action.login("*****@*****.**","123456")));
    //        System.out.println(Json.toJson(action.login("*****@*****.**","12346")));

    //        action.del("20092009");
    //        action.del("20102010");
    //        action.del("20132013");
  }
  /**
   * 无and关系的tag查询
   *
   * @param tagIds 标签ids
   * @param order
   * @param pager
   * @return
   */
  public List<Resource> resourceTagSearch(Integer tagId, String order, Pager pager) {

    List<Resource> query = null;

    if (tagId != null) {
      Sql sql_resource =
          Sqls.create(
              "select * from resource as r, resource_tag as rt where rt.resource_id = r.id and rt.tag_id = "
                  + tagId);
      sql_resource.setCallback(Sqls.callback.entities());
      sql_resource.setEntity(dao.getEntity(Resource.class));
      dao.execute(sql_resource);
      query = sql_resource.getList(Resource.class);
      if (pager != null) {
        pager.setRecordCount(query.size());
      }

    } else {
      System.out.print("resourceservice: tagid无效");
    }
    for (Resource resource : query) {
      resourceRelationFull(resource);
    }
    return query;
  }
Beispiel #3
0
 public static int getRecordSize(Dao dao, String s) {
   Sql _s = Sqls.create("select count(*) nums from ( " + s + " )");
   _s.setCallback(Sqls.callback.entity());
   _s.setEntity(dao.getEntity(Record.class));
   dao.execute(_s);
   return ((Record) _s.getResult()).getInt("nums");
 }
Beispiel #4
0
 public static List getRecords(Dao dao, String sql, Class t) {
   Sql s = Sqls.create(sql);
   s.setCallback(Sqls.callback.entities());
   s.setEntity(dao.getEntity(t));
   dao.execute(s);
   return s.getList(Record.class);
 }
  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));
  }
Beispiel #6
0
  @Override
  public List<Item> listWithSkuByOrder(long orderId) {
    String exp =
        "select i.id as 'i.id', i.sku_id as 'i.sku_id', i.sku_more_id as 'i.sku_more_id'\n"
            + "     , i.dprice as 'i.dprice', i.dcount as 'i.dcount', i.payment as 'i.payment'\n"
            + "     , i.return_time as 'i.return_time', i.return_reason as 'i.return_reason'"
            + "     , i.return_desc as 'i.return_desc'\n"
            + "     , i.state as 'i.state', i.order_id as 'i.order_id'\n"
            + "     , g.cate_code as 's.cate_code', g.gname as 's.gname', sku.img as 's.img'\n"
            + "     , sku.model as 's.model', sku.sprice as 's.sprice', sm.size as 's.size'\n"
            + "from t_item i\n"
            + "inner join t_sku sku on sku.id = i.sku_id\n"
            + "inner join t_sku_more sm on sm.id = i.sku_more_id\n"
            + "inner join t_goods g on g.id = sku.goods_id\n"
            + "where i.order_id = @orderId";

    Sql sql = Sqls.queryRecord(exp);
    sql.params().set("orderId", orderId);

    dao.execute(sql);
    List<Record> list = sql.getList(Record.class);
    List<Item> itemList = new ArrayList<Item>();
    for (Record re : list) {
      Item item = re.toEntity(dao.getEntity(Item.class), "i.");
      Sku4Item skuInfo = re.toEntity(dao.getEntity(Sku4Item.class), "s.");
      item.setSku(skuInfo);
      itemList.add(item);
    }

    return itemList;
  }
  public void confirm(ActionEvent event) {
    String name = nameField.getText();
    if (S.isEmpty(name)) {
      tipsLabel.setText("错误:工具名字不能为空!");
      nameField.requestFocus();
      return;
    }
    String command = commandText.getText();
    String order = orderField.getText();
    ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem();
    Integer parentId = bandeja.getId();
    ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem();
    String type = toolType.getToolType();

    ToolsTray toolsTray = new ToolsTray();
    toolsTray.setTrayName(name);
    toolsTray.setCommand(command);
    toolsTray.setParentId(parentId);
    toolsTray.setToolOrder(order);
    toolsTray.setToolType(type);
    if (null == id) {
      dao.insert(toolsTray);
      id = toolsTray.getId();
      tipsLabel.setText("添加成功:" + name);
    } else {
      toolsTray.setId(id);
      dao.update(toolsTray);
      tipsLabel.setText("更新成功:" + name);
    }
    refresh(null);
  }
Beispiel #8
0
 public static Record getRecord(Dao dao, String sql) {
   Sql s = Sqls.create(sql);
   s.setCallback(Sqls.callback.entity());
   s.setEntity(dao.getEntity(Record.class));
   dao.execute(s);
   return (Record) s.getResult();
 }
  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);
  }
Beispiel #10
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();
 }
Beispiel #11
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;
  }
Beispiel #12
0
 @Aop("redis")
 public boolean updateTags(String topicId, @Param("tags") Set<String> tags) {
   if (Strings.isBlank(topicId) || tags == null) {
     return false;
   }
   Topic topic = dao.fetch(Topic.class, topicId);
   if (topic == null) return false;
   Set<String> oldTags = topic.getTags();
   if (oldTags == null) oldTags = new HashSet<>();
   log.debugf("update from '%s' to '%s'", oldTags, tags);
   topic.setTags(tags);
   dao.update(topic, "tags");
   Set<String> newTags = new HashSet<>(tags);
   newTags.removeAll(oldTags);
   Set<String> removeTags = new HashSet<>(oldTags);
   ;
   removeTags.remove(tags);
   fillTopic(topic, null);
   Date lastReplyTime = topic.getCreateTime();
   if (topic.getLastComment() != null) lastReplyTime = topic.getLastComment().getCreateTime();
   Pipeline pipe = jedis().pipelined();
   for (String tag : removeTags) {
     pipe.zrem(RKEY_TOPIC_TAG + tag.toLowerCase().trim(), topic.getId());
     pipe.zincrby(RKEY_TOPIC_TAG_COUNT, -1, tag.toLowerCase().trim());
   }
   for (String tag : newTags) {
     pipe.zadd(RKEY_TOPIC_TAG + tag.toLowerCase().trim(), lastReplyTime.getTime(), topic.getId());
     pipe.zincrby(RKEY_TOPIC_TAG_COUNT, 1, tag.toLowerCase().trim());
   }
   pipe.sync();
   return true;
 }
Beispiel #13
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;
  }
Beispiel #14
0
 public static Object getRecort(Dao dao, String sql, Class t) {
   Sql s = Sqls.create(sql);
   s.setCallback(Sqls.callback.entity());
   s.setEntity(dao.getEntity(t));
   dao.execute(s);
   return s.getResult();
 }
Beispiel #15
0
  @Async
  protected void notifyUsers(Topic topic, TopicReply reply, String cnt, int userId) {
    String replyAuthorName = dao.fetch(User.class, userId).getName();
    // 通知原本的作者
    if (topic.getUserId() != userId) {
      String alert = replyAuthorName + "回复了您的帖子";
      pushUser(
          topic.getUserId(),
          alert,
          topic.getId(),
          replyAuthorName,
          topic.getTitle(),
          PushService.PUSH_TYPE_REPLY);
    }

    Set<String> ats = findAt(cnt, 5);
    for (String at : ats) {
      User user = dao.fetch(User.class, at);
      if (user == null) continue;
      if (topic.getUserId() == user.getId()) continue; // 前面已经发过了
      if (userId == user.getId()) continue; // 自己@自己, 忽略
      String alert = replyAuthorName + "在帖子回复中@了你";
      pushUser(
          user.getId(),
          alert,
          topic.getId(),
          replyAuthorName,
          topic.getTitle(),
          PushService.PUSH_TYPE_AT);
    }
  }
Beispiel #16
0
 @At
 @Ok("json")
 @AdaptBy(type = JsonAdaptor.class)
 public Object del(
     @Param("..") Store store, @Attr(scope = Scope.SESSION, value = "account") Account acc) {
   dao.delete(dao.fetch(Store.class, store.getId()));
   return store;
 }
Beispiel #17
0
 public static List<Record> getRecords(Dao dao, String sql, int page, int size) {
   Sql s = Sqls.create(sql);
   s.setCallback(Sqls.callback.entities());
   s.setPager(dao.createPager(page, size));
   s.setEntity(dao.getEntity(Record.class));
   dao.execute(s);
   return (List<Record>) s.getList(Record.class);
 }
Beispiel #18
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());
 }
Beispiel #19
0
  public boolean createEntity(Dao dao, Entity<?> en) {
    StringBuilder sb = new StringBuilder("CREATE TABLE " + en.getTableName() + "(");
    // 创建字段
    for (MappingField mf : en.getMappingFields()) {
      if (mf.isReadonly()) continue;
      sb.append('\n').append(mf.getColumnName());
      // 自增主键特殊形式关键字
      if (mf.isId() && mf.isAutoIncreasement()) {
        sb.append(" SERIAL");
      } else {
        sb.append(' ').append(evalFieldType(mf));
        // 非主键的 @Name,应该加入唯一性约束
        if (mf.isName() && en.getPkType() != PkType.NAME) {
          sb.append(" UNIQUE NOT NULL");
        }
        // 普通字段
        else {
          if (mf.isUnsigned()) sb.append(" UNSIGNED");
          if (mf.isNotNull()) sb.append(" NOT NULL");
          if (mf.isAutoIncreasement()) throw Lang.noImplement();
          if (mf.hasDefaultValue())
            sb.append(" DEFAULT '").append(getDefaultValue(mf)).append('\'');
        }
      }
      sb.append(',');
    }
    // 创建主键
    List<MappingField> pks = en.getPks();
    if (!pks.isEmpty()) {
      sb.append('\n');
      sb.append(
          String.format(
              "CONSTRAINT %s_pkey PRIMARY KEY (",
              en.getTableName().replace('.', '_').replace('"', '_')));
      for (MappingField pk : pks) {
        sb.append(pk.getColumnName()).append(',');
      }
      sb.setCharAt(sb.length() - 1, ')');
      sb.append("\n ");
    }

    // 结束表字段设置
    sb.setCharAt(sb.length() - 1, ')');

    // 执行创建语句
    dao.execute(Sqls.create(sb.toString()));

    // 创建索引
    dao.execute(createIndexs(en).toArray(new Sql[0]));

    // 创建关联表
    createRelation(dao, en);

    // 添加注释(表注释与字段注释)
    addComment(dao, en);

    return true;
  }
Beispiel #20
0
 protected void dropRelation(Dao dao, Entity<?> en) {
   final List<Sql> sqls = new ArrayList<Sql>(5);
   for (LinkField lf : en.visitManyMany(null, null, null)) {
     ManyManyLinkField mm = (ManyManyLinkField) lf;
     if (!dao.exists(mm.getRelationName())) continue;
     sqls.add(Sqls.create("DROP TABLE " + mm.getRelationName()));
   }
   dao.execute(sqls.toArray(new Sql[sqls.size()]));
 }
Beispiel #21
0
 public void init() {
   if (dao.count(ForumTip.class) < 1) {
     ForumTip forumTip = new ForumTip();
     forumTip.setUid(1);
     forumTip.setContent("第一条测试信息--论坛信息");
     forumTip.setCreateTime(System.currentTimeMillis());
     dao.insert(forumTip);
   }
 }
Beispiel #22
0
 /** 查询sql并把结果放入传入的class组成的List中 */
 public static <T> List<T> query(
     Dao dao, Class<T> classOfT, String sql, Condition cnd, Pager pager) {
   Sql sql2 = Sqls.queryEntity(sql);
   sql2.setEntity(dao.getEntity(classOfT));
   sql2.setCondition(cnd);
   sql2.setPager(pager);
   dao.execute(sql2);
   return sql2.getList(classOfT);
 }
Beispiel #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()));
  }
Beispiel #24
0
  @Override
  public Item findWithOrder(long id) {
    if (id <= 0) {
      throw new IllegalParameterException();
    }

    Item item = dao.fetch(Item.class, id);
    if (null != item) {
      dao.fetchLinks(item, "order");
    }
    return item;
  }
  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);
  }
 // @RequiresPermissions("topic:index:rebuild")
 public void rebuild() throws IOException {
   Sql sql = Sqls.queryString("select id from t_topic where tp='ask'");
   dao.execute(sql);
   luceneIndex.writer.deleteAll();
   String[] topicIds = sql.getObject(String[].class);
   for (String topicId : topicIds) {
     Topic topic = dao.fetch(Topic.class, topicId);
     bigContentService.fill(topic);
     _add(topic);
   }
   luceneIndex.writer.commit();
 }
Beispiel #27
0
 /**
  * 用没有处理过的Nutz.sql带分页
  *
  * @param dao
  * @param s
  * @param page
  * @param size
  * @return
  */
 public static Record getRecordsByNutSql(Dao dao, Sql s, int page, int size) {
   int total = getRecordSize(dao, s.toString());
   s.setCallback(Sqls.callback.entities());
   s.setPager(dao.createPager(page, size));
   s.setEntity(dao.getEntity(Record.class));
   dao.execute(s);
   Record rd = new Record();
   List<Record> records = s.getList(Record.class);
   rd.put("total", total);
   rd.put("rows", records);
   return rd;
 }
Beispiel #28
0
 public void createRelation(Dao dao, Entity<?> en) {
   final List<Sql> sqls = new ArrayList<Sql>(5);
   for (LinkField lf : en.visitManyMany(null, null, null)) {
     ManyManyLinkField mm = (ManyManyLinkField) lf;
     if (dao.exists(mm.getRelationName())) continue;
     String sql = "CREATE TABLE " + mm.getRelationName() + "(";
     sql += mm.getFromColumnName() + " " + evalFieldType(mm.getHostField()) + ",";
     sql += mm.getToColumnName() + " " + evalFieldType(mm.getLinkedField());
     sql += ")";
     sqls.add(Sqls.create(sql));
   }
   dao.execute(sqls.toArray(new Sql[sqls.size()]));
 }
Beispiel #29
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;
  }
Beispiel #30
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);
 }