From 065142057ba3983af899991085e37ac1ec502320 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 19 九月 2023 14:06:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 77 ++++++++++++++++++++++++--------------
1 files changed, 49 insertions(+), 28 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 480922a..9be6f79 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,6 +13,7 @@
import com.gps31.push.netty.client.TcpClient;
import com.gps31.push.util.MapUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.sy.service.impl.ArdSyCarDayServiceImpl;
import com.ruoyi.sy.service.impl.ArdSyCarServiceImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -74,36 +75,56 @@
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);//鏌ヨ杞﹁締鍙婇儴闂�
- gpsMap.putAll(result);
- String ancestors = (String) gpsMap.get("ancestors");//鑾峰彇鐖剁骇閮ㄩ棬
- String[] ancestorsArray = ancestors.split(",");
- if(ancestorsArray.length == 1){//鏈�楂樼骇閮ㄩ棬
- String deptId = String.valueOf(gpsMap.get("deptId"));
- Map<String,Map<String,Object>> deptMap = PositionContainer.getDeptPositionMap().get(deptId);
- if(deptMap == null){
- deptMap = new HashMap();
- }
- deptMap.put((String)gpsMap.get("carId"),gpsMap);//棣栨鍔犲叆瀹瑰櫒锛屽啀娆″幓閲�
- PositionContainer.getDeptPositionMap().put(deptId,deptMap);
- }else{
- //鍔犲叆鏈儴闂ㄥ鍣�
- String deptId = String.valueOf(gpsMap.get("deptId"));
- Map<String,Map<String,Object>> deptMap = PositionContainer.getDeptPositionMap().get(deptId);
- if(deptMap == null){
- deptMap = new HashMap();
- }
- deptMap.put((String)gpsMap.get("carId"),gpsMap);//棣栨鍔犲叆瀹瑰櫒锛屽啀娆″幓閲�
- PositionContainer.getDeptPositionMap().put(deptId,deptMap);
- //鍔犲叆鐖剁骇閮ㄩ棬瀹瑰櫒
- for(int i = 1;i <= ancestorsArray.length - 1;i++){
- String deptIdp = String.valueOf(gpsMap.get(ancestorsArray[i]));
- Map<String,Map<String,Object>> deptMapp = PositionContainer.getDeptPositionMap().get(deptIdp);
- if(deptMapp == null){
- deptMapp = new HashMap();
+ if(result != null){
+ gpsMap.putAll(result);
+ String ancestors = (String) gpsMap.get("ancestors");//鑾峰彇鐖剁骇閮ㄩ棬
+ String[] ancestorsArray = ancestors.split(",");
+ if(ancestorsArray.length == 1){//鏈�楂樼骇閮ㄩ棬
+ String deptId = String.valueOf(gpsMap.get("deptId"));
+ Map<String,Map<String,Object>> deptMap = PositionContainer.getDeptPositionMap().get(deptId);
+ if(deptMap == null){
+ deptMap = new HashMap();
+ deptMap.put((String)gpsMap.get("carId"),gpsMap);
+ PositionContainer.getDeptPositionMap().put(deptId,deptMap);
+ }else{
+ deptMap.put((String)gpsMap.get("carId"),gpsMap);
}
- deptMapp.put((String)gpsMap.get("carId"),gpsMap);//棣栨鍔犲叆瀹瑰櫒锛屽啀娆″幓閲�
- PositionContainer.getDeptPositionMap().put(deptIdp,deptMap);
+ }else{//鍏朵粬閮ㄩ棬
+ //鍔犲叆鏈儴闂ㄥ鍣�
+ String deptId = String.valueOf(gpsMap.get("deptId"));
+ Map<String,Map<String,Object>> deptMap = PositionContainer.getDeptPositionMap().get(deptId);
+ if(deptMap == null){
+ deptMap = new HashMap();
+ deptMap.put((String)gpsMap.get("carId"),gpsMap);
+ PositionContainer.getDeptPositionMap().put(deptId,deptMap);
+ }else{
+ deptMap.put((String)gpsMap.get("carId"),gpsMap);
+ }
+ //鍔犲叆鐖剁骇閮ㄩ棬瀹瑰櫒
+ for(int i = 1;i <= ancestorsArray.length - 1;i++){
+ String deptIdp = ancestorsArray[i];
+ Map<String,Map<String,Object>> deptMapp = PositionContainer.getDeptPositionMap().get(deptIdp);
+ if(deptMapp == null){
+ deptMapp = new HashMap();
+ deptMapp.put((String)gpsMap.get("carId"),gpsMap);
+ PositionContainer.getDeptPositionMap().put(deptIdp,deptMapp);
+ }else{
+ deptMapp.put((String)gpsMap.get("carId"),gpsMap);
+ }
+ }
+ }
+ //瀛樺叆鐢ㄦ埛瀹瑰櫒
+ if(PositionContainer.getUserPositionMap().size() != 0){
+ for(String userId : PositionContainer.getUserPositionMap().keySet()){
+ Map<String,Map<String,Object>> carIdCarMap = PositionContainer.getUserPositionMap().get(userId);
+ if(carIdCarMap != null){
+ if(carIdCarMap.keySet().contains(carId)){
+ PositionContainer.getUserPositionMap().get(userId).put(carId,gpsMap);
+ }
+ }
+ }
}
}
/**
--
Gitblit v1.9.3