修改 动态多条件查询火点信息
This commit is contained in:
parent
9321bdf9bf
commit
d3ab960893
@ -43,6 +43,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点数据
|
* 添加火点数据
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -60,6 +61,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试
|
* 测试
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -79,6 +81,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今天的火点信息
|
* 查询今天的火点信息
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -96,6 +99,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询火点信息
|
* 动态多条件查询火点信息
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
@ -119,21 +123,29 @@ public class FirePointController {
|
|||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
// 查询省
|
// 查询省
|
||||||
if(sysUserEntity.getCountyCode().substring(2).equals("0000")){
|
if (9 == sysUserEntity.getCountyCode().length()) {
|
||||||
|
// 查询县
|
||||||
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), satelliteType, landType, startTime, endTime);
|
||||||
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
|
}
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
|
} else if (sysUserEntity.getCountyCode().substring(2).equals("0000")) {
|
||||||
|
// 查询省
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePoint(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePoint(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
||||||
if (firePointEntities == null || firePointEntities.size() == 0) {
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
// 查询市
|
|
||||||
} else if (sysUserEntity.getCountyCode().substring(4).equals("00") && !sysUserEntity.getCountyCode().substring(2).equals("0000")) {
|
} else if (sysUserEntity.getCountyCode().substring(4).equals("00") && !sysUserEntity.getCountyCode().substring(2).equals("0000")) {
|
||||||
|
// 查询市
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCity(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCity(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
||||||
if (firePointEntities == null || firePointEntities.size() == 0) {
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
// 查询县
|
|
||||||
} else {
|
} else {
|
||||||
|
// 查询县
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), satelliteType, landType, startTime, endTime);
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), satelliteType, landType, startTime, endTime);
|
||||||
if (firePointEntities == null || firePointEntities.size() == 0) {
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
@ -144,6 +156,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码修改火点状态
|
* 根据火点编码修改火点状态
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
@ -157,6 +170,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交核查任务
|
* 提交核查任务
|
||||||
|
*
|
||||||
* @param files
|
* @param files
|
||||||
* @param appTaskBodyVo
|
* @param appTaskBodyVo
|
||||||
* @return
|
* @return
|
||||||
@ -179,6 +193,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询核查的任务信息
|
* 查询核查的任务信息
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -189,6 +204,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一周的火点信息
|
* 查询近一周的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointBetweenSeven")
|
@GetMapping("/selectFirePointBetweenSeven")
|
||||||
@ -204,6 +220,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点信息
|
* 查询近一个月的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointByMonth")
|
@GetMapping("/selectFirePointByMonth")
|
||||||
@ -223,6 +240,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询火点数量
|
* 查询火点数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointNum")
|
@GetMapping("/selectFirePointNum")
|
||||||
@ -246,6 +264,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该省所有的市
|
* 查询该省所有的市
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectCityName")
|
@GetMapping("/selectCityName")
|
||||||
@ -263,6 +282,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码查询火点信息
|
* 根据火点编码查询火点信息
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -276,6 +296,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试添加火点信息
|
* 测试添加火点信息
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -293,6 +314,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入全国省市区
|
* 导入全国省市区
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -307,6 +329,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今天的火点信息(测试)
|
* 查询今天的火点信息(测试)
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -324,6 +347,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除水体类型的火点信息
|
* 删除水体类型的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
@ -346,6 +370,7 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码添加火点前后的图片
|
* 根据火点编码添加火点前后的图片
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -210,19 +210,16 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
//List<CityEntity> byCityCode = cityDao.findByCityCode(cityCodeOne.substring(0,3));
|
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(cityCodeOne);
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(cityCodeOne);
|
||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
CityEntity byCityCode1 = cityDao.findByCityName(cityName);
|
|
||||||
String proName = byCityCode1.getProName();
|
|
||||||
if (!"".equals(startTime) && !"".equals(endTime)) {
|
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||||
// 结束时间
|
// 结束时间
|
||||||
LocalDate localDate1 = localDate.plusDays(1);
|
LocalDate localDate1 = localDate.plusDays(1);
|
||||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||||
return query.selectFirePointByCity(proName, cityName, cityCode, satelliteType, landType, startTime, dateToString);
|
return query.selectFirePointByCity(cityName, cityCode, satelliteType, landType, startTime, dateToString);
|
||||||
}
|
}
|
||||||
return query.selectFirePointByCity(proName, cityName, cityCode, satelliteType, landType, startTime, endTime);
|
return query.selectFirePointByCity(cityName, cityCode, satelliteType, landType, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,18 +235,14 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
|
|
||||||
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(cityCode);
|
|
||||||
CityEntity byCityCode = cityDao.findByCityName(byCountyCode.get(0).getCityName());
|
|
||||||
String proName = byCityCode.getProName();
|
|
||||||
if (!"".equals(startTime) && !"".equals(endTime)) {
|
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||||
// 结束时间
|
// 结束时间
|
||||||
LocalDate localDate1 = localDate.plusDays(1);
|
LocalDate localDate1 = localDate.plusDays(1);
|
||||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||||
return query.selectFirePointByCounty(proName, cityCode, satelliteType, landType, startTime, dateToString);
|
return query.selectFirePointByCounty(cityCode, satelliteType, landType, startTime, dateToString);
|
||||||
}
|
}
|
||||||
return query.selectFirePointByCounty(proName, cityCode, satelliteType, landType, startTime, endTime);
|
return query.selectFirePointByCounty(cityCode, satelliteType, landType, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -381,7 +374,6 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
public List<FirePointEntity> selectFirePointBetweenSeven() {
|
public List<FirePointEntity> selectFirePointBetweenSeven() {
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
String endTime = DateTimeUtil.dateTimeToString(localDateTime);
|
String endTime = DateTimeUtil.dateTimeToString(localDateTime);
|
||||||
|
|
||||||
// 当前时间减7
|
// 当前时间减7
|
||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(7);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(7);
|
||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
@ -401,21 +393,18 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
// 当前时间减31
|
// 当前时间减31
|
||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(31);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(31);
|
||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
if ("0000".equals(countyCode.substring(2))) {
|
if (9 == countyCode.length()) {
|
||||||
|
return query.selectFirePointByMonthCounty(countyCode, startTime, endTime);
|
||||||
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
||||||
String proName = byProCode.get(0).getProName();
|
String proName = byProCode.get(0).getProName();
|
||||||
return query.selectFirePointByMonth(proName, startTime, endTime);
|
return query.selectFirePointByMonthPro(proName, startTime, endTime);
|
||||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
CityEntity byCityName = cityDao.findByCityName(cityName);
|
return query.selectFirePointByMonthCity(cityName, startTime, endTime);
|
||||||
String proName = byCityName.getProName();
|
|
||||||
return query.selectFirePointByMonthCity(proName, cityName, startTime, endTime);
|
|
||||||
} else {
|
} else {
|
||||||
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
|
return query.selectFirePointByMonthCounty(countyCode, startTime, endTime);
|
||||||
CityEntity byCityName = cityDao.findByCityName(byCountyCode.get(0).getCityName());
|
|
||||||
String proName = byCityName.getProName();
|
|
||||||
return query.selectFirePointByMonthCounty(proName, countyCode, startTime, endTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -26,13 +23,9 @@ public class Query {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询项目信息(省)
|
* 动态多条件查询项目信息(省)
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByPro(String address, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointByPro(String address, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (address != null && !"".equals(address)) {
|
if (address != null && !"".equals(address)) {
|
||||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||||
@ -44,16 +37,8 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||||
}
|
}
|
||||||
if (landType != null && !"".equals(landType)) {
|
if (landType != null && !"".equals(landType)) {
|
||||||
// if(address.equals("山东省")){
|
|
||||||
// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地"));
|
|
||||||
// }
|
|
||||||
list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType));
|
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), "耕地"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (startTime != null && !"".equals(startTime)) {
|
if (startTime != null && !"".equals(startTime)) {
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
@ -70,20 +55,15 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询项目信息(市)
|
* 动态多条件查询项目信息(市)
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByCity(String proName, String address, String cityCode,String satelliteType,String landType,String startTime,String endTime) {
|
public List<FirePointEntity> selectFirePointByCity(String address, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (address != null && !"".equals(address)) {
|
if (address != null && !"".equals(address)) {
|
||||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||||
@ -95,16 +75,8 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||||
}
|
}
|
||||||
if (landType != null && !"".equals(landType)) {
|
if (landType != null && !"".equals(landType)) {
|
||||||
// if(proName.equals("山东省")){
|
|
||||||
// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地"));
|
|
||||||
// }
|
|
||||||
list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType));
|
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), "耕地"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (startTime != null && !"".equals(startTime)) {
|
if (startTime != null && !"".equals(startTime)) {
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
@ -121,20 +93,15 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询项目信息(县)
|
* 动态多条件查询项目信息(县)
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByCounty(String proName, String cityCode,String satelliteType,String landType,String startTime,String endTime) {
|
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (cityCode != null && !"".equals(cityCode)) {
|
if (cityCode != null && !"".equals(cityCode)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("countyCode").as(String.class), cityCode));
|
list.add(criteriaBuilder.equal(root.get("countyCode").as(String.class), cityCode));
|
||||||
@ -143,16 +110,8 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||||
}
|
}
|
||||||
if (landType != null && !"".equals(landType)) {
|
if (landType != null && !"".equals(landType)) {
|
||||||
// if(proName.equals("山东省")){
|
|
||||||
// list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地"));
|
|
||||||
// }
|
|
||||||
list.add(criteriaBuilder.equal(root.get("landType").as(String.class), landType));
|
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), "耕地"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (startTime != null && !"".equals(startTime)) {
|
if (startTime != null && !"".equals(startTime)) {
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
@ -169,21 +128,15 @@ public class Query {
|
|||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTimes));
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一周的火点
|
* 查询近一周的火点
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointBetweenThree(String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointBetweenThree(String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (startTime != null && !"".equals(startTime)) {
|
if (startTime != null && !"".equals(startTime)) {
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
@ -193,21 +146,15 @@ public class Query {
|
|||||||
}
|
}
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点
|
* 查询近一个月的火点信息(省)
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByMonth(String address,String startTime,String endTime) {
|
public List<FirePointEntity> selectFirePointByMonthPro(String address, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (address != null && !"".equals(address)) {
|
if (address != null && !"".equals(address)) {
|
||||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||||
@ -218,27 +165,17 @@ public class Query {
|
|||||||
if (endTime != null && !"".equals(endTime)) {
|
if (endTime != null && !"".equals(endTime)) {
|
||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), 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), "耕地"));
|
|
||||||
// }
|
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点信息(市)
|
* 查询近一个月的火点信息(市)
|
||||||
* @param address
|
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByMonthCity(String proName, String address,String startTime,String endTime) {
|
public List<FirePointEntity> selectFirePointByMonthCity(String address, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (address != null && !"".equals(address)) {
|
if (address != null && !"".equals(address)) {
|
||||||
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + address + "%"));
|
||||||
@ -249,27 +186,17 @@ public class Query {
|
|||||||
if (endTime != null && !"".equals(endTime)) {
|
if (endTime != null && !"".equals(endTime)) {
|
||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), 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), "耕地"));
|
|
||||||
// }
|
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点信息(县)
|
* 查询近一个月的火点信息(县)
|
||||||
* @param countyCode
|
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<FirePointEntity> selectFirePointByMonthCounty(String proName, String countyCode,String startTime,String endTime) {
|
public List<FirePointEntity> selectFirePointByMonthCounty(String countyCode, String startTime, String endTime) {
|
||||||
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
|
Specification<FirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
@Override
|
|
||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (countyCode != null && !"".equals(countyCode)) {
|
if (countyCode != null && !"".equals(countyCode)) {
|
||||||
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), countyCode));
|
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), countyCode));
|
||||||
@ -280,12 +207,8 @@ public class Query {
|
|||||||
if (endTime != null && !"".equals(endTime)) {
|
if (endTime != null && !"".equals(endTime)) {
|
||||||
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), 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), "耕地"));
|
|
||||||
// }
|
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return firePointDao.findAll(specification);
|
return firePointDao.findAll(specification);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user