管道基础大数据平台系统开发-【后端】-Server
13693261870
2022-12-29 8fca57bbef06840721ec0dc86ba24911c48dfc4d
12.29
已修改5个文件
85 ■■■■■ 文件已修改
data/db_tab.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/ts.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/PipelineController.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/show/PipelineEntity.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/DownloadService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_tab.sql
@@ -800,7 +800,7 @@
comment on table lf.sys_download is '下载记录表';
comment on column lf.sys_download.id is '主键ID';
comment on column lf.sys_download.name is '名称';
comment on column lf.sys_download.type is '类型:1-Shp文件,2-专题图,3-元数据,4-业务数据';
comment on column lf.sys_download.type is '类型:1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析';
comment on column lf.sys_download.depid is '单位ID';
comment on column lf.sys_download.sizes is '文件大小:单位MB';
comment on column lf.sys_download.dcount is '下载次数';
data/ts.sql
@@ -124,7 +124,7 @@
from bd.dlg_25w_hyda as a, (select segname, remarks, pipename, geom from bs.m_pipesegment where gid = 24) as b
where ST_Intersects(a.geom, b.geom)
select * from lf.sys_download where type=4;
src/main/java/com/lf/server/controller/show/PipelineController.java
@@ -94,6 +94,47 @@
    }
    @SysLog()
    @ApiOperation(value = "请求管道分析结果下载")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pe", value = "管道分析实体类", dataType = "PipelineEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/downloadReq")
    public ResponseMsg<Object> downloadReq(@RequestBody PipelineEntity pe) {
        try {
            if (null == pe || StringHelper.isEmpty(pe.getPwd())) {
                return fail("密码不能为空");
            }
            if (null == pe.getTabs() || 0 == pe.getTabs().size()) {
                return fail("请输入表名");
            }
            if (!checkTabs(pe.getTabs())) {
                return fail("存在非法表名");
            }
            if (!DownloadService.decryptPwd(pe)) {
                return fail("密码解密失败", null);
            }
            if (!StringHelper.checkPwdValid(pe.getPwd())) {
                return fail("密码不符合要求");
            }
            Map<String, Object> map = new HashMap<>(4);
            for (String tab : pe.getTabs()) {
                List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid());
                if (null != rs && rs.size() > 0) {
                    map.put(tab, rs);
                }
            }
            //
            return success(map);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询下载文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""),
@@ -112,7 +153,7 @@
                return fail("用户未登录", null);
            }
            int count = downloadService.selectCountForUser(ue.getCreateUser(), 4, name);
            int count = downloadService.selectCountForUser(ue.getCreateUser(), 5, name);
            if (count == 0) {
                return success(0, null);
            }
src/main/java/com/lf/server/entity/show/PipelineEntity.java
@@ -23,6 +23,13 @@
    private List<String> tabs;
    /**
     * 密码
     */
    @JSONField(serialize = false)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String pwd;
    /**
     * 主键ID
     */
    private Integer gid;
@@ -73,6 +80,14 @@
        this.tabs = tabs;
    }
    public String getPwd() {
        return pwd;
    }
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
    public String getPipeName() {
        return pipeName;
    }
src/main/java/com/lf/server/service/data/DownloadService.java
@@ -3,6 +3,7 @@
import com.lf.server.entity.ctrl.DownloadReqEntity;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.data.MetaFileEntity;
import com.lf.server.entity.show.PipelineEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.*;
import com.lf.server.mapper.data.DownloadMapper;
@@ -141,6 +142,28 @@
    /**
     * 解密
     *
     * @param pe 管道分析实体类
     * @return 是/否解密成功
     */
    public static boolean decryptPwd(PipelineEntity pe) {
        try {
            String pwd = RsaHelper.decrypt(pe.getPwd());
            if (StringHelper.isEmpty(pwd)) {
                return false;
            }
            pe.setPwd(pwd);
            return true;
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return false;
        }
    }
    /**
     * 解密
     *
     * @param pwd 加密密码
     * @return 原始密码
     */