火点优化

This commit is contained in:
liuchengqian 2023-01-05 08:47:49 +08:00
parent ad57a3e46f
commit cd54841e88
3 changed files with 5 additions and 77 deletions

View File

@ -38,7 +38,6 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/queryFirePoint").permitAll()
.antMatchers(HttpMethod.POST, "/api/user/updateSysUser").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfigDict").permitAll()
.antMatchers(HttpMethod.GET, "/importThree").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfigValue").permitAll()
.antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll()
.antMatchers(HttpMethod.POST, "/globalConfig").permitAll()

View File

@ -66,67 +66,6 @@ public class FirePointController {
@Resource
private FirePointQueryHelper firePointQueryHelper;
@GetMapping("/importThree")
public String importThree() throws Exception {
String rootDir = "/Users/liuchengqian/Desktop/source_three/";
ExcelImportUtil importUtil = new ExcelImportUtil(new File(rootDir+"1023.xlsx"));
List<Map<String, String>> excelMapList = importUtil.readExcelContent();
//20221024084045098124080
for (int i = 0; i < excelMapList.size(); i++) {
Map<String, String> excelMap = excelMapList.get(i);
String 火点监测时间 = excelMap.get("火点监测时间");
String 经度 = excelMap.get("经度");
String 纬度 = excelMap.get("纬度");
String 区县名称 = excelMap.get("区县名称");
String 地表类型 = excelMap.get("地表类型");
String 卫星源 = excelMap.get("卫星源");
String 置信度 = excelMap.get("置信度");
FirePointEntity firePointEntity = new FirePointEntity();
firePointEntity.setFireCode(String.valueOf(System.currentTimeMillis()));
firePointEntity.setSatelliteTime(火点监测时间);
firePointEntity.setLongitude(Double.parseDouble(经度));
firePointEntity.setLatitude(Double.parseDouble(纬度));
firePointEntity.setSatelliteType(卫星源);
firePointEntity.setLandType(地表类型);
firePointEntity.setConfidence(置信度);
firePointEntity.setAddTime(火点监测时间);
firePointEntity.setFireType("0");
firePointEntity.setFireImage(null);
firePointEntity.setSatelliteImage(null);
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
try {
bindAddress(firePointEntity);
} catch (Exception e) {
e.printStackTrace();
log.info("添加火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
}
firePointDao.save(firePointEntity);
Thread.sleep(20);
System.out.println("已完成" + (i) + "/" + excelMapList.size());
}
Locale locale = LocaleContextHolder.getLocale();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKK", locale);
}
private void bindAddress(FirePointEntity firePointEntity) throws Exception {
List<String> locationList = new ArrayList<>();
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
GaoDeIgGeocodeVo.Regeocode reGeoCode = geocode.getRegeocodes().get(0);
String formattedAddress = reGeoCode.getFormatted_address();
firePointEntity.setFirePointAddress(formattedAddress);
GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0);
firePointEntity.setCountyCode(addressComponent.getAdcode());
firePointEntity.setCountyName(addressComponent.getDistrict());
String townCode = addressComponent.getTowncode();
String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode;
firePointEntity.setStreetCode(fixedTownCode);
firePointEntity.setStreetName(addressComponent.getTownship());
}
@GetMapping("/queryzzhd")
public String queryzzhd() {
List<FirePointEntity> firePointEntities1 = firePointQueryHelper.queryZZHD("371482", "2022-01-01 00:00:10", "2022-06-26 00:00:10");

View File

@ -115,13 +115,7 @@ public class FirePointServiceImpl implements FirePointService {
firePointEntity.setFireImage(firePointQo.getFireImage());
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
try {
bindAddress(firePointEntity);
} catch (Exception e) {
e.printStackTrace();
log.info("添加火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
return false;
}
if (checkDuplicatedData(firePointEntity)) {
return false;
@ -234,12 +228,8 @@ public class FirePointServiceImpl implements FirePointService {
shanDongFirePoint.setFireImage(firePointQo.getFireImage());
shanDongFirePoint.setSatelliteImage(firePointQo.getSatelliteImage());
shanDongFirePoint.setVerifyState("0");
try {
bindAddress(shanDongFirePoint);
} catch (Exception e) {
e.printStackTrace();
System.out.println("添加山东火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
}
if (checkDuplicatedDataX(shanDongFirePoint) || checkDuplicatedData(shanDongFirePoint)) {
return false;
}
@ -341,7 +331,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 为实体类绑定地址编号名称
*/
private void bindAddress(FirePointEntity firePointEntity) throws Exception {
private void bindAddress(FirePointEntity firePointEntity) {
List<String> locationList = new ArrayList<>();
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
@ -360,7 +350,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 为实体类绑定地址编号名称
*/
private void bindAddress(ShanDongFirePointEntity firePointEntity) throws Exception {
private void bindAddress(ShanDongFirePointEntity firePointEntity) {
List<String> locationList = new ArrayList<>();
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);