From 7a88b4f8dffff5e644665dda868329f57029a6a5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Wed, 29 Sep 2021 08:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=9F=A5=E8=AF=A2=E4=BB=8A=E6=97=A5?= =?UTF-8?q?=E7=81=AB=E7=82=B9=E4=BF=A1=E6=81=AF=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 9 ++------ .../com/xkrs/controller/FileController.java | 2 -- .../xkrs/controller/FirePointController.java | 17 ++++++++++++++ .../xkrs/controller/SysUserController.java | 10 --------- src/main/java/com/xkrs/dao/FireDao.java | 22 +++++++++++++++++++ src/main/java/com/xkrs/dao/NationwideDao.java | 2 +- .../com/xkrs/service/FirePointService.java | 7 ++++++ .../impl/FireAndRangerServiceImpl.java | 2 -- .../service/impl/FirePointServiceImpl.java | 21 ++++++++++++++++++ 9 files changed, 70 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index e959735..fb6b868 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,11 @@ org.springframework.boot spring-boot-starter-parent 2.4.1 - + com.xkrs fire_point - 0.0.1-SNAPSHOT + 0.0.1 fire_point 火点项目 @@ -206,11 +206,6 @@ aliyun-java-sdk-core 4.0.6 - com.aliyun aliyun-java-sdk-dysmsapi diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index 9fbf6a7..e1b7cba 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -67,7 +67,6 @@ public class FileController { filePath.setScene(map.get("scene")); filePathDao.save(filePath); } - //List> path = filePathDao.findPath(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "上传成功!", locale); } @@ -100,7 +99,6 @@ public class FileController { filePath.setMd5(map.get("md5")); filePath.setScene(map.get("scene")); filePathDao.save(filePath); - //List> path = filePathDao.findPath(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "上传成功!", locale); } diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 4968751..41d88bb 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -307,4 +307,21 @@ public class FirePointController { firePointService.importCityExcel(file); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"导入成功",locale); } + + /** + * 查询今天的火点信息(测试) + * @param token + * @return + */ + @GetMapping("/selectTodayFire") + @PreAuthorize("hasAnyAuthority('auth_general_user')") + public String selectTodayFire(@RequestParam("countyCode") String countyCode,@RequestHeader(value="Authorization") String token){ + // 获取区域信息 + Locale locale = LocaleContextHolder.getLocale(); + List firePointEntities = firePointService.selectTodayFire(countyCode); + if(firePointEntities == null || firePointEntities.size() == 0){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有火点数据",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale); + } } diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index f711c79..b2a7e52 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -86,16 +86,6 @@ public class SysUserController { return sysUserService.addUser(userQo); } - - /*@RequestMapping(value="/get/all", method = RequestMethod.GET) - @PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')") - public String getAllSysUser(){ - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); - Iterable sysUserDtoList = sysUserService.getAllSysUser(); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserDtoList,locale); - }*/ - /** * 软删除指定id的普通用户 * @param id diff --git a/src/main/java/com/xkrs/dao/FireDao.java b/src/main/java/com/xkrs/dao/FireDao.java index 4b60f4e..8a1117c 100644 --- a/src/main/java/com/xkrs/dao/FireDao.java +++ b/src/main/java/com/xkrs/dao/FireDao.java @@ -1,13 +1,35 @@ package com.xkrs.dao; import com.xkrs.model.entity.FirePoint; +import com.xkrs.model.entity.FirePointEntity; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; +import java.util.List; + /** * @author XinYi Song */ @Component public interface FireDao extends JpaRepository { + /** + * 查询今天的火点信息 + * @param addTime + * @param address + * @return + */ + @Query(value = "select * from fire where add_time like CONCAT('%',:addTime,'%') and fire_point_address like CONCAT('%',:address,'%')",nativeQuery = true) + List selectTodayFire(String addTime, String address); + + /** + * 区县条件查询今天火点信息 + * @param addTime + * @param countyCode + * @return + */ + @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%') and county_code = :countyCode",nativeQuery = true) + List selectTodayFireOne(String addTime,String countyCode); + } diff --git a/src/main/java/com/xkrs/dao/NationwideDao.java b/src/main/java/com/xkrs/dao/NationwideDao.java index bf064aa..f429328 100644 --- a/src/main/java/com/xkrs/dao/NationwideDao.java +++ b/src/main/java/com/xkrs/dao/NationwideDao.java @@ -19,7 +19,7 @@ public interface NationwideDao extends JpaRepository { * @param proCode * @return */ - @Query(value = "select city_name,city_code from nationwide where pro_code = ?",nativeQuery = true) + @Query(value = "select DISTINCT city_name,city_code from nationwide where pro_code = ?",nativeQuery = true) List> findCityByProCode(String proCode); /** diff --git a/src/main/java/com/xkrs/service/FirePointService.java b/src/main/java/com/xkrs/service/FirePointService.java index 6b72119..d2b668f 100644 --- a/src/main/java/com/xkrs/service/FirePointService.java +++ b/src/main/java/com/xkrs/service/FirePointService.java @@ -150,4 +150,11 @@ public interface FirePointService { * @throws Exception */ void importCityExcel(MultipartFile file) throws Exception; + + /** + * 查询今日火点信息(测试) + * @param countyCode + * @return + */ + List selectTodayFire(String countyCode); } diff --git a/src/main/java/com/xkrs/service/impl/FireAndRangerServiceImpl.java b/src/main/java/com/xkrs/service/impl/FireAndRangerServiceImpl.java index 694d69c..787b85f 100644 --- a/src/main/java/com/xkrs/service/impl/FireAndRangerServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FireAndRangerServiceImpl.java @@ -86,8 +86,6 @@ public class FireAndRangerServiceImpl implements FireAndRangerService { String content = JSON.toJSONString(map); String ss = URLEncoder.encode(content,"utf-8"); - //String url = "https://api.xmpush.xiaomi.com/v3/message/alias?title=收到消息&description=请"+rangerName+ "去核查该火点信息&payload="+content+"&restricted_package_name=com.xkrs.fieldverification¬ify_id=1&extra.notify_effect=2&extra.intent_uri=fieldverify://xkrs.com&alias="+rangerName; - String url = "https://api.xmpush.xiaomi.com/v3/message/alias?title=收到消息&description=请"+verifier+"去核查该火点信息&payload="+ss+"&restricted_package_name=com.xkrs.fieldverification¬ify_id=2&extra.notify_effect=2&extra.intent_uri=fieldverify://xkrs.com&alias="+rangerName+"&extra.notify_foreground=0&extra.channel_id=mipush"; String time = DateTimeUtil.dateTimeToString(LocalDateTime.now()); diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 2723407..585bd86 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -485,4 +485,25 @@ public class FirePointServiceImpl implements FirePointService { //批量添加到订单详情 nationwideDao.saveAll(orderDetails); } + + /** + * 查询今日的火点信息(测试) + * @param countyCode + * @return + */ + @Override + public List selectTodayFire(String countyCode) { + String addTime = DateTimeUtil.dateToString(LocalDate.now()); + if("0000".equals(countyCode.substring(2))){ + List byProCode = cityDao.findByProCode(countyCode); + String proName = byProCode.get(0).getProName(); + return fireDao.selectTodayFire(addTime,proName); + }else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){ + List byCityCode = countyDao.findByCityCode(countyCode); + String cityName = byCityCode.get(0).getCityName(); + return fireDao.selectTodayFire(addTime,cityName); + }else { + return fireDao.selectTodayFireOne(addTime,countyCode); + } + } }