package org.springblade.modules.yw.controller;
|
|
import lombok.AllArgsConstructor;
|
import org.apache.logging.log4j.util.Strings;
|
import org.locationtech.jts.geom.Coordinate;
|
import org.springblade.modules.dem.DemUtils;
|
import org.springblade.modules.yw.entity.*;
|
import org.springblade.modules.yw.service.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.io.File;
|
import java.util.List;
|
|
/**
|
* 测试数据处理
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/test/data")
|
public class TestController {
|
|
private final IEmergencySpaceService emergencySpaceService;
|
private final IFacilityService facilityService;
|
private final IFirmInfoService firmInfoService;
|
private final IGeomInfoService geomInfoService;
|
private final IIndParkInfoService indParkInfoService;
|
private final IPanoramicService panoramicService;
|
private final IProTarService proTarService;
|
private final ISuppliesService suppliesService;
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/emeSpace")
|
public void handleDataEmeSpace(){
|
// 查询数据
|
List<EmergencySpaceEntity> list = emergencySpaceService.list();
|
// 获取高程
|
for (EmergencySpaceEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng()) && Strings.isBlank(emergencySpaceEntity.getGeom())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
emergencySpaceService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/fac")
|
public void handleDataFac(){
|
// 查询数据
|
List<FacilityEntity> list = facilityService.list();
|
// 获取高程
|
for (FacilityEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
facilityService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/firm")
|
public void handleDataFirm(){
|
// 查询数据
|
List<FirmInfo> list = firmInfoService.list();
|
// 获取高程
|
for (FirmInfo emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
firmInfoService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/ind")
|
public void handleDataInd(){
|
// 查询数据
|
List<IndParkInfoEntity> list = indParkInfoService.list();
|
// 获取高程
|
for (IndParkInfoEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
indParkInfoService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/pan")
|
public void handleDataPan(){
|
// 查询数据
|
List<PanoramicEntity> list = panoramicService.list();
|
// 获取高程
|
for (PanoramicEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
panoramicService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/pro")
|
public void handleDataPro(){
|
// 查询数据
|
List<ProTarEntity> list = proTarService.list();
|
// 获取高程
|
for (ProTarEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
proTarService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
/**
|
* 测试数据处理
|
*/
|
@GetMapping("/sup")
|
public void handleDataSup(){
|
// 查询数据
|
List<SuppliesEntity> list = suppliesService.list();
|
// 获取高程
|
for (SuppliesEntity emergencySpaceEntity : list) {
|
if (!Strings.isBlank(emergencySpaceEntity.getLng())){
|
Coordinate point = new Coordinate(Double.parseDouble(emergencySpaceEntity.getLng()), Double.parseDouble(emergencySpaceEntity.getLat()));
|
int ele = DemUtils.calculateMaxByPoint(getFile(), point);
|
// 设置高程
|
emergencySpaceEntity.setEle(Integer.toString(ele));
|
// 更新数据
|
suppliesService.updateById(emergencySpaceEntity);
|
}
|
}
|
}
|
|
public File getFile(){
|
String demPath = "F:\\aliyun\\江西省地形数据\\江西省12.5米DEM_CGCS2000.tif";
|
return new File(demPath);
|
}
|
}
|