Java Code Examples for com.zhazhapan.util.Formatter#listToJson()

The following examples show how to use com.zhazhapan.util.Formatter#listToJson() . 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: FileController.java    From efo with MIT License 6 votes vote down vote up
@ApiOperation(value = "获取文件记录")
@ApiImplicitParams({@ApiImplicitParam(name = "offset", value = "偏移量", required = true), @ApiImplicitParam(name =
        "categoryId", value = "分类ID", required = true), @ApiImplicitParam(name = "orderBy", value = "排序方式",
        required = true, example = "id desc"), @ApiImplicitParam(name = "search", value = "记录匹配(允许为空)")})
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAll(int offset, int categoryId, String orderBy, String search) {
    User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
    boolean canGet = EfoApplication.settings.getBooleanUseEval(ConfigConsts.ANONYMOUS_VISIBLE_OF_SETTING) ||
            (Checker.isNotNull(user) && user.getIsVisible() == 1);
    if (canGet) {
        int userId = Checker.isNull(user) ? 0 : user.getId();
        return Formatter.listToJson(fileService.listAll(userId, offset, categoryId, orderBy, search));
    } else {
        jsonObject.put("error", "权限被限制,无法获取资源,请联系管理员");
        return jsonObject.toString();
    }
}
 
Example 2
Source File: UserController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取所有用户")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "指定用户(默认所有用户)"), @ApiImplicitParam(name = "offset",
        value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getUser(String user, int offset) {
    User u = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
    return Formatter.listToJson(userService.listUser(u.getPermission(), user, offset));
}
 
Example 3
Source File: AuthController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取权限记录")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "用户", required = true), @ApiImplicitParam(name =
        "file", value = "文件", required = true), @ApiImplicitParam(name = "offset", value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAuth(String user, String file, int offset) {
    return Formatter.listToJson(authService.listAuth(user, file, offset));
}
 
Example 4
Source File: DownloadedController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取文件下载记录")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "指定用户(默认所有用户)"), @ApiImplicitParam(name =
        "指定文件(默认所有文件)"), @ApiImplicitParam(name = "category", value = "指定分类(默认所有分类)"), @ApiImplicitParam(name =
        "offset", value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "all", method = RequestMethod.GET)
public String getAll(String user, String file, String category, int offset) {
    return Formatter.listToJson(downloadService.list(user, file, category, offset));
}
 
Example 5
Source File: UploadedController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取文件上传记录")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "指定用户(默认所有用户)"), @ApiImplicitParam(name =
        "指定文件(默认所有文件)"), @ApiImplicitParam(name = "category", value = "指定分类(默认所有分类)"), @ApiImplicitParam(name =
        "offset", value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "all", method = RequestMethod.GET)
public String getAll(String user, String file, String category, int offset) {
    return Formatter.listToJson(uploadedService.list(user, file, category, offset));
}
 
Example 6
Source File: FileController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取我的下载记录")
@ApiImplicitParams({@ApiImplicitParam(name = "offset", value = "偏移量", required = true), @ApiImplicitParam(name =
        "search", value = "记录匹配(允许为空)")})
@AuthInterceptor(InterceptorLevel.USER)
@RequestMapping(value = "/user/downloaded", method = RequestMethod.GET)
public String getUserDownloaded(int offset, String search) {
    User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
    return Formatter.listToJson(fileService.listUserDownloaded(user.getId(), offset, search));
}
 
Example 7
Source File: FileController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取我的上传记录")
@ApiImplicitParams({@ApiImplicitParam(name = "offset", value = "偏移量", required = true), @ApiImplicitParam(name =
        "search", value = "记录匹配(允许为空)")})
@AuthInterceptor(InterceptorLevel.USER)
@RequestMapping(value = "/user/uploaded", method = RequestMethod.GET)
public String getUserUploaded(int offset, String search) {
    User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
    return Formatter.listToJson(fileService.listUserUploaded(user.getId(), offset, search));
}
 
Example 8
Source File: FileController.java    From efo with MIT License 5 votes vote down vote up
@ApiOperation(value = "获取所有文件的基本信息")
@ApiImplicitParams({@ApiImplicitParam(name = "user", value = "指定用户(默认所有用户)"), @ApiImplicitParam(name = "file",
        value = "指定文件(默认所有文件)"), @ApiImplicitParam(name = "category", value = "指定分类(默认所有分类)"), @ApiImplicitParam
        (name = "offset", value = "偏移量", required = true)})
@AuthInterceptor(InterceptorLevel.ADMIN)
@RequestMapping(value = "/basic/all", method = RequestMethod.GET)
public String getBasicAll(String user, String file, String category, int offset) {
    return Formatter.listToJson(fileService.listBasicAll(user, file, category, offset));
}
 
Example 9
Source File: CategoryController.java    From efo with MIT License 4 votes vote down vote up
@ApiOperation(value = "获取所有分类")
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAll() {
    return Formatter.listToJson(categoryService.list());
}