管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-05-29 b1e97e3b11b6f95b9e39cd475dca027ba690598c
src/main/java/com/lf/server/controller/data/PublishController.java
@@ -77,6 +77,8 @@
        switch (type) {
            case "DOM":
                return "type in ('tif', 'tiff', 'img')";
            case "DEM":
                return "type in ('tif', 'tiff')";
            case "MPT":
                return "type = 'mpt'";
            case "3DML":
@@ -136,8 +138,8 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PubEntity", paramType = "body")
    })
    @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) {
    @PostMapping(value = "/insertForPub", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Object> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) {
        try {
            if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) {
                return fail("实体类为空或找不到元数据ID", 0);
@@ -152,11 +154,31 @@
                entity.setToken(WebHelper.getToken(req));
            }
            int count = publishService.insertForPub(entity);
            String method = getConvertMethod(entity.getType());
            long count = publishService.postForPub(entity, method, 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":
                return "/Convert/ToSG";
            case "BIM":
                return "/Convert/ToTileset";
            default:
                throw new Exception("数据类型不匹配");
        }
    }
@@ -166,13 +188,13 @@
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1")
    })
    @GetMapping(value = "/deletes")
    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) {
    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids, HttpServletRequest req) {
        try {
            if (ids == null || ids.isEmpty()) {
                return fail("id数组不能为空", -1);
            }
            int count = publishService.deletes(StringHelper.join(ids, ","));
            int count = publishService.deletes(ids, req);
            return success(count);
        } catch (Exception ex) {