月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-09-02 2fcbeffa30bc674cffdd0147da271754468073a3
src/main/java/com/moon/server/controller/data/PublishController.java
@@ -61,7 +61,7 @@
                return fail("数据类别为空", null);
            }
            String types = getType(dircode, type);
            String types = getType(type);
            int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name);
            if (count == 0) {
                return success(0, null);
@@ -78,55 +78,19 @@
    /**
     * 获取类型
     */
    private String getType(String dircode, String type) throws Exception {
    private String getType(String type) throws Exception {
        switch (type) {
            case "DOM":
                return "type in ('tif', 'tiff', 'img')" + getFilter(dircode, type);
                return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 3, 4, 5)";
            case "DEM":
                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'";
                return "type in ('tif', 'tiff', 'dem') and mata_type = 2";
            case "Vector":
                return "type in ('shp', 'gdb') and mata_type = 6";
            case "Model":
                return "type in ('ifc', 'gdb') and mata_type = 7";
            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()
@@ -162,7 +126,7 @@
    /**
     * 获取发布类型
     */
    private String getPubType(String type) {
    private String getPubType(String type) throws Exception {
        if (StringHelper.isEmpty(type)) {
            return null;
        }
@@ -172,20 +136,12 @@
                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'";
            case "Vector":
                return "type = 'Vector'";
            case "Model":
                return "type = 'Model'";
            default:
                return null;
                throw new Exception("数据类型不匹配");
        }
    }
@@ -200,31 +156,6 @@
            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);
        }
@@ -252,36 +183,12 @@
            }
            permsService.clearPermsCache();
            String method = getConvertMethod(entity.getType());
            long count = publishService.postForPub(entity, method, req);
            // String method = getConvertMethod(entity.getType())
            long count = publishService.postForPub(entity, "", req);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    /**
     * 获取转换方法
     */
    private String getConvertMethod(String type) throws Exception {
        switch (type) {
            case "DOM":
                return "/Convert/ToTiles";
            case "DEM":
                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("数据类型不匹配");
        }
    }