临时适配 张庄 火点查询需求

This commit is contained in:
liuchengqian 2022-07-26 15:57:08 +08:00
parent 49b2d4c436
commit ea357838ee
3 changed files with 49 additions and 0 deletions

View File

@ -48,6 +48,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll() .antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll()
.antMatchers("/ws/asset").permitAll() .antMatchers("/ws/asset").permitAll()
.antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll() .antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll()
.antMatchers(HttpMethod.GET, "/queryzzhd").permitAll()
.antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll() .antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll()
.antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll() .antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll()
.antMatchers(HttpMethod.POST, "/insertAppTask").permitAll() .antMatchers(HttpMethod.POST, "/insertAppTask").permitAll()

View File

@ -59,6 +59,29 @@ public class FirePointController {
@Resource @Resource
private FirePointQueryHelper firePointQueryHelper; private FirePointQueryHelper firePointQueryHelper;
@GetMapping("/queryzzhd")
public String queryzzhd() {
Locale locale = LocaleContextHolder.getLocale();
List<FirePointEntity> firePointEntities1 = firePointQueryHelper.queryZZHD("371482", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities2 = firePointQueryHelper.queryZZHD("371403", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities3 = firePointQueryHelper.queryZZHD("371426", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities4 = firePointQueryHelper.queryZZHD("371424", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities5 = firePointQueryHelper.queryZZHD("371526", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities6 = firePointQueryHelper.queryZZHD("371425", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointEntities7 = firePointQueryHelper.queryZZHD("371503", "2022-01-01 00:00:10", null);
List<FirePointEntity> firePointList = new ArrayList<>();
firePointList.addAll(firePointEntities1);
firePointList.addAll(firePointEntities2);
firePointList.addAll(firePointEntities3);
firePointList.addAll(firePointEntities4);
firePointList.addAll(firePointEntities5);
firePointList.addAll(firePointEntities6);
firePointList.addAll(firePointEntities7);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale);
}
/** /**
* 添加火点数据 * 添加火点数据
* *

View File

@ -70,4 +70,29 @@ public class FirePointQueryHelper {
return firePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime")); return firePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime"));
} }
public List<FirePointEntity> queryZZHD(String code, String startTime, String endTime) {
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
//查询条件集合
List<Predicate> predicateList = new ArrayList<>();
predicateList.add(criteriaBuilder.equal(root.get("countyCode").as(String.class), code));
//开始时间查询条件
if (!TextUtils.isEmpty(startTime)) {
LocalDateTime startTime1 = DateTimeUtils.stringToLocalDateTime(startTime);
LocalDateTime startTime2 = LocalDateTime.of(startTime1.getYear(), startTime1.getMonth(), startTime1.getDayOfMonth(), 0, 0, 0, 0);
String startTimeString = DateTimeUtils.localDateTimeToString(startTime2);
predicateList.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimeString));
}
//结束时间查询条件
if (!TextUtils.isEmpty(endTime)) {
LocalDateTime endTime1 = DateTimeUtils.stringToLocalDateTime(endTime);
LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0);
String endTimeString = DateTimeUtils.localDateTimeToString(endTime2);
predicateList.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimeString));
}
Predicate[] predicateArray = new Predicate[predicateList.size()];
return criteriaBuilder.and(predicateList.toArray(predicateArray));
};
return firePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime"));
}
} }