| | |
| | | } |
| | | |
| | | PublishEntity publishEntity = createPublishEntity(pub, layerId, serviceId); |
| | | Integer id = publishService.insert(publishEntity); |
| | | if (null == id) { |
| | | return id; |
| | | int rows = publishService.insert(publishEntity); |
| | | if (0 == rows) { |
| | | return 0; |
| | | } |
| | | |
| | | publishEntity.setId(id); |
| | | ResEntity resEntity = createResEntity(publishEntity); |
| | | resService.insert(resEntity); |
| | | |
| | | return insertMetaPub(pub, id); |
| | | return insertMetaPub(pub, publishEntity.getId()); |
| | | } |
| | | |
| | | /** |
| | |
| | | layer.setEnhance_type(pub.getEnhanceType()); |
| | | layer.setNodata(getNoData(pub, metas)); |
| | | |
| | | CreateLayerEntity.ImagePathList imagePathList = entity.getImage_path_list().get(0); |
| | | CreateLayerEntity.ImagePathList imagePathList = entity.new ImagePathList(); |
| | | imagePathList.setPath(pathHelper.getConfig().getUploadPath()); |
| | | entity.getImage_path_list().add(imagePathList); |
| | | |
| | | List<CreateLayerEntity.ImageList> imageLists = entity.getImage_list(); |
| | | for (MetaEntity meta : metas) { |
| | |
| | | */ |
| | | public Integer postLayerEntity(CreateLayerEntity layerEntity) { |
| | | Map<String, Object> map = getMapData(layerEntity); |
| | | String url = String.format("%s/sj_raster/sj_raster/v6/api/layer?%s", sjUrl, ak); |
| | | String url = String.format("%s/sj_raster/v6/api/layer?%s", sjUrl, ak); |
| | | |
| | | LayerResultEntity rs = postForRest(url, map, LayerResultEntity.class); |
| | | boolean flag = null == rs || !StaticData.SUCCESS.equals(rs.getStatus()) || null == rs.getResult().getLayer_id(); |
| | |
| | | */ |
| | | public PublishEntity createPublishEntity(PubEntity pub, Integer layerId, Integer serviceId) { |
| | | PublishEntity entity = new PublishEntity(); |
| | | entity.setType(pub.getType()); |
| | | entity.setLayerid(layerId); |
| | | entity.setServiceid(serviceId); |
| | | entity.setEventid(pub.getUuid()); |
| | | entity.setName(pub.getName()); |
| | | entity.setUrl(String.format(TYPES.get(0).equals(pub.getType()) ? DOM_FORMAT : DEM_FORMAT, sjUrl, serviceId, StaticData.I0)); |
| | | entity.setPath(null); |
| | | entity.setType(pub.getType()); |
| | | entity.setStatus(3); |
| | | entity.setDirid(pub.getDircode()); |
| | | entity.setDepid(pub.getDepcode()); |
| | | entity.setEnhanceType(pub.getEnhanceType()); |
| | | entity.setMin(pub.getMin()); |
| | | entity.setMax(pub.getMax()); |
| | | 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)); |
| | | entity.setCtType(getColorTableType(pub)); |
| | | entity.setCtJson(getColorTableJson(pub)); |
| | | entity.setCreateUser(pub.getUserId()); |
| | | entity.setGeom("null"); |
| | | |
| | | return entity; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取颜色表类型 |
| | | */ |
| | | private String getColorTableType(PubEntity pub) { |
| | | if (null == pub.getColorTable() && null == pub.getGradientColorTable()) { |
| | | return null; |
| | | } |
| | | if (null != pub.getGradientColorTable()) { |
| | | return "渐变颜色表"; |
| | | } |
| | | |
| | | return "普通颜色表"; |
| | | } |
| | | |
| | | /** |
| | | * 获取颜色表的JSON字符串 |
| | | */ |
| | | public String getColorTableJson(PubEntity pub) { |