管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-12-19 e6e00736db2e3c11607f8ae3d92d790423b0d3e1
1
已添加1个文件
已修改2个文件
84 ■■■■■ 文件已修改
src/main/java/com/lf/server/controller/show/DataLibController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/DataLibService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/DataLibController.java
@@ -23,6 +23,7 @@
import com.lf.server.service.all.BaseQueryService;
import com.lf.server.service.data.DownloadService;
import com.lf.server.service.data.MetaService;
import com.lf.server.service.show.DataLibService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -51,6 +52,9 @@
    @Autowired
    TokenService tokenService;
    @Autowired
    DataLibService dataLibService;
    @Autowired
    DownloadService downloadService;
@@ -151,10 +155,9 @@
    }
    @SysLog()
    @ApiOperation(value = "请求下载")
    @ApiOperation(value = "请求元数据下载")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pwd", value = "密码", dataType = "String", paramType = "body", example = ""),
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "body", example = "1,2")
            @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/downloadReq")
@@ -267,4 +270,40 @@
            WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res);
        }
    }
    @SysLog()
    @ApiOperation(value = "请求DB数据下载")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/downloadDbReq")
    public ResponseMsg<Object> downloadDbReq(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) {
                return fail("密码不能为空");
            }
            if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) {
                return fail("请选择要下载的文件");
            }
            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("没有找到元数据");
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            String guid = downloadService.zipFiles(ue, list, reqEntity.getPwd());
            return success(guid);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
}
src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java
@@ -16,6 +16,10 @@
    private List<Integer> ids;
    private String wkt;
    private List<String> entities;
    public DownloadReqEntity() {
    }
@@ -42,4 +46,20 @@
    public void setIds(List<Integer> ids) {
        this.ids = ids;
    }
    public String getWkt() {
        return wkt;
    }
    public void setWkt(String wkt) {
        this.wkt = wkt;
    }
    public List<String> getEntities() {
        return entities;
    }
    public void setEntities(List<String> entities) {
        this.entities = entities;
    }
}
src/main/java/com/lf/server/service/show/DataLibService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.lf.server.service.show;
import com.lf.server.helper.PathHelper;
import com.lf.server.service.data.DownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * èµ„料馆
 * @author WWW
 */
@Service
public class DataLibService {
    @Autowired
    PathHelper pathHelper;
    @Autowired
    DownloadService downloadService;
}