月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-09-05 61b0eefa5a1b6ff7d8b24b458b0c01e79fd21113
src/main/java/com/moon/server/service/data/ShuJianService.java
@@ -11,6 +11,7 @@
import com.moon.server.helper.PathHelper;
import com.moon.server.helper.RestHelper;
import com.moon.server.helper.StringHelper;
import com.moon.server.service.sys.ResService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -41,6 +42,9 @@
    PathHelper pathHelper;
    @Resource
    ResService resService;
    @Resource
    MetaService metaService;
    @Resource
@@ -50,12 +54,18 @@
    public final static List<String> TYPES = new ArrayList<>(Arrays.asList("DOM", "DEM"));
    private final static String DOM_FORMAT = "%s/sj_raster/v6/wmts/service/system/%d/%s";
    private final static String DEM_FORMAT = "%s/sj_raster/v6/terrain_mesh/service/system/%d/%s";
    private final static String COLOR_TABLE = "%s/sj_raster/v6/api/color_table?%s&page_count=%d&page_num=%d&key=";
    /**
     * 分页查询数简的颜色表
     */
    public void selectSjColorTables(Integer pageSize, Integer pageIndex, HttpServletRequest req, HttpServletResponse res) {
        try {
            String url = String.format("%s/sj_raster/v6/api/color_table?%s&page_count=%d&page_num=%d&key=", sjUrl, ak, pageSize, pageIndex);
            String url = String.format(COLOR_TABLE, sjUrl, ak, pageSize, pageIndex);
            HttpHelper httpHelper = new HttpHelper();
            httpHelper.service(req, res, null, url);
@@ -123,11 +133,11 @@
     * 获取EPSG编码
     */
    public String getEpsg(PubEntity pub) {
        if (StaticData.I104903 == pub.getEpsgCode()) {
            return "ESRI:" + pub.getEpsgCode();
        if (StaticData.I104903 == pub.getEpsg()) {
            return "ESRI:" + pub.getEpsg();
        }
        return "EPSG:" + pub.getEpsgCode();
        return "EPSG:" + pub.getEpsg();
    }
    /**
@@ -180,7 +190,7 @@
        CreateServiceEntity.Services services = entity.getService();
        services.setName(pub.getName());
        services.setAccess_name(StringHelper.getGuid());
        services.setAccess_name(pub.getUuid());
        services.setPub_status(1);
        services.setRect_minx(-180.0);
        services.setRect_miny(-90.0);
@@ -217,14 +227,16 @@
        entity.setName(pub.getName());
        entity.setMin(pub.getMin());
        entity.setMax(pub.getMax());
        entity.setEpsg(pub.getEpsgCode());
        entity.setEpsg(pub.getEpsg());
        entity.setCreateUser(pub.getUserId());
        entity.setDirid(pub.getDircode());
        entity.setDepid(pub.getDepcode());
        entity.setStatus(3);
        entity.setLayerid(layerId);
        entity.setServiceid(serviceId);
        entity.setEventid(pub.getUuid());
        entity.setJson(getColorTableJson(pub));
        entity.setUrl(String.format(TYPES.get(0).equals(pub.getType()) ? DOM_FORMAT : DEM_FORMAT, sjUrl, serviceId, StaticData.I0));
        return entity;
    }
@@ -264,7 +276,7 @@
    /**
     * 插入数简服务
     */
    public Integer updateSjService(PubEntity pub, HttpServletRequest req, HttpServletResponse res) {
    public Integer updateSjService(PubEntity pub) {
        PublishEntity entity = publishService.selectById(pub.getPubid());
        if (null == entity) {
            return 0;
@@ -275,8 +287,49 @@
        if (null != entity.getServiceid()) {
            deleteService(entity.getServiceid());
        }
        setPubEntity(pub, entity);
        return 1;
        CreateLayerEntity layerEntity = createLayerEntity(pub);
        Integer layerId = postLayerEntity(layerEntity);
        if (null == layerId) {
            return 0;
        }
        CreateServiceEntity serviceEntity = createServiceEntity(pub, layerId);
        Integer serviceId = postServiceEntity(serviceEntity);
        if (null == serviceId) {
            return 0;
        }
        entity.setLayerid(layerId);
        entity.setServiceid(serviceId);
        entity.setUpdateUser(pub.getUserId());
        if (StringHelper.isEmpty(entity.getGeom())) {
            entity.setGeom(StaticData.NULL);
        }
        return publishService.update(entity);
    }
    /**
     * 设置发布实体类
     */
    private void setPubEntity(PubEntity pub, PublishEntity entity) {
        List<MetaEntity> metas = publishService.selectMetasByPubid(pub.getPubid());
        List<Integer> ids = new ArrayList<>();
        for (MetaEntity meta : metas) {
            ids.add(meta.getId());
        }
        pub.setIds(ids);
        if (StringHelper.isEmpty(pub.getName())) {
            pub.setName(entity.getName());
        }
        if (null == pub.getEpsg() || 0 == pub.getEpsg()) {
            pub.setEpsg(entity.getEpsg());
        }
    }
    /**