From 9849e22e8a01d071affb22391f266077a87edd67 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 1 Mar 2023 17:03:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E7=94=A8=E6=88=B7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=81=AB=E7=82=B9=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../straw/utils/FirePointQueryManager.java | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) 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();