diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 247ab1d..d4c3d80 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -48,6 +48,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll() .antMatchers("/ws/asset").permitAll() .antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll() + .antMatchers(HttpMethod.GET, "/queryzzhd").permitAll() .antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll() .antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll() .antMatchers(HttpMethod.POST, "/insertAppTask").permitAll() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index ba81a44..3ebccc9 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -59,6 +59,29 @@ public class FirePointController { @Resource private FirePointQueryHelper firePointQueryHelper; + @GetMapping("/queryzzhd") + public String queryzzhd() { + Locale locale = LocaleContextHolder.getLocale(); + + List firePointEntities1 = firePointQueryHelper.queryZZHD("371482", "2022-01-01 00:00:10", null); + List firePointEntities2 = firePointQueryHelper.queryZZHD("371403", "2022-01-01 00:00:10", null); + List firePointEntities3 = firePointQueryHelper.queryZZHD("371426", "2022-01-01 00:00:10", null); + List firePointEntities4 = firePointQueryHelper.queryZZHD("371424", "2022-01-01 00:00:10", null); + List firePointEntities5 = firePointQueryHelper.queryZZHD("371526", "2022-01-01 00:00:10", null); + List firePointEntities6 = firePointQueryHelper.queryZZHD("371425", "2022-01-01 00:00:10", null); + List firePointEntities7 = firePointQueryHelper.queryZZHD("371503", "2022-01-01 00:00:10", null); + + List 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); + } + /** * 添加火点数据 * diff --git a/src/main/java/com/xkrs/utils/FirePointQueryHelper.java b/src/main/java/com/xkrs/utils/FirePointQueryHelper.java index b0ba661..dda71bc 100644 --- a/src/main/java/com/xkrs/utils/FirePointQueryHelper.java +++ b/src/main/java/com/xkrs/utils/FirePointQueryHelper.java @@ -70,4 +70,29 @@ public class FirePointQueryHelper { return firePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime")); } + public List queryZZHD(String code, String startTime, String endTime) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + //查询条件集合 + List 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")); + } + } \ No newline at end of file