管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-08-08 534a27c16e9081ac13900b823a9bcf3cbae013dc
src/main/java/com/lf/server/controller/data/PublishController.java
@@ -16,11 +16,11 @@
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;
/**
@@ -133,26 +133,59 @@
    @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;
        }
    }
@@ -167,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);
        }
@@ -193,11 +251,9 @@
                entity.setToken(WebHelper.getToken(req));
            }
            layerService.clearCache();
            String method = getConvertMethod(entity.getType());
            long count = publishService.postForPub(entity, method, req);
            if (count > 0) {
                layerService.clearCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -221,7 +277,7 @@
            case "BIM":
                return "/Convert/ToTileset";
            case "LAS":
                return "/Convert/ToLas";
                return "/Convert/ToLasByPy";
            case "OSGB":
                return "/Convert/ToOsgb";
            default:
@@ -247,11 +303,11 @@
                return fail("没有找到要删除的数据", -1);
            }
            publishService.deleteFiles(list);
            // publishService.deleteFiles(list)
            layerService.clearCache();
            publishService.deleteFiles(ids, req);
            int count = publishService.deletes(ids, req);
            if (count > 0) {
                layerService.clearCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -273,10 +329,8 @@
                entity.setUpdateUser(ue.getId());
            }
            layerService.clearCache();
            int count = publishService.update(entity);
            if (count > 0) {
                layerService.clearCache();
            }
            return success(count);
        } catch (Exception ex) {