添加河流空间数据接口
This commit is contained in:
parent
83ba536679
commit
b6999256f3
@ -1,10 +1,12 @@
|
||||
package com.gis3c.spatial.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3SpatialDao;
|
||||
import com.gis3c.spatial.entity.ModelRiver;
|
||||
import com.gis3c.spatial.entity.SeparatedRiver;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -14,4 +16,7 @@ import java.util.Set;
|
||||
public interface RiverDao {
|
||||
public List<SeparatedRiver> findRiversByStationCodes(@Param("stationCodes") Set<String> stationCodes);
|
||||
public List<SeparatedRiver> findRiversByRiverCodes(@Param("riverCodes") Set<String> riverCodes);
|
||||
|
||||
public List<ModelRiver> findModelRiverInfo();
|
||||
public List<ModelRiver> findModelRiverByName(@Param("riverName") String riverName);
|
||||
}
|
||||
|
||||
34
src/main/java/com/gis3c/spatial/entity/ModelRiver.java
Normal file
34
src/main/java/com/gis3c/spatial/entity/ModelRiver.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/4/25.
|
||||
*/
|
||||
public class ModelRiver extends BaseFeature{
|
||||
private String riverName;
|
||||
private String aliasName;
|
||||
private Integer orderNum;
|
||||
|
||||
public String getRiverName() {
|
||||
return riverName;
|
||||
}
|
||||
|
||||
public void setRiverName(String riverName) {
|
||||
this.riverName = riverName;
|
||||
}
|
||||
|
||||
public String getAliasName() {
|
||||
return aliasName;
|
||||
}
|
||||
|
||||
public void setAliasName(String aliasName) {
|
||||
this.aliasName = aliasName;
|
||||
}
|
||||
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,8 @@
|
||||
package com.gis3c.spatial.service;
|
||||
|
||||
import com.gis3c.spatial.entity.ModelRiver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -22,4 +25,17 @@ public interface RiverService {
|
||||
* @return
|
||||
*/
|
||||
public String findRiversByRiverCodes(Set<String> riverCodes,Map<String,String> sufaceStations);
|
||||
|
||||
/**
|
||||
* 获取500米分段河流河流名称和别名
|
||||
* @return
|
||||
*/
|
||||
public List<ModelRiver> findModelRiverInfo();
|
||||
|
||||
/**
|
||||
* 根据河流名称获取500米分段河流GeoJSON数据
|
||||
* @param riverName
|
||||
* @return
|
||||
*/
|
||||
public String findModelRiverByName(String riverName);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gis3c.spatial.service.impl;
|
||||
import com.gis3c.common.exception.BusinessException;
|
||||
import com.gis3c.spatial.common.FeatureUtilities;
|
||||
import com.gis3c.spatial.dao.RiverDao;
|
||||
import com.gis3c.spatial.entity.ModelRiver;
|
||||
import com.gis3c.spatial.entity.SeparatedRiver;
|
||||
import com.gis3c.spatial.service.RiverService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -65,4 +66,22 @@ public class RiverServiceImpl implements RiverService {
|
||||
}
|
||||
return riverJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelRiver> findModelRiverInfo() {
|
||||
return riverDao.findModelRiverInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findModelRiverByName(String riverName) {
|
||||
String riverJson = null;
|
||||
List<ModelRiver> queryRiver
|
||||
= riverDao.findModelRiverByName(riverName);
|
||||
try {
|
||||
riverJson = FeatureUtilities.JavaBeans2Json(queryRiver);
|
||||
} catch (IllegalAccessException | IOException e) {
|
||||
throw new BusinessException("ModelRiver实体转GeoJSON出错");
|
||||
}
|
||||
return riverJson;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,11 +9,13 @@ import com.gis3c.ol.service.MapService;
|
||||
import com.gis3c.ol.service.SourceService;
|
||||
import com.gis3c.spatial.common.FeatureUtilities;
|
||||
import com.gis3c.spatial.common.GeometryUtilities;
|
||||
import com.gis3c.spatial.entity.ModelRiver;
|
||||
import com.gis3c.spatial.entity.Region;
|
||||
import com.gis3c.spatial.entity.RegionType;
|
||||
import com.gis3c.spatial.service.RegionService;
|
||||
import com.gis3c.spatial.service.RiverService;
|
||||
import com.gis3c.spatial.service.TestService;
|
||||
import com.sun.corba.se.spi.ior.ObjectKey;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
|
||||
@ -37,8 +39,15 @@ public class App {
|
||||
return new ClassPathXmlApplicationContext("classpath:spring-config.xml");
|
||||
}
|
||||
public static void main(String[] args) throws IllegalAccessException, IOException {
|
||||
// ApplicationContext context = ApplicationInit();
|
||||
// RiverService riverService = context.getBean(RiverService.class);
|
||||
ApplicationContext context = ApplicationInit();
|
||||
RiverService riverService = context.getBean(RiverService.class);
|
||||
|
||||
List<ModelRiver> riverInfo = riverService.findModelRiverInfo();
|
||||
System.out.println(riverInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// String resilt = riverService.findRiversByRiverCodes(
|
||||
// new HashSet<>(Arrays.asList(new String[]{"3783","3363"})));
|
||||
|
||||
@ -9,6 +9,13 @@
|
||||
<result property="geometry" column="geom" javaType="Geometry"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="modelRiverResult" type="com.gis3c.spatial.entity.ModelRiver">
|
||||
<result property="riverName" column="rivername" />
|
||||
<result property="aliasName" column="aliasname" />
|
||||
<result property="orderNum" column="ordernum" />
|
||||
<result property="geometry" column="geom" javaType="Geometry"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findRiversByStationCodes" resultMap="separatedRiverResult">
|
||||
SELECT t.rivercode, t.rivername,t.stationcod,t.stationnam, t.geom
|
||||
FROM separatedriver t
|
||||
@ -40,4 +47,16 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="findModelRiverInfo" resultMap="modelRiverResult">
|
||||
SELECT DISTINCT rivername,aliasname
|
||||
from modelriver
|
||||
ORDER BY rivername;
|
||||
</select>
|
||||
<select id="findModelRiverByName" resultMap="modelRiverResult">
|
||||
SELECT rivername,aliasname,ordernum,geom
|
||||
FROM modelriver
|
||||
WHERE rivername = #{riverName, javaType=java.lang.String}
|
||||
ORDER BY ordernum
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user