添加河流空间数据接口

This commit is contained in:
hukekuan@163.com 2018-04-12 17:17:33 +08:00
parent 65ee59f1ea
commit 83ba536679
2 changed files with 38 additions and 4 deletions

View File

@ -1,11 +1,25 @@
package com.gis3c.spatial.service;
import java.util.Map;
import java.util.Set;
/**
* Created by hukekuan on 2018/4/12.
*/
public interface RiverService {
public String findRiversByStationCodes(Set<String> stationCodes);
public String findRiversByRiverCodes(Set<String> riverCodes);
/**
* 根据站点编号获取分段河流数据
* @param stationCodes 站点编号
* @param sufaceStations 站点编号和站点水质的集合
* @return
*/
public String findRiversByStationCodes(Set<String> stationCodes,Map<String,String> sufaceStations);
/**
* 根据河流编号获取分段河流数据
* @param riverCodes 河流编号
* @param sufaceStations 站点编号和站点水质的集合
* @return
*/
public String findRiversByRiverCodes(Set<String> riverCodes,Map<String,String> sufaceStations);
}

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -21,10 +22,19 @@ public class RiverServiceImpl implements RiverService {
private RiverDao riverDao;
@Override
public String findRiversByStationCodes(Set<String> stationCodes) {
public String findRiversByStationCodes(Set<String> stationCodes,Map<String,String> sufaceStations) {
String riverJson = null;
List<SeparatedRiver> riverList
= riverDao.findRiversByStationCodes(stationCodes);
if(sufaceStations != null){
riverList.forEach(separatedRiver -> {
if(sufaceStations.keySet().contains(separatedRiver.getStationCode())){
separatedRiver.setLevel(sufaceStations.get(separatedRiver.getStationCode()));
}else {
separatedRiver.setLevel("--");
}
});
}
try {
riverJson = FeatureUtilities.JavaBeans2Json(riverList);
} catch (IllegalAccessException | IOException e) {
@ -34,10 +44,20 @@ public class RiverServiceImpl implements RiverService {
}
@Override
public String findRiversByRiverCodes(Set<String> riverCodes) {
public String findRiversByRiverCodes(Set<String> riverCodes,Map<String,String> sufaceStations) {
String riverJson = null;
List<SeparatedRiver> riverList
= riverDao.findRiversByRiverCodes(riverCodes);
if(sufaceStations != null){
riverList.forEach(separatedRiver -> {
if(separatedRiver.getStationCode() != null
&& sufaceStations.keySet().contains(separatedRiver.getStationCode())){
separatedRiver.setLevel(sufaceStations.get(separatedRiver.getStationCode()));
}else {
separatedRiver.setLevel("--");
}
});
}
try {
riverJson = FeatureUtilities.JavaBeans2Json(riverList);
} catch (IllegalAccessException | IOException e) {