From ecfe3a8a701553e6fc5b2e39e368a78674c017ef Mon Sep 17 00:00:00 2001 From: qdxkrs <39894542+qdxkrs@users.noreply.github.com> Date: Fri, 29 Apr 2022 11:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/common/config/CorsInterceptor.java | 3 +- .../controller/ForestRangerController.java | 1 - .../service/impl/FirePointServiceImpl.java | 22 ++++--- src/main/java/com/xkrs/utils/Query.java | 63 ++++++++++--------- 4 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/CorsInterceptor.java b/src/main/java/com/xkrs/common/config/CorsInterceptor.java index e2103c5..3215259 100644 --- a/src/main/java/com/xkrs/common/config/CorsInterceptor.java +++ b/src/main/java/com/xkrs/common/config/CorsInterceptor.java @@ -13,7 +13,8 @@ import javax.servlet.http.HttpServletResponse; @Component public class CorsInterceptor implements HandlerInterceptor { - @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { //添加跨域CORS response.setHeader("Access-Control-Allow-Origin", "*"); diff --git a/src/main/java/com/xkrs/controller/ForestRangerController.java b/src/main/java/com/xkrs/controller/ForestRangerController.java index 945859a..7eef946 100644 --- a/src/main/java/com/xkrs/controller/ForestRangerController.java +++ b/src/main/java/com/xkrs/controller/ForestRangerController.java @@ -53,5 +53,4 @@ public class ForestRangerController { return forestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone); } - } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index f5c4cd7..08d6a43 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -137,24 +137,28 @@ public class FirePointServiceImpl implements FirePointService { if("0000".equals(countyCode.substring(2))){ List byProCode = cityDao.findByProCode(countyCode); String proName = byProCode.get(0).getProName(); - if(proName.equals("山东省")){ - return firePointDao.selectTodayFirePointShandong(addTime,proName); - } +// if(proName.equals("山东省")){ +// return firePointDao.selectTodayFirePointShandong(addTime,proName); +// } return firePointDao.selectTodayFirePoint(addTime,proName); + }else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){ List byCityCode = countyDao.findByCityCode(countyCode); String cityName = byCityCode.get(0).getCityName(); CityEntity byCityName = cityDao.findByCityName(cityName); - if(byCityName.getProName().equals("山东省")){ - return firePointDao.selectTodayFirePointShandong(addTime,cityName); - } +// if(byCityName.getProName().equals("山东省")){ +// return firePointDao.selectTodayFirePointShandong(addTime,cityName); +// } return firePointDao.selectTodayFirePoint(addTime,cityName); }else { CountyEntity byCountyCode = countyDao.findByCountyCode(countyCode); CityEntity byCityName = cityDao.findByCityName(byCountyCode.getCityName()); - if(byCityName.getProName().equals("山东省")){ - return firePointDao.selectTodayFirePointOneShandong(addTime,countyCode); - } +// if(b +// +// +// yCityName.getProName().equals("山东省")){ +// return firePointDao.selectTodayFirePointOneShandong(addTime,countyCode); +// } return firePointDao.selectTodayFirePointOne(addTime,countyCode); } } diff --git a/src/main/java/com/xkrs/utils/Query.java b/src/main/java/com/xkrs/utils/Query.java index 6cc6203..289682d 100644 --- a/src/main/java/com/xkrs/utils/Query.java +++ b/src/main/java/com/xkrs/utils/Query.java @@ -44,15 +44,16 @@ public class Query { list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType)); } if (landType != null && !"".equals(landType)) { - if(address.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(address.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType)); - }else { - if(address.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } } +// else { +// if(address.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } +// } if(startTime != null && !"".equals(startTime)){ list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime)); } @@ -94,15 +95,16 @@ public class Query { list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType)); } if (landType != null && !"".equals(landType)) { - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType)); - }else { - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } } +// else { +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } +// } if(startTime != null && !"".equals(startTime)){ list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime)); } @@ -141,15 +143,16 @@ public class Query { list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType)); } if (landType != null && !"".equals(landType)) { - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType)); - }else { - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } } +// else { +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } +// } if(startTime != null && !"".equals(startTime)){ list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime)); } @@ -215,9 +218,9 @@ public class Query { if(endTime != null && !"".equals(endTime)){ list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTime)); } - if(address.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(address.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); } @@ -246,9 +249,9 @@ public class Query { if(endTime != null && !"".equals(endTime)){ list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTime)); } - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); } @@ -277,9 +280,9 @@ public class Query { if(endTime != null && !"".equals(endTime)){ list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTime)); } - if(proName.equals("山东省")){ - list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); - } +// if(proName.equals("山东省")){ +// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地")); +// } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); }