月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2024-11-11 fee67ca8a0760315047a52fc4101a8f4f80b7a7f
src/main/java/com/moon/server/controller/data/PublishController.java
@@ -23,12 +23,9 @@
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 数据发布
 * @author WWW
 */
@Api(tags = "数据管理\\发布管理")
@RestController
@SuppressWarnings("ALL")
@RequestMapping("/publish")
public class PublishController extends BaseController {
    @Resource
@@ -78,13 +75,10 @@
        }
    }
    /**
     * 获取类型
     */
    private String getType(String type) throws Exception {
        switch (type) {
            case "DOM":
                return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 3, 4, 5)";
                return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 2, 3, 4, 5)";
            case "DEM":
                return "type in ('tif', 'tiff', 'dem') and mata_type = 2";
            case "Vector":
@@ -126,9 +120,6 @@
        }
    }
    /**
     * 获取发布类型
     */
    private String getPubType(String type) throws Exception {
        if (StringHelper.isEmpty(type)) {
            return null;
@@ -136,13 +127,13 @@
        switch (type) {
            case "DOM":
                return "type = 'DOM'";
                return "a.type = 'DOM'";
            case "DEM":
                return "type = 'DEM'";
                return "a.type = 'DEM'";
            case "Vector":
                return "type = 'Vector'";
                return "a.type = 'Vector'";
            case "Model":
                return "type = 'Model'";
                return "a.type = 'Model'";
            default:
                throw new Exception("数据类型不匹配");
        }
@@ -179,6 +170,26 @@
    }
    @SysLog()
    @ApiOperation(value = "查询数简图层")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "port", value = "端口", dataType = "int", paramType = "query", example = "50001")
    })
    @GetMapping(value = "/selectSjLayers")
    public void selectSjLayers(Integer port, HttpServletRequest req, HttpServletResponse res) {
        shuJianService.selectSjLayers(port, req, res);
    }
    @SysLog()
    @ApiOperation(value = "查询数简任务状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "任务ID", dataType = "int", paramType = "query", example = "10008101")
    })
    @GetMapping(value = "/selectSjMissionStatus")
    public void selectSjMissionStatus(Integer id, HttpServletRequest req, HttpServletResponse res) {
        shuJianService.selectSjMissionStatus(id, req, res);
    }
    @SysLog()
    @ApiOperation(value = "插入数简服务")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PubEntity", paramType = "body")
@@ -193,15 +204,19 @@
            if (StringHelper.isEmpty(entity.getType())) {
                return fail("发布类别为空", null);
            }
            if (!ShuJianService.TYPES.contains(entity.getType())) {
                return fail("发布类别不支持", null);
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            if (null != ue) {
                entity.setUserId(ue.getId());
                entity.setDepcode(ue.getDepcode());
            }
            entity.setDefault();
            permsService.clearPermsCache();
            Integer rows = shuJianService.insertSjService(entity, req, res);
            Integer rows = shuJianService.insertSjService(entity);
            return success(rows);
        } catch (Exception ex) {
@@ -230,9 +245,10 @@
                entity.setUserId(ue.getId());
                entity.setDepcode(ue.getDepcode());
            }
            entity.setDefault();
            permsService.clearPermsCache();
            Integer rows = shuJianService.updateSjService(entity, req, res);
            Integer rows = shuJianService.updateSjService(entity);
            return success(rows);
        } catch (Exception ex) {
@@ -245,7 +261,7 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1")
    })
    @GetMapping(value = "/deletes")
    @GetMapping(value = "/deletesSjServices")
    public ResponseMsg<Integer> deletesSjServices(@RequestParam List<Integer> ids) {
        try {
            if (null == ids || ids.isEmpty()) {
@@ -260,4 +276,57 @@
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PublishEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> update(@RequestBody PublishEntity entity, HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUpdateUser(ue.getId());
            }
            if (StringHelper.isEmpty(entity.getGeom())) {
                entity.setGeom("null");
            }
            permsService.clearPermsCache();
            int count = publishService.update(entity);
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "更新数简图层的拉伸方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PubEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/updateSjLayerStretch", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> updateSjLayerStretch(@RequestBody PubEntity entity, HttpServletRequest req) {
        try {
            if (null == entity || null == entity.getLayerId()) {
                return fail("实体类为空或图层ID为空", 0);
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            if (null != ue) {
                entity.setUserId(ue.getId());
                entity.setDepcode(ue.getDepcode());
            }
            Integer rows = shuJianService.updateSjLayerStretch(entity);
            return success(rows);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
        }
    }
}