月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-08-14 e002c67732b571f0b20cca8321ca8ee1ddba2e05
修改文件上传、GDB/Shp数据读取、数据入库、元数据管理等接口
已重命名1个文件
已修改35个文件
981 ■■■■ 文件已修改
src/main/java/com/moon/server/config/PropertiesConfig.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/config/RestTemplateConfig.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/all/BaseQueryController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/data/DataCountController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/data/MetaController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/data/PublishController.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/data/upload/UploadController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/sys/TokenController.java 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/all/StaticData.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/ctrl/PubEntity.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/data/MetaFileEntity.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/FileHelper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/GdbHelper.java 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/MdbHelper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/PathHelper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/ShpHelper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/helper/StringHelper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/mapper/data/MetaMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/mapper/data/PublishMapper.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/mapper/sys/ReportMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/all/BaseQueryService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/all/BaseUploadService.java 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/all/UploadAttachService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/MetaService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/PublishService.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/UploadService.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/show/DataLibService.java 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/show/InquiryService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/sys/ProxyService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/sys/ReportService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/all/BaseQueryMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/MetaMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/data/PublishMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/show/OneMapMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/ReportMapper.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/config/PropertiesConfig.java
@@ -51,4 +51,8 @@
    public String getTilePath() {
        return tilePath;
    }
    public String getLfData() {
        return tilePath.replace("2d\\tiles", "");
    }
}
src/main/java/com/moon/server/config/RestTemplateConfig.java
@@ -25,7 +25,7 @@
@ConditionalOnClass(value = {RestTemplate.class, HttpClient.class})
public class RestTemplateConfig {
    /**
     * è¿žæŽ¥æ± çš„æœ€å¤§è¿žæŽ¥æ•°é»˜è®¤ä¸º0
     * è¿žæŽ¥æ± çš„æœ€å¤§è¿žæŽ¥æ•°é»˜è®¤ä¸º0,不限制
     */
    @Value("${remote.maxTotalConnect:0}")
    private int maxTotalConnect;
@@ -37,13 +37,13 @@
    private int maxConnectPerRoute;
    /**
     * è¿žæŽ¥è¶…时默认5s
     * è¿žæŽ¥è¶…时默认5s,-1为不限制
     */
    @Value("${remote.connectTimeout:5000}")
    private int connectTimeout;
    /**
     * è¯»å–超时默认30s
     * è¯»å–超时默认30s,-1为不限制
     */
    @Value("${remote.readTimeout:30000}")
    private int readTimeout;
src/main/java/com/moon/server/controller/all/BaseQueryController.java
@@ -200,7 +200,7 @@
            if (StringHelper.isEmpty(wkt)) {
                return fail("WKT不能为空", null);
            }
            if (null == limit || limit < 1 || limit > StaticData.ONE_HUNDRED) {
            if (null == limit || limit < 1 || limit > StaticData.I100) {
                limit = 20;
            }
            if (null == buffer || buffer < 0 || buffer > StaticData.ONE_HUNDRED_THOUSAND) {
@@ -424,11 +424,12 @@
            @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"),
            @ApiImplicitParam(name = "dirs", value = "目录编码", dataType = "String", paramType = "query", example = "00,01"),
            @ApiImplicitParam(name = "tab", value = "表名", dataType = "String", paramType = "query", example = "dlg_"),
            @ApiImplicitParam(name = "types", value = "类别", dataType = "String", paramType = "query", example = "测绘(ESV)"),
            @ApiImplicitParam(name = "hasGeom", value = "含有Geom字段", dataType = "Boolean", paramType = "query", example = "false"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Boolean hasGeom, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, String types, Boolean hasGeom, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
@@ -445,14 +446,15 @@
            if (dirs != null) {
                filters += String.format(" and %s", dirs);
            }
            String typesFilter = getTypesFilter(types);
            String field = null == hasGeom || !hasGeom ? "gid" : "geom";
            int count = baseQueryService.selectTabsForCount(tab, field);
            int count = baseQueryService.selectTabsForCount(tab, typesFilter, field);
            if (count == 0) {
                return success(0, null);
            }
            List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, field, filters, pageSize, pageSize * (pageIndex - 1));
            List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, typesFilter, field, filters, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
@@ -460,6 +462,48 @@
        }
    }
    /**
     * èŽ·å–ç±»åˆ«è¿‡æ»¤æ¡ä»¶
     */
    private String getTypesFilter(String types) {
        if (StringHelper.isEmpty(types)) {
            return null;
        }
        List<String> list = new ArrayList<>();
        for (String type : types.split(StaticData.COMMA)) {
            switch (type) {
                case "测绘(ESV)":
                    list.add("bak like '工程数据/测绘%'");
                    break;
                case "勘察(EGE)":
                    list.add("bak like '工程数据/勘察%'");
                    break;
                case "地灾(EGD)":
                    list.add("bak like '工程数据/地灾%'");
                    break;
                case "洞库(EGD)":
                    list.add("bak like '工程数据/洞库%'");
                    break;
                case "基础测绘":
                    list.add("bak like '基础数据/测绘%'");
                    break;
                case "基础地灾":
                    list.add("bak like '基础数据/地灾%'");
                    break;
                case "基础勘察":
                    list.add("bak like '基础数据/勘察%'");
                    break;
                case "合规数据":
                case "管理数据":
                default:
                    break;
            }
        }
        return list.isEmpty() ? null : StringHelper.join(list, " or ");
    }
    @SysLog()
    @ApiOperation(value = "查询字段信息")
    @ApiImplicitParams({
src/main/java/com/moon/server/controller/data/DataCountController.java
@@ -80,6 +80,19 @@
    }
    @SysLog()
    @ApiOperation(value = "按文件类型统计")
    @GetMapping(value = "/countSizesByType")
    public ResponseMsg<Object> countSizesByType() {
        try {
            List<CountEntity> list = reportService.countSizesByType();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询服务调用量统计")
    @GetMapping(value = "/selectCountServices")
    public ResponseMsg<Object> selectCountServices() {
@@ -106,6 +119,19 @@
    }
    @SysLog()
    @ApiOperation(value = "按项目统计数据")
    @GetMapping(value = "/countSizesByPrj")
    public ResponseMsg<Object> countSizesByPrj() {
        try {
            List<CountEntity> list = reportService.countSizesByPrj();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "下载报告")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报告ID", dataType = "Integer", paramType = "7")
src/main/java/com/moon/server/controller/data/MetaController.java
@@ -100,6 +100,26 @@
    }
    @SysLog()
    @ApiOperation(value = "根据GUID查询GDB")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "guid", value = "GUID", dataType = "String", paramType = "query", example = "d58e66d9606a4b85e7c8ab43b3db0b55")
    })
    @GetMapping(value = "/selectGdbByGuid")
    public ResponseMsg<Object> selectGdbByGuid(String guid) {
        try {
            if (StringHelper.isEmpty(guid)) {
                return fail("文件GUID值不能为空", null);
            }
            List<MetaEntity> rs = metaService.selectGdbByGuid(guid);
            return success(null == rs ? 0 : rs.size(), rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "根据父ID分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "metaid", value = "父ID", dataType = "String", paramType = "query", example = "0"),
src/main/java/com/moon/server/controller/data/PublishController.java
@@ -9,16 +9,18 @@
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.helper.StringHelper;
import com.moon.server.helper.WebHelper;
import com.moon.server.service.all.PermsService;
import com.moon.server.service.data.PublishService;
import com.moon.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
/**
@@ -29,11 +31,14 @@
@RestController
@RequestMapping("/publish")
public class PublishController extends BaseController {
    @Autowired
    @Resource
    PublishService publishService;
    @Autowired
    @Resource
    TokenService tokenService;
    @Resource
    PermsService permsService;
    @SysLog()
    @ApiOperation(value = "分页查询元数据")
@@ -56,7 +61,7 @@
                return fail("数据类别为空", null);
            }
            String types = getType(type);
            String types = getType(dircode, type);
            int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name);
            if (count == 0) {
                return success(0, null);
@@ -73,47 +78,114 @@
    /**
     * èŽ·å–ç±»åž‹
     */
    private String getType(String type) throws Exception {
    private String getType(String dircode, String type) throws Exception {
        switch (type) {
            case "DOM":
                return "type in ('tif', 'tiff', 'img')";
                return "type in ('tif', 'tiff', 'img')" + getFilter(dircode, type);
            case "DEM":
                return "type in ('tif', 'tiff')";
                return "type in ('tif', 'tiff')" + getFilter(dircode, type);
            case "MPT":
                return "type = 'mpt'";
            case "3DML":
                return "type = '3dml'";
            case "CPT":
                return "type = 'cpt'";
            case "BIM":
                return "type in ('ifc', 'fbx', 'rvt')";
            case "LAS":
                return "type in ('las', 'laz')";
            case "OSGB":
                return "type = 'osgb'";
            default:
                throw new Exception("数据类型不匹配");
        }
    }
    /**
     * èŽ·å–è¿‡æ»¤æ¡ä»¶
     */
    private String getFilter(String dircode, String type) {
        dircode = StringHelper.isEmpty(dircode) ? "" : StringHelper.getRightLike(dircode);
        List<String> list = null;
        switch (type) {
            case "DOM":
                list = publishService.selectCodesForDir(dircode, 0);
                break;
            case "DEM":
                list = publishService.selectCodesForDir(dircode, 1);
                break;
            default:
                break;
        }
        if (null == list || list.isEmpty()) {
            return "";
        }
        for (int i = 0, c = list.size(); i < c; i++) {
            list.set(i, "'" + list.get(i) + "'");
        }
        return " and dircode not in (" + StringHelper.join(list, ",") + ")";
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "dircode", value = "目录", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "type", 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 = "/selectByPageAndCount")
    public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, String dircode, String type, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            type = getPubType(type);
            int count = publishService.selectCount(name);
            int count = publishService.selectCount(name, dircode, type);
            if (count == 0) {
                return success(0, null);
            }
            List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
            List<PublishEntity> rs = publishService.selectByPage(name, dircode, type, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    /**
     * èŽ·å–å‘å¸ƒç±»åž‹
     */
    private String getPubType(String type) {
        if (StringHelper.isEmpty(type)) {
            return null;
        }
        switch (type) {
            case "DOM":
                return "type = 'DOM'";
            case "DEM":
                return "type = 'DEM'";
            case "MPT":
                return "type = 'mpt'";
            case "3DML":
                return "type = '3dml'";
            case "CPT":
                return "type = 'cpt'";
            case "BIM":
                return "type in ('ifc', 'fbx', 'rvt')";
            case "LAS":
                return "type in ('las', 'laz')";
            case "OSGB":
                return "type = 'osgb'";
            default:
                return null;
        }
    }
@@ -128,6 +200,31 @@
            PublishEntity entity = publishService.selectById(id);
            return success(entity);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询Las文件坐标系ID")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "元数据ID集合", dataType = "Integer[]", paramType = "query", example = "10483,10481,10456,10285")
    })
    @GetMapping(value = "/selectLasCs")
    public ResponseMsg<Object> selectLasCs(Integer[] ids, HttpServletRequest req) {
        try {
            if (null == ids || ids.length == 0) {
                return fail("元数据ID集合不能为空");
            }
            PubEntity entity = new PubEntity();
            entity.setIds(Arrays.asList(ids));
            entity.setDircode("00");
            entity.setToken(WebHelper.getToken(req));
            List<Integer> list = publishService.selectLasCs(entity, "/Convert/ReadLasCs", req);
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
@@ -154,6 +251,7 @@
                entity.setToken(WebHelper.getToken(req));
            }
            permsService.clearLayerCache();
            String method = getConvertMethod(entity.getType());
            long count = publishService.postForPub(entity, method, req);
@@ -174,9 +272,14 @@
                return "/Convert/ToTerra";
            case "MPT":
            case "3DML":
            case "CPT":
                return "/Convert/ToSG";
            case "BIM":
                return "/Convert/ToTileset";
            case "LAS":
                return "/Convert/ToLasByPy";
            case "OSGB":
                return "/Convert/ToOsgb";
            default:
                throw new Exception("数据类型不匹配");
        }
@@ -193,6 +296,16 @@
            if (ids == null || ids.isEmpty()) {
                return fail("id数组不能为空", -1);
            }
            String strs = StringHelper.join(ids, ",");
            List<PublishEntity> list = publishService.selectByIds(strs);
            if (null == list || list.isEmpty()) {
                return fail("没有找到要删除的数据", -1);
            }
            // publishService.deleteFiles(list)
            permsService.clearLayerCache();
            publishService.deleteFiles(ids, req);
            int count = publishService.deletes(ids, req);
@@ -216,6 +329,7 @@
                entity.setUpdateUser(ue.getId());
            }
            permsService.clearLayerCache();
            int count = publishService.update(entity);
            return success(count);
src/main/java/com/moon/server/controller/data/upload/UploadController.java
@@ -125,7 +125,7 @@
    @GetMapping(value = "/selectFiles")
    public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) {
        try {
            List<MetaFileEntity> list = uploadService.selectFiles(path);
            List<MetaFileEntity> list = uploadService.selectFiles(path, false);
            return success(list);
        } catch (Exception ex) {
@@ -161,8 +161,8 @@
    @SysLog()
    @ApiOperation(value = "查询映射")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "20230110010101"),
            @ApiImplicitParam(name = "dirid", value = "目录ID", dataType = "Integer", paramType = "query", example = "163"),
            @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "20230722"),
            @ApiImplicitParam(name = "dirid", value = "目录ID", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "verid", value = "版本ID", dataType = "Integer", paramType = "query", example = "0"),
            @ApiImplicitParam(name = "epsgCode", value = "坐标编码", dataType = "String", paramType = "query", example = "EPSG:4490")
    })
src/main/java/com/moon/server/controller/sys/TokenController.java
src/main/java/com/moon/server/entity/all/StaticData.java
@@ -34,6 +34,10 @@
    public final static int ONE_HUNDRED_THOUSAND = 100000;
    public static final double D90 = 90.0;
    public static final double D100 = 100.0;
    public static final double D1024 = 1024.0;
    public static final double D1050 = 1050.0;
@@ -46,11 +50,15 @@
    public static final int I31 = 31;
    public static final int I50 = 50;
    public static final int I60 = 60;
    public static final int I90 = 90;
    public static final int I90_NEG = -90;
    public final static int I100 = 100;
    public static final int I120 = 120;
@@ -61,6 +69,8 @@
    public static final int I1000 = 1000;
    public static final int I2050 = 2050;
    public static final int I4326 = 4326;
    public static final int I4490 = 4490;
@@ -86,9 +96,10 @@
     */
    public final static String COMMA = ",";
    public final static String AK = "?ak=";
    public final static String REST_LAYER = "/v6/rest/";
    /**
     * æ³¢æµªå·
     */
    public final static String TILDE = "~";
    /**
     * å•引号
@@ -96,6 +107,10 @@
    public final static String SINGLE_QUOTES = "'";
    public final static String BBOREHOLE = "bborehole";
    public final static String AK = "?ak=";
    public final static String REST_LAYER = "/v6/rest/";
    public final static String TEXT_XML = "text/xml";
@@ -116,6 +131,8 @@
    public final static String SHP = ".shp";
    public final static String NGDB = "gdb";
    public final static String GDB = ".gdb";
    public final static String JPG = ".jpg";
@@ -129,6 +146,10 @@
    public final static String TIF = ".tif";
    public final static String TIFF = ".tiff";
    public final static String LAS = ".las";
    public final static String OSGB = ".osgb";
    public static String ADMIN = "admin";
@@ -191,6 +212,10 @@
    public final static String MULTIPOLYGON = "MULTIPOLYGON";
    public final static String MULTICURVE = "MULTICURVE";
    public final static String COMPOUNDCURVE = "COMPOUNDCURVE";
    public static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "文件找不到"));
    /**
@@ -221,12 +246,12 @@
    /**
     * TIF文件扩展名
     */
    public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml"));
    public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tif.ovr", ".tif.aux.xml", ".tif.xml"));
    /**
     * TIFF文件扩展名
     */
    public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tiff.ovr", ".tiff.aux.xml", ".tiff.enp", ".tiff.xml"));
    public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tiff.ovr", ".tiff.aux.xml", ".tiff.xml"));
    /**
     * SHP文件扩展名
@@ -236,7 +261,7 @@
    /**
     * Mapper排除扩展名
     */
    public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml"));
    public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.xml", ".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml"));
    /**
     * æ‰€æœ‰æ–‡ä»¶æ‰©å±•名
src/main/java/com/moon/server/entity/ctrl/PubEntity.java
@@ -30,7 +30,13 @@
    private String depcode;
    private List<String> ids;
    private List<Integer> ids;
    private List<Integer> models;
    private List<Integer> srids;
    private List<Double> zs;
    public String getType() {
        return type;
@@ -104,11 +110,35 @@
        this.depcode = depcode;
    }
    public List<String> getIds() {
    public List<Integer> getIds() {
        return ids;
    }
    public void setIds(List<String> ids) {
    public void setIds(List<Integer> ids) {
        this.ids = ids;
    }
    public List<Integer> getModels() {
        return models;
    }
    public void setModels(List<Integer> models) {
        this.models = models;
    }
    public List<Integer> getSrids() {
        return srids;
    }
    public void setSrids(List<Integer> srids) {
        this.srids = srids;
    }
    public List<Double> getZs() {
        return zs;
    }
    public void setZs(List<Double> zs) {
        this.zs = zs;
    }
}
src/main/java/com/moon/server/entity/data/MetaFileEntity.java
@@ -42,6 +42,8 @@
    private int rows;
    private int records;
    private String msg;
    private Boolean isMeta;
@@ -176,6 +178,14 @@
        this.rows = rows;
    }
    public int getRecords() {
        return records;
    }
    public void setRecords(int records) {
        this.records = records;
    }
    public String getMsg() {
        return msg;
    }
src/main/java/com/moon/server/helper/FileHelper.java
@@ -401,7 +401,7 @@
    /**
     * æ ¹æ®è·¯å¾„获取文件
     */
    public static void getFilesByPath(List<File> list, String path) {
    public static void getFilesByPath(List<String> list, String path) {
        File file = new File(path);
        if (file.isDirectory()) {
            File[] files = file.listFiles();
@@ -413,11 +413,11 @@
                if (f.isDirectory()) {
                    getFilesByPath(list, f.getPath());
                } else {
                    list.add(f);
                    list.add(f.getPath());
                }
            }
        } else {
            list.add(file);
            list.add(file.getPath());
        }
    }
src/main/java/com/moon/server/helper/GdbHelper.java
@@ -8,7 +8,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gdal.ogr.*;
import org.gdal.osr.CoordinateTransformation;
import org.gdal.osr.SpatialReference;
import org.gdal.osr.osr;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@@ -107,7 +109,7 @@
    /**
     * è¯»å–数据
     */
    public static <T> List<T> readData(Class clazz, String filePath, String layerName) {
    public static <T> List<T> readData(Class clazz, String filePath, String layerName, boolean isTransform) {
        List<T> list = new ArrayList<>();
        Driver driver = null;
@@ -127,7 +129,7 @@
            for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) {
                Layer layer = dataSource.GetLayer(i);
                if (layer.GetName().equals(layerName)) {
                    GdbHelper.readLayer(clazz, layer, list);
                    GdbHelper.readLayer(clazz, layer, list, isTransform);
                    break;
                }
@@ -145,7 +147,7 @@
    /**
     * è¯»å–图层
     */
    public static <T> void readLayer(Class clazz, Layer layer, List<T> list) {
    public static <T> void readLayer(Class clazz, Layer layer, List<T> list, boolean isTransform) {
        try {
            Field gField = getGeomField(clazz);
@@ -155,6 +157,8 @@
                return;
            }
            CoordinateTransformation ct = getCoordinateTransformation(layer, isTransform);
            do {
                Feature f = layer.GetNextFeature();
                if (null == f) {
@@ -162,7 +166,7 @@
                }
                T t = (T) clazz.newInstance();
                readFeature(t, f, map, gField);
                readFeature(t, f, map, gField, ct);
                list.add(t);
            } while (true);
        } catch (Exception ex) {
@@ -170,6 +174,33 @@
        } finally {
            GdbHelper.delete(layer);
        }
    }
    /**
     * èŽ·å–åæ ‡è½¬æ¢å™¨
     */
    private static CoordinateTransformation getCoordinateTransformation(Layer layer, boolean isTransform) {
        if (!isTransform) {
            return null;
        }
        String epsg = layer.GetSpatialRef().GetAttrValue("AUTHORITY", 1);
        if (StringHelper.isEmpty(epsg)) {
            return null;
        }
        int epsgId = Integer.parseInt(epsg);
        if (StaticData.I4326 == epsgId || StaticData.I4490 == epsgId) {
            return null;
        }
        SpatialReference srTarget = new SpatialReference();
        srTarget.ImportFromEPSG(StaticData.I4490);
        layer.GetSpatialRef().SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER);
        srTarget.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER);
        return CoordinateTransformation.CreateCoordinateTransformation(layer.GetSpatialRef(), srTarget);
    }
    /**
@@ -193,14 +224,13 @@
        try {
            FeatureDefn fd = layer.GetLayerDefn();
            for (int i = 0, count = fd.GetFieldCount(); i < count; i++) {
                FieldDefn fieldDefn = fd.GetFieldDefn(i);
                try {
                    String name = fieldDefn.GetName().toLowerCase();
                    String name = fd.GetFieldDefn(i).GetName().toLowerCase();
                    if (StaticData.READ_EXCLUDE_FIELDS.contains(name)) {
                        continue;
                    }
                    Field field = clazz.getDeclaredField(name);
                    Field field = clazz.getDeclaredField("gbcode".equals(name) ? "gb" : name);
                    field.setAccessible(true);
                    map.put(i, field);
@@ -213,14 +243,14 @@
                getFieldMapper(clazz.getSuperclass(), layer, map);
            }
        } catch (Exception ex) {
            //
            log.error(ex);
        }
    }
    /**
     * è¯»å–Feature
     */
    private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField) {
    private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField, CoordinateTransformation ct) {
        for (Integer i : map.keySet()) {
            try {
                Field field = map.get(i);
@@ -231,7 +261,7 @@
        }
        if (null != gField) {
            setGeom(t, f, gField);
            setGeom(t, gField, f.GetGeometryRef(), ct);
        }
    }
@@ -288,12 +318,17 @@
     * wkbNone = 100,
     * wkbLinearRing = 101
     */
    private static <T> void setGeom(T t, Feature f, Field gField) {
    private static <T> void setGeom(T t, Field gField, Geometry geometry, CoordinateTransformation ct) {
        try {
            String geo = "null";
            if (null != f.GetGeometryRef()) {
                String wkt = f.GetGeometryRef().ExportToWkt();
                // f.GetGeometryRef().GetGeometryType()
            if (null == geometry) {
                gField.set(t, "null");
                return;
            }
            if (null != ct) {
                int flag = geometry.Transform(ct);
            }
            String wkt = geometry.ExportToWkt();
                if (wkt.contains(StaticData.LINESTRING) && !wkt.contains(StaticData.MULTILINESTRING)) {
                    wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")";
                }
@@ -301,11 +336,14 @@
                    wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")";
                }
                wkt = wkt.replace(" 0,", ",").replace(" 0)", ")");
                geo = String.format("ST_GeomFromText('%s')", wkt);
            if (wkt.contains(StaticData.MULTICURVE)) {
                wkt = wkt.replace("MULTICURVE (", "MULTILINESTRING (").replace("CIRCULARSTRING ", "");
                if (wkt.contains(StaticData.COMPOUNDCURVE)) {
                    wkt = wkt.replace("COMPOUNDCURVE (", "").replace(")))", "))");
                }
            }
            gField.set(t, geo);
            gField.set(t, String.format("ST_GeomFromText('%s')", wkt));
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
src/main/java/com/moon/server/helper/MdbHelper.java
@@ -75,7 +75,7 @@
            for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) {
                Layer layer = dataSource.GetLayer(i);
                if (layer.GetName().equals(layerName)) {
                    GdbHelper.readLayer(clazz, layer, list);
                    GdbHelper.readLayer(clazz, layer, list, true);
                    break;
                }
src/main/java/com/moon/server/helper/PathHelper.java
@@ -2,6 +2,7 @@
import com.moon.server.config.PropertiesConfig;
import com.moon.server.entity.all.SettingData;
import com.moon.server.entity.all.StaticData;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,8 +23,6 @@
    private static int downloadPath = 1;
    private static int uploadPath = 1;
    private final static double D90 = 90;
    private final static Log log = LogFactory.getLog(PathHelper.class);
@@ -142,7 +141,7 @@
    public void deleteOldPath(String tempPath) {
        try {
            double ran = Math.random() * 99;
            if (ran < D90) {
            if (ran < StaticData.D90) {
                return;
            }
src/main/java/com/moon/server/helper/ShpHelper.java
@@ -214,7 +214,7 @@
    /**
     * è¯»å–数据
     */
    public static <T> List<T> readData(Class clazz, String filePath) {
    public static <T> List<T> readData(Class clazz, String filePath, boolean isTransform) {
        List<T> list = new ArrayList<>();
        Driver driver = null;
@@ -231,7 +231,7 @@
            }
            Layer layer = dataSource.GetLayer(0);
            GdbHelper.readLayer(clazz, layer, list);
            GdbHelper.readLayer(clazz, layer, list, isTransform);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        } finally {
src/main/java/com/moon/server/helper/StringHelper.java
@@ -3,6 +3,7 @@
import com.moon.server.entity.all.StaticData;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@@ -226,4 +227,20 @@
        return sb.toString();
    }
    /**
     * å­—符串转整数集合
     */
    public static List<Integer> strToIntegers(String str) {
        if (StringHelper.isEmpty(str)) {
            return null;
        }
        List<Integer> list = new ArrayList<>();
        for (String s : str.split(StaticData.COMMA)) {
            list.add(Integer.parseInt(s));
        }
        return list;
    }
}
src/main/java/com/moon/server/mapper/all/BaseQueryMapper.java
@@ -38,22 +38,24 @@
     * æ ¹æ®è¡¨åæŸ¥è¯¢è®°å½•æ•°
     *
     * @param tab   è¡¨å
     * @param typesFilter ç±»åˆ«
     * @param field å­—段
     * @return
     */
    public Integer selectTabsForCount(String tab, String field);
    public Integer selectTabsForCount(String tab, String typesFilter, String field);
    /**
     * æ ¹æ®è¡¨ååˆ†é¡µæŸ¥è¯¢
     *
     * @param tab     è¡¨å
     * @param typesFilter ç±»åˆ«
     * @param field   å­—段
     * @param filters è¿‡æ»¤æ¡ä»¶
     * @param limit   è®°å½•æ•°
     * @param offset  åç§»é‡
     * @return
     */
    public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset);
    public List<TabEntity> selectTabsByPage(String tab, String typesFilter, String field, String filters, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢å­—段信息
src/main/java/com/moon/server/mapper/data/MetaMapper.java
@@ -38,6 +38,14 @@
    public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset);
    /**
     * æ ¹æ®GUID查询GDB
     *
     * @param guid
     * @return
     */
    public List<MetaEntity> selectGdbByGuid(String guid);
    /**
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param depcode
src/main/java/com/moon/server/mapper/data/PublishMapper.java
@@ -18,19 +18,23 @@
     * æŸ¥è¯¢è®°å½•æ•°
     *
     * @param name åç§°
     * @param dircode ç›®å½•编码
     * @param type    ç±»åˆ«
     * @return è®°å½•æ•°
     */
    public Integer selectCount(String name);
    public Integer selectCount(String name, String dircode, String type);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param name   åç§°
     * @param dircode ç›®å½•编码
     * @param type    ç±»åˆ«
     * @param limit  è®°å½•æ•°
     * @param offset åç§»é‡
     * @return åˆ—表
     */
    public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset);
    public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset);
    /**
     * æŸ¥è¯¢æ‰€æœ‰
@@ -56,6 +60,15 @@
    public List<PublishEntity> selectByIds(String ids);
    /**
     * æ ¹æ®ç›®å½•查询DOM和DEM的编码
     *
     * @param dircode ç›®å½•
     * @param isDom   1-DOM,0-DEM
     * @return
     */
    public List<String> selectCodesForDir(String dircode, Integer isDom);
    /**
     * æ’入一条
     *
     * @param entity
src/main/java/com/moon/server/mapper/sys/ReportMapper.java
@@ -105,6 +105,13 @@
    public List<CountEntity> countSizes();
    /**
     * æŒ‰æ–‡ä»¶ç±»åž‹ç»Ÿè®¡
     *
     * @return
     */
    public List<CountEntity> countSizesByType();
    /**
     * æœåŠ¡è°ƒç”¨é‡ç»Ÿè®¡
     *
     * @return
@@ -117,4 +124,11 @@
     * @return
     */
    public List<CountEntity> countOperates();
    /**
     * æŒ‰é¡¹ç›®ç»Ÿè®¡æ•°æ®
     *
     * @return
     */
    public List<CountEntity> countSizesByPrj();
}
src/main/java/com/moon/server/service/all/BaseQueryService.java
@@ -265,17 +265,17 @@
    }
    @Override
    public Integer selectTabsForCount(String tab, String field) {
    public Integer selectTabsForCount(String tab, String typesFilter, String field) {
        tab = StringHelper.getLikeUpperStr(tab);
        return baseQueryMapper.selectTabsForCount(tab, field);
        return baseQueryMapper.selectTabsForCount(tab, typesFilter, field);
    }
    @Override
    public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset) {
    public List<TabEntity> selectTabsByPage(String tab, String typesFilter, String field, String filters, Integer limit, Integer offset) {
        tab = StringHelper.getLikeUpperStr(tab);
        return baseQueryMapper.selectTabsByPage(tab, field, filters, limit, offset);
        return baseQueryMapper.selectTabsByPage(tab, typesFilter, field, filters, limit, offset);
    }
    @Override
src/main/java/com/moon/server/service/all/BaseUploadService.java
@@ -129,7 +129,7 @@
    /**
     * æŸ¥è¯¢æ–‡ä»¶
     */
    public List<MetaFileEntity> selectFiles(String subPath) {
    public List<MetaFileEntity> selectFiles(String subPath, boolean hasMd5) {
        String root = pathHelper.getConfig().getTempPath() + File.separator + subPath;
        File file = new File(root);
@@ -145,7 +145,7 @@
        for (File f : files) {
            String fileName = FileHelper.getFileName(f.getPath());
            String extName = FileHelper.getExtension(fileName);
            if (!isExtValid(extName)) {
            if (!isFileValid(f.getName())) {
                continue;
            }
@@ -154,7 +154,7 @@
            mf.setExtName(extName);
            mf.setSizes(FileHelper.sizeToMb(f.length()));
            mf.setPath(subPath + File.separator + fileName);
            if (!StaticData.ZIP.equals(extName)) {
            if (hasMd5 && !StaticData.ZIP.equals(extName)) {
                mf.setGuid(FileHelper.getFileMd5(f.getPath()));
            }
@@ -190,7 +190,7 @@
     * æŸ¥è¯¢æ˜ å°„
     */
    public List<MetaFileEntity> selectMappers(UserEntity ue, String path, DirEntity dir, VerEntity ver, String epsgCode) {
        List<MetaFileEntity> metas = selectFiles(path);
        List<MetaFileEntity> metas = selectFiles(path, true);
        if (null == metas || metas.isEmpty()) {
            return null;
        }
@@ -252,14 +252,13 @@
    private void getFilesByPath(List<File> list, String path) {
        File file = new File(path);
        if (!file.isDirectory()) {
            String extName = FileHelper.getExtension(file);
            if (isExtValid(extName)) {
            if (isFileValid(file.getName())) {
                list.add(file);
            }
            return;
        }
        if (isGdbFile(file)) {
        if (isGdbFile(file) || isOsgbFile(file)) {
            list.add(file);
            return;
        }
@@ -272,8 +271,7 @@
            if (f.isDirectory()) {
                getFilesByPath(list, f.getPath());
            } else {
                String extName = FileHelper.getExtension(f);
                if (isExtValid(extName)) {
                if (isFileValid(f.getName())) {
                    list.add(f);
                }
            }
@@ -281,10 +279,22 @@
    }
    /**
     * æ‰©å±•是否有效
     * æ–‡ä»¶æ˜¯/否有效
     */
    private boolean isExtValid(String extName) {
        return StaticData.ALL_EXTENSION.contains(extName) && !StaticData.MAPPER_EXCLUDE_EXT.contains(extName);
    private boolean isFileValid(String fileName) {
        String extName = FileHelper.getExtension(fileName);
        if (fileName.startsWith(StaticData.TILDE) || !StaticData.ALL_EXTENSION.contains(extName)) {
            return false;
        }
        fileName = fileName.toLowerCase();
        for (String ext : StaticData.MAPPER_EXCLUDE_EXT) {
            if (fileName.contains(ext)) {
                return false;
            }
        }
        return true;
    }
    /**
@@ -294,18 +304,19 @@
        List<MetaFileEntity> list = new ArrayList<>();
        for (File f : files) {
            boolean isGdb = isGdbFile(f);
            if (!isGdb && f.isDirectory()) {
            boolean isOsgb = isOsgbFile(f);
            boolean isFile = isGdb || isOsgb;
            if (f.isDirectory() && !isFile) {
                continue;
            }
            String fileName = FileHelper.getFileName(f.getPath());
            String extName = FileHelper.getExtension(fileName);
            if (!isExtValid(extName) || fileName.startsWith("~")) {
            String extName = isOsgb ? StaticData.OSGB : FileHelper.getExtension(fileName);
            if (!isFileValid(f.getName())) {
                continue;
            }
            String dircode = getDirByPath(f.getPath(), fileName, dir, dirs);
            boolean isShp = StaticData.SHP.equals(extName);
            if (isGdb) {
                List<MetaFileEntity> rs = getGdbMappers(f, meta, dircode, start);
                if (null != rs && rs.size() > 0) {
@@ -313,13 +324,30 @@
                }
                continue;
            }
            if (isOsgb) {
                list.add(getOsgbMapper(f, meta, dircode, start));
                continue;
            }
            MetaFileEntity mf = createMetaFileEntity(f, meta, fileName, extName);
            mf.setPath(f.getPath().substring(start));
            mf.setDircode(dircode);
            list.add(mf);
        }
        return list;
    }
    /**
     * åˆ›å»ºå…ƒæ•°æ®æ–‡ä»¶å®žä½“ç±»
     */
    private MetaFileEntity createMetaFileEntity(File f, MetaFileEntity meta, String fileName, String extName) {
        boolean isShp = StaticData.SHP.equals(extName);
            MetaFileEntity mf = createMetaFileEntity(meta);
            mf.setDircode(dircode);
            mf.setEventid(StringHelper.getGuid());
            mf.setName(fileName);
            mf.setExtName(extName);
            mf.setPath(f.getPath().substring(start));
            if (isShp) {
                List<String> shpFiles = getShpFiles(f.getPath());
@@ -330,10 +358,8 @@
                mf.setSizes(FileHelper.sizeToMb(f.length()));
                mf.setGuid(FileHelper.getFileMd5(f.getPath()));
            }
            list.add(mf);
        }
        return list;
        return mf;
    }
    /**
@@ -464,7 +490,7 @@
            MetaFileEntity mf = createMetaFileEntity(meta);
            mf.setDircode(dircode);
            mf.setEventid(StringHelper.getGuid());
            mf.setName(fileName);
            mf.setName(fileName + "\\" + tab);
            mf.setExtName(extName);
            mf.setSizes(FileHelper.sizeToMb(f.length()));
            mf.setPath(f.getPath().substring(start));
@@ -482,16 +508,9 @@
     */
    private boolean isGdbFile(File f) {
        if (f.isDirectory() && f.getName().toLowerCase().endsWith(StaticData.GDB)) {
            File[] files = f.listFiles();
            if (null == files || files.length == 0) {
                return false;
            }
            File gdb = new File(f.getPath() + File.separator + "gdb");
            for (File file : files) {
                if ("gdb".equals(file.getName())) {
                    return true;
                }
            }
            return gdb.exists() && !gdb.isDirectory();
        }
        return false;
@@ -519,6 +538,46 @@
    }
    /**
     * æ˜¯/否为OSGB文件
     */
    private boolean isOsgbFile(File f) {
        if (f.isDirectory()) {
            File meta = new File(f.getPath() + File.separator + "metadata.xml");
            File data = new File(f.getPath() + File.separator + "Data");
            return meta.exists() && !meta.isDirectory() && data.exists() && data.isDirectory();
        }
        return false;
    }
    /**
     * èŽ·å–OSGB文件映射
     */
    private MetaFileEntity getOsgbMapper(File f,  MetaFileEntity meta, String dircode, int start) {
        String fileName = FileHelper.getFileName(f.getPath());
        List<String> files = new ArrayList<>();
        FileHelper.getFilesByPath(files, f.getPath());
        String md5 = getFilesMd5(files);
        double sizes = getFilesSize(files);
        MetaFileEntity mf = createMetaFileEntity(meta);
        mf.setDircode(dircode);
        mf.setEventid(StringHelper.getGuid());
        mf.setName(fileName);
        mf.setExtName(StaticData.OSGB);
        mf.setSizes(FileHelper.sizeToMb(f.length()));
        mf.setPath(f.getPath().substring(start));
        mf.setSizes(sizes);
        mf.setGuid(md5);
        return mf;
    }
    /**
     * èŽ·å–å‚æ•° *
     * Enumeration<String> headers = req.getHeaderNames();
     * Enumeration<String> attributes = req.getAttributeNames();
src/main/java/com/moon/server/service/all/UploadAttachService.java
@@ -2,20 +2,17 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moon.server.controller.all.BaseController;
import com.moon.server.entity.all.ResponseMsg;
import com.moon.server.entity.all.SettingData;
import com.moon.server.entity.all.*;
import com.moon.server.entity.ctrl.KeyValueEntity;
import com.moon.server.entity.data.DownloadEntity;
import com.moon.server.entity.data.MetaEntity;
import com.moon.server.entity.data.MetaFileEntity;
import com.moon.server.entity.sys.AttachEntity;
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.helper.*;
import com.moon.server.mapper.all.BasicMapper;
import com.moon.server.mapper.data.DownloadMapper;
import com.moon.server.service.sys.AttachService;
import com.moon.server.entity.all.BaseEntity;
import com.moon.server.entity.all.StaticData;
import com.moon.server.helper.*;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.model.FileHeader;
import net.lingala.zip4j.model.ZipParameters;
src/main/java/com/moon/server/service/data/MetaService.java
@@ -66,6 +66,11 @@
    }
    @Override
    public List<MetaEntity> selectGdbByGuid(String guid) {
        return metaMapper.selectGdbByGuid(guid);
    }
    @Override
    public Integer selectMetasForCount(String depcode, String dirs, String name) {
        depcode = StringHelper.getRightLike(depcode);
        name = StringHelper.getLikeUpperStr(name);
@@ -238,6 +243,9 @@
            }
            if (str.contains("bs.s_explorationpoint ")) {
                list.add(str.replace("bs.s_explorationpoint ", "bs.s_surveyworksite "));
            }
            if (str.contains("bs.m_surface_deformation_data ")) {
                list.add(str.replace("bs.m_surface_deformation_data ", "bs.m_surface_deformation_data_date "));
            }
            i++;
@@ -524,6 +532,8 @@
                        addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT);
                        break;
                    case StaticData.GDB:
                        continue;
                    case StaticData.OSGB:
                        addFolderFile(uploadPath, mf, zip, params);
                        break;
                    default:
src/main/java/com/moon/server/service/data/PublishService.java
@@ -7,16 +7,21 @@
import com.moon.server.entity.ctrl.RegisterEntity;
import com.moon.server.entity.data.MetaEntity;
import com.moon.server.entity.data.PublishEntity;
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.helper.PathHelper;
import com.moon.server.helper.RestHelper;
import com.moon.server.helper.StringHelper;
import com.moon.server.helper.WebHelper;
import com.moon.server.mapper.data.PublishMapper;
import com.moon.server.service.sys.TokenService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
@@ -34,26 +39,34 @@
    @Value("${sys.iisHost}")
    private String iisHost;
    @Autowired
    @Resource
    PublishMapper publishMapper;
    @Autowired
    @Resource
    FmeService fmeService;
    @Resource
    PathHelper pathHelper;
    @Resource
    TokenService tokenService;
    private final static Log log = LogFactory.getLog(PublishService.class);
    @Override
    public Integer selectCount(String name) {
    public Integer selectCount(String name, String dircode, String type) {
        name = StringHelper.getLikeUpperStr(name);
        dircode = StringHelper.getRightLike(dircode);
        return publishMapper.selectCount(name);
        return publishMapper.selectCount(name, dircode, type);
    }
    @Override
    public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset) {
    public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset) {
        name = StringHelper.getLikeUpperStr(name);
        dircode = StringHelper.getRightLike(dircode);
        return publishMapper.selectByPage(name, limit, offset);
        return publishMapper.selectByPage(name, dircode, type, limit, offset);
    }
    @Override
@@ -69,6 +82,11 @@
    @Override
    public List<PublishEntity> selectByIds(String ids) {
        return publishMapper.selectByIds(ids);
    }
    @Override
    public List<String> selectCodesForDir(String dircode, Integer isDom) {
        return publishMapper.selectCodesForDir(dircode, isDom);
    }
    @Override
@@ -122,6 +140,27 @@
        name = StringHelper.getLikeUpperStr(name);
        return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset);
    }
    public List<Integer> selectLasCs(PubEntity entity, String method, HttpServletRequest req) {
        Map<String, Object> map = getMapData(entity);
        String str = RestHelper.postForRest(exportServer + method, map);
        if (StringHelper.isEmpty(str)) {
            return null;
        }
        ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class);
        if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) {
            return null;
        }
        String rs = msg.getResult();
        if (StringHelper.isEmpty(rs)) {
            return null;
        }
        return StringHelper.strToIntegers(rs);
    }
    /**
@@ -182,6 +221,11 @@
        }
        for (PublishEntity entity : list) {
            // é¿å…é‡å¤æ³¨å†Œ
            if (null != entity.getUpdateTime()) {
                continue;
            }
            String url = entity.getUrl().replace("{host}", iisHost);
            String type = getServerType(entity);
@@ -208,6 +252,10 @@
                return "三维地形服务";
            case "mpt":
                return "三维场景服务";
            case "las":
            case "laz":
            case "cpt":
                return "三维点云服务";
            default:
                return "三维模型服务";
        }
@@ -245,4 +293,61 @@
            }
        }
    }
    /**
     * åˆ é™¤å‘布文件
     */
    public void deleteFiles(List<PublishEntity> list) {
        String lfData = pathHelper.getConfig().getLfData();
        for (PublishEntity pub : list) {
            if (null != pub.getUrl() && pub.getUrl().contains("/SG/")) {
                continue;
            }
            String path = lfData + pub.getPath().replace("\\tileset.json", "");
            File file = new File(path);
            if (!file.exists() || !file.isDirectory()) {
                continue;
            }
            String cmd = String.format("cmd /c rd \"%s\" /s /q", path);
            WebHelper.exec(cmd);
        }
    }
    /**
     * åˆ é™¤å‘布文件
     */
    public void deleteFiles(List<Integer> ids, HttpServletRequest req) {
        PubEntity entity = new PubEntity();
        entity.setIds(ids);
        entity.setDircode("00");
        UserEntity ue = tokenService.getCurrentUser(req);
        if (ue != null) {
            entity.setUserId(ue.getId());
            entity.setToken(WebHelper.getToken(req));
        }
        long rows = postForPub(entity, "/Convert/DeleteFiles");
    }
    /**
     * å‘送发布请求
     */
    public long postForPub(PubEntity entity, String method) {
        Map<String, Object> map = getMapData(entity);
        String str = RestHelper.postForRest(exportServer + method, map);
        if (StringHelper.isEmpty(str)) {
            return 0;
        }
        ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class);
        if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) {
            return 0;
        }
        return msg.getCount();
    }
}
src/main/java/com/moon/server/service/data/UploadService.java
@@ -1,15 +1,16 @@
package com.moon.server.service.data;
import com.google.common.collect.Lists;
import com.moon.server.entity.all.BaseEntity;
import com.moon.server.entity.all.StaticData;
import com.moon.server.entity.data.*;
import com.moon.server.entity.sys.UserEntity;
import com.moon.server.helper.*;
import com.moon.server.mapper.all.BasicMapper;
import com.moon.server.mapper.data.UploadMapper;
import com.moon.server.service.all.BaseQueryService;
import com.moon.server.service.all.BaseUploadService;
import com.moon.server.service.sys.DepService;
import com.moon.server.entity.data.*;
import com.moon.server.helper.*;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -93,6 +94,9 @@
            File f = new File(mf.getPath());
            if (!f.exists()) {
                mf.setMsg("文件丢失");
            }
            if (f.exists() && StringHelper.isNull(mf.getGuid())) {
                mf.setGuid(FileHelper.getFileMd5(f.getPath()));
            }
            MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), null);
@@ -227,21 +231,40 @@
        List<?> list;
        if (StaticData.SHP.equals(mf.getExtName())) {
            list = ShpHelper.readData(clazz, mf.getPath());
            list = ShpHelper.readData(clazz, mf.getPath(), true);
        } else {
            list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab());
            list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab(), true);
        }
        if (null == list || list.isEmpty()) {
            return;
        }
        mf.setRecords(list.size());
        setCreateInfo(list, mf);
        int rows = basicMapper.insertBatch(list);
        int rows = batchInserts(basicMapper, list);
        if (rows > 0) {
            mf.setEntity(mf.getTab());
            mf.setTab(tabName);
            mf.setRows(rows);
        }
    }
    /**
     * æ‰¹é‡æ’å…¥
     */
    private <T> int batchInserts(BasicMapper basicMapper, List<T> list) {
        int rows = 0;
        //int count = (int) Math.ceil(list.size() / StaticData.D100)
        List<List<T>> subLists = Lists.partition(list, StaticData.I50);
        for (List<T> sub : subLists) {
            try {
                rows += basicMapper.insertBatch(sub);
            } catch (Exception ex) {
                log.error(ex);
            }
        }
        return rows;
    }
    /**
@@ -296,6 +319,9 @@
                    break;
                case StaticData.SHP:
                    copyMultiFile(mf, StaticData.SHP_EXT);
                    break;
                case StaticData.OSGB:
                    copyFolderFile(mf);
                    break;
                case StaticData.GDB:
                    if (gdbList.contains(mf.getPath())) {
@@ -425,15 +451,11 @@
            return;
        }
        newFile.mkdirs();
        File[] files = file.listFiles();
        if (null == files || files.length == 0) {
            return;
        }
        for (File f : files) {
            String subFile = targetPath + File.separator + FileHelper.getFileName(f.getPath());
            f.renameTo(new File(subFile));
        try {
            // newFile.mkdirs()
            FileUtils.moveDirectory(file, newFile);
        } catch (Exception ex) {
            log.error(ex);
        }
        mf.setPath(subPath);
    }
@@ -464,15 +486,25 @@
     */
    private void insertMetas(List<MetaFileEntity> list) {
        int metaId = insertParentMeta(list);
        List<String> guids = new ArrayList<>();
        for (MetaFileEntity mf : list) {
            if (null != mf.getMsg()) {
                continue;
            }
            MetaEntity me = createMeta(mf, metaId);
            metaService.insert(me);
            if (StaticData.NGDB.equals(me.getType())) {
                if (guids.contains(me.getGuid())) {
                    me.setIsmeta((short)-1);
                } else {
                    guids.add(me.getGuid());
                }
            }
            mf.setMsg(me.getId() > 0 ? "成功" : "失败");
            metaService.insert(me);
            String err = mf.getRows() < mf.getRecords() ? "(" + (mf.getRecords() - mf.getRows()) + " æ¡å¤±è´¥)" : "";
            mf.setMsg(me.getId() > 0 ? String.format("成功%s", err) : "失败");
        }
    }
src/main/java/com/moon/server/service/show/DataLibService.java
@@ -285,7 +285,7 @@
        }
        List<String> list = codesAsList(codes);
        removeDuplicate(list);
        list = copeDirCodes(list);
        setRightLike(list, field);
        return "(" + StringHelper.join(list, " or ") + ")";
@@ -305,39 +305,75 @@
    }
    /**
     * åŽ»é™¤é‡å¤
     * å¤„理目录编码
     */
    private static void removeDuplicate(List<String> list) {
        int i = 0;
        while (i < list.size()) {
            int j = findStr(list, i);
            if (j > -1) {
                list.remove(j);
                continue;
    private static List<String> copeDirCodes(List<String> list) {
        List<String> prjList = getDirCodesByLen(list, 0, 2);
        List<String> appList = getDirCodesByLen(list, 3, 30);
        if (prjList.isEmpty() && appList.isEmpty()) {
            return list;
        }
        if (prjList.isEmpty()) {
            return appList;
        }
        if (appList.isEmpty()) {
            return prjList;
            }
            i++;
        }
        return filterCodes(prjList, appList);
    }
    /**
     * æŸ¥æ‰¾å­—符串
     * æ ¹æ®é•¿åº¦èŽ·å–å•ä½ç¼–ç 
     */
    private static int findStr(List<String> list, int i) {
        String source = list.get(i);
        for (int j = i + 1, c = list.size(); j < c; j++) {
            if (list.get(j).startsWith(source)) {
                return j;
    private static List<String> getDirCodesByLen(List<String> list, int start, int end) {
        List<String> rs = new ArrayList<>();
        for (String code : list) {
            if (StringHelper.isEmpty(code)) {
                continue;
            }
            if (code.length() >= start && code.length() <= end) {
                rs.add(code);
            }
        }
        return -1;
        return rs;
    }
    /**
     * è¿‡æ»¤é¡¹ç›®ç¼–码
     */
    private static List<String> filterCodes(List<String> prjList, List<String> appList) {
        int i = 0;
        while (i < appList.size()) {
            boolean flag = false;
            for (String prj : prjList) {
                if (appList.get(i).startsWith(prj)) {
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                appList.remove(i);
                continue;
            }
            i++;
        }
        return appList;
    }
    /**
     * è®¾ç½® å³like
     */
    private static void setRightLike(List<String> list, String field) {
        if (list.isEmpty()) {
            list.add("1 = 2");
            return;
        }
        for (int i = 0, c = list.size(); i < c; i++) {
            String str = String.format("%s like '%s%%'", field, list.get(i));
            list.set(i, str);
src/main/java/com/moon/server/service/show/InquiryService.java
@@ -95,7 +95,7 @@
     * ç“¦ç‰‡è·¯å¾„是否存在
     */
    private boolean isTilePathExist(PublishEntity pub) {
        String tilePath = pathHelper.getConfig().getTilePath().replace("2d\\tiles", "") + pub.getPath();
        String tilePath = pathHelper.getConfig().getTilePath() + pub.getPath();
        File f = new File(tilePath);
        if (!f.exists() || !f.isDirectory()) {
@@ -112,6 +112,12 @@
     */
    private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) {
        List<File> list = new ArrayList<>();
        File view = new File(pub.getPath() + File.separator + "view.htm");
        if (view.exists() && !view.isDirectory()) {
            list.add(view);
        }
        for (int i = 0; i < StaticData.I23; i++) {
            List<File> files = findTilesByZoom(dt, pub, i);
            if (files.size() > 0) {
src/main/java/com/moon/server/service/sys/ProxyService.java
@@ -56,7 +56,7 @@
        // 9.获取资源实体
        ResEntity entity = getResEntity(ue, resId);
        if (null == entity || StaticData.TWO != entity.getType() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) {
        if (null == entity || StaticData.TWO != entity.getStatus() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) {
            WebHelper.writeStr2Page(res, ILLEGAL_RESOURCE);
            return;
        }
src/main/java/com/moon/server/service/sys/ReportService.java
@@ -94,6 +94,11 @@
    }
    @Override
    public List<CountEntity> countSizesByType() {
        return reportMapper.countSizesByType();
    }
    @Override
    public List<CountEntity> countServices() {
        return reportMapper.countServices();
    }
@@ -103,6 +108,11 @@
        return reportMapper.countOperates();
    }
    @Override
    public List<CountEntity> countSizesByPrj() {
        return reportMapper.countSizesByPrj();
    }
    /**
     * åˆ›å»ºæŠ¥å‘Š
     */
src/main/resources/mapper/all/BaseQueryMapper.xml
@@ -28,6 +28,9 @@
            <if test="tab != null">
                and upper(tab) like #{tab} or upper(tab_desc) like #{tab}
            </if>
            <if test="typesFilter != null">
                and (${typesFilter})
            </if>
        </where>
    </select>
@@ -39,6 +42,9 @@
            <if test="tab != null">
                and (upper(tab) like #{tab} or upper(tab_desc) like #{tab})
            </if>
            <if test="typesFilter != null">
                and (${typesFilter})
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset};
src/main/resources/mapper/data/MetaMapper.xml
@@ -4,7 +4,7 @@
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_meta
        <where>
            1 = 1
            ismeta between 0 and 1
            <if test="depcode != null">
                and depcode like #{depcode}
            </if>
@@ -24,7 +24,7 @@
        select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
        from lf.sys_meta a
        <where>
            1 = 1
            ismeta between 0 and 1
            <if test="depcode != null">
                and depcode like #{depcode}
            </if>
@@ -42,6 +42,12 @@
        limit #{limit} offset #{offset}
    </select>
    <select id="selectGdbByGuid" resultType="com.moon.server.entity.data.MetaEntity">
        select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
        from lf.sys_meta a
        where type = 'gdb' and guid = #{guid};
    </select>
    <select id="selectMetasForCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_meta
        <where>
src/main/resources/mapper/data/PublishMapper.xml
ÎļþÃû´Ó src/main/resources/mapper/show/PublishMapper.xml ÐÞ¸Ä
@@ -48,8 +48,15 @@
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_publish
        <where>
            1 = 1
            <if test="name != null">
                upper(name) like #{name}
                and upper(name) like #{name}
            </if>
            <if test="dircode != null">
                and dirid like #{dircode}
            </if>
            <if test="type != null">
                and ${type}
            </if>
        </where>
    </select>
@@ -58,11 +65,18 @@
        select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_publish a
        <where>
            1 = 1
            <if test="name != null">
                upper(name) like #{name}
                and upper(name) like #{name}
            </if>
            <if test="dircode != null">
                and dirid like #{dircode}
            </if>
            <if test="type != null">
                and ${type}
            </if>
        </where>
        order by id desc
        order by a.update_time desc, a.create_time desc
        limit #{limit} offset #{offset}
    </select>
@@ -80,6 +94,25 @@
        select * from lf.sys_publish where id in (${ids}) order by id desc;
    </select>
    <select id="selectCodesForDir" resultType="java.lang.String">
        select code
        from lf.sys_dir
        <where>
            <choose>
                <when test="isDom > 0">
                    name in ('DOM', '数字正射影像图')
                </when>
                <otherwise>
                    name in ('DEM', '数字高程模型')
                </otherwise>
            </choose>
            <if test="dircode != null">
                and code like #{dircode}
            </if>
        </where>
        order by code;
    </select>
    <insert id="insert" parameterType="com.moon.server.entity.data.PublishEntity">
        insert into lf.sys_publish
        (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,bak)
src/main/resources/mapper/show/OneMapMapper.xml
@@ -128,7 +128,9 @@
    <select id="countProjectTour" resultType="java.util.Map">
        SELECT st_astext(geom) AS wkt,* FROM bs.m_pipeline
        <where>
            <if test="pipename != null  and pipename != ''"> and pipename = #{pipename}</if>
            <if test="pipename != null and pipename != ''">
                pipename = #{pipename}
            </if>
        </where>
    </select>
src/main/resources/mapper/sys/ReportMapper.xml
@@ -86,6 +86,14 @@
        order by depcode;
    </select>
    <!-- æŒ‰æ–‡ä»¶ç±»åž‹ç»Ÿè®¡ -->
    <select id="countSizesByType" resultType="com.moon.server.entity.ctrl.CountEntity">
        select type "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count"
        from lf.sys_meta
        group by type
        order by type;
    </select>
    <!-- æœåŠ¡è°ƒç”¨é‡ç»Ÿè®¡ -->
    <select id="countServices" resultType="com.moon.server.entity.ctrl.CountEntity">
        select name "m1", count(*) "count"
@@ -101,4 +109,13 @@
        group by modular1,modular2
        order by modular1 desc,modular2;
    </select>
    <!-- æŒ‰é¡¹ç›®ç»Ÿè®¡æ•°æ® -->
    <select id="countSizesByPrj" resultType="com.moon.server.entity.ctrl.CountEntity">
        select name "m1", coalesce((select sum(sizes) from lf.sys_meta b where b.dircode like a.code || '%'), 0) "sizes",
            (select count(*) from lf.sys_meta b where b.dircode like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by a.code;
    </select>
</mapper>