From 0306cdeb0c80728125cbbef747f83db3a0273281 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 26 May 2022 18:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=86=E5=9C=B0=E7=90=86=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E6=97=B6=E6=9B=B4=E6=96=B0=E8=A1=97=E9=81=93=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E5=92=8C=E8=A1=97=E9=81=93=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FirePointServiceImpl.java | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index dcf2760..66418fa 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -110,33 +110,17 @@ public class FirePointServiceImpl implements FirePointService { firePointEntity.setFireImage(firePointQo.getFireImage()); firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage()); try { - bindStreetCode(firePointEntity); + bindStreetCodeName(firePointEntity); } catch (Exception e) { e.printStackTrace(); System.out.println("添加火点信息 逆地理编码请求街道编号失败:" + e.getMessage()); } log.info("-------发现新火点"); - /*log.info("---------------开始进行实时通讯,将检测到的火点传给前端"); - Map map = new HashMap(3); - map.put("countyCode",firePointQo.getCountyCode()); - map.put("countyName",firePointQo.getCountyName()); - map.put("fireCode",firePointQo.getFireCode()); - map.put("latitude",firePointQo.getLatitude()); - map.put("longitude",firePointQo.getLongitude()); - map.put("satelliteTime",DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue())); - map.put("satelliteType",firePointQo.getSatelliteType()); - map.put("addTime",DateTimeUtil.dateTimeToString(LocalDateTime.now())); - map.put("detailedAddress",AddressUtils.getLatAndLng(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString())); - Map map1 = new HashMap(3); - map1.put("fire",map); - String websocket = JSON.toJSONString(map1); - // 将监测到的火点信息返给前端 - WebSocketServer.broadInfo(websocket);*/ return firePointDao.save(firePointEntity); } } - private void bindStreetCode(FirePointEntity firePointEntity) throws Exception { + private void bindStreetCodeName(FirePointEntity firePointEntity) throws Exception { List locationList = new ArrayList<>(); locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude()); GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList); @@ -145,6 +129,10 @@ public class FirePointServiceImpl implements FirePointService { townCode = townCode.substring(0, 9); } firePointEntity.setStreetCode(townCode); + List byStreetCode = streetDao.findByStreetCode(townCode); + if (byStreetCode != null && byStreetCode.size() > 0) { + firePointEntity.setStreetName(byStreetCode.get(0).getStreetName()); + } }