管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-28 f8a8316533399b57db5d11548602bd1267ff3eb7
1
已修改1个文件
36 ■■■■■ 文件已修改
src/main/java/com/lf/server/controller/data/MetaController.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/MetaController.java
@@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
/**
@@ -287,6 +288,40 @@
    }
    @SysLog()
    @ApiOperation(value = "查询下载文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guid", value = "文件GUID", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "pwd", value = "密码", dataType = "String", paramType = "query")
    })
    @GetMapping(value = "/selectDownloadFile")
    public ResponseMsg<Boolean> selectDownloadFile(String guid, String pwd) {
        try {
            if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                return fail("文件ID和密码不能为空", null);
            }
            String password = downloadService.decryptPwd(pwd);
            if (null == password) {
                return fail("密码解密失败", null);
            }
            DownloadEntity de = downloadService.selectByGuid(guid);
            if (null == de) {
                return fail("文件不存在", null);
            }
            if (!StringHelper.isNull(de.getPwd()) && !Md5Helper.validatePassword(password, de.getPwd())) {
                return fail("密码不正确", null);
            }
            String filePath = downloadService.getDownloadFilePath(de);
            File file = new File(filePath);
            return success(file.exists());
        } catch (Exception ex) {
            return fail(ex.getMessage(), false);
        }
    }
    @SysLog()
    @ApiOperation(value = "下载文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guid", value = "文件GUID", dataType = "String", paramType = "query"),
@@ -299,7 +334,6 @@
            if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "文件ID和密码不能为空", res);
            }
            String password = downloadService.decryptPwd(pwd);
            if (null == password) {
                WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "密码解密失败", res);