管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-12 4d8dd71b7d13fa41132c46831090c6282af502cb
1
已修改5个文件
86 ■■■■ 文件已修改
data/db_tab.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/ExportController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/ExportService.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/MarkService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
说明.txt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_tab.sql
@@ -788,7 +788,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-下载数据,2-下载专题图';
comment on column lf.sys_download.type is '类型:1-ShapeFile,2-专题图';
comment on column lf.sys_download.depid is '单位ID';
comment on column lf.sys_download.dcount is '下载次数';
comment on column lf.sys_download.pwd is 'MD5';
src/main/java/com/lf/server/controller/show/ExportController.java
@@ -7,7 +7,6 @@
import com.lf.server.entity.show.ExportEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.data.DownloadService;
import com.lf.server.service.show.ExportService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -33,9 +32,6 @@
    @Autowired
    TokenService tokenService;
    @Autowired
    DownloadService downloadService;
    @SysLog()
    @ApiOperation(value = "分页查询")
@@ -81,14 +77,12 @@
                return fail("用户未登录");
            }
            String str = exportService.post(entity);
            String str = exportService.post(ue, entity);
            if (StringHelper.isNull(str)) {
                return fail("出图失败");
            }
            //
            return success(str);
            return success("出图成功", str);
        } catch (Exception ex) {
            return fail(ex.getMessage());
        }
src/main/java/com/lf/server/service/show/ExportService.java
@@ -2,18 +2,21 @@
import com.alibaba.fastjson.JSON;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.show.ExportEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.FileHelper;
import com.lf.server.helper.PathHelper;
import com.lf.server.helper.RestHelper;
import com.lf.server.helper.StringHelper;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import com.lf.server.service.data.DownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -25,8 +28,22 @@
    @Value("${sys.path.exportServer}")
    private String exportServer;
    public String post(ExportEntity entity) {
        Map<String, Object> map = getPostEntity(entity);
    @Autowired
    PathHelper pathHelper;
    @Autowired
    DownloadService downloadService;
    /**
     * POST请求出图服务
     *
     * @param ue     ç”¨æˆ·ç±»
     * @param entity åœ¨çº¿åˆ¶å›¾ç±»
     * @return æˆåŠŸ
     * @throws Exception
     */
    public String post(UserEntity ue, ExportEntity entity) throws Exception {
        Map<String, Object> map = getMapData(entity);
        String url = exportServer + "/Export/Start";
        String str = RestHelper.postForRest(url, map);
@@ -39,10 +56,22 @@
            return null;
        }
        return msg.getResult();
        String file = pathHelper.getConfig().getDownloadPath() + File.separator + msg.getResult();
        File f = new File(file);
        if (!f.exists() && !f.isDirectory()) {
            return null;
        }
        DownloadEntity de = getDownloadEntity(ue, file);
        int rows = downloadService.insert(de);
        return rows > 0 ? de.getGuid() : null;
    }
    private Map<String, Object> getPostEntity(ExportEntity entity) {
    /**
     * èŽ·å–Map数据
     */
    private Map<String, Object> getMapData(ExportEntity entity) {
        Map<String, Object> map = new HashMap<String, Object>();
        Field[] fields = entity.getClass().getDeclaredFields();
@@ -63,4 +92,23 @@
        return map;
    }
    /**
     * èŽ·å–ä¸‹è½½å®žä½“ç±»
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
        de.setType(2);
        de.setDepid(ue.getDepid());
        de.setDcount(0);
        // de.setPwd(null)
        de.setUrl(FileHelper.getRelativePath(file));
        de.setDescr("专题图文件");
        de.setGuid(FileHelper.getFileMd5(file));
        de.setCreateUser(ue.getId());
        // de.setGeom(null)
        return de;
    }
}
src/main/java/com/lf/server/service/show/MarkService.java
@@ -181,7 +181,7 @@
        de.setDcount(0);
        // de.setPwd(null)
        de.setUrl(FileHelper.getRelativePath(file));
        de.setDescr("下载ShapeFile文件");
        de.setDescr("ShapeFile文件");
        de.setGuid(FileHelper.getFileMd5(file));
        de.setCreateUser(ue.getId());
        // de.setGeom(null)
˵Ã÷.txt
@@ -39,9 +39,9 @@
38.开发根据实体名称进行动态分页查询
39.开发根据实体名称+字段+值模糊搜索前10条记录
40.开发根据实体名称查询空间表的WKT记录
41.搭建QGIS+Python开发环境 <
42.
43.
41.搭建QGIS+Python开发环境
42.开发根据名称模糊搜索用户、单位的前10条记录
43.构建QGIS工程,使用Python运行工程 <
44.
45.
46.
@@ -50,10 +50,8 @@
49.
50.
-----------------------------------------------
.开发根据名称模糊搜索用户、单位的前10条记录
.开发根据标绘JSON数据生成shp文件并下载
.开发上传shp文件转换为JSON数据接口
.构建QGIS工程,使用Python运行工程
.创建QGIS出图模板
.开发Python出图功能
.开发QGIS出图的C#服务