org.nutz.lang.Strings Java Examples

The following examples show how to use org.nutz.lang.Strings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SiteController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询站点列表
 */
@RequiresPermissions("cms:site:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return siteService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #2
Source File: XssHttpServletRequestWrapper.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 覆盖getParameter方法,将参数名和参数值都做xss过滤。<br/>
 * 如果需要获得原始的值,则通过super.getParameterValues(name)来获取<br/>
 * getParameterNames,getParameterValues和getParameterMap也可能需要覆盖
 */
@Override
public String getParameter(String name) {
    if(("content".equals(name) || name.endsWith("WithHtml")) && !isIncludeRichText){
        return super.getParameter(name);
    }
    name = JsoupUtil.clean(name);
    String value = super.getParameter(name);
    if (Strings.isNotBlank(value)) {
        // HTML transformation characters
        value = JsoupUtil.clean(value);
        // SQL injection characters
        value = StringEscapeUtils.escapeSql(value);
    }
    return value;
}
 
Example #3
Source File: DeptServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
public boolean checkDeptNameUnique(String id, String parentId, String menuName) {
    Cnd cnd =Cnd.NEW();
    if(Strings.isNotBlank(id)){
        cnd.and("id","!=",id);
    }
    if(Strings.isNotBlank(parentId)){
        cnd.and("parent_id","=",parentId);
    }
    if(Strings.isNotBlank(menuName)){
        cnd.and("dept_name", "=", menuName);
    }
    List<Dept> list = this.query(cnd);
    if (Lang.isEmpty(list)) {
        return true;
    }
    return false;
}
 
Example #4
Source File: SimpleAuthorizingRealm.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
		UsernamePasswordToken upToken = (UsernamePasswordToken) token;
		if (Lang.isEmpty(upToken) || Strings.isEmpty(upToken.getUsername())) {
			throw Lang.makeThrow(AuthenticationException.class, "Account name is empty");
		}
		User user = userService.fetch(Cnd.where("login_name","=",upToken.getUsername()));
		if (Lang.isEmpty(user)) {
			throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", upToken.getUsername());
		}
		if (user.isStatus()) {
			throw Lang.makeThrow(LockedAccountException.class, "Account [ %s ] is locked.", upToken.getUsername());
		}
		SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user,
				user.getPassword().toCharArray(), ByteSource.Util.bytes(user.getSalt()), getName());
		info.setCredentialsSalt(ByteSource.Util.bytes(user.getSalt()));
//        info.
		return info;
	}
 
Example #5
Source File: BaseServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
public TableDataInfo tableListFetchLinks(Integer pageNumber, Integer pageSize,Cnd cnd,String orderByColumn,String isAsc,String linkname){
    Pager pager=null;
    if(Lang.isNotEmpty(pageNumber) && Lang.isNotEmpty(pageSize)){
        pager = this.dao().createPager(pageNumber, pageSize);
    }
    if (Strings.isNotBlank(orderByColumn) && Strings.isNotBlank(isAsc)) {
        MappingField field =dao().getEntity(this.getEntityClass()).getField(orderByColumn);
        if(Lang.isNotEmpty(field)){
            cnd.orderBy(field.getColumnName(),isAsc);
        }
    }
    List<T> list = this.dao().query(this.getEntityClass(), cnd, pager);
    if (!Strings.isBlank(linkname)) {
        this.dao().fetchLinks(list, linkname);
    }
    return new TableDataInfo(list, this.dao().count(this.getEntityClass(),cnd));
}
 
Example #6
Source File: BaseServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
public QueryResult listPage(int pageNumber, int pageSize, Cnd cnd, String orderByColumn, String isAsc, String linkname){
    Pager pager = this.dao().createPager(pageNumber, pageSize);
    if (Strings.isNotBlank(orderByColumn) && Strings.isNotBlank(isAsc)) {
        MappingField field =dao().getEntity(this.getEntityClass()).getField(orderByColumn);
        if(Lang.isNotEmpty(field)){
            cnd.orderBy(field.getColumnName(),isAsc);
        }
    }
    List<T> list = this.dao().query(this.getEntityClass(), cnd, pager);
    if (!Strings.isBlank(linkname)) {
        this.dao().fetchLinks(list, linkname);
    }
    pager.setRecordCount(this.dao().count(getEntityClass(), cnd));
    return new QueryResult(list, pager);
}
 
Example #7
Source File: UserServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 更新角色
 *
 * @param data
 */
@Override
public void updataRelation(User data) {
    List<String> ids = new ArrayList<>();
    if (data != null && Strings.isNotBlank(data.getRoleIds())) {
        if (Strings.isNotBlank(data.getRoleIds())) {
            ids = Arrays.asList(data.getRoleIds().split(","));
        }
        //清除已有关系
        User tmpData = this.fetch(data.getId());
        this.fetchLinks(tmpData, "roles");
        dao().clearLinks(tmpData, "roles");
    }
    if (ids != null && ids.size() > 0) {
        Criteria cri = Cnd.cri();
        cri.where().andInStrList("id", ids);
        List<Role> roleList = roleService.query(cri);
        data.setRoles(roleList);
    }
    //更新关系
    dao().insertRelation(data, "roles");
}
 
Example #8
Source File: Wxs.java    From nutzwx with Apache License 2.0 6 votes vote down vote up
/**
 * 根据提交参数,生成签名
 *
 * @param map
 *            要签名的集合
 * @param key
 *            商户秘钥
 * @return 签名
 *
 * @see <a href=
 *      "https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3">
 *      微信商户平台签名算法</a>
 *
 */
public static String genPaySign(Map<String, Object> map, String key, String signType) {
    String[] nms = map.keySet().toArray(new String[map.size()]);
    Arrays.sort(nms);
    StringBuilder sb = new StringBuilder();
    signType = signType == null ? "MD5" : signType.toUpperCase();
    boolean isMD5 = "MD5".equals(signType);
    for (String nm : nms) {
        Object v = map.get(nm);
        if (null == v)
            continue;
        // JSSDK 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。
        // 但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
        if (isMD5 && "timestamp".equals(nm)) {
            nm = "timeStamp";
        }
        String s = v.toString();
        if (Strings.isBlank(s))
            continue;
        sb.append(nm).append('=').append(s).append('&');
    }
    sb.append("key=").append(key);
    return Lang.digest(signType, sb).toUpperCase();
}
 
Example #9
Source File: LoachClient.java    From nutzcloud with Apache License 2.0 6 votes vote down vote up
protected boolean _ping() {
    try {
        String pingURL = url + "/ping/" + getServiceName() + "/" + id;
        if (isDebug())
            log.debug("Ping URL=" + pingURL);
        Request req = Request.create(pingURL, METHOD.GET);
        req.getHeader().clear();
        req.getHeader().set("If-None-Match", lastPingETag);
        Response resp = Sender.create(req, conf.getInt("loach.client.ping.timeout", 1000)).setConnTimeout(1000).send();
        String cnt = resp.getContent();
        if (isDebug())
            log.debug("Ping result : " + cnt);
        if (resp.isOK()) {
            lastPingETag = Strings.sBlank(resp.getHeader().get("ETag"), "ABC");
            NutMap re = Json.fromJson(NutMap.class, cnt);
            if (re != null && re.getBoolean("ok", false))
                return true;
        } else if (resp.getStatus() == 304) {
            return true;
        }
    }
    catch (Throwable e) {
        log.debugf("bad url? %s %s", url, e.getMessage());
    }
    return false;
}
 
Example #10
Source File: Utils.java    From web-flash with MIT License 6 votes vote down vote up
/**
 * 以“_”分割的单词转换为首字母大写驼峰格式
 * @param src
 * @return
 */
public static String upperCamel(String src){
    if(!src.contains("_")){
        return src;
    }
    src = src.toLowerCase();
    StringBuilder result = new StringBuilder();
    for(String sitem:src.split("_")){
        if(result.toString().length()==0){
            result.append(Strings.upperFirst(sitem));
        }else{
            result.append(Strings.upperFirst(sitem));
        }
    }
    return result.toString();
}
 
Example #11
Source File: PetController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询宠物列表
 */
@RequiresPermissions("test:pet:list")
@At
@Ok("json")
public Object list(@Param("pageNum")int pageNum,
				   @Param("pageSize")int pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return petService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,"master");
}
 
Example #12
Source File: Utils.java    From flash-waimai with MIT License 6 votes vote down vote up
/**
 * 以“_”分割的单词转换为首字母大写驼峰格式
 * @param src
 * @return
 */
public static String upperCamel(String src){
    if(!src.contains("_")){
        return src;
    }
    src = src.toLowerCase();
    StringBuilder result = new StringBuilder();
    for(String sitem:src.split("_")){
        if(result.toString().length()==0){
            result.append(Strings.upperFirst(sitem));
        }else{
            result.append(Strings.upperFirst(sitem));
        }
    }
    return result.toString();
}
 
Example #13
Source File: CategoryServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
   public List<Map<String, Object>> selectTree(String parentId, String name) {
	Cnd cnd = Cnd.NEW();
	if (Strings.isNotBlank(name)) {
		//cnd.and("name", "like", "%" + name + "%");
	}
	if (Strings.isNotBlank(parentId)) {
		cnd.and("parent_id", "=", parentId);
	}
	//cnd.and("status", "=", false).and("del_flag", "=", false);
	cnd.asc("sort");
	List<Category> list = this.query(cnd);
	List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
	trees = getTrees(list);
	return trees;
}
 
Example #14
Source File: DeptServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
public List<Map<String, Object>> selectTree(String parentId, String name) {
    Cnd cnd = Cnd.NEW();
    if (Strings.isNotBlank(name)) {
        cnd.and("dept_name", "like", "%" + name + "%");
    }
    if (Strings.isNotBlank(parentId)) {
        cnd.and("parent_id", "=", parentId);
    }
    cnd.and("status", "=", false).and("del_flag", "=", false);
    List<Dept> deptList = this.query(cnd);
    List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
    trees = getTrees(deptList);
    return trees;
}
 
Example #15
Source File: RoleServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 校验角色名称是否唯一
 * @param roleName
 * @return
 */
@Override
public boolean checkRoleNameUnique(String id, String roleName, String roleKey) {
    Cnd cnd =Cnd.NEW();
    if(Strings.isNotBlank(id)){
        cnd.and("id","!=",id);
    }
    if(Strings.isNotBlank(roleName)){
        cnd.and("role_name", "=", roleName);
    }
    if(Strings.isNotBlank(roleKey)){
        cnd.and("role_key", "=", roleKey);
    }
    List<Role> roleList = this.query(cnd);
    if (Lang.isEmpty(roleList)) {
        return true;
    }
    return false;
}
 
Example #16
Source File: RoleServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 更新角色
 *
 * @param data
 * @return
 */
@Override
public int update(Role data) {
    List<String> ids = new ArrayList<>();
    if (data != null && data.getMenuIds() != null) {
        if (Strings.isNotBlank(data.getMenuIds())) {
            ids = Arrays.asList(data.getMenuIds().split(","));
        }
        //清除已有关系
        Role tmpData = this.fetch(data.getId());
        this.fetchLinks(tmpData, "menus");
        dao().clearLinks(tmpData, "menus");
    }
    if (ids != null && ids.size() > 0) {
        Criteria cri = Cnd.cri();
        cri.where().andInStrList("id", ids);
        List<Menu> menuList = menuService.query(cri);
        data.setMenus(menuList);
    }
    int count = dao().update(data);
    dao().insertRelation(data, "menus");
    return count;
}
 
Example #17
Source File: AreaServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
	 * 查询数据树
	 * @param parentId
	 * @param name
	 * @return
	 */
	@Override
    public List<Map<String, Object>> selectTree(String parentId, String name) {
		Cnd cnd = Cnd.NEW();
		if (Strings.isNotBlank(name)) {
			//cnd.and("name", "like", "%" + name + "%");
		}
		if (Strings.isNotBlank(parentId)) {
			cnd.and("parent_id", "=", parentId);
		}
//		cnd.and("status", "=", false).and("del_flag", "=", false);
		List<Area> list = this.query(cnd);
		List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
		trees = getTrees(list);
		return trees;
	}
 
Example #18
Source File: MasterController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询主人列表
 */
@RequiresPermissions("test:master:list")
@At
@Ok("json")
public Object list(@Param("pageNum")int pageNum,
				   @Param("pageSize")int pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return masterService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #19
Source File: ProfileController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@At
@POST
@Ok("json")
@Slog(tag="个人信息", after="重置密码")
public Result resetPwdDo(@Param("oldPassword") String oldPassword,
                       @Param("newPassword") String newPassword) {
    User user = ShiroUtils.getSysUser();
    String old = new Sha256Hash(oldPassword, user.getSalt(), 1024).toBase64();
    if (Strings.isNotBlank(newPassword) && old.equals(user.getPassword())) {
        user.setPassword(newPassword);
        if (userService.resetUserPwd(user) > 0) {
            ShiroUtils.setSysUser(userService.fetch(user.getId()));
            return Result.success("system.success");
        }
        return Result.error("system.error");
    } else {
        return Result.error("profile.resetpwd");
    }
}
 
Example #20
Source File: DictController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询字典列表
 */
@RequiresPermissions("sys:dict:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
       cnd.and("del_flag","=",false);
	return dictService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #21
Source File: WxMenuServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
public List<Map<String, Object>> selectTree(String parentId, String name) {
	Cnd cnd = Cnd.NEW();
	if (Strings.isNotBlank(name)) {
		//cnd.and("name", "like", "%" + name + "%");
	}
	if (Strings.isNotBlank(parentId)) {
		cnd.and("parent_id", "=", parentId);
	}
	//cnd.and("status", "=", false).and("del_flag", "=", false);
	List<WxMenu> list = this.query(cnd);
	List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
	trees = getTrees(list);
	return trees;
}
 
Example #22
Source File: GlobalsSettingProcessor.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
    public void process(ActionContext ac) throws Throwable {

        boolean captcha = Boolean.valueOf(Globals.getConfig("login.captcha"));
        String path = ac.getServletContext().getContextPath();
        String projectName = path.length() > 0 ? path + "/" : "/";
        ac.getRequest().setAttribute("AppBase", projectName);
        ac.getRequest().setAttribute("captchaEnabled", captcha);
        ac.getRequest().setAttribute("pubkey", Globals.getPublicKey());
//      //允许跨越
//        ac.getResponse().addHeader("Access-Control-Allow-Origin", "*");
//        ac.getResponse().addHeader("Access-Control-Allow-Credentials", "true");
//        ac.getResponse().addHeader("Access-Control-Allow-Headers",
//                "Origin, X-Requested-With, Content-Type, Accept, Connection, User-Agent, Cookie");
        // 如果url中有语言属性则设置
        String lang = ac.getRequest().getParameter("lang");
        if (!Strings.isEmpty(lang)) {
            Mvcs.setLocalizationKey(lang);
        } else {
            // Mvcs.getLocalizationKey()  1.r.56 版本是null,所以要做两次判断, 1.r.57已修复为默认值 Nutz:Fix issue 1072
            lang = Strings.isBlank(Mvcs.getLocalizationKey()) ? Mvcs.getDefaultLocalizationKey() : Mvcs.getLocalizationKey();
        }
        ac.getRequest().setAttribute("lang", lang);
        doNext(ac);
    }
 
Example #23
Source File: MenuController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@At
@POST
@Ok("json")
@RequiresPermissions("sys:menu:edit")
@Slog(tag="菜单", after="修改保存菜单")
public Object editDo(@Param("..") Menu menu, @Param("parentId") String parentId, Errors es, HttpServletRequest req) {
    try {
        if(es.hasError()){
             return Result.error(es);
        }
        if (menu != null && Strings.isEmpty(menu.getParentId())) {
            menu.setParentId("0");
        }
        if(Lang.isNotEmpty(menu)){
            menu.setUpdateBy(ShiroUtils.getSysUserId());
            menu.setUpdateTime(new Date());
            menuService.update(menu);
        }
        return Result.success("system.success");
    } catch (Exception e) {
        return Result.error(e instanceof ErrorException ? e.getMessage() : "system.error");
    }
}
 
Example #24
Source File: WechatAPIImpl.java    From mpsdk4j with Apache License 2.0 6 votes vote down vote up
@Override
public Follower getWebOauth2User(String openId, String lang) {
    lang = Strings.sBlank(lang, "zh_CN");
    WebOauth2Result result = _oath2.get(openId);
    if (result == null){
       throw Lang.wrapThrow(new WechatAPIException("用户未授权"));
    } else if (!result.isAvailable()){
        result = refreshWebOauth2Result(result.getRefreshToken());
    }

    String url = mergeAPIUrl(oauth2UserURL, result.getAccessToken(), openId, lang);
    APIResult ar = wechatServerResponse(url,
            HTTP_GET,
            NONE_BODY,
            "以网页授权方式获取公众号[%s]的用户[%s-%s]信息失败.",
            openId,
            lang);
    return Json.fromJson(Follower.class, ar.getJson());
}
 
Example #25
Source File: WxMenuController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询微信菜单列表
 */
@At
@Ok("json")
@RequiresPermissions("wx:menu:list")
public Object list(@Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return wxMenuService.query(cnd);
}
 
Example #26
Source File: Globals.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 获取上传文件的根目录
 *
 * @return
 */
public static String getUserfilesBaseDir() {
    String dir = getConfig("userfiles.basedir");
    if (Strings.isBlank(dir)) {
        try {
            dir = Mvcs.getServletContext().getRealPath("/");
        } catch (Exception e) {
            return "";
        }
    }
    if (!dir.endsWith("/")) {
        dir += "/";
    }
    // System.out.println("userfiles.basedir: " + dir);
    return dir;
}
 
Example #27
Source File: OAuth2Util.java    From DAFramework with MIT License 6 votes vote down vote up
public static EAccessToken fetch(OAuth2Authentication oAuth2Authentication, OAuth2AccessToken accessToken){
	EAccessToken eAccessToken = new EAccessToken();
	eAccessToken.setOpenUser(fetch(oAuth2Authentication));

	Object details = oAuth2Authentication.getDetails();
	if(details instanceof OAuth2AuthenticationDetails){
		OAuth2AuthenticationDetails details1 = (OAuth2AuthenticationDetails) details;
		eAccessToken.setRemoteAddress(details1.getRemoteAddress());
		eAccessToken.setSessionId(details1.getSessionId());
	}
	eAccessToken.setTokenType(accessToken.getTokenType());
	eAccessToken.setTokenValue(accessToken.getValue());
	eAccessToken.setExpiresIn(accessToken.getExpiresIn());
	if (accessToken.getRefreshToken() != null) {
		eAccessToken.setRefreshToken(accessToken.getRefreshToken().getValue());
	}
	if (accessToken.getScope() != null) {
		String scopes = Strings.join2("|", accessToken.getScope().toArray(new String[]{}));
		eAccessToken.setScopes(scopes);
	}
	return eAccessToken;
}
 
Example #28
Source File: MaterialController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询微信素材列表
 */
@RequiresPermissions("wx:material:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return materialService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #29
Source File: RoleController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
                   @Param("pageSize")Integer pageSize,
                   @Param("roleName") String roleName,
                   @Param("roleKey") String roleKey,
                   @Param("orderByColumn") String orderByColumn,
                   @Param("isAsc") String isAsc,
                   HttpServletRequest req) {
    Cnd cnd = Cnd.NEW();
    if (!Strings.isBlank(roleName)){
        cnd.and("role_name", "like", "%" + roleName +"%");
    }
    if (!Strings.isBlank(roleKey)){
        cnd.and("role_key", "=", roleKey);
    }
    return roleService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #30
Source File: UserOnlineController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询在线用户记录列表
 */
@RequiresPermissions("monitor:online:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String ipaddr,
				   @Param("loginName") String loginName,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(ipaddr)){
		cnd.and("ipaddr", "=", ipaddr);
	}
	if (!Strings.isBlank(loginName)){
		cnd.and("login_name", "=", loginName);
	}
	return userOnlineService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}