fix:修改getTifByRegionAndTime拼接url

main
xlp 6 months ago
parent 8032a8db91
commit de9589f00a

@ -76,8 +76,6 @@ public class DataImportServiceImpl implements DataImportService {
radi_chn_mul_horMapper radichnmulhorMapper; radi_chn_mul_horMapper radichnmulhorMapper;
@Override @Override
public List<String> upLoadProjectLedgerBySingleFile(MultipartFile file) throws IOException { public List<String> upLoadProjectLedgerBySingleFile(MultipartFile file) throws IOException {
return null; return null;
@ -89,7 +87,6 @@ public class DataImportServiceImpl implements DataImportService {
} }
/** /**
* Excel * Excel
* *
@ -128,7 +125,7 @@ public class DataImportServiceImpl implements DataImportService {
}); });
//将list插入数据库 //将list插入数据库
Integer integer = tSamplingDataDetailsMapper.insertByBatch(list); Integer integer = tSamplingDataDetailsMapper.insertByBatch(list);
log.info("成功插入 {} 条数据",integer); log.info("成功插入 {} 条数据", integer);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -245,15 +242,15 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<String> upLoadRailwayStaUAVTifData(MultipartFile[] railwayStaUAVTifDataFile){ public List<String> upLoadRailwayStaUAVTifData(MultipartFile[] railwayStaUAVTifDataFile) {
//设置时间格式 //设置时间格式
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" ); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//1、处理文件位置 //1、处理文件位置
//文件存放位置 //文件存放位置
String realPath = "data"; String realPath = "data";
//按照时间格式划分 //按照时间格式划分
String format = sdf.format(new Date()); 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 + File.separator + UUID.randomUUID()+ File.separator;
// String path = realPath; // String path = realPath;
@ -264,7 +261,6 @@ public class DataImportServiceImpl implements DataImportService {
} }
String objPath = System.getProperty("user.dir") + File.separator + path; String objPath = System.getProperty("user.dir") + File.separator + path;
// 2、保存文件到指定路径存文件到指定路径 // 2、保存文件到指定路径存文件到指定路径
for (MultipartFile file : railwayStaUAVTifDataFile) { for (MultipartFile file : railwayStaUAVTifDataFile) {
@ -298,17 +294,6 @@ public class DataImportServiceImpl implements DataImportService {
return retMsg; return retMsg;
// //设置时间格式 // //设置时间格式
// SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" ); // SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
// //1、处理文件位置 // //1、处理文件位置
@ -363,6 +348,7 @@ public class DataImportServiceImpl implements DataImportService {
/** /**
* *
*
* @param folder * @param folder
* @return * @return
*/ */
@ -408,7 +394,7 @@ public class DataImportServiceImpl implements DataImportService {
@Override @Override
public List<TGeoserverinfo> getTifByRegion(String region) { public List<TGeoserverinfo> getTifByRegion(String region) {
try{ try {
List<TGeoserverinfo> tifByRegion = tGeoserverinfoMapper.getTifByRegion(region); List<TGeoserverinfo> tifByRegion = tGeoserverinfoMapper.getTifByRegion(region);
if (tifByRegion != null) { if (tifByRegion != null) {
for (TGeoserverinfo info : tifByRegion) { for (TGeoserverinfo info : tifByRegion) {
@ -416,7 +402,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
} }
return tifByRegion; return tifByRegion;
}catch (ParamsException e){ } catch (ParamsException e) {
throw new RuntimeException("Failed to get region info", e); throw new RuntimeException("Failed to get region info", e);
} }
@ -424,29 +410,31 @@ public class DataImportServiceImpl implements DataImportService {
@Override @Override
public TGeoserverinfo getTifByRegionAndTime(String region) { public TGeoserverinfo getTifByRegionAndTime(String region) {
try{ try {
TGeoserverinfo tGeoserverinfo = new TGeoserverinfo(); TGeoserverinfo tGeoserverinfo = new TGeoserverinfo();
tGeoserverinfo = tGeoserverinfoMapper.getTifByRegionAndTime(region); tGeoserverinfo = tGeoserverinfoMapper.getTifByRegionAndTime(region);
if (tGeoserverinfo != null) {
tGeoserverinfo.setUrl(geoServerPubService.getMapBox3857RasterWmsUrl(tGeoserverinfo.getId()));
}
return tGeoserverinfo; return tGeoserverinfo;
}catch (ParamsException e){ }catch(ParamsException e){
throw new RuntimeException("数据库获取失败", e); throw new RuntimeException("数据库获取失败", e);
} }
} }
@Override @Override
public List<String> getLayer() { public List<String> getLayer () {
try{ try {
List<String> layer = new ArrayList<>(); List<String> layer = new ArrayList<>();
layer.add("城市三维模型"); layer.add("城市三维模型");
layer.add("居民点"); layer.add("居民点");
return layer; return layer;
}catch (ParamsException e){ } catch (ParamsException e) {
return null; return null;
} }
} }
@Override @Override
public List<String> getTifByLayer(String layer) { public List<String> getTifByLayer (String layer){
List<String> tifUrls; List<String> tifUrls;
try { try {
tifUrls = new ArrayList<>(); tifUrls = new ArrayList<>();
@ -469,18 +457,18 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<ElementRet> getElementInfo() { public List<ElementRet> getElementInfo () {
try { try {
List<ElementRet> elementInfo = new ArrayList<>(); List<ElementRet> elementInfo = new ArrayList<>();
elementInfo = radichnmulhorMapper.getElementInfo(); elementInfo = radichnmulhorMapper.getElementInfo();
return elementInfo; return elementInfo;
}catch (ParamsException e){ } catch (ParamsException e) {
return null; return null;
} }
} }
@Override @Override
public List<ElementValue> getValueByElement(String element) { public List<ElementValue> getValueByElement (String element){
Map<String, String> elementMap = new HashMap<String, String>() {{ Map<String, String> elementMap = new HashMap<String, String>() {{
put("总辐射辐照度", "V14311"); put("总辐射辐照度", "V14311");
put("净辐射辐照度", "V14312"); put("净辐射辐照度", "V14312");
@ -507,7 +495,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<MonitorRet> getMonitorInfo() { public List<MonitorRet> getMonitorInfo () {
List<MonitorRet> monitorInfoList = new ArrayList<>(); List<MonitorRet> monitorInfoList = new ArrayList<>();
try { try {
Map<String, String> monitorMap = new HashMap<>(); Map<String, String> monitorMap = new HashMap<>();
@ -522,16 +510,16 @@ public class DataImportServiceImpl implements DataImportService {
monitorMap.put("监测点9", "10"); monitorMap.put("监测点9", "10");
monitorMap.put("监测点10", "5"); monitorMap.put("监测点10", "5");
monitorInfoList.add(new MonitorRet("监测点1", 104.06, 30.67,"50")); // 成都 monitorInfoList.add(new MonitorRet("监测点1", 104.06, 30.67, "50")); // 成都
monitorInfoList.add(new MonitorRet("监测点2", 104.76, 31.46,"45")); // 绵阳 monitorInfoList.add(new MonitorRet("监测点2", 104.76, 31.46, "45")); // 绵阳
monitorInfoList.add(new MonitorRet("监测点3", 105.06, 30.87,"40")); // 德阳 monitorInfoList.add(new MonitorRet("监测点3", 105.06, 30.87, "40")); // 德阳
monitorInfoList.add(new MonitorRet("监测点4", 105.36, 30.57,"35")); // 广元 monitorInfoList.add(new MonitorRet("监测点4", 105.36, 30.57, "35")); // 广元
monitorInfoList.add(new MonitorRet("监测点5", 106.06, 29.37,"30")); // 遂宁 monitorInfoList.add(new MonitorRet("监测点5", 106.06, 29.37, "30")); // 遂宁
monitorInfoList.add(new MonitorRet("监测点6", 106.76, 29.07,"25")); // 内江 monitorInfoList.add(new MonitorRet("监测点6", 106.76, 29.07, "25")); // 内江
monitorInfoList.add(new MonitorRet("监测点7", 107.06, 28.77,"20")); // 乐山 monitorInfoList.add(new MonitorRet("监测点7", 107.06, 28.77, "20")); // 乐山
monitorInfoList.add(new MonitorRet("监测点8", 107.36, 28.47,"15")); // 眉山 monitorInfoList.add(new MonitorRet("监测点8", 107.36, 28.47, "15")); // 眉山
monitorInfoList.add(new MonitorRet("监测点9", 107.66, 28.17,"10")); // 宜宾 monitorInfoList.add(new MonitorRet("监测点9", 107.66, 28.17, "10")); // 宜宾
monitorInfoList.add(new MonitorRet("监测点10", 107.96, 27.87,"5")); // 泸州 monitorInfoList.add(new MonitorRet("监测点10", 107.96, 27.87, "5")); // 泸州
// 使用Collections.sort和自定义的Comparator进行排序 // 使用Collections.sort和自定义的Comparator进行排序
Collections.sort(monitorInfoList, new Comparator<MonitorRet>() { Collections.sort(monitorInfoList, new Comparator<MonitorRet>() {
@ -552,7 +540,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<String> getCurrentTime() { public List<String> getCurrentTime () {
// 获取当前时间 // 获取当前时间
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
// 定义时间格式 // 定义时间格式
@ -564,7 +552,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<BaseMapVoRet> getBaseMapList() { public List<BaseMapVoRet> getBaseMapList () {
List<BaseMapVoRet> baseMapVoRetList = new ArrayList<>(); List<BaseMapVoRet> baseMapVoRetList = new ArrayList<>();
//配置文件中定义的 //配置文件中定义的
List<BaseMapVoRet> basemapConfigList = layerDispConfig.getBasemap(); List<BaseMapVoRet> basemapConfigList = layerDispConfig.getBasemap();
@ -590,7 +578,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public List<ElementValueRet> getElementStatus(String element) { public List<ElementValueRet> getElementStatus (String element){
Map<String, String> elementMap = new HashMap<String, String>() {{ Map<String, String> elementMap = new HashMap<String, String>() {{
put("总辐射辐照度", "V14311"); put("总辐射辐照度", "V14311");
put("净辐射辐照度", "V14312"); put("净辐射辐照度", "V14312");
@ -625,7 +613,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
@Override @Override
public PageVo<SiteListVoRet> getSiteListInfo(SiteListVoReq siteListVoReq) { public PageVo<SiteListVoRet> getSiteListInfo (SiteListVoReq siteListVoReq){
Page<SiteListVoRet> page = new Page<>(siteListVoReq.getCurrent(), siteListVoReq.getSize()); Page<SiteListVoRet> page = new Page<>(siteListVoReq.getCurrent(), siteListVoReq.getSize());
if (siteListVoReq.getDataType().equals("总辐射辐照度")) { if (siteListVoReq.getDataType().equals("总辐射辐照度")) {
page = radichnmulhorMapper.getSiteListInfo1(page, siteListVoReq.getDataType()); page = radichnmulhorMapper.getSiteListInfo1(page, siteListVoReq.getDataType());
@ -645,7 +633,8 @@ public class DataImportServiceImpl implements DataImportService {
//将records数据取出来 //将records数据取出来
return new PageVo<>(page); return new PageVo<>(page);
} }
private String getURL(TGeoserverinfo geoBasedatageoserverinfo) {
private String getURL (TGeoserverinfo geoBasedatageoserverinfo){
String url = ""; String url = "";
String geoServerURL = ""; String geoServerURL = "";
geoServerURL = mygeoServerConfig.getGeoserverapiurl(); geoServerURL = mygeoServerConfig.getGeoserverapiurl();
@ -686,7 +675,7 @@ public class DataImportServiceImpl implements DataImportService {
* @param coordsExcelFile Excel * @param coordsExcelFile Excel
* @return List<DataManageExcelModel> * @return List<DataManageExcelModel>
*/ */
private List<DataManageExcelModel> readExcelSheets(MultipartFile coordsExcelFile) { private List<DataManageExcelModel> readExcelSheets (MultipartFile coordsExcelFile){
List<DataManageExcelModel> list = new ArrayList<>(); List<DataManageExcelModel> list = new ArrayList<>();
// 坐标数据读入 // 坐标数据读入
@ -721,7 +710,7 @@ public class DataImportServiceImpl implements DataImportService {
} }
public Map readExcel(MultipartFile file) throws IOException { public Map readExcel (MultipartFile file) throws IOException {
Map map = new HashMap<>(); Map map = new HashMap<>();
// public List<DataManageExcelModel> readExcel() throws IOException { // public List<DataManageExcelModel> readExcel() throws IOException {
//读取Excel中的数据 //读取Excel中的数据
@ -757,5 +746,4 @@ public class DataImportServiceImpl implements DataImportService {
return map; return map;
} }
} }

Loading…
Cancel
Save