From 206f44705a6048a86e41683118815984f5b277a1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Fri, 30 Jul 2021 08:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E7=81=AB=E7=82=B9=E7=BC=96=E7=A0=81=E6=9F=A5=E8=AF=A2=E7=81=AB?= =?UTF-8?q?=E7=82=B9=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/common/config/WebSecurityConfig.java | 1 + .../xkrs/controller/FirePointController.java | 17 +++++++++++++++++ .../xkrs/service/impl/FirePointServiceImpl.java | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 6f4958e..2742346 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -51,6 +51,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET,"/websocketTest").permitAll() .antMatchers(HttpMethod.GET,"/selectCityName").permitAll() .antMatchers(HttpMethod.GET,"/weather/cityName").permitAll() + .antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll() // 所有其它请求需要身份认证 .anyRequest().authenticated() .and() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index a086260..8e9cab5 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -2,6 +2,7 @@ package com.xkrs.controller; import com.xkrs.common.encapsulation.PromptMessageEnum; import com.xkrs.common.tool.TokenUtil; +import com.xkrs.dao.FirePointDao; import com.xkrs.dao.SysUserDao; import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.SysUserEntity; @@ -34,6 +35,9 @@ public class FirePointController { @Resource private SysUserDao sysUserDao; + @Resource + private FirePointDao firePointDao; + /** * 添加火点数据 * @param firePointQo @@ -225,4 +229,17 @@ public class FirePointController { List> maps = firePointService.selectCityName(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale); } + + /** + * 根据火点编码查询火点信息 + * @param fireCode + * @return + */ + @GetMapping("/selectFirePoint") + public String selectFirePoint(@RequestParam("fireCode") String fireCode){ + // 获取区域信息 + Locale locale = LocaleContextHolder.getLocale(); + FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode,locale); + } } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 88c1756..fd9303c 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -86,7 +86,7 @@ public class FirePointServiceImpl implements FirePointService { firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); firePointEntity.setFireType("0"); log.info("-------发现新火点"); - log.info("---------------开始进行实时通讯,将检测到的火点传给前端"); + /*log.info("---------------开始进行实时通讯,将检测到的火点传给前端"); Map map = new HashMap(3); map.put("countyCode",firePointQo.getCountyCode()); map.put("countyName",firePointQo.getCountyName()); @@ -101,7 +101,7 @@ public class FirePointServiceImpl implements FirePointService { map1.put("fire",map); String websocket = JSON.toJSONString(map1); // 将监测到的火点信息返给前端 - WebSocketServer.broadInfo(websocket); + WebSocketServer.broadInfo(websocket);*/ return firePointDao.save(firePointEntity); }