diff --git a/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java index 6d6c159..a3afb8d 100644 --- a/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java +++ b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java @@ -171,6 +171,28 @@ public class FirePointQueryManager { List predicateList = new ArrayList<>(); //添加区划编码的过滤 predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), finalMNoRedundantUserCode + "%")); + //开始时间查询条件 + 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).plusDays(1); + LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth(), 0, 0, 0, 0); + String endTimeString = DateTimeUtils.localDateTimeToString(endTime2); + predicateList.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimeString)); + } + //卫星类型查询条件 + if (!TextUtils.isEmpty(satelliteType)) { + predicateList.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType)); + } + //地物类型查询条件 + if (!TextUtils.isEmpty(landType)) { + predicateList.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType)); + } for (VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem : mVipTimeRangeItemList) { String userStartTime = vipTimeRangeItem.getStartTime(); String userEndTime = vipTimeRangeItem.getEndTime(); @@ -191,7 +213,28 @@ public class FirePointQueryManager { List predicateList = new ArrayList<>(); //添加区划编码的过滤 predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), finalMNoRedundantUserCode + "%")); - + //开始时间查询条件 + 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).plusDays(1); + LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth(), 0, 0, 0, 0); + String endTimeString = DateTimeUtils.localDateTimeToString(endTime2); + predicateList.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimeString)); + } + //卫星类型查询条件 + if (!TextUtils.isEmpty(satelliteType)) { + predicateList.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType)); + } + //地物类型查询条件 + if (!TextUtils.isEmpty(landType)) { + predicateList.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType)); + } List subPredicateList = new ArrayList<>(); for (VipTimeRangeBean.VipTimeRangeItemBean vipTimeRangeItem : mVipTimeRangeItemList) { String userStartTime = vipTimeRangeItem.getStartTime();