使用天地图反查填补历史数据
This commit is contained in:
parent
c4ae4f10ab
commit
60aae894f7
@ -35,6 +35,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||||
.antMatchers("/global/configuration/**").permitAll()
|
.antMatchers("/global/configuration/**").permitAll()
|
||||||
.antMatchers("/push/**").permitAll()
|
.antMatchers("/push/**").permitAll()
|
||||||
|
.antMatchers("/debug").permitAll()
|
||||||
.antMatchers("/queryFirePoint").permitAll()
|
.antMatchers("/queryFirePoint").permitAll()
|
||||||
.antMatchers("/queryNotice").permitAll()//查询通知
|
.antMatchers("/queryNotice").permitAll()//查询通知
|
||||||
.antMatchers(HttpMethod.POST, "/api/user/updateSysUser").permitAll()
|
.antMatchers(HttpMethod.POST, "/api/user/updateSysUser").permitAll()
|
||||||
|
@ -11,14 +11,17 @@ import com.xkrs.model.entity.SysUserEntity;
|
|||||||
import com.xkrs.model.qo.AuditFireTypeQo;
|
import com.xkrs.model.qo.AuditFireTypeQo;
|
||||||
import com.xkrs.model.qo.FirePointQo;
|
import com.xkrs.model.qo.FirePointQo;
|
||||||
import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo;
|
import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo;
|
||||||
|
import com.xkrs.model.vo.TianDiTuGeocodeVo;
|
||||||
import com.xkrs.service.FirePointService;
|
import com.xkrs.service.FirePointService;
|
||||||
import com.xkrs.service.StreetService;
|
import com.xkrs.service.StreetService;
|
||||||
import com.xkrs.service.impl.FirePointServiceImpl;
|
import com.xkrs.service.impl.FirePointServiceImpl;
|
||||||
import com.xkrs.utils.FirePointQueryHelper;
|
import com.xkrs.utils.FirePointQueryHelper;
|
||||||
|
import com.xkrs.utils.TianDiTuApiUtil;
|
||||||
import org.apache.hc.core5.util.TextUtils;
|
import org.apache.hc.core5.util.TextUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -94,6 +97,50 @@ public class FirePointController {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/debug")
|
||||||
|
public String debug() {
|
||||||
|
//使用天地图反查填补历史数据-start
|
||||||
|
System.out.println("开始解析");
|
||||||
|
while (true) {
|
||||||
|
//查询未审核的普通火点
|
||||||
|
Specification<FirePointEntity> specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
|
List<Predicate> predicateList = new ArrayList<>();
|
||||||
|
predicateList.add(criteriaBuilder.isNull(root.get("streetCode").as(String.class)));
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("streetCode").as(String.class), ""));
|
||||||
|
predicateList.add(criteriaBuilder.isNull(root.get("streetName").as(String.class)));
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("streetName").as(String.class), ""));
|
||||||
|
predicateList.add(criteriaBuilder.isNull(root.get("firePointAddress").as(String.class)));
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("firePointAddress").as(String.class), ""));
|
||||||
|
return criteriaBuilder.or(predicateList.toArray(new Predicate[predicateList.size()]));
|
||||||
|
};
|
||||||
|
//未审核的普通火点列表
|
||||||
|
PageRequest pageRequest = PageRequest.of(1, 1000, Sort.by(Sort.Direction.DESC, "satelliteTime"));
|
||||||
|
List<FirePointEntity> list = firePointDao.findAll(specificationOrdinary, pageRequest).getContent();
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (FirePointEntity item : list) {
|
||||||
|
try {
|
||||||
|
TianDiTuGeocodeVo geocode = TianDiTuApiUtil.geocode(item.getLongitude(), item.getLatitude());
|
||||||
|
TianDiTuGeocodeVo.ResultDTO.AddressComponentDTO addressComponent = geocode.result.addressComponent;
|
||||||
|
item.setFirePointAddress(geocode.result.formattedAddress);
|
||||||
|
item.setCountyCode(addressComponent.countyCode.substring(3, 9));
|
||||||
|
item.setCountyName(addressComponent.county);
|
||||||
|
item.setStreetCode(addressComponent.townCode.substring(3, 12));
|
||||||
|
item.setStreetName(addressComponent.town);
|
||||||
|
firePointDao.saveAndFlush(item);
|
||||||
|
System.out.println("解析成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("解析失败" + item.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//使用天地图反查填补历史数据-end
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKKKK", locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点数据
|
* 添加火点数据
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user