From c77b05a87bbf1b337cd4a80027f9b1406177831a Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Mon, 6 Dec 2021 09:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B9=E6=8D=AE=E7=81=AB?= =?UTF-8?q?=E7=82=B9=E7=BC=96=E7=A0=81=E6=9F=A5=E8=AF=A2=E7=81=AB=E7=82=B9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/common/config/WebSecurityConfig.java | 2 +- .../xkrs/controller/FirePointController.java | 2 +- .../service/impl/FirePointServiceImpl.java | 40 ++++++++++++------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 6e796dd..0cd052b 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -52,7 +52,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET,"/selectCityName").permitAll() .antMatchers(HttpMethod.GET,"/weather/cityName").permitAll() .antMatchers(HttpMethod.GET,"/weather/cityId").permitAll() - .antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll() + .antMatchers(HttpMethod.GET,"/selectFirePointByCode").permitAll() .antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll() .antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll() .antMatchers(HttpMethod.POST,"/uploadFileMore").permitAll() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 6c36af8..278dd36 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -270,7 +270,7 @@ public class FirePointController { * @param fireCode * @return */ - @GetMapping("/selectFirePoint") + @GetMapping("/selectFirePointByCode") public String selectFirePoint(@RequestParam("fireCode") String fireCode){ // 获取区域信息 Locale locale = LocaleContextHolder.getLocale(); diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 118e453..08f5351 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -161,11 +161,14 @@ public class FirePointServiceImpl implements FirePointService { public List selectFirePoint(String proCode,String cityCode, String satelliteType, String landType, String startTime, String endTime) { List byProCode = cityDao.findByProCode(proCode); String proName = byProCode.get(0).getProName(); - LocalDate localDate = DateTimeUtil.stringToDate(endTime); - // 结束时间 - LocalDate localDate1 = localDate.plusDays(1); - String dateToString = DateTimeUtil.dateToString(localDate1); - return query.selectFirePointByPro(proName,cityCode, satelliteType, landType, startTime, dateToString); + if(!"".equals(startTime) && !"".equals(endTime)){ + LocalDate localDate = DateTimeUtil.stringToDate(endTime); + // 结束时间 + LocalDate localDate1 = localDate.plusDays(1); + String dateToString = DateTimeUtil.dateToString(localDate1); + return query.selectFirePointByPro(proName,cityCode, satelliteType, landType, startTime, dateToString); + } + return query.selectFirePointByPro(proName,cityCode, satelliteType, landType, startTime, endTime); } /** @@ -184,11 +187,14 @@ public class FirePointServiceImpl implements FirePointService { //List byCityCode = cityDao.findByCityCode(cityCodeOne.substring(0,3)); List byCityCode = countyDao.findByCityCode(cityCodeOne); String cityName = byCityCode.get(0).getCityName(); - LocalDate localDate = DateTimeUtil.stringToDate(endTime); - // 结束时间 - LocalDate localDate1 = localDate.plusDays(1); - String dateToString = DateTimeUtil.dateToString(localDate1); - return query.selectFirePointByCity(cityName,cityCode,satelliteType,landType,startTime,dateToString); + if(!"".equals(startTime) && !"".equals(endTime)){ + LocalDate localDate = DateTimeUtil.stringToDate(endTime); + // 结束时间 + LocalDate localDate1 = localDate.plusDays(1); + String dateToString = DateTimeUtil.dateToString(localDate1); + return query.selectFirePointByCity(cityName,cityCode,satelliteType,landType,startTime,dateToString); + } + return query.selectFirePointByCity(cityName,cityCode,satelliteType,landType,startTime,endTime); } /** @@ -203,11 +209,15 @@ public class FirePointServiceImpl implements FirePointService { @Cacheable(keyGenerator = "keyGenerator", unless="#result == null") @Override public List selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) { - LocalDate localDate = DateTimeUtil.stringToDate(endTime); - // 结束时间 - LocalDate localDate1 = localDate.plusDays(1); - String dateToString = DateTimeUtil.dateToString(localDate1); - return query.selectFirePointByCounty(cityCode,satelliteType,landType,startTime,dateToString); + + if(!"".equals(startTime) && !"".equals(endTime)){ + LocalDate localDate = DateTimeUtil.stringToDate(endTime); + // 结束时间 + LocalDate localDate1 = localDate.plusDays(1); + String dateToString = DateTimeUtil.dateToString(localDate1); + return query.selectFirePointByCounty(cityCode,satelliteType,landType,startTime,dateToString); + } + return query.selectFirePointByCounty(cityCode,satelliteType,landType,startTime,endTime); } /**