管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-12-24 09b6ca0c60b882d6ba13bd7f7b37576203d93d3f
src/main/java/com/lf/server/controller/show/DataLibController.java
@@ -10,7 +10,6 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.all.StaticData;
import com.lf.server.entity.ctrl.DownloadReqEntity;
import com.lf.server.entity.data.DictEntity;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.MetaFileEntity;
@@ -21,6 +20,7 @@
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.DownlogService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -54,6 +54,9 @@
    DataLibService dataLibService;
    @Autowired
    DownlogService downlogService;
    @Autowired
    DownloadService downloadService;
    @Autowired
@@ -62,24 +65,25 @@
    @SysLog()
    @ApiOperation(value = "分页查询元数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "depid", value = "单位ID", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "dirid", value = "目录ID", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageForMeta")
    public ResponseMsg<List<MetaEntity>> selectByPageForMeta(Integer dirid, String name, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<MetaEntity>> selectByPageForMeta(Integer depid, Integer dirid, String name, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = metaService.selectCount(dirid, name);
            int count = metaService.selectCount(depid, dirid, name);
            if (count == 0) {
                return success(0, null);
            }
            List<MetaEntity> rs = metaService.selectByPage(dirid, name, pageSize, pageSize * (pageIndex - 1));
            List<MetaEntity> rs = metaService.selectByPage(depid, dirid, name, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
@@ -145,7 +149,7 @@
            if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) {
                return fail("请选择要下载的文件");
            }
            if (!downloadService.decryptPwd(reqEntity)) {
            if (!DownloadService.decryptPwd(reqEntity)) {
                return fail("密码解密失败", null);
            }
            if (!StringHelper.checkPwdValid(reqEntity.getPwd())) {
@@ -182,7 +186,7 @@
                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
            }
            String password = downloadService.decryptPwd(pwd);
            String password = DownloadService.decryptPwd(pwd);
            if (null == password) {
                return fail("密码解密失败", null);
            }
@@ -221,7 +225,7 @@
                pwd = URLDecoder.decode(pwd, StandardCharsets.UTF_8.name());
            }
            String password = downloadService.decryptPwd(pwd);
            String password = DownloadService.decryptPwd(pwd);
            if (null == password) {
                WebHelper.writeInfo(HttpStatus.BAD_REQUEST, "密码解密失败", res);
            }
@@ -236,9 +240,7 @@
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            de.setDcount(de.getDcount() + 1);
            de.setDownloadUser(ue.getId());
            int rows = downloadService.update(de);
            downlogService.updateInfos(ue, de, req);
            String filePath = downloadService.getDownloadFilePath(de);
            WebHelper.download(filePath, de.getName(), res);