From cf695c6db30c07e2ea9783f31660936787f67eb9 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期六, 21 十月 2023 14:06:56 +0800
Subject: [PATCH] 推送入栏
---
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
index 9be6f79..cf6e07b 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
@@ -13,15 +13,16 @@
import com.gps31.push.netty.client.TcpClient;
import com.gps31.push.util.MapUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.sy.domain.ArdOilWall;
+import com.ruoyi.sy.service.impl.ArdOilWallServiceImpl;
import com.ruoyi.sy.service.impl.ArdSyCarDayServiceImpl;
import com.ruoyi.sy.service.impl.ArdSyCarServiceImpl;
+import com.ruoyi.utils.gps.GeoTools;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.awt.geom.Point2D;
+import java.util.*;
/**
* <p>Description: </p>
@@ -72,12 +73,37 @@
Map<String,Object> gpsMap = pushMsg.getJsonMap();
/*String carName = MapUtil.getStrVal(gpsMap, "carName","");//鑾峰彇杞︾墝鍙�
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- System.out.println(sdf.format(new Date()));
- log.error(String.format(" ---->鏀跺埌瀹氫綅鏁版嵁:%s",JSON.toJSONString(gpsMap)));*/
+ System.out.println(sdf.format(new Date()));*/
+// log.error(String.format(" ---->鏀跺埌瀹氫綅鏁版嵁:%s",JSON.toJSONString(gpsMap)));
String carId = (String)gpsMap.get("carId");
((ArdSyCarDayServiceImpl)SpringUtils.getBean("ardSyCarDayServiceImpl")).insertArdSyCarDay(carId);//鏂板杞﹁締涓婃姤鏃堕棿
Map<String,Object> result = ((ArdSyCarServiceImpl)SpringUtils.getBean("ardSyCarServiceImpl")).getArdSyCarAndDeptByCarId(carId);//鏌ヨ杞﹁締鍙婇儴闂�
+// log.error("---------------------"+result);
if(result != null){
+ //娓呮筏瀹氫綅
+ String lng = (String) gpsMap.get("lng");//鑾峰彇缁忓害
+ String lat = (String) gpsMap.get("lat");//鑾峰彇绾害
+ String carName = (String) gpsMap.get("carName");//鑾峰彇杞︾墝鍙�
+ String time = (String) gpsMap.get("result");//瀹氫綅鏃堕棿
+ String deptNum = (String) result.get("deptId");//鑾峰彇閮ㄩ棬ID
+ String deptName = (String) result.get("deptName");//鑾峰彇閮ㄩ棬鍚嶇О
+ //瀹氫箟2缁寸┖闂�
+ Point2D.Double point = new Point2D.Double(Double.parseDouble(lng), Double.parseDouble(lat));
+ List<Point2D.Double> pts = new ArrayList<Point2D.Double>();
+ //鍖归厤鍏ㄩ儴鍥存爮
+ List<ArdOilWall> ardOilWalls = ((ArdOilWallServiceImpl)SpringUtils.getBean("ArdOilWallServiceImpl")).all();
+ for (int i = 0; i < ardOilWalls.size(); i++) {
+ pts.clear();
+ ArdOilWall ardOilWall = ardOilWalls.get(i);
+ String[] coord = ardOilWall.getCoord().split(",");
+ for (int j = 0; j < coord.length; j = j + 3) {
+ pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j+1])));
+ }
+ if(GeoTools.IsPtInPoly(point, pts)){
+ //杩涘叆浜嗗洿鏍忓叆搴�
+
+ }
+ }
gpsMap.putAll(result);
String ancestors = (String) gpsMap.get("ancestors");//鑾峰彇鐖剁骇閮ㄩ棬
String[] ancestorsArray = ancestors.split(",");
--
Gitblit v1.9.3