|
|
|
@ -76,8 +76,6 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
radi_chn_mul_horMapper radichnmulhorMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> upLoadProjectLedgerBySingleFile(MultipartFile file) throws IOException {
|
|
|
|
|
return null;
|
|
|
|
@ -89,7 +87,6 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入Excel坐标点信息
|
|
|
|
|
*
|
|
|
|
@ -128,7 +125,7 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
});
|
|
|
|
|
//将list插入数据库
|
|
|
|
|
Integer integer = tSamplingDataDetailsMapper.insertByBatch(list);
|
|
|
|
|
log.info("成功插入 {} 条数据",integer);
|
|
|
|
|
log.info("成功插入 {} 条数据", integer);
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
@ -245,15 +242,15 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> upLoadRailwayStaUAVTifData(MultipartFile[] railwayStaUAVTifDataFile){
|
|
|
|
|
public List<String> upLoadRailwayStaUAVTifData(MultipartFile[] railwayStaUAVTifDataFile) {
|
|
|
|
|
//设置时间格式
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
//1、处理文件位置
|
|
|
|
|
//文件存放位置
|
|
|
|
|
String realPath = "data";
|
|
|
|
|
//按照时间格式划分
|
|
|
|
|
String format = sdf.format(new Date());
|
|
|
|
|
String path = realPath + File.separator+ format+ File.separator + UUID.randomUUID()+ File.separator;
|
|
|
|
|
String path = realPath + File.separator + format + File.separator + UUID.randomUUID() + File.separator;
|
|
|
|
|
// String path = realPath + File.separator + UUID.randomUUID()+ File.separator;
|
|
|
|
|
// String path = realPath;
|
|
|
|
|
|
|
|
|
@ -264,7 +261,6 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String objPath = System.getProperty("user.dir") + File.separator + path;
|
|
|
|
|
// 2、保存文件到指定路径存文件到指定路径
|
|
|
|
|
for (MultipartFile file : railwayStaUAVTifDataFile) {
|
|
|
|
@ -298,17 +294,6 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
return retMsg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //设置时间格式
|
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
|
|
|
|
|
// //1、处理文件位置
|
|
|
|
@ -363,6 +348,7 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 递归删除文件夹及其内部所有文件
|
|
|
|
|
*
|
|
|
|
|
* @param folder 要删除的文件夹
|
|
|
|
|
* @return 是否删除成功
|
|
|
|
|
*/
|
|
|
|
@ -391,32 +377,32 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TGeoserverinfo> getRefionInfo() {
|
|
|
|
|
try {
|
|
|
|
|
List<TGeoserverinfo> regionInfo = tGeoserverinfoMapper.getRefionInfo();
|
|
|
|
|
if (regionInfo != null) {
|
|
|
|
|
for (TGeoserverinfo info : regionInfo) {
|
|
|
|
|
info.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(info.getId()));
|
|
|
|
|
try {
|
|
|
|
|
List<TGeoserverinfo> regionInfo = tGeoserverinfoMapper.getRefionInfo();
|
|
|
|
|
if (regionInfo != null) {
|
|
|
|
|
for (TGeoserverinfo info : regionInfo) {
|
|
|
|
|
info.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(info.getId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return regionInfo;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
// 这里可以记录日志或者处理异常
|
|
|
|
|
throw new RuntimeException("Failed to get region info", e);
|
|
|
|
|
}
|
|
|
|
|
return regionInfo;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
// 这里可以记录日志或者处理异常
|
|
|
|
|
throw new RuntimeException("Failed to get region info", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TGeoserverinfo> getTifByRegion(String region) {
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
List<TGeoserverinfo> tifByRegion = tGeoserverinfoMapper.getTifByRegion(region);
|
|
|
|
|
if (tifByRegion != null) {
|
|
|
|
|
for (TGeoserverinfo info : tifByRegion) {
|
|
|
|
|
info.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(info.getId()));
|
|
|
|
|
for (TGeoserverinfo info : tifByRegion) {
|
|
|
|
|
info.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(info.getId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tifByRegion;
|
|
|
|
|
}catch (ParamsException e){
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
throw new RuntimeException("Failed to get region info", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -424,338 +410,340 @@ public class DataImportServiceImpl implements DataImportService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public TGeoserverinfo getTifByRegionAndTime(String region) {
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
TGeoserverinfo tGeoserverinfo = new TGeoserverinfo();
|
|
|
|
|
tGeoserverinfo = tGeoserverinfoMapper.getTifByRegionAndTime(region);
|
|
|
|
|
if (tGeoserverinfo != null) {
|
|
|
|
|
tGeoserverinfo.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(tGeoserverinfo.getId()));
|
|
|
|
|
}
|
|
|
|
|
return tGeoserverinfo;
|
|
|
|
|
}catch (ParamsException e){
|
|
|
|
|
throw new RuntimeException("数据库获取失败", e);
|
|
|
|
|
}catch(ParamsException e){
|
|
|
|
|
throw new RuntimeException("数据库获取失败", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getLayer () {
|
|
|
|
|
try {
|
|
|
|
|
List<String> layer = new ArrayList<>();
|
|
|
|
|
layer.add("城市三维模型");
|
|
|
|
|
layer.add("居民点");
|
|
|
|
|
return layer;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getLayer() {
|
|
|
|
|
try{
|
|
|
|
|
List<String> layer = new ArrayList<>();
|
|
|
|
|
layer.add("城市三维模型");
|
|
|
|
|
layer.add("居民点");
|
|
|
|
|
return layer;
|
|
|
|
|
}catch (ParamsException e){
|
|
|
|
|
return null;
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getTifByLayer (String layer){
|
|
|
|
|
List<String> tifUrls;
|
|
|
|
|
try {
|
|
|
|
|
tifUrls = new ArrayList<>();
|
|
|
|
|
switch (layer) {
|
|
|
|
|
case "城市三维模型":
|
|
|
|
|
tifUrls.add("http://111.42.18.66:8089/api/c3dserver/");
|
|
|
|
|
break;
|
|
|
|
|
case "居民点":
|
|
|
|
|
tifUrls.add("http://111.42.18.66:8089/api/c3dserver/");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// 如果输入的城市名称不在已知列表中,可以返回一个空列表或者null
|
|
|
|
|
tifUrls = null;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return tifUrls;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getTifByLayer(String layer) {
|
|
|
|
|
List<String> tifUrls;
|
|
|
|
|
try {
|
|
|
|
|
tifUrls = new ArrayList<>();
|
|
|
|
|
switch (layer) {
|
|
|
|
|
case "城市三维模型":
|
|
|
|
|
tifUrls.add("http://111.42.18.66:8089/api/c3dserver/");
|
|
|
|
|
break;
|
|
|
|
|
case "居民点":
|
|
|
|
|
tifUrls.add("http://111.42.18.66:8089/api/c3dserver/");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// 如果输入的城市名称不在已知列表中,可以返回一个空列表或者null
|
|
|
|
|
tifUrls = null;
|
|
|
|
|
break;
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementRet> getElementInfo () {
|
|
|
|
|
try {
|
|
|
|
|
List<ElementRet> elementInfo = new ArrayList<>();
|
|
|
|
|
elementInfo = radichnmulhorMapper.getElementInfo();
|
|
|
|
|
return elementInfo;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return tifUrls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementRet> getElementInfo() {
|
|
|
|
|
try {
|
|
|
|
|
List<ElementRet> elementInfo = new ArrayList<>();
|
|
|
|
|
elementInfo = radichnmulhorMapper.getElementInfo();
|
|
|
|
|
return elementInfo;
|
|
|
|
|
}catch (ParamsException e){
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementValue> getValueByElement (String element){
|
|
|
|
|
Map<String, String> elementMap = new HashMap<String, String>() {{
|
|
|
|
|
put("总辐射辐照度", "V14311");
|
|
|
|
|
put("净辐射辐照度", "V14312");
|
|
|
|
|
put("直接辐射辐照度", "V14313");
|
|
|
|
|
put("散射辐射辐照度", "V14314");
|
|
|
|
|
put("反射辐射辐照度", "V14315");
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<ElementValue> retValue = new ArrayList<>();
|
|
|
|
|
// 检查传入的中文element是否在映射关系中
|
|
|
|
|
String mappedElementCode = elementMap.get(element);
|
|
|
|
|
if (mappedElementCode != null) {
|
|
|
|
|
// 如果在映射关系中,使用对应的英文代码去查询数据库
|
|
|
|
|
retValue = tSamplingDataDetailsMapper.getValueByElement(element); // 这里传入的是中文元素名称
|
|
|
|
|
}
|
|
|
|
|
if (retValue != null && !retValue.isEmpty()) {
|
|
|
|
|
return retValue;
|
|
|
|
|
}
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
throw new RuntimeException("Failed to get element info", e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementValue> getValueByElement(String element) {
|
|
|
|
|
Map<String, String> elementMap = new HashMap<String, String>() {{
|
|
|
|
|
put("总辐射辐照度", "V14311");
|
|
|
|
|
put("净辐射辐照度", "V14312");
|
|
|
|
|
put("直接辐射辐照度", "V14313");
|
|
|
|
|
put("散射辐射辐照度", "V14314");
|
|
|
|
|
put("反射辐射辐照度", "V14315");
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<ElementValue> retValue = new ArrayList<>();
|
|
|
|
|
// 检查传入的中文element是否在映射关系中
|
|
|
|
|
String mappedElementCode = elementMap.get(element);
|
|
|
|
|
if (mappedElementCode != null) {
|
|
|
|
|
// 如果在映射关系中,使用对应的英文代码去查询数据库
|
|
|
|
|
retValue = tSamplingDataDetailsMapper.getValueByElement(element); // 这里传入的是中文元素名称
|
|
|
|
|
@Override
|
|
|
|
|
public List<MonitorRet> getMonitorInfo () {
|
|
|
|
|
List<MonitorRet> monitorInfoList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
Map<String, String> monitorMap = new HashMap<>();
|
|
|
|
|
monitorMap.put("监测点1", "50");
|
|
|
|
|
monitorMap.put("监测点2", "45");
|
|
|
|
|
monitorMap.put("监测点3", "40");
|
|
|
|
|
monitorMap.put("监测点4", "35");
|
|
|
|
|
monitorMap.put("监测点5", "30");
|
|
|
|
|
monitorMap.put("监测点6", "25");
|
|
|
|
|
monitorMap.put("监测点7", "20");
|
|
|
|
|
monitorMap.put("监测点8", "15");
|
|
|
|
|
monitorMap.put("监测点9", "10");
|
|
|
|
|
monitorMap.put("监测点10", "5");
|
|
|
|
|
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点1", 104.06, 30.67, "50")); // 成都
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点2", 104.76, 31.46, "45")); // 绵阳
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点3", 105.06, 30.87, "40")); // 德阳
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点4", 105.36, 30.57, "35")); // 广元
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点5", 106.06, 29.37, "30")); // 遂宁
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点6", 106.76, 29.07, "25")); // 内江
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点7", 107.06, 28.77, "20")); // 乐山
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点8", 107.36, 28.47, "15")); // 眉山
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点9", 107.66, 28.17, "10")); // 宜宾
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点10", 107.96, 27.87, "5")); // 泸州
|
|
|
|
|
|
|
|
|
|
// 使用Collections.sort和自定义的Comparator进行排序
|
|
|
|
|
Collections.sort(monitorInfoList, new Comparator<MonitorRet>() {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(MonitorRet o1, MonitorRet o2) {
|
|
|
|
|
// 提取值并转换为整数
|
|
|
|
|
int value1 = Integer.parseInt(o1.getMonitorValue());
|
|
|
|
|
int value2 = Integer.parseInt(o2.getMonitorValue());
|
|
|
|
|
// 降序排序
|
|
|
|
|
return Integer.compare(value2, value1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return monitorInfoList;
|
|
|
|
|
}
|
|
|
|
|
if (retValue != null && !retValue.isEmpty()) {
|
|
|
|
|
return retValue;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getCurrentTime () {
|
|
|
|
|
// 获取当前时间
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
// 定义时间格式
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// 格式化当前时间为字符串
|
|
|
|
|
String formattedTime = now.format(formatter);
|
|
|
|
|
// 返回包含当前时间字符串的列表
|
|
|
|
|
return Arrays.asList(formattedTime);
|
|
|
|
|
}
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
throw new RuntimeException("Failed to get element info", e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MonitorRet> getMonitorInfo() {
|
|
|
|
|
List<MonitorRet> monitorInfoList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
Map<String, String> monitorMap = new HashMap<>();
|
|
|
|
|
monitorMap.put("监测点1", "50");
|
|
|
|
|
monitorMap.put("监测点2", "45");
|
|
|
|
|
monitorMap.put("监测点3", "40");
|
|
|
|
|
monitorMap.put("监测点4", "35");
|
|
|
|
|
monitorMap.put("监测点5", "30");
|
|
|
|
|
monitorMap.put("监测点6", "25");
|
|
|
|
|
monitorMap.put("监测点7", "20");
|
|
|
|
|
monitorMap.put("监测点8", "15");
|
|
|
|
|
monitorMap.put("监测点9", "10");
|
|
|
|
|
monitorMap.put("监测点10", "5");
|
|
|
|
|
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点1", 104.06, 30.67,"50")); // 成都
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点2", 104.76, 31.46,"45")); // 绵阳
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点3", 105.06, 30.87,"40")); // 德阳
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点4", 105.36, 30.57,"35")); // 广元
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点5", 106.06, 29.37,"30")); // 遂宁
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点6", 106.76, 29.07,"25")); // 内江
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点7", 107.06, 28.77,"20")); // 乐山
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点8", 107.36, 28.47,"15")); // 眉山
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点9", 107.66, 28.17,"10")); // 宜宾
|
|
|
|
|
monitorInfoList.add(new MonitorRet("监测点10", 107.96, 27.87,"5")); // 泸州
|
|
|
|
|
|
|
|
|
|
// 使用Collections.sort和自定义的Comparator进行排序
|
|
|
|
|
Collections.sort(monitorInfoList, new Comparator<MonitorRet>() {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(MonitorRet o1, MonitorRet o2) {
|
|
|
|
|
// 提取值并转换为整数
|
|
|
|
|
int value1 = Integer.parseInt(o1.getMonitorValue());
|
|
|
|
|
int value2 = Integer.parseInt(o2.getMonitorValue());
|
|
|
|
|
// 降序排序
|
|
|
|
|
return Integer.compare(value2, value1);
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseMapVoRet> getBaseMapList () {
|
|
|
|
|
List<BaseMapVoRet> baseMapVoRetList = new ArrayList<>();
|
|
|
|
|
//配置文件中定义的
|
|
|
|
|
List<BaseMapVoRet> basemapConfigList = layerDispConfig.getBasemap();
|
|
|
|
|
if (!CollectionUtils.isEmpty(basemapConfigList)) {
|
|
|
|
|
baseMapVoRetList.addAll(basemapConfigList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return monitorInfoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getCurrentTime() {
|
|
|
|
|
// 获取当前时间
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
// 定义时间格式
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// 格式化当前时间为字符串
|
|
|
|
|
String formattedTime = now.format(formatter);
|
|
|
|
|
// 返回包含当前时间字符串的列表
|
|
|
|
|
return Arrays.asList(formattedTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseMapVoRet> getBaseMapList() {
|
|
|
|
|
List<BaseMapVoRet> baseMapVoRetList = new ArrayList<>();
|
|
|
|
|
//配置文件中定义的
|
|
|
|
|
List<BaseMapVoRet> basemapConfigList = layerDispConfig.getBasemap();
|
|
|
|
|
if (!CollectionUtils.isEmpty(basemapConfigList)) {
|
|
|
|
|
baseMapVoRetList.addAll(basemapConfigList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<TGeoserverinfo> geoBasedatageoserverinfos = tGeoserverinfoMapper.selectList(null);
|
|
|
|
|
if (!CollectionUtils.isEmpty(geoBasedatageoserverinfos)) {
|
|
|
|
|
for (int i = 0; i < geoBasedatageoserverinfos.size(); i++) {
|
|
|
|
|
TGeoserverinfo geoBasedatageoserverinfo = geoBasedatageoserverinfos.get(i);
|
|
|
|
|
BaseMapVoRet baseMapVoRet = new BaseMapVoRet();
|
|
|
|
|
baseMapVoRet.setName(geoBasedatageoserverinfo.getGeoserverlayers());
|
|
|
|
|
//http://121.37.165.19:8082/geoserver/cztl/wms?service=WMS&version=1.1.0&request=GetMap&layers=cztl:SAT_RTD_JS_00_CPC_20230405_202304250000&bbox=494883.5,3398883.5,496536.5,3400386.5&width=768&height=698&srs=EPSG:32647&styles=cztl:style_cpc&format=application/openlayers
|
|
|
|
|
//取3857坐标系地址
|
|
|
|
|
String url = getURL(geoBasedatageoserverinfo);
|
|
|
|
|
baseMapVoRet.setUrl(url);
|
|
|
|
|
baseMapVoRet.setDefaultonoff("off");
|
|
|
|
|
baseMapVoRetList.add(baseMapVoRet);
|
|
|
|
|
List<TGeoserverinfo> geoBasedatageoserverinfos = tGeoserverinfoMapper.selectList(null);
|
|
|
|
|
if (!CollectionUtils.isEmpty(geoBasedatageoserverinfos)) {
|
|
|
|
|
for (int i = 0; i < geoBasedatageoserverinfos.size(); i++) {
|
|
|
|
|
TGeoserverinfo geoBasedatageoserverinfo = geoBasedatageoserverinfos.get(i);
|
|
|
|
|
BaseMapVoRet baseMapVoRet = new BaseMapVoRet();
|
|
|
|
|
baseMapVoRet.setName(geoBasedatageoserverinfo.getGeoserverlayers());
|
|
|
|
|
//http://121.37.165.19:8082/geoserver/cztl/wms?service=WMS&version=1.1.0&request=GetMap&layers=cztl:SAT_RTD_JS_00_CPC_20230405_202304250000&bbox=494883.5,3398883.5,496536.5,3400386.5&width=768&height=698&srs=EPSG:32647&styles=cztl:style_cpc&format=application/openlayers
|
|
|
|
|
//取3857坐标系地址
|
|
|
|
|
String url = getURL(geoBasedatageoserverinfo);
|
|
|
|
|
baseMapVoRet.setUrl(url);
|
|
|
|
|
baseMapVoRet.setDefaultonoff("off");
|
|
|
|
|
baseMapVoRetList.add(baseMapVoRet);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return baseMapVoRetList;
|
|
|
|
|
}
|
|
|
|
|
return baseMapVoRetList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementValueRet> getElementStatus(String element) {
|
|
|
|
|
Map<String, String> elementMap = new HashMap<String, String>() {{
|
|
|
|
|
put("总辐射辐照度", "V14311");
|
|
|
|
|
put("净辐射辐照度", "V14312");
|
|
|
|
|
put("直接辐射辐照度", "V14313");
|
|
|
|
|
put("散射辐射辐照度", "V14314");
|
|
|
|
|
put("反射辐射辐照度", "V14315");
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<ElementValueRet> retValue = new ArrayList<>();
|
|
|
|
|
// 检查传入的中文element是否在映射关系中
|
|
|
|
|
String mappedElementCode = elementMap.get(element);
|
|
|
|
|
if (mappedElementCode == null) {
|
|
|
|
|
// 如果映射关系中没有对应的代码,返回空列表或者抛出异常
|
|
|
|
|
return retValue; // 或者抛出一个自定义异常
|
|
|
|
|
}
|
|
|
|
|
// 如果在映射关系中,使用对应的英文代码去查询数据库
|
|
|
|
|
List<ElementValueRet> dbValues = tSamplingDataDetailsMapper.getElementStatus(mappedElementCode);
|
|
|
|
|
if (dbValues != null) {
|
|
|
|
|
for (ElementValueRet value : dbValues) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
// 设置status为"正常"
|
|
|
|
|
value.setStatus("正常");
|
|
|
|
|
retValue.add(value);
|
|
|
|
|
@Override
|
|
|
|
|
public List<ElementValueRet> getElementStatus (String element){
|
|
|
|
|
Map<String, String> elementMap = new HashMap<String, String>() {{
|
|
|
|
|
put("总辐射辐照度", "V14311");
|
|
|
|
|
put("净辐射辐照度", "V14312");
|
|
|
|
|
put("直接辐射辐照度", "V14313");
|
|
|
|
|
put("散射辐射辐照度", "V14314");
|
|
|
|
|
put("反射辐射辐照度", "V14315");
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<ElementValueRet> retValue = new ArrayList<>();
|
|
|
|
|
// 检查传入的中文element是否在映射关系中
|
|
|
|
|
String mappedElementCode = elementMap.get(element);
|
|
|
|
|
if (mappedElementCode == null) {
|
|
|
|
|
// 如果映射关系中没有对应的代码,返回空列表或者抛出异常
|
|
|
|
|
return retValue; // 或者抛出一个自定义异常
|
|
|
|
|
}
|
|
|
|
|
// 如果在映射关系中,使用对应的英文代码去查询数据库
|
|
|
|
|
List<ElementValueRet> dbValues = tSamplingDataDetailsMapper.getElementStatus(mappedElementCode);
|
|
|
|
|
if (dbValues != null) {
|
|
|
|
|
for (ElementValueRet value : dbValues) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
// 设置status为"正常"
|
|
|
|
|
value.setStatus("正常");
|
|
|
|
|
retValue.add(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retValue;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
throw new RuntimeException("Failed to get element info", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retValue;
|
|
|
|
|
} catch (ParamsException e) {
|
|
|
|
|
throw new RuntimeException("Failed to get element info", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageVo<SiteListVoRet> getSiteListInfo(SiteListVoReq siteListVoReq) {
|
|
|
|
|
Page<SiteListVoRet> page = new Page<>(siteListVoReq.getCurrent(), siteListVoReq.getSize());
|
|
|
|
|
if (siteListVoReq.getDataType().equals("总辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo1(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("净辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo2(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("直接辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo3(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("散射辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo4(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("反射辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo5(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
//将records数据取出来
|
|
|
|
|
return new PageVo<>(page);
|
|
|
|
|
}
|
|
|
|
|
private String getURL(TGeoserverinfo geoBasedatageoserverinfo) {
|
|
|
|
|
String url = "";
|
|
|
|
|
String geoServerURL = "";
|
|
|
|
|
geoServerURL = mygeoServerConfig.getGeoserverapiurl();
|
|
|
|
|
String workspaces = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverworkspaces())) {
|
|
|
|
|
workspaces = geoBasedatageoserverinfo.getGeoserverworkspaces();
|
|
|
|
|
} else {
|
|
|
|
|
workspaces = geoBasedatageoserverinfo.getGeoserverworkspaces();
|
|
|
|
|
}
|
|
|
|
|
String layer = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverlayers())) {
|
|
|
|
|
layer = geoBasedatageoserverinfo.getGeoserverlayers();
|
|
|
|
|
}
|
|
|
|
|
String styles = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverstyles())) {
|
|
|
|
|
styles = geoBasedatageoserverinfo.getGeoserverstyles();
|
|
|
|
|
@Override
|
|
|
|
|
public PageVo<SiteListVoRet> getSiteListInfo (SiteListVoReq siteListVoReq){
|
|
|
|
|
Page<SiteListVoRet> page = new Page<>(siteListVoReq.getCurrent(), siteListVoReq.getSize());
|
|
|
|
|
if (siteListVoReq.getDataType().equals("总辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo1(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("净辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo2(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("直接辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo3(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("散射辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo4(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
if (siteListVoReq.getDataType().equals("反射辐射辐照度")) {
|
|
|
|
|
page = radichnmulhorMapper.getSiteListInfo5(page, siteListVoReq.getDataType());
|
|
|
|
|
}
|
|
|
|
|
//将records数据取出来
|
|
|
|
|
return new PageVo<>(page);
|
|
|
|
|
}
|
|
|
|
|
String srs = "EPSG:3857";
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(geoServerURL) || StringUtils.isEmpty(layer) || StringUtils.isEmpty(workspaces)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (geoServerURL.endsWith("/")) {
|
|
|
|
|
geoServerURL = geoServerURL.substring(0, geoServerURL.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
url = geoServerURL + "/" + workspaces + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=" + workspaces + ":" + layer + "&width=768&height=698&srs=" + srs;
|
|
|
|
|
if (!StringUtils.isEmpty(styles)) {
|
|
|
|
|
url += "&styles=" + workspaces + ":" + styles;
|
|
|
|
|
private String getURL (TGeoserverinfo geoBasedatageoserverinfo){
|
|
|
|
|
String url = "";
|
|
|
|
|
String geoServerURL = "";
|
|
|
|
|
geoServerURL = mygeoServerConfig.getGeoserverapiurl();
|
|
|
|
|
String workspaces = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverworkspaces())) {
|
|
|
|
|
workspaces = geoBasedatageoserverinfo.getGeoserverworkspaces();
|
|
|
|
|
} else {
|
|
|
|
|
workspaces = geoBasedatageoserverinfo.getGeoserverworkspaces();
|
|
|
|
|
}
|
|
|
|
|
String layer = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverlayers())) {
|
|
|
|
|
layer = geoBasedatageoserverinfo.getGeoserverlayers();
|
|
|
|
|
}
|
|
|
|
|
String styles = "";
|
|
|
|
|
if (!StringUtils.isEmpty(geoBasedatageoserverinfo.getGeoserverstyles())) {
|
|
|
|
|
styles = geoBasedatageoserverinfo.getGeoserverstyles();
|
|
|
|
|
}
|
|
|
|
|
String srs = "EPSG:3857";
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(geoServerURL) || StringUtils.isEmpty(layer) || StringUtils.isEmpty(workspaces)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (geoServerURL.endsWith("/")) {
|
|
|
|
|
geoServerURL = geoServerURL.substring(0, geoServerURL.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
url = geoServerURL + "/" + workspaces + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=" + workspaces + ":" + layer + "&width=768&height=698&srs=" + srs;
|
|
|
|
|
if (!StringUtils.isEmpty(styles)) {
|
|
|
|
|
url += "&styles=" + workspaces + ":" + styles;
|
|
|
|
|
}
|
|
|
|
|
url += "&FORMAT=image/png&TRANSPARENT=true";
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
url += "&FORMAT=image/png&TRANSPARENT=true";
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 读取Excel文件
|
|
|
|
|
*
|
|
|
|
|
* @param coordsExcelFile Excel文件
|
|
|
|
|
* @return List<DataManageExcelModel>
|
|
|
|
|
*/
|
|
|
|
|
private List<DataManageExcelModel> readExcelSheets(MultipartFile coordsExcelFile) {
|
|
|
|
|
|
|
|
|
|
List<DataManageExcelModel> list = new ArrayList<>();
|
|
|
|
|
// 坐标数据读入
|
|
|
|
|
try (InputStream fis = coordsExcelFile.getInputStream()) {
|
|
|
|
|
// 一个文件一个reader
|
|
|
|
|
ExcelReader excelReader = EasyExcel.read(fis).extraRead(CellExtraTypeEnum.MERGE).build();
|
|
|
|
|
List<ReadSheet> sheetList = excelReader.excelExecutor().sheetList();
|
|
|
|
|
log.info("开始读取坐标点Excel数据.....");
|
|
|
|
|
if (!sheetList.isEmpty()) {
|
|
|
|
|
sheetList.forEach(eachSheet -> {
|
|
|
|
|
ImportExcelListener<DataManageExcelModel> importExcelListener = new ImportExcelListener<>(2);
|
|
|
|
|
ReadSheet sheet = EasyExcel.readSheet(eachSheet.getSheetNo())
|
|
|
|
|
.head(DataManageExcelModel.class)
|
|
|
|
|
.registerReadListener(importExcelListener)
|
|
|
|
|
.headRowNumber(2)
|
|
|
|
|
.build();
|
|
|
|
|
log.info("开始读取sheet[{}]坐标点Excel数据.....", eachSheet.getSheetName());
|
|
|
|
|
excelReader.read(sheet);
|
|
|
|
|
List<DataManageExcelModel> data = importExcelListener.getList();
|
|
|
|
|
log.info("*************************************************************************");
|
|
|
|
|
log.info("sheet[{}] 读取到{}行数据...", eachSheet.getSheetName(), data.size());
|
|
|
|
|
log.info(String.valueOf(data));
|
|
|
|
|
list.addAll(data);
|
|
|
|
|
});
|
|
|
|
|
/**
|
|
|
|
|
* 读取Excel文件
|
|
|
|
|
*
|
|
|
|
|
* @param coordsExcelFile Excel文件
|
|
|
|
|
* @return List<DataManageExcelModel>
|
|
|
|
|
*/
|
|
|
|
|
private List<DataManageExcelModel> readExcelSheets (MultipartFile coordsExcelFile){
|
|
|
|
|
|
|
|
|
|
List<DataManageExcelModel> list = new ArrayList<>();
|
|
|
|
|
// 坐标数据读入
|
|
|
|
|
try (InputStream fis = coordsExcelFile.getInputStream()) {
|
|
|
|
|
// 一个文件一个reader
|
|
|
|
|
ExcelReader excelReader = EasyExcel.read(fis).extraRead(CellExtraTypeEnum.MERGE).build();
|
|
|
|
|
List<ReadSheet> sheetList = excelReader.excelExecutor().sheetList();
|
|
|
|
|
log.info("开始读取坐标点Excel数据.....");
|
|
|
|
|
if (!sheetList.isEmpty()) {
|
|
|
|
|
sheetList.forEach(eachSheet -> {
|
|
|
|
|
ImportExcelListener<DataManageExcelModel> importExcelListener = new ImportExcelListener<>(2);
|
|
|
|
|
ReadSheet sheet = EasyExcel.readSheet(eachSheet.getSheetNo())
|
|
|
|
|
.head(DataManageExcelModel.class)
|
|
|
|
|
.registerReadListener(importExcelListener)
|
|
|
|
|
.headRowNumber(2)
|
|
|
|
|
.build();
|
|
|
|
|
log.info("开始读取sheet[{}]坐标点Excel数据.....", eachSheet.getSheetName());
|
|
|
|
|
excelReader.read(sheet);
|
|
|
|
|
List<DataManageExcelModel> data = importExcelListener.getList();
|
|
|
|
|
log.info("*************************************************************************");
|
|
|
|
|
log.info("sheet[{}] 读取到{}行数据...", eachSheet.getSheetName(), data.size());
|
|
|
|
|
log.info(String.valueOf(data));
|
|
|
|
|
list.addAll(data);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
excelReader.finish();
|
|
|
|
|
log.info("坐标点Excel数据读取完成!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
excelReader.finish();
|
|
|
|
|
log.info("坐标点Excel数据读取完成!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map readExcel(MultipartFile file) throws IOException {
|
|
|
|
|
Map map = new HashMap<>();
|
|
|
|
|
public Map readExcel (MultipartFile file) throws IOException {
|
|
|
|
|
Map map = new HashMap<>();
|
|
|
|
|
// public List<DataManageExcelModel> readExcel() throws IOException {
|
|
|
|
|
//读取Excel中的数据
|
|
|
|
|
//读取Excel中的数据
|
|
|
|
|
// File file = ResourceUtils.getFile("classpath:" + File.separator + "excel" + File.separator + "2014年-2021年一亿棵梭梭项目台账(全).xlsx");
|
|
|
|
|
ExcelReader excelReader1 = EasyExcel.read(file.getInputStream()).extraRead(CellExtraTypeEnum.MERGE).build();
|
|
|
|
|
List<ReadSheet> sheetList = excelReader1.excelExecutor().sheetList();
|
|
|
|
|
List<DataManageExcelModel> list = new ArrayList<>();
|
|
|
|
|
LinkedHashSet<DataManageExcelModel> DataManageExcelModels = new LinkedHashSet<>();
|
|
|
|
|
List<String> messageList = new ArrayList<String>();
|
|
|
|
|
ExcelReader excelReader1 = EasyExcel.read(file.getInputStream()).extraRead(CellExtraTypeEnum.MERGE).build();
|
|
|
|
|
List<ReadSheet> sheetList = excelReader1.excelExecutor().sheetList();
|
|
|
|
|
List<DataManageExcelModel> list = new ArrayList<>();
|
|
|
|
|
LinkedHashSet<DataManageExcelModel> DataManageExcelModels = new LinkedHashSet<>();
|
|
|
|
|
List<String> messageList = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
if (!sheetList.isEmpty()) {
|
|
|
|
|
try {
|
|
|
|
|
for (ReadSheet eachSheet : sheetList) {
|
|
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++正在解析{}的台账表", eachSheet.getSheetName());
|
|
|
|
|
ImportExcelListener<DataManageExcelModel> importExcelListener = new ImportExcelListener<>(1);
|
|
|
|
|
ReadSheet sheet = EasyExcel.readSheet(eachSheet.getSheetNo()).head(DataManageExcelModel.class).registerReadListener(importExcelListener)
|
|
|
|
|
.headRowNumber(1).build();
|
|
|
|
|
excelReader1.read(sheet);
|
|
|
|
|
DataManageExcelModels.addAll(importExcelListener.getList());
|
|
|
|
|
}
|
|
|
|
|
} catch (ExcelAnalysisException e) {
|
|
|
|
|
StringTokenizer st = new StringTokenizer(e.getMessage(), "|");
|
|
|
|
|
while (st.hasMoreElements()) {
|
|
|
|
|
messageList.add(st.nextElement().toString());
|
|
|
|
|
if (!sheetList.isEmpty()) {
|
|
|
|
|
try {
|
|
|
|
|
for (ReadSheet eachSheet : sheetList) {
|
|
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++正在解析{}的台账表", eachSheet.getSheetName());
|
|
|
|
|
ImportExcelListener<DataManageExcelModel> importExcelListener = new ImportExcelListener<>(1);
|
|
|
|
|
ReadSheet sheet = EasyExcel.readSheet(eachSheet.getSheetNo()).head(DataManageExcelModel.class).registerReadListener(importExcelListener)
|
|
|
|
|
.headRowNumber(1).build();
|
|
|
|
|
excelReader1.read(sheet);
|
|
|
|
|
DataManageExcelModels.addAll(importExcelListener.getList());
|
|
|
|
|
}
|
|
|
|
|
} catch (ExcelAnalysisException e) {
|
|
|
|
|
StringTokenizer st = new StringTokenizer(e.getMessage(), "|");
|
|
|
|
|
while (st.hasMoreElements()) {
|
|
|
|
|
messageList.add(st.nextElement().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
excelReader1.finish();
|
|
|
|
|
list = new ArrayList<>(DataManageExcelModels);
|
|
|
|
|
System.out.println(list);
|
|
|
|
|
map.put("msg", messageList);
|
|
|
|
|
map.put("list", list);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
excelReader1.finish();
|
|
|
|
|
list = new ArrayList<>(DataManageExcelModels);
|
|
|
|
|
System.out.println(list);
|
|
|
|
|
map.put("msg", messageList);
|
|
|
|
|
map.put("list", list);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|