添加了根据火点编码查询火点信息的接口

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-07-30 08:29:00 +08:00
parent 2cebe20881
commit 206f44705a
3 changed files with 20 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET,"/websocketTest").permitAll() .antMatchers(HttpMethod.GET,"/websocketTest").permitAll()
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll() .antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
.antMatchers(HttpMethod.GET,"/weather/cityName").permitAll() .antMatchers(HttpMethod.GET,"/weather/cityName").permitAll()
.antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll()
// 所有其它请求需要身份认证 // 所有其它请求需要身份认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()

View File

@ -2,6 +2,7 @@ package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum; import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.common.tool.TokenUtil; import com.xkrs.common.tool.TokenUtil;
import com.xkrs.dao.FirePointDao;
import com.xkrs.dao.SysUserDao; import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.entity.SysUserEntity; import com.xkrs.model.entity.SysUserEntity;
@ -34,6 +35,9 @@ public class FirePointController {
@Resource @Resource
private SysUserDao sysUserDao; private SysUserDao sysUserDao;
@Resource
private FirePointDao firePointDao;
/** /**
* 添加火点数据 * 添加火点数据
* @param firePointQo * @param firePointQo
@ -225,4 +229,17 @@ public class FirePointController {
List<Map<String, Object>> maps = firePointService.selectCityName(); List<Map<String, Object>> maps = firePointService.selectCityName();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale); 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);
}
} }

View File

@ -86,7 +86,7 @@ public class FirePointServiceImpl implements FirePointService {
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
firePointEntity.setFireType("0"); firePointEntity.setFireType("0");
log.info("-------发现新火点"); log.info("-------发现新火点");
log.info("---------------开始进行实时通讯,将检测到的火点传给前端"); /*log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
Map map = new HashMap(3); Map map = new HashMap(3);
map.put("countyCode",firePointQo.getCountyCode()); map.put("countyCode",firePointQo.getCountyCode());
map.put("countyName",firePointQo.getCountyName()); map.put("countyName",firePointQo.getCountyName());
@ -101,7 +101,7 @@ public class FirePointServiceImpl implements FirePointService {
map1.put("fire",map); map1.put("fire",map);
String websocket = JSON.toJSONString(map1); String websocket = JSON.toJSONString(map1);
// 将监测到的火点信息返给前端 // 将监测到的火点信息返给前端
WebSocketServer.broadInfo(websocket); WebSocketServer.broadInfo(websocket);*/
return firePointDao.save(firePointEntity); return firePointDao.save(firePointEntity);
} }