From e77f417caba14aca97c3f2261731c01829f474a8 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 31 Aug 2022 09:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20endTime1.getDayOfMonth()?= =?UTF-8?q?=20+=201=20=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/common/config/WebSecurityConfig.java | 1 + .../com/xkrs/controller/FirePointController.java | 3 +-- .../com/xkrs/service/impl/FirePointServiceImpl.java | 12 ++++++------ .../java/com/xkrs/utils/FirePointQueryHelper.java | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index d4c3d80..9f01c00 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -77,6 +77,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET, "/api/adm/getCountyList").permitAll()//根据市编号获取区县列表 .antMatchers(HttpMethod.GET, "/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表 .antMatchers(HttpMethod.GET, "/updateFirePointStreetCode").permitAll() + .antMatchers(HttpMethod.GET, "/selectTodayFirePoint").permitAll() // 所有其它请求需要身份认证 .anyRequest().authenticated() .and() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index ace51e5..dd285b5 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -208,11 +208,10 @@ public class FirePointController { /** * 查询今天的火点信息 * - * @param token * @return */ @GetMapping("/selectTodayFirePoint") - public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) { + public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode) { List firePointList = firePointService.selectTodayFirePoint(countyCode); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale); } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 1383ee5..d9070b0 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -482,8 +482,8 @@ public class FirePointServiceImpl implements FirePointService { LocalDateTime startTime2 = LocalDateTime.of(startTime1.getYear(), startTime1.getMonth(), startTime1.getDayOfMonth(), 0, 0, 0, 0); String startTimeString = DateTimeUtils.localDateTimeToString(startTime2); - LocalDateTime endTime1 = LocalDateTime.now(); - LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0); + LocalDateTime endTime1 = LocalDateTime.now().plusDays(1); + LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth(), 0, 0, 0, 0); String endTimeString = DateTimeUtils.localDateTimeToString(endTime2); return firePointQueryHelper.queryFirePoint(countyCode, startTimeString, endTimeString, null, null); @@ -500,8 +500,8 @@ public class FirePointServiceImpl implements FirePointService { LocalDateTime startTime2 = LocalDateTime.of(startTime1.getYear(), startTime1.getMonth(), startTime1.getDayOfMonth(), 0, 0, 0, 0); String startTimeString = DateTimeUtils.localDateTimeToString(startTime2); - LocalDateTime endTime1 = LocalDateTime.now(); - LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0); + LocalDateTime endTime1 = LocalDateTime.now().plusDays(1); + LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth(), 0, 0, 0, 0); String endTimeString = DateTimeUtils.localDateTimeToString(endTime2); return firePointQueryHelper.queryFirePoint(null, startTimeString, endTimeString, null, null); @@ -518,8 +518,8 @@ public class FirePointServiceImpl implements FirePointService { LocalDateTime startTime2 = LocalDateTime.of(startTime1.getYear(), startTime1.getMonth(), startTime1.getDayOfMonth(), 0, 0, 0, 0); String startTimeString = DateTimeUtils.localDateTimeToString(startTime2); - LocalDateTime endTime1 = LocalDateTime.now(); - LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0); + LocalDateTime endTime1 = LocalDateTime.now().plusDays(1); + LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth(), 0, 0, 0, 0); String endTimeString = DateTimeUtils.localDateTimeToString(endTime2); return firePointQueryHelper.queryFirePoint(countyCode, startTimeString, endTimeString, null, null); diff --git a/src/main/java/com/xkrs/utils/FirePointQueryHelper.java b/src/main/java/com/xkrs/utils/FirePointQueryHelper.java index dda71bc..62fa3a1 100644 --- a/src/main/java/com/xkrs/utils/FirePointQueryHelper.java +++ b/src/main/java/com/xkrs/utils/FirePointQueryHelper.java @@ -51,8 +51,8 @@ public class FirePointQueryHelper { } //结束时间查询条件 if (!TextUtils.isEmpty(endTime)) { - LocalDateTime endTime1 = DateTimeUtils.stringToLocalDateTime(endTime); - LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0); + 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)); } @@ -84,8 +84,8 @@ public class FirePointQueryHelper { } //结束时间查询条件 if (!TextUtils.isEmpty(endTime)) { - LocalDateTime endTime1 = DateTimeUtils.stringToLocalDateTime(endTime); - LocalDateTime endTime2 = LocalDateTime.of(endTime1.getYear(), endTime1.getMonth(), endTime1.getDayOfMonth() + 1, 0, 0, 0, 0); + 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)); }