| | |
| | | import com.moon.server.entity.data.MetaPubEntity; |
| | | import com.moon.server.entity.data.PublishEntity; |
| | | import com.moon.server.entity.shujian.*; |
| | | import com.moon.server.entity.sys.LayerEntity; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import com.moon.server.helper.HttpHelper; |
| | | import com.moon.server.helper.RestHelper; |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.service.sys.LayerService; |
| | | import com.moon.server.service.sys.ResService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | |
| | | @Resource |
| | | PublishService publishService; |
| | | |
| | | @Resource |
| | | LayerService layerService; |
| | | |
| | | private final static Log log = LogFactory.getLog(ShuJianService.class); |
| | | |
| | |
| | | ResEntity resEntity = createResEntity(publishEntity); |
| | | resService.insert(resEntity); |
| | | |
| | | return insertMetaPub(pub, publishEntity.getId()); |
| | | insertMetaPub(pub, publishEntity.getId()); |
| | | layerService.insert(createLayerEntity(resEntity, StaticData.I3)); |
| | | |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建图层 |
| | | */ |
| | | private LayerEntity createLayerEntity(ResEntity resEntity, Integer category) { |
| | | Integer pid = layerService.selectIdByName(StaticData.I1 == resEntity.getData() ? "DOM" : "DEM"); |
| | | Integer orderNum = layerService.selectMaxOrderNumByPid(pid); |
| | | LayerEntity layer = layerService.selectById(pid); |
| | | |
| | | LayerEntity entity = new LayerEntity(); |
| | | entity.setPid(pid); |
| | | entity.setCnName(resEntity.getCnName()); |
| | | entity.setEnName(resEntity.getEnName()); |
| | | entity.setUrl(resEntity.getProxy()); |
| | | // 是否为图层:0-图层组,1-图层 |
| | | entity.setIsLayer(1); |
| | | entity.setLevel(null == layer ? 1 : layer.getLevel() + 1); |
| | | entity.setOrderNum(orderNum); |
| | | // 状态:0-停止,1-启用 |
| | | entity.setStatus(1); |
| | | entity.setCreateUser(resEntity.getCreateUser()); |
| | | entity.setResid(resEntity.getId()); |
| | | // 类别:0-URL,1-TMS,2-WMTS,3-WMS,4-WFS,5-Tileset |
| | | entity.setType(StaticData.I1 == resEntity.getData() ? 2 : 0); |
| | | // 数据类型:0-URL,1-DOM,2-DEM |
| | | entity.setData(resEntity.getData()); |
| | | // 服务类别:0-其他,1-GisServer,2-GeoServer,3-数简 |
| | | entity.setCategory(category); |
| | | // 是/否默认显示 |
| | | entity.setIsShow(0); |
| | | |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 获取颜色表类型 |
| | | */ |
| | | private String getColorTableType(PubEntity pub) { |
| | |
| | | ResEntity resEntity = resService.selectByPubid(entity.getId()); |
| | | if (null == resEntity) { |
| | | resEntity = createResEntity(entity); |
| | | return resService.insert(resEntity); |
| | | resService.insert(resEntity); |
| | | } else { |
| | | resEntity.setUpdateUser(pub.getUserId()); |
| | | resEntity.setCnName(entity.getName()); |
| | | resEntity.setUrl(entity.getUrl()); |
| | | return resService.update(resEntity); |
| | | resService.update(resEntity); |
| | | } |
| | | |
| | | LayerEntity lyrEntity = layerService.selectByResId(resEntity.getId()); |
| | | if (null != lyrEntity) { |
| | | lyrEntity.setCnName(resEntity.getCnName()); |
| | | lyrEntity.setUpdateUser(pub.getUserId()); |
| | | layerService.update(lyrEntity); |
| | | } |
| | | |
| | | return entity.getId(); |
| | | } |
| | | |
| | | /** |