基于javaweb+mysql的springboot线上网络文件管理系统(java+springboot+html+ssm+maven+mysql)

基于javaweb+mysql的springboot线上网络文件管理系统(java+springboot+html+ssm+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SpringBoot线上网络文件管理系统(java+springboot+html+ssm+maven+mysql)

项目介绍

本项目分为前后台,有管理员与用户两种角色;

管理员角色包含以下功能:

管理员登录,管理员主页,权限管理,分类管理,用户管理,文档管理,下载记录,上传记录等功能。 用户角色包含以下功能:

注册账号,登录,系统首页,我的资源查看,编辑资源,我的资料修改,文件上传,密码重置,邮箱信息,密码重置成功等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 8.0/5.7版本;

6.是否Maven项目:是;

技术栈

HTML+CSS+JavaScript+mysql+Spring+SpringMVC+mybatis+Spring boot

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

  2. 运行项目,输入http://localhost:8091 登录

    @ApiOperation(value = "登录(用户名密码和token必须有一个输入)")
    @ApiImplicitParams({@ApiImplicitParam(name = "username", value = "用户名"), @ApiImplicitParam(name
            = "password", value = "密码"), @ApiImplicitParam(name = "auto", value = "是否自动登录", dataType = "Boolean"),
            @ApiImplicitParam(name = "token", value = "用于自动登录")})
    @AuthInterceptor(InterceptorLevel.NONE)
    @RequestMapping(value = "/login", method = RequestMethod.PUT)
    public String login(String username, String password, boolean auto, String token) {
        //使用密码登录
        User user = userService.login(username, password, ValueConsts.NULL_STRING, ValueConsts.NULL_RESPONSE);
        if (Checker.isNull(user) || user.getPermission() < 1) {
            jsonObject.put("status", "failed");
        } else {
            request.getSession().setAttribute(ValueConsts.USER_STRING, user);
            jsonObject.put("status", "success");
            if (auto) {
                jsonObject.put("token", TokenConfig.generateToken(token, user.getId()));
            } else {
                jsonObject.put("token", "");
                TokenConfig.removeTokenByValue(user.getId());
            }
        }
        return jsonObject.toString();
    }

    @ApiOperation(value = "用户注册(当不需要验证邮箱时,邮箱和验证码可空)")
    @ApiImplicitParams({@ApiImplicitParam(name = "username", value = "用户名", required = true), @ApiImplicitParam(name
            = "email", value = "邮箱"), @ApiImplicitParam(name = "password", value = "密码", required = true),
            @ApiImplicitParam(name = "code", value = "验证码")})
    @AuthInterceptor(InterceptorLevel.NONE)
    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public String register(String username, String email, String password, String code) {
        boolean emilVerify = StartApplication.settings.getBooleanUseEval(ConfigConsts.EMAIL_VERIFY_OF_SETTINGS);
        jsonObject.put("status", "error");
        if (!emilVerify || isCodeValidate(code)) {
            if (userService.usernameExists(username)) {
                jsonObject.put("message", "用户名已经存在");
            } else if (userService.emailExists(email)) {
                jsonObject.put("message", "该邮箱已经被注册啦");
            } else if (userService.register(username, email, password)) {
                jsonObject.put("status", "success");
            } else {
                jsonObject.put("message", "数据格式不合法");
            }
        } else {
            jsonObject.put("message", "验证码校验失败");
        }
        return jsonObject.toString();

/**
 */
@Service
public class FileServiceImpl implements IFileService {

    private final static Logger logger = LoggerFactory.getLogger(FileServiceImpl.class);

    private static final String FILE_SUFFIX = "{fileSuffix}";

    private static final String RANDOM_ID = "{randomId}";

    private static final String YEAR = "{year}";

    private static final String MONTH = "{month}";

    private static final String DAY = "{day}";

    private static final String AUTHOR = "{author}";

    private static final String FILE_NAME = "{fileName}";
     * @return 是否删除成功
     */
    boolean removeByVisitUrl(String visitUrl);

    /**
     * 通过本地路径删除
     *
     * @param localUrl 访问路径
     *
     * @return 是否删除成功
     */
    boolean removeByLocalUrl(String localUrl);

    /**
     * 获取资源
     *
     * @param visitUrl 访问路径
     * @param request {@link HttpServletRequest}
     *
     * @return {@link File}
     */
    String getResource(String visitUrl, HttpServletRequest request);

    /**
     * 通过访问路径获取本地文件路径
     *
     * @param visitUrl 访问路径
     *
     * @return {@link String}
     */
    String getLocalUrlByVisitUrl(String visitUrl);

    /**
     * 获取所有文件
     *
     * @param userId 用户编号
     * @param offset 偏移
     * @param categoryId 分类编号
     * @param orderBy 排序方式
     * @param search 搜索
     *
     * @return {@link List}
     */
    List<FileRecord> listAll(int userId, int offset, int categoryId, String orderBy, String search);

    /**
     * 上传文件
     *
    /**
     * 更新用户登录时间
     *
     * @param user {@link User}
     */
    void updateUserLoginTime(User user);

    /**
     * 更新密码
     *
     * @param password 密码
     * @param id 用户编号
     *
     * @return 是否更新成功
     */
    boolean updatePasswordById(String password, int id);

    /**
     * 检查密码是否合法
     *
     * @param password 密码
     *
     * @return {@link Boolean}
     */
    boolean checkPassword(String password);

    /**
     * 检查邮箱是否存在
     *
     * @param email 邮箱
     *
     * @return {@link Boolean}
     */
    boolean emailExists(String email);

    /**
     * 更新用户基本信息
     *
     * @param id 编号
     * @param avatar 头像
     * @param realName 真实姓名
     * @param email 邮箱
     *
     * @return 是否更新成功
     */
    boolean updateBasicInfoById(int id, String avatar, String realName, String email);

    /**
                        }
                    }
                } else {
                    return false;
                }
            }
            //是否可以上传
            boolean canUpload = !multipartFile.isEmpty() && size <= maxSize && Pattern.compile(StartApplication
                    .settings.getStringUseEval(ConfigConsts.FILE_SUFFIX_MATCH_OF_SETTING)).matcher(suffix).matches()
                    && (Checker.isNotExists(localUrl) || !fileExists || StartApplication.settings.getBooleanUseEval
                    (ConfigConsts.FILE_COVER_OF_SETTING));
            logger.info("is empty [" + multipartFile.isEmpty() + "], file size [" + size + "], max file size [" +
                    maxSize + "]");
            if (canUpload) {
                String visitUrl = getRegularVisitUrl(Checker.isNotEmpty(prefix) && user.getPermission() > 1 ? prefix
                        : StartApplication.settings.getStringUseEval(ConfigConsts.CUSTOM_LINK_RULE_OF_SETTING), user,
                        name, suffix, category);
                if (fileExists) {
                    removeByLocalUrl(localUrl);
                }
                if (visitUrlExists(visitUrl)) {
                    removeByVisitUrl(visitUrl);
                }
                try {
                    multipartFile.transferTo(new java.io.File(localUrl));
                    logger.info("local url of upload file: " + localUrl);
                    File file = new File(name, suffix, localUrl, visitUrl, WebUtils.scriptFilter(description),
                            WebUtils.scriptFilter(tag), user.getId(), categoryId);
                    int[] auth = SettingConfig.getAuth(ConfigConsts.FILE_DEFAULT_AUTH_OF_SETTING);
                    file.setAuth(auth[0], auth[1], auth[2], auth[3], auth[4]);
                    boolean isSuccess = fileDAO.insertFile(file);
                    if (isSuccess) {
                        long fileId = fileDAO.getIdByLocalUrl(localUrl);
                        if (fileId > 0) {
                            authService.insertDefaultAuth(user.getId(), fileId);
                        }
                    } else {
                        FileExecutor.deleteFile(localUrl);
                    }
                    return isSuccess;
                } catch (Exception e) {
                    FileExecutor.deleteFile(localUrl);
                    logger.error("save file error: " + e.getMessage());
                }
            }
        }
        return false;
    }

    private String getRegularVisitUrl(String customUrl, User user, String fileName, String suffix, Category category) {

/**
 */
@RestController
@RequestMapping("/category")
@Api(value = "/category", description = "文件分类相关操作")
public class CategoryController {

    private final ICategoryService categoryService;

    @Autowired
    public CategoryController(ICategoryService categoryService) {this.categoryService = categoryService;}

    @ApiOperation(value = "新增一个分类")
    @AuthInterceptor(InterceptorLevel.ADMIN)
    @RequestMapping(value = "/{name}", method = RequestMethod.POST)
    public String add(@PathVariable("name") String name) {
        return ControllerUtils.getResponse(categoryService.insert(name));
    }

    @ApiOperation(value = "更新分类名称")
    @ApiImplicitParam(name = "name", value = "新的名称", required = true)
    @AuthInterceptor(InterceptorLevel.ADMIN)
    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
    public String update(@PathVariable("id") int id, String name) {
        boolean isSuccess = Checker.isNotEmpty(name) && categoryService.update(id, name);
        return ControllerUtils.getResponse(isSuccess);
    }

    @ApiOperation(value = "删除一个分类")
    @AuthInterceptor(InterceptorLevel.ADMIN)
    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    public String remove(@PathVariable("id") int id) {
        return ControllerUtils.getResponse(categoryService.remove(id));
                .CODE_STRING)));
    }
}

/**
 */
@RestController
@RequestMapping("/file")
@Api(value = "/file", description = "文件相关操作")
public class FileController {

    private final IFileService fileService;

    private final HttpServletRequest request;

    private final JSONObject jsonObject;

    @Autowired
    public FileController(IFileService fileService, HttpServletRequest request, JSONObject jsonObject) {
        this.fileService = fileService;
        this.request = request;
        this.jsonObject = jsonObject;
    }

            boolean canUpload = !multipartFile.isEmpty() && size <= maxSize && Pattern.compile(StartApplication
                    .settings.getStringUseEval(ConfigConsts.FILE_SUFFIX_MATCH_OF_SETTING)).matcher(suffix).matches()
                    && (Checker.isNotExists(localUrl) || !fileExists || StartApplication.settings.getBooleanUseEval
                    (ConfigConsts.FILE_COVER_OF_SETTING));
            logger.info("is empty [" + multipartFile.isEmpty() + "], file size [" + size + "], max file size [" +
                    maxSize + "]");
            if (canUpload) {
                String visitUrl = getRegularVisitUrl(Checker.isNotEmpty(prefix) && user.getPermission() > 1 ? prefix
                        : StartApplication.settings.getStringUseEval(ConfigConsts.CUSTOM_LINK_RULE_OF_SETTING), user,
                        name, suffix, category);
                if (fileExists) {
                    removeByLocalUrl(localUrl);
                }
                if (visitUrlExists(visitUrl)) {
                    removeByVisitUrl(visitUrl);
                }
                try {
                    multipartFile.transferTo(new java.io.File(localUrl));
                    logger.info("local url of upload file: " + localUrl);
                    File file = new File(name, suffix, localUrl, visitUrl, WebUtils.scriptFilter(description),
                            WebUtils.scriptFilter(tag), user.getId(), categoryId);
                    int[] auth = SettingConfig.getAuth(ConfigConsts.FILE_DEFAULT_AUTH_OF_SETTING);
                    file.setAuth(auth[0], auth[1], auth[2], auth[3], auth[4]);
                    boolean isSuccess = fileDAO.insertFile(file);
                    if (isSuccess) {
                        long fileId = fileDAO.getIdByLocalUrl(localUrl);
                        if (fileId > 0) {
                            authService.insertDefaultAuth(user.getId(), fileId);
                        }
                    } else {
                        FileExecutor.deleteFile(localUrl);
                    }
                    return isSuccess;
                } catch (Exception e) {
                    FileExecutor.deleteFile(localUrl);
                    logger.error("save file error: " + e.getMessage());
                }
            }
        }
        return false;
    }

    private String getRegularVisitUrl(String customUrl, User user, String fileName, String suffix, Category category) {
        Date date = new Date();
        suffix = suffix.startsWith(".") ? "" : "." + suffix;
        if (Checker.isNotEmpty(customUrl)) {
            try {
                customUrl = URLDecoder.decode(customUrl, "utf-8");
                        : StartApplication.settings.getStringUseEval(ConfigConsts.CUSTOM_LINK_RULE_OF_SETTING), user,
                        name, suffix, category);
                if (fileExists) {
                    removeByLocalUrl(localUrl);
                }
                if (visitUrlExists(visitUrl)) {
                    removeByVisitUrl(visitUrl);
                }
                try {
                    multipartFile.transferTo(new java.io.File(localUrl));
                    logger.info("local url of upload file: " + localUrl);
                    File file = new File(name, suffix, localUrl, visitUrl, WebUtils.scriptFilter(description),
                            WebUtils.scriptFilter(tag), user.getId(), categoryId);
                    int[] auth = SettingConfig.getAuth(ConfigConsts.FILE_DEFAULT_AUTH_OF_SETTING);
                    file.setAuth(auth[0], auth[1], auth[2], auth[3], auth[4]);
                    boolean isSuccess = fileDAO.insertFile(file);
                    if (isSuccess) {
                        long fileId = fileDAO.getIdByLocalUrl(localUrl);
                        if (fileId > 0) {
                            authService.insertDefaultAuth(user.getId(), fileId);
                        }
                    } else {
                        FileExecutor.deleteFile(localUrl);
                    }
                    return isSuccess;
                } catch (Exception e) {
                    FileExecutor.deleteFile(localUrl);
                    logger.error("save file error: " + e.getMessage());
                }
            }
        }
        return false;
    }

    private String getRegularVisitUrl(String customUrl, User user, String fileName, String suffix, Category category) {
        Date date = new Date();
        suffix = suffix.startsWith(".") ? "" : "." + suffix;
        if (Checker.isNotEmpty(customUrl)) {
            try {
                customUrl = URLDecoder.decode(customUrl, "utf-8");
            } catch (UnsupportedEncodingException e) {
                logger.error(e.getMessage());
            }
        }
            } else {
                jsonObject.put("message", "格式不合法");
            }
        } else {
            jsonObject.put("message", "验证码校验失败");
        }
        return jsonObject.toString();
    }

    @ApiOperation(value = "检测用户名是否已经注册")
    @ApiImplicitParam(name = "username", value = "用户名", required = true)
    @AuthInterceptor(InterceptorLevel.NONE)
    @RequestMapping(value = "/username/exists", method = RequestMethod.GET)
    public String usernameExists(String username) {
        jsonObject.put("exists", userService.usernameExists(username));
        return jsonObject.toString();
    }

    @ApiOperation(value = "检测邮箱是否已经注册")
    @ApiImplicitParam(name = "email", value = "邮箱", required = true)
    @AuthInterceptor(InterceptorLevel.NONE)
    @RequestMapping(value = "/email/exists", method = RequestMethod.GET)
    public String emailExists(String email) {
        jsonObject.put("exists", userService.emailExists(email));
        return jsonObject.toString();
    }

    private boolean isCodeValidate(String code) {
        return Checker.checkNull(code).equals(String.valueOf(request.getSession().getAttribute(DefaultValues
                .CODE_STRING)));
    }
}

            }
        }
        User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
        if (Checker.isNull(user)) {
            //读取token,自动登录
            Cookie cookie = HttpUtils.getCookie(ValueConsts.TOKEN_STRING, request.getCookies());
            if (Checker.isNotNull(cookie)) {
                user = userService.login(ValueConsts.EMPTY_STRING, ValueConsts.EMPTY_STRING, cookie.getValue(),
                        response);
                if (Checker.isNotNull(user)) {
                    request.getSession().setAttribute(ValueConsts.USER_STRING, user);
                }
            }
        }
        if (level != InterceptorLevel.NONE) {
            boolean isRedirect = Checker.isNull(user) || (level == InterceptorLevel.ADMIN && user.getPermission() <
                    2) || (level == InterceptorLevel.SYSTEM && user.getPermission() < 3);
            if (isRedirect) {
                response.sendRedirect(DefaultValues.SIGNIN_PAGE);
                return false;
            }
        }
        return true;
    }
}

    @AuthInterceptor(InterceptorLevel.USER)
    @RequestMapping(value = "/password", method = RequestMethod.PUT)
    public String updatePassword(String oldPassword, String newPassword) {
        User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
        jsonObject.put("status", "error");
        try {
            if (user.getPassword().equals(JavaEncrypt.sha256(oldPassword))) {
                if (userService.updatePasswordById(newPassword, user.getId())) {
                    jsonObject.put("status", "success");
                    TokenConfig.removeTokenByValue(user.getId());
                } else {
                    jsonObject.put("message", "新密码格式不正确");
                }
            } else {
                jsonObject.put("message", "原密码不正确");
            }
        } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
            jsonObject.put("message", "服务器内部错误,请稍后重新尝试");
        }
        return jsonObject.toString();
    }

    @ApiOperation(value = "获取我的基本信息")
    @AuthInterceptor(InterceptorLevel.USER)
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public String getInfo() {
        User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
        JSONObject object = JSON.parseObject(user.toString());
        object.remove(ValueConsts.ID_STRING);
        object.remove(ValueConsts.PASSWORD_STRING);
        return object.toString();
    }

    @ApiOperation(value = "登录(用户名密码和token必须有一个输入)")
    @ApiImplicitParams({@ApiImplicitParam(name = "username", value = "用户名"), @ApiImplicitParam(name
            = "password", value = "密码"), @ApiImplicitParam(name = "auto", value = "是否自动登录", dataType = "Boolean"),
            @ApiImplicitParam(name = "token", value = "用于自动登录")})
    @AuthInterceptor(InterceptorLevel.NONE)
    @RequestMapping(value = "/login", method = RequestMethod.PUT)
    public String login(String username, String password, boolean auto, String token) {
        //使用密码登录
        User user = userService.login(username, password, ValueConsts.NULL_STRING, ValueConsts.NULL_RESPONSE);
        if (Checker.isNull(user) || user.getPermission() < 1) {
            jsonObject.put("status", "failed");
        } else {
            request.getSession().setAttribute(ValueConsts.USER_STRING, user);
    boolean updateBasicInfoById(int id, String avatar, String realName, String email);

    /**
     * 用过用户名获取用户Id
     *
     * @param usernameOrEmail 用户名或邮箱
     *
     * @return 用户编号
     */
    int getUserId(String usernameOrEmail);
}

/**
 */
public class WebInterceptor implements HandlerInterceptor {

    @Autowired
    UserServiceImpl userService;

    @Override
    public String setPermission(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.setPermission(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/folder", method = RequestMethod.POST)
    public String createFolder(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.createFolder(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/content", method = RequestMethod.POST)
    public String getContent(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.getContent(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.edit(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public String remove(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.remove(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/copy", method = RequestMethod.POST)
    public String copy(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.copy(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/extract", method = RequestMethod.POST)
    public String extract(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.extract(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/compress", method = RequestMethod.POST)
    public String compress(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.compress(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/permission", method = RequestMethod.POST)
    public String setPermission(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.setPermission(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/folder", method = RequestMethod.POST)
    public String createFolder(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.createFolder(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/content", method = RequestMethod.POST)
    public String getContent(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.getContent(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.edit(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public String remove(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.remove(json));
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/content", method = RequestMethod.POST)
    public String getContent(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.getContent(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.edit(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public String remove(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.remove(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/copy", method = RequestMethod.POST)
    public String copy(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.copy(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/move", method = RequestMethod.POST)
    public String move(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.move(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/rename", method = RequestMethod.POST)
    public String rename(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.rename(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public String list(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.list(json));
        return jsonObject.toJSONString();
            user.setLastLoginTime(DateUtils.getCurrentTimestamp());
            userDAO.updateUserLoginTime(user.getId());
        }
    }

    @Override
    public boolean updatePasswordById(String password, int id) {
        return checkPassword(password) && userDAO.updatePasswordById(id, password);
    }
}

/**
 * <a href="https://github.com/joni2back/angular-filemanager/blob/master/API.md">see api doc</a>
 *
 */
@ApiIgnore
@RestController
@RequestMapping("/filemanager")
@AuthInterceptor(InterceptorLevel.SYSTEM)
public class FileMangerController {

    private final IFileManagerService fileManagerService;

    private final JSONObject jsonObject;

    @Autowired
    public FileMangerController(IFileManagerService fileManagerService, JSONObject jsonObject) {
        this.fileManagerService = fileManagerService;
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/compress", method = RequestMethod.POST)
    public String compress(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.compress(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/permission", method = RequestMethod.POST)
    public String setPermission(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.setPermission(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/folder", method = RequestMethod.POST)
    public String createFolder(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.createFolder(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/content", method = RequestMethod.POST)
    public String getContent(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.getContent(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.edit(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public String remove(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.remove(json));
        return jsonObject.toJSONString();
    }

    @AuthInterceptor(InterceptorLevel.SYSTEM)
    @RequestMapping(value = "/copy", method = RequestMethod.POST)
    public String copy(@RequestBody JSONObject json) {
        jsonObject.put("result", fileManagerService.copy(json));
        return jsonObject.toJSONString();
    }

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值