管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-30 e5d341086b634f9ac0345b576e6497f978a53941
src/main/java/com/lf/server/controller/data/MetaController.java
@@ -22,6 +22,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
/**
@@ -40,6 +42,8 @@
    @Autowired
    DownloadService downloadService;
    private final static String EQ = "=";
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
@@ -275,13 +279,22 @@
            if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) {
                return fail("请选择要下载的文件");
            }
            if (!downloadService.validatePwd(reqEntity)) {
            if (!downloadService.decryptPwd(reqEntity)) {
                return fail("密码解密失败", null);
            }
            if (!StringHelper.checkPwdValid(reqEntity.getPwd())) {
                return fail("密码不符合要求");
            }
            List<MetaFileEntity> list = metaService.selectMetaFiles(reqEntity.getIds());
            if (null == list || list.isEmpty()) {
                return fail("没有找到元数据");
            }
            return success(true);
            UserEntity ue = tokenService.getCurrentUser(req);
            String guid = downloadService.zipFiles(ue, list, reqEntity.getPwd());
            return success(guid);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
@@ -299,6 +312,10 @@
            if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                return fail("文件ID和密码不能为空", null);
            }
            if (!pwd.endsWith(EQ)) {
                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
            }
            String password = downloadService.decryptPwd(pwd);
            if (null == password) {
                return fail("密码解密失败", null);
@@ -334,6 +351,10 @@
            if (StringHelper.isEmpty(guid) || StringHelper.isEmpty(pwd)) {
                WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "文件ID和密码不能为空", res);
            }
            if (!pwd.endsWith(EQ)) {
                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
            }
            String password = downloadService.decryptPwd(pwd);
            if (null == password) {
                WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "密码解密失败", res);