月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-09-03 d950bfac44ca8dcdfe91de52fde0fe86e0829753
src/main/java/com/moon/server/service/data/ShuJianService.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.moon.server.entity.all.StaticData;
import com.moon.server.entity.ctrl.PubEntity;
import com.moon.server.entity.data.MetaPubEntity;
import com.moon.server.entity.data.PublishEntity;
import com.moon.server.entity.shujian.*;
import com.moon.server.helper.HttpHelper;
@@ -30,8 +31,6 @@
 */
@Service
public class ShuJianService {
    private final static Log log = LogFactory.getLog(ShuJianService.class);
    @Value("${shujian.ak}")
    private String ak;
@@ -40,6 +39,8 @@
    @Resource
    PublishService publishService;
    private final static Log log = LogFactory.getLog(ShuJianService.class);
    /**
     * 分页查询数简的颜色表
@@ -58,22 +59,26 @@
    /**
     * 插入数简服务
     */
    public Integer insertSjService(PubEntity pubEntity, HttpServletRequest req, HttpServletResponse res) {
        CreateLayerEntity layerEntity = createLayerEntity(pubEntity);
    public Integer insertSjService(PubEntity pub) {
        CreateLayerEntity layerEntity = createLayerEntity(pub);
        Integer layerId = postLayerEntity(layerEntity);
        if (null == layerId) {
            return 0;
        }
        CreateServiceEntity serviceEntity = createServiceEntity(pubEntity);
        CreateServiceEntity serviceEntity = createServiceEntity(pub);
        Integer serviceId = postServiceEntity(serviceEntity);
        if (null == serviceId) {
            return 0;
        }
        PublishEntity publishEntity = createPublishEntity(pubEntity, layerId, serviceId);
        PublishEntity publishEntity = createPublishEntity(pub, layerId, serviceId);
        Integer id = publishService.insert(publishEntity);
        if (null == id) {
            return id;
        }
        return publishService.insert(publishEntity);
        return insertMetaPub(pub, id);
    }
    /**
@@ -158,22 +163,64 @@
     * 创建发布实体类
     */
    public PublishEntity createPublishEntity(PubEntity pub, Integer layerId, Integer serviceId) {
        String epsg = (StaticData.I104903 == pub.getEpsgCode() ? "ESRI:" : "EPSG:") + pub.getEpsgCode();
        PublishEntity entity = new PublishEntity();
        entity.setType(pub.getType());
        entity.setName(pub.getName());
        entity.setMin(pub.getMin());
        entity.setMax(pub.getMax());
        entity.setBak(epsg);
        entity.setBak(getEpsg(pub));
        entity.setCreateUser(pub.getUserId());
        entity.setDirid(pub.getDircode());
        entity.setDepid(pub.getDepcode());
        entity.setStatus(3);
        entity.setLayerid(layerId);
        entity.setServiceid(serviceId);
        entity.setJson(getColorTableJson(pub));
        return entity;
    }
    /**
     * 获取EPSG编码
     */
    public String getEpsg(PubEntity pub) {
        if (StaticData.I104903 == pub.getEpsgCode()) {
            return "ESRI:" + pub.getEpsgCode();
        }
        return "EPSG:" + pub.getEpsgCode();
    }
    /**
     * 获取颜色表的JSON字符串
     */
    public String getColorTableJson(PubEntity pub) {
        if (null == pub.getColorTable() && null == pub.getGradientColorTable()) {
            return null;
        }
        if (null != pub.getGradientColorTable()) {
            return JSON.toJSONString(pub.getGradientColorTable());
        }
        return JSON.toJSONString(pub.getColorTable());
    }
    /**
     * 插入元数据发布类
     */
    private int insertMetaPub(PubEntity pub, Integer pubid) {
        int count = 0;
        for (Integer metaid : pub.getIds()) {
            MetaPubEntity mp = new MetaPubEntity();
            mp.setMetaid(metaid);
            mp.setPubid(pubid);
            mp.setCreateUser(pub.getUserId());
            count += publishService.insertMetaPub(mp);
        }
        return count;
    }
    /**
@@ -199,7 +246,6 @@
     */
    public Integer deletesSjServices(List<Integer> ids) {
        String strs = StringHelper.join(ids, ",");
        List<PublishEntity> list = publishService.selectByIds(strs);
        if (null == list || list.isEmpty()) {
            return 0;