| | |
| | | } |
| | | |
| | | permsService.clearPermsCache(); |
| | | Integer rows = shuJianService.updateSjService(entity, req, res); |
| | | Integer rows = shuJianService.updateSjService(entity); |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | public final static String OSGB = ".osgb"; |
| | | |
| | | public final static String NULL = "null"; |
| | | |
| | | public static String ADMIN = "admin"; |
| | | |
| | | public final static String SYS_META = "sysmeta"; |
| | |
| | | |
| | | import com.moon.server.entity.shujian.ColorTableEntity; |
| | | import com.moon.server.entity.shujian.GradientColorTableEntity; |
| | | import com.moon.server.helper.StringHelper; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | |
| | | public PubEntity() { |
| | | min = 0; |
| | | max = 18; |
| | | epsgCode = 104903; |
| | | epsg = 104903; |
| | | uuid = StringHelper.getGuid(); |
| | | } |
| | | |
| | | /** |
| | | * 发布ID |
| | | */ |
| | | private Integer pubid; |
| | | |
| | | /** |
| | | * 唯一键 |
| | | */ |
| | | private String uuid; |
| | | |
| | | /** |
| | | * 类型:DOM,DEM,Vector,Model |
| | |
| | | /** |
| | | * EPSG编码 |
| | | */ |
| | | private Integer epsgCode; |
| | | private Integer epsg; |
| | | |
| | | /** |
| | | * 用户ID |
| | |
| | | this.pubid = pubid; |
| | | } |
| | | |
| | | public String getUuid() { |
| | | return uuid; |
| | | } |
| | | |
| | | public void setUuid(String uuid) { |
| | | this.uuid = uuid; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | |
| | | this.max = max; |
| | | } |
| | | |
| | | public Integer getEpsgCode() { |
| | | return epsgCode; |
| | | public Integer getEpsg() { |
| | | return epsg; |
| | | } |
| | | |
| | | public void setEpsgCode(Integer epsgCode) { |
| | | this.epsgCode = epsgCode; |
| | | public void setEpsg(Integer epsg) { |
| | | this.epsg = epsg; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | |
| | | |
| | | private Integer serviceid; |
| | | |
| | | private String eventid; |
| | | |
| | | private String name; |
| | | |
| | | private String url; |
| | |
| | | this.serviceid = serviceid; |
| | | } |
| | | |
| | | public String getEventid() { |
| | | return eventid; |
| | | } |
| | | |
| | | public void setEventid(String eventid) { |
| | | this.eventid = eventid; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | |
| | | 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; |
| | |
| | | PathHelper pathHelper; |
| | | |
| | | @Resource |
| | | ResService resService; |
| | | |
| | | @Resource |
| | | MetaService metaService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | 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); |
| | |
| | | * 获取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(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | 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); |
| | |
| | | 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; |
| | | } |
| | |
| | | /** |
| | | * 插入数简服务 |
| | | */ |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | </selectKey> |
| | | |
| | | insert into lf.sys_publish |
| | | (layerid,serviceid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak) |
| | | (layerid,serviceid,eventid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak) |
| | | values |
| | | (#{layerid},#{serviceid},#{name},#{url},#{path},#{type},#{status},#{dirid},#{depid},#{enhanceType},#{min},#{max},#{epsg},#{ctType},#{ctJson},#{json},#{createUser},now(),${geom},#{bak}) |
| | | (#{layerid},#{serviceid},#{eventid},#{name},#{url},#{path},#{type},#{status},#{dirid},#{depid},#{enhanceType},#{min},#{max},#{epsg},#{ctType},#{ctJson},#{json},#{createUser},now(),${geom},#{bak}) |
| | | </insert> |
| | | |
| | | <insert id="insertPubDown"> |
| | |
| | | |
| | | <insert id="inserts"> |
| | | insert into lf.sys_publish |
| | | (layerid,serviceid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak) |
| | | (layerid,serviceid,eventid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.layerid},#{item.serviceid},#{item.name},#{item.url},#{item.path},#{item.type},#{item.status},#{item.dirid},#{item.depid},#{item.enhanceType},#{item.min},#{item.max},#{item.epsg},#{item.ctType},#{item.ctJson},#{item.json},#{item.createUser},now(),${item.geom},#{item.bak}) |
| | | (#{item.layerid},#{item.serviceid},#{item.eventid},#{item.name},#{item.url},#{item.path},#{item.type},#{item.status},#{item.dirid},#{item.depid},#{item.enhanceType},#{item.min},#{item.max},#{item.epsg},#{item.ctType},#{item.ctJson},#{item.json},#{item.createUser},now(),${item.geom},#{item.bak}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | |
| | | <update id="update"> |
| | | update lf.sys_publish |
| | | set layerid=#{layerid},serviceid=#{serviceid},name=#{name},url=#{url},path=#{path},type=#{type},status=#{status},dirid=#{dirid},depid=#{depid},enhance_type=#{enhanceType},min=#{min},max=#{max},epsg=#{epsg},ct_type=#{ctType},ct_json=#{ctJson},json=#{json},update_user=#{updateUser},update_time=now(),geom=${geom},bak=#{bak} |
| | | set layerid=#{layerid},serviceid=#{serviceid},eventid=#{eventid},name=#{name},url=#{url},path=#{path},type=#{type},status=#{status},dirid=#{dirid},depid=#{depid},enhance_type=#{enhanceType},min=#{min},max=#{max},epsg=#{epsg},ct_type=#{ctType},ct_json=#{ctJson},json=#{json},update_user=#{updateUser},update_time=now(),geom=${geom},bak=#{bak} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_publish |
| | | set layerid=#{item.layerid},serviceid=#{item.serviceid},name=#{item.name},url=#{item.url},path=#{item.path},type=#{item.type},status=#{item.status},dirid=#{item.dirid},depid=#{item.depid},enhance_type=#{item.enhanceType},min=#{item.min},max=#{item.max},epsg=#{item.epsg},ct_type=#{item.ctType},ct_json=#{item.ctJson},json=#{item.json},update_user=#{item.updateUser},update_time=now(),geom=${item.geom},bak=#{item.bak} |
| | | set layerid=#{item.layerid},serviceid=#{item.serviceid},eventid=#{item.eventid},name=#{item.name},url=#{item.url},path=#{item.path},type=#{item.type},status=#{item.status},dirid=#{item.dirid},depid=#{item.depid},enhance_type=#{item.enhanceType},min=#{item.min},max=#{item.max},epsg=#{item.epsg},ct_type=#{item.ctType},ct_json=#{item.ctJson},json=#{item.json},update_user=#{item.updateUser},update_time=now(),geom=${item.geom},bak=#{item.bak} |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |