src/main/java/com/moon/server/controller/data/PublishController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/mapper/data/DirMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/mapper/sys/LayerMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/service/data/DirService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/service/data/ShuJianService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/moon/server/service/sys/LayerService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/data/DirMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/sys/LayerMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/sys/ResMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/moon/server/controller/data/PublishController.java
@@ -290,6 +290,9 @@ if (ue != null) { entity.setUpdateUser(ue.getId()); } if (StringHelper.isEmpty(entity.getGeom())) { entity.setGeom("null"); } permsService.clearPermsCache(); int count = publishService.update(entity); src/main/java/com/moon/server/mapper/data/DirMapper.java
@@ -115,12 +115,4 @@ * @return */ public List<DirEntity> selectDirsForPrj(); /** * 根据名称查询ID * * @param name 名称 * @return ID */ public Integer selectIdByName(String name); } src/main/java/com/moon/server/mapper/sys/LayerMapper.java
@@ -64,6 +64,30 @@ public LayerEntity selectById(int id); /** * 根据名称查询ID * * @param name 名称 * @return ID */ public Integer selectIdByName(String name); /** * 根据pid查询最大排序数 * * @param pid 父类ID * @return 最大排序数 */ public Integer selectMaxOrderNumByPid(Integer pid); /** * 根据资源ID查询图层 * * @param resid 资源ID * @return 图层 */ public LayerEntity selectByResId(Integer resid); /** * 插入一条 * * @param entity src/main/java/com/moon/server/service/data/DirService.java
@@ -94,12 +94,6 @@ return dirMapper.selectDirsForPrj(); } @Override public Integer selectIdByName(String name) { Integer id = dirMapper.selectIdByName(name); return null == id ? 0 : id; } /** * 创建数据目录 */ src/main/java/com/moon/server/service/data/ShuJianService.java
@@ -7,10 +7,12 @@ 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; @@ -51,6 +53,9 @@ @Resource PublishService publishService; @Resource LayerService layerService; private final static Log log = LogFactory.getLog(ShuJianService.class); @@ -117,7 +122,10 @@ ResEntity resEntity = createResEntity(publishEntity); resService.insert(resEntity); return insertMetaPub(pub, publishEntity.getId()); insertMetaPub(pub, publishEntity.getId()); layerService.insert(createLayerEntity(resEntity, StaticData.I3)); return rows; } /** @@ -308,6 +316,39 @@ } /** * 创建图层 */ 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) { @@ -398,13 +439,22 @@ 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(); } /** src/main/java/com/moon/server/service/sys/LayerService.java
@@ -3,11 +3,9 @@ import com.moon.server.entity.all.RedisCacheKey; import com.moon.server.entity.all.SettingData; import com.moon.server.entity.sys.LayerEntity; import com.moon.server.entity.sys.ResEntity; import com.moon.server.helper.StringHelper; import com.moon.server.mapper.sys.LayerMapper; import com.moon.server.service.all.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -83,6 +81,22 @@ } @Override public Integer selectIdByName(String name) { Integer id = layerMapper.selectIdByName(name); return null == id ? 0 : id; } @Override public Integer selectMaxOrderNumByPid(Integer pid) { return layerMapper.selectMaxOrderNumByPid(pid); } @Override public LayerEntity selectByResId(Integer resid) { return layerMapper.selectByResId(resid); } @Override public Integer insert(LayerEntity entity) { return layerMapper.insert(entity); } src/main/resources/mapper/data/DirMapper.xml
@@ -53,10 +53,6 @@ select a.* from lf.sys_dir a where code not like '00%' order by code; </select> <select id="selectIdByName" resultType="java.lang.Integer"> select id from lf.sys_dir where name = #{name}; </select> <!-- 插入一条 --> <insert id="insert" parameterType="com.moon.server.entity.data.DirEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> src/main/resources/mapper/sys/LayerMapper.xml
@@ -68,6 +68,18 @@ select * from lf.sys_layer where id = #{id} </select> <select id="selectIdByName" resultType="java.lang.Integer"> select id from lf.sys_dir where name = #{name}; </select> <select id="selectOrderNumByPid" resultType="java.lang.Integer"> select coalesce(max(order_num), 0) + 1 from lf.sys_layer where pid = #{pid}; </select> <select id="selectByResId" resultType="com.moon.server.entity.sys.LayerEntity"> select * from lf.sys_layer where resid = #{resid} limit 1; </select> <insert id="insert" parameterType="com.moon.server.entity.sys.LayerEntity"> insert into lf.sys_layer (pid,cn_name,en_name,url,is_layer,is_show,icon,level,order_num,status,create_user,create_time,bak,elev,resid,type,data,tab,category,flag) src/main/resources/mapper/sys/ResMapper.xml
@@ -88,6 +88,10 @@ </select> <insert id="insert" parameterType="com.moon.server.entity.sys.ResEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_res_id_seq'::regclass) as id </selectKey> insert into lf.sys_res (cn_name,en_name,status,type,data,category,url,test,descr,depid,dirid,img,create_user,create_time,bak,tab,args,pubid) values