修改 动态多条件查询火点信息
This commit is contained in:
parent
9321bdf9bf
commit
d3ab960893
@ -43,66 +43,70 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点数据
|
* 添加火点数据
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/insertFirePoint")
|
@PostMapping("/insertFirePoint")
|
||||||
public String insertFirePoint(@RequestBody FirePointQo firePointQo){
|
public String insertFirePoint(@RequestBody FirePointQo firePointQo) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FirePointEntity firePointEntity = firePointService.insertFirePoint(firePointQo);
|
FirePointEntity firePointEntity = firePointService.insertFirePoint(firePointQo);
|
||||||
if(firePointEntity == null){
|
if (firePointEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"添加数据失败",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "添加数据失败", locale);
|
||||||
}else {
|
} else {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试
|
* 测试
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectUserName")
|
@GetMapping("/selectUserName")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
||||||
public String selectUserName(@RequestHeader(value="Authorization") String token){
|
public String selectUserName(@RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserEntity.getUserName(),locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, sysUserEntity.getUserName(), locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今天的火点信息
|
* 查询今天的火点信息
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectTodayFirePoint")
|
@GetMapping("/selectTodayFirePoint")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
||||||
public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode,@RequestHeader(value="Authorization") String token){
|
public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectTodayFirePoint(countyCode);
|
List<FirePointEntity> firePointEntities = firePointService.selectTodayFirePoint(countyCode);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询火点信息
|
* 动态多条件查询火点信息
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectFirePoint")
|
@PostMapping("/selectFirePoint")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
||||||
public String selectFirePoint(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String selectFirePoint(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 区县编码
|
// 区县编码
|
||||||
@ -119,44 +123,54 @@ 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.selectFirePoint(sysUserEntity.getCountyCode(),cityCode, 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(4).equals("00") && !sysUserEntity.getCountyCode().substring(2).equals("0000")){
|
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByCity(sysUserEntity.getCountyCode(), cityCode, satelliteType, landType, startTime, endTime);
|
|
||||||
if(firePointEntities == null || firePointEntities.size() == 0){
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有火点数据",locale);
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale);
|
|
||||||
// 查询县
|
// 查询县
|
||||||
}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);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,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);
|
||||||
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
|
}
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
|
} 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);
|
||||||
|
if (firePointEntities == null || firePointEntities.size() == 0) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
|
||||||
|
}
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
|
} else {
|
||||||
|
// 查询县
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码修改火点状态
|
* 根据火点编码修改火点状态
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateTypeByFireCode")
|
@PostMapping("/updateTypeByFireCode")
|
||||||
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
|
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
String fireCode = (String) map.get("fireCode");
|
String fireCode = (String) map.get("fireCode");
|
||||||
String fireType = (String) map.get("fireType");
|
String fireType = (String) map.get("fireType");
|
||||||
return firePointService.updateTypeByFireCode(fireCode,fireType,token);
|
return firePointService.updateTypeByFireCode(fireCode, fireType, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交核查任务
|
* 提交核查任务
|
||||||
|
*
|
||||||
* @param files
|
* @param files
|
||||||
* @param appTaskBodyVo
|
* @param appTaskBodyVo
|
||||||
* @return
|
* @return
|
||||||
@ -165,20 +179,21 @@ public class FirePointController {
|
|||||||
public String insertAppTask(@RequestParam("files") MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException {
|
public String insertAppTask(@RequestParam("files") MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
if("".equals(appTaskBodyVo.getFireCode()) || appTaskBodyVo.getFireCode() == null){
|
if ("".equals(appTaskBodyVo.getFireCode()) || appTaskBodyVo.getFireCode() == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火点编码不能为空",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码不能为空", locale);
|
||||||
}
|
}
|
||||||
if("".equals(appTaskBodyVo.getTaskInformation()) || appTaskBodyVo.getTaskInformation() == null){
|
if ("".equals(appTaskBodyVo.getTaskInformation()) || appTaskBodyVo.getTaskInformation() == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"任务描述不能为空",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "任务描述不能为空", locale);
|
||||||
}
|
}
|
||||||
if(files == null || files.length == 0 ){
|
if (files == null || files.length == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"图片不能为空",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "图片不能为空", locale);
|
||||||
}
|
}
|
||||||
return firePointService.insertAppTask(files,appTaskBodyVo);
|
return firePointService.insertAppTask(files, appTaskBodyVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询核查的任务信息
|
* 查询核查的任务信息
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -189,110 +204,117 @@ public class FirePointController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一周的火点信息
|
* 查询近一周的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointBetweenSeven")
|
@GetMapping("/selectFirePointBetweenSeven")
|
||||||
public String selectFirePointBetweenSeven(){
|
public String selectFirePointBetweenSeven() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointBetweenSeven();
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePointBetweenSeven();
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点信息
|
* 查询近一个月的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointByMonth")
|
@GetMapping("/selectFirePointByMonth")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
||||||
public String selectFirePointByMonth(@RequestHeader(value="Authorization") String token) {
|
public String selectFirePointByMonth(@RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByMonth(sysUserEntity.getCountyCode());
|
List<FirePointEntity> firePointEntities = firePointService.selectFirePointByMonth(sysUserEntity.getCountyCode());
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询火点数量
|
* 查询火点数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointNum")
|
@GetMapping("/selectFirePointNum")
|
||||||
public String selectFirePointNum(@RequestParam("keepType") String keepType){
|
public String selectFirePointNum(@RequestParam("keepType") String keepType) {
|
||||||
// keepType为1时,查询近一天的火点数量
|
// keepType为1时,查询近一天的火点数量
|
||||||
if("1".equals(keepType)){
|
if ("1".equals(keepType)) {
|
||||||
return firePointService.selectFirePointNumDay();
|
return firePointService.selectFirePointNumDay();
|
||||||
// keepType为2时,查询近一周的火点数量
|
// keepType为2时,查询近一周的火点数量
|
||||||
}else if("2".equals(keepType)){
|
} else if ("2".equals(keepType)) {
|
||||||
return firePointService.selectFirePointNumWeek();
|
return firePointService.selectFirePointNumWeek();
|
||||||
}else {
|
} else {
|
||||||
return firePointService.selectFirePointNumMonth();
|
return firePointService.selectFirePointNumMonth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/websocketTest")
|
@GetMapping("/websocketTest")
|
||||||
public void websocketTest(@RequestParam("message") String message){
|
public void websocketTest(@RequestParam("message") String message) {
|
||||||
|
|
||||||
WebSocketServer.broadInfo(message);
|
WebSocketServer.broadInfo(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该省所有的市
|
* 查询该省所有的市
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectCityName")
|
@GetMapping("/selectCityName")
|
||||||
public String selectCityName(@RequestParam("code") String code){
|
public String selectCityName(@RequestParam("code") String code) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
if(code.substring(2).equals("0000")){
|
if (code.substring(2).equals("0000")) {
|
||||||
List<Map<String, Object>> maps = firePointService.selectCityName(code);
|
List<Map<String, Object>> maps = firePointService.selectCityName(code);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||||
}else {
|
} else {
|
||||||
List<Map<String, Object>> maps = firePointService.selectCountyName(code);
|
List<Map<String, Object>> maps = firePointService.selectCountyName(code);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码查询火点信息
|
* 根据火点编码查询火点信息
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectFirePointByCode")
|
@GetMapping("/selectFirePointByCode")
|
||||||
public String selectFirePoint(@RequestParam("fireCode") String fireCode){
|
public String selectFirePoint(@RequestParam("fireCode") String fireCode) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试添加火点信息
|
* 测试添加火点信息
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/insertFireTest")
|
@PostMapping("/insertFireTest")
|
||||||
public String insertFireTest(@RequestBody FirePointQo firePointQo){
|
public String insertFireTest(@RequestBody FirePointQo firePointQo) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FirePoint firePoint = firePointService.insertFireTest(firePointQo);
|
FirePoint firePoint = firePointService.insertFireTest(firePointQo);
|
||||||
if(firePoint == null){
|
if (firePoint == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"添加数据失败",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "添加数据失败", locale);
|
||||||
}else {
|
} else {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入全国省市区
|
* 导入全国省市区
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -302,70 +324,73 @@ public class FirePointController {
|
|||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
firePointService.importCityExcel(file);
|
firePointService.importCityExcel(file);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"导入成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "导入成功", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今天的火点信息(测试)
|
* 查询今天的火点信息(测试)
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectTodayFire")
|
@GetMapping("/selectTodayFire")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
||||||
public String selectTodayFire(@RequestParam("countyCode") String countyCode,@RequestHeader(value="Authorization") String token){
|
public String selectTodayFire(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<FirePoint> firePointEntities = firePointService.selectTodayFire(countyCode);
|
List<FirePoint> firePointEntities = firePointService.selectTodayFire(countyCode);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除水体类型的火点信息
|
* 删除水体类型的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
@PostMapping("/deleteShuiTi")
|
@PostMapping("/deleteShuiTi")
|
||||||
public String deleteShuiTi(){
|
public String deleteShuiTi() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<Integer> integers = firePointDao.selectId();
|
List<Integer> integers = firePointDao.selectId();
|
||||||
firePointDao.deleteByIdIn(integers);
|
firePointDao.deleteByIdIn(integers);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"删除成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除成功", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/selectBeijing")
|
@GetMapping("/selectBeijing")
|
||||||
public String selectBeijing(){
|
public String selectBeijing() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<FirePointEntity> firePointEntities = firePointDao.selectBeijing();
|
List<FirePointEntity> firePointEntities = firePointDao.selectBeijing();
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointEntities, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码添加火点前后的图片
|
* 根据火点编码添加火点前后的图片
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
@PostMapping("/updateBeforeFireAndAfterFireImage")
|
@PostMapping("/updateBeforeFireAndAfterFireImage")
|
||||||
public String updateBeforeFireAndAfterFireImage(@RequestBody Map map){
|
public String updateBeforeFireAndAfterFireImage(@RequestBody Map map) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String fireCode = (String) map.get("fireCode");
|
String fireCode = (String) map.get("fireCode");
|
||||||
String beforeFireImage = (String) map.get("beforeFireImage");
|
String beforeFireImage = (String) map.get("beforeFireImage");
|
||||||
String afterFireImage = (String) map.get("afterFireImage");
|
String afterFireImage = (String) map.get("afterFireImage");
|
||||||
if(fireCode == null || "".equals(fireCode)){
|
if (fireCode == null || "".equals(fireCode)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火点编码不能为空!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码不能为空!", locale);
|
||||||
}
|
}
|
||||||
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
||||||
if(byFireCode == null){
|
if (byFireCode == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火点编码错误!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码错误!", locale);
|
||||||
}
|
}
|
||||||
firePointDao.updateBeforeFireAndAfterFireImage(fireCode,beforeFireImage,afterFireImage);
|
firePointDao.updateBeforeFireAndAfterFireImage(fireCode, beforeFireImage, afterFireImage);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加图片成功!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加图片成功!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,15 +23,11 @@ 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 + "%"));
|
||||||
}
|
}
|
||||||
if (cityCode != null && !"".equals(cityCode)) {
|
if (cityCode != null && !"".equals(cityCode)) {
|
||||||
@ -44,17 +37,9 @@ 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 (startTime != null && !"".equals(startTime)) {
|
||||||
// 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));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
@ -64,48 +49,35 @@ public class Query {
|
|||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
||||||
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
||||||
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));
|
||||||
}
|
}
|
||||||
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 + "%"));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||||
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 (startTime != null && !"".equals(startTime)) {
|
||||||
// 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));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
@ -115,45 +87,32 @@ public class Query {
|
|||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
||||||
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
||||||
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));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||||
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 (startTime != null && !"".equals(startTime)) {
|
||||||
// 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));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
|
||||||
}
|
}
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
@ -163,129 +122,93 @@ public class Query {
|
|||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(30);
|
||||||
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTimes = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTimes));
|
||||||
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));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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 + "%"));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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 + "%"));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
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