修改查询

This commit is contained in:
qdxkrs 2022-04-29 11:34:05 +08:00
parent 0ddc79be43
commit ecfe3a8a70
4 changed files with 48 additions and 41 deletions

View File

@ -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", "*");

View File

@ -53,5 +53,4 @@ public class ForestRangerController {
return forestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
}
}

View File

@ -137,24 +137,28 @@ public class FirePointServiceImpl implements FirePointService {
if("0000".equals(countyCode.substring(2))){
List<CityEntity> 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<CountyEntity> 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);
}
}

View File

@ -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));
}