From fb85b1053475a90d902f1dcfd1f1c24b368eabac Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期四, 17 八月 2023 14:58:21 +0800
Subject: [PATCH] 增加一件调度获取附近车人相机
---
ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java | 3
ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java | 8
ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java | 8
ruoyi-admin/src/main/resources/logback.xml | 19 +
ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java | 54 +++
ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java | 21 +
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 60 +++
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 6
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 54 +++
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 622 ++++++++++++++++++++++++-----------------
ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml | 1
11 files changed, 590 insertions(+), 266 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java b/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
index 1abb135..c594b93 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
@@ -46,8 +46,7 @@
private IArdAppPositionService ardAppPositionService;
@Autowired
private ISysUserService sysUserService;
- @Autowired
- private RongCloudService rongCloudService;
+
/**
* 鏌ヨapp浣嶇疆鍒楄〃
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
index 05640d8..6952476 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
@@ -2,6 +2,8 @@
import java.util.List;
import com.ruoyi.app.position.domain.ArdAppPosition;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.scheduling.domian.SchedulingParam;
/**
@@ -65,4 +67,10 @@
* @return 缁撴灉
*/
public int deleteArdAppPositionById(String id);
+ /**
+ * 鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ public List<SysUser>getNearAppUsers(SchedulingParam param);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
index 5fa11ea..e6ea43b 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
@@ -3,12 +3,17 @@
import com.ruoyi.app.position.domain.ArdAppPosition;
import com.ruoyi.app.position.mapper.ArdAppPositionMapper;
import com.ruoyi.app.position.service.IArdAppPositionService;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.tools.GisTool;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -17,6 +22,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
@@ -26,10 +32,12 @@
* @date 2023-07-18
*/
@Service
+@Slf4j
public class ArdAppPositionServiceImpl implements IArdAppPositionService {
@Resource
private ArdAppPositionMapper ardAppPositionMapper;
-
+ @Resource
+ private ISysUserService iSysUserService;
/**
* 鏌ヨapp浣嶇疆
@@ -41,6 +49,7 @@
public ArdAppPosition selectArdAppPositionById(String id) {
return ardAppPositionMapper.selectArdAppPositionById(id);
}
+
/**
* 鎸夌敤鎴穒d鏌ヨ鏈�鍚庣殑浣嶇疆淇℃伅
*
@@ -48,9 +57,10 @@
* @return app浣嶇疆
*/
@Override
- public ArdAppPosition selectLastArdAppPositionByUserId(String userId){
+ public ArdAppPosition selectLastArdAppPositionByUserId(String userId) {
return ardAppPositionMapper.selectLastArdAppPositionByUserId(userId);
}
+
/**
* 鏌ヨapp浣嶇疆鍒楄〃
*
@@ -108,4 +118,50 @@
return ardAppPositionMapper.deleteArdAppPositionById(id);
}
+ /**
+ * 鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ @Override
+ public List<SysUser> getNearAppUsers(SchedulingParam param) {
+ Double longitude = param.getLongitude();
+ Double latitude = param.getLatitude();
+ if (longitude == null && latitude == null) {
+ log.debug("鍘熺偣鍧愭爣涓虹┖");
+ return null;
+ }
+ Integer radius = param.getSealingRadius();
+
+ if (radius == null) {
+ log.debug("鍗婂緞璺濈涓虹┖");
+ return null;
+ }
+
+ SysUser user = new SysUser();
+ List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user);
+ //杩囨护鍦ㄧ嚎
+ List<SysUser> onLineList = appUserList.stream()
+ .filter(sysUser -> (sysUser.getAppOnlineState().equals("0")))
+ .collect(Collectors.toList());
+ //杩囨护鑼冨洿
+ List<SysUser> filteredList = new ArrayList<>();
+ for(SysUser sysUser:onLineList) {
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.selectLastArdAppPositionByUserId(sysUser.getUserId());
+ if (ardAppPosition != null) {
+ Double lon = ardAppPosition.getLongitude();
+ Double lat = ardAppPosition.getLatitude();
+ if(longitude==null||latitude==null)
+ {
+ continue;
+ }
+ double distance = GisTool.getDistance(new double[]{ longitude, latitude}, new double[]{ lon, lat});
+ if (distance <= radius) {
+ filteredList.add(sysUser); // 灏嗘弧瓒虫潯浠剁殑鐢ㄦ埛娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ }
+ }
+ return filteredList;
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
index 268ca44..4236c78 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
@@ -7,6 +7,7 @@
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.scheduling.domian.SchedulingParam;
/**
* 鐩告満璁惧Service鎺ュ彛
@@ -83,4 +84,11 @@
public TreeMap getNearCamerasBycoordinate(CameraCmd cmd);
+
+ /**
+ * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ List<ArdCameras> getNearCameras(SchedulingParam param);
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
index 7a1a5be..85cf727 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -2,6 +2,7 @@
import java.time.LocalTime;
import java.util.*;
+import java.util.stream.Collectors;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
@@ -11,6 +12,7 @@
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.hiksdk.common.GlobalVariable;
+import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.utils.tools.ArdTool;
import com.ruoyi.device.camera.domain.ArdCameras;
@@ -19,6 +21,7 @@
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.utils.tools.GisTool;
+import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -137,10 +140,8 @@
@Override
public int deleteArdCamerasByIds(String[] ids) {
int res = ardCamerasMapper.deleteArdCamerasByIds(ids);
- if(res>0)
- {
- for(String id:ids)
- {
+ if (res > 0) {
+ for (String id : ids) {
redisCache.deleteObject(getCacheKey(id));
}
}
@@ -260,5 +261,50 @@
return null;
}
+ /**
+ * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:57:21
+ */
+ @Override
+ public List<ArdCameras> getNearCameras(SchedulingParam param) {
+ try {
+ Double longitude = param.getLongitude();
+ Double latitude = param.getLatitude();
+ if (longitude == null && latitude == null) {
+ log.debug("鍘熺偣鍧愭爣涓虹┖");
+ return null;
+ }
+ Integer radius = param.getMonitoringRadius();
+ if (radius == null) {
+ log.debug("鐩戞帶鍦堝崐寰勮窛绂讳负绌�");
+ return null;
+ }
+ String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
+ //鑾峰彇鎵�鏈夊厜鐢�
+ List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(new ArdCameras());
+ //缁熻鎵�鏈夊厜鐢靛彲瑙嗚寖鍥村唴涓庢姤璀︾偣鐨勮窛绂�
+ List<ArdCameras> ardCameras = new ArrayList<>();
+ for (ArdCameras camera : ardCamerasList) {
+ if (camera.getLongitude() == null && camera.getLatitude() == null) {
+ continue;
+ }
+ double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()};
+ double distance = GisTool.getDistance(new double[]{longitude, latitude}, camPosition);
+ if (distance <= radius) {
+ camera.setChannel(ArdTool.getChannelBydayNightTime(dayNightTime));
+ ardCameras.add(camera);
+ }
+ }
+ //杩囨护鍦ㄧ嚎鐩告満
+ List<ArdCameras> onlineList = ardCameras.stream()
+ .filter(ardCamera -> (!ardCamera.getLoginId().equals(-1)))
+ .collect(Collectors.toList());
+ return onlineList;
+ } catch (Exception ex) {
+ log.error("鑾峰彇闄勮繎鐩告満寮傚父:" + ex.getMessage());
+ }
+ return null;
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java b/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java
new file mode 100644
index 0000000..63029af
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java
@@ -0,0 +1,54 @@
+package com.ruoyi.scheduling.controller;
+
+import com.ruoyi.app.position.service.IArdAppPositionService;
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.device.camera.domain.ArdCameras;
+import com.ruoyi.device.camera.service.IArdCamerasService;
+import com.ruoyi.scheduling.domian.SchedulingParam;
+import com.ruoyi.sy.service.IArdSyCarService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @ClassName: SchedulingController
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�08鏈�17鏃�11:05:59
+ * @Version: 1.0
+ **/
+@RestController
+@RequestMapping("/scheduling")
+@Api(tags = "涓�閿皟搴�")
+public class SchedulingController {
+ @Resource
+ IArdSyCarService iArdSyCarService;
+ @Resource
+ IArdCamerasService iArdCamerasService;
+ @Resource
+ IArdAppPositionService iArdAppPositionService;
+
+ @GetMapping("/getNearVehiPersonCam")
+ @ApiOperation("鑾峰彇闄勮繎鐨勮溅浜虹浉鏈�")
+ AjaxResult getNearVehiPersonCam(SchedulingParam param) {
+ Map<String, Object> nearMap = new HashMap<>();
+
+ List<Map<String, Object>> Cars = iArdSyCarService.getNearCar(param);
+ nearMap.put("car", Cars);
+ List<ArdCameras> Cameras = iArdCamerasService.getNearCameras(param);
+ nearMap.put("camera", Cameras);
+ List<SysUser> AppUsers = iArdAppPositionService.getNearAppUsers(param);
+ nearMap.put("users", AppUsers);
+
+ return AjaxResult.success(nearMap);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java b/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java
new file mode 100644
index 0000000..9b911d5
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java
@@ -0,0 +1,21 @@
+package com.ruoyi.scheduling.domian;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Description:
+ * @ClassName: RequestParam
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�08鏈�17鏃�13:16:25
+ * @Version: 1.0
+ **/
+@Data
+public class SchedulingParam {
+
+ Integer sealingRadius;
+ Integer monitoringRadius;
+ Double longitude;
+ Double latitude;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index 247a4b9..4b7a002 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Map;
+import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.sy.domain.ArdSyCar;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.utils.result.Results;
@@ -134,5 +135,8 @@
* 鏍规嵁鏃堕棿鍙婅溅杈嗕富閿煡璇㈣鏈堟瘡澶╂槸鍚︽湁杞ㄨ抗
*/
public Results getExistTraceByCarIdAndMonth(String userId,String carId,String time);
-
+ /**
+ * 鑾峰彇闄勮繎鑼冨洿鍐呯殑杞﹁締淇℃伅
+ * */
+ List<Map<String, Object>> getNearCar(SchedulingParam param);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index a57558f..1d57773 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -13,9 +13,13 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.sy.domain.ArdSyCarDay;
import com.ruoyi.sy.mapper.ArdSyCarDayMapper;
+import com.ruoyi.utils.tools.GisTool;
import com.ruoyi.utils.websocket.util.WebSocketUtils;
import com.ruoyi.device.hiksdk.config.MinioClientSingleton;
import com.ruoyi.storage.minio.utils.MinioUtils;
@@ -33,6 +37,7 @@
import io.minio.Result;
import io.minio.http.Method;
import io.minio.messages.Item;
+import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@@ -55,6 +60,7 @@
* @date 2023-06-26
*/
@Service
+@Slf4j(topic = "sy")
public class ArdSyCarServiceImpl implements IArdSyCarService {
@Resource
private ArdSyCarMapper ardSyCarMapper;
@@ -70,13 +76,14 @@
@Resource
private SYClient sYClient;
-
+ @Resource
+ RedisCache redisCache;
@Resource
private ArdSyCarDayMapper ardSyCarDayMapper;
- private Map<Integer,Map<String,String>> logInMap = new HashMap();
+ private Map<Integer, Map<String, String>> logInMap = new HashMap();
- private Map<String, Timer> userCarTimerMap = new HashMap();
+ private Map<String, Timer> userCarTimerMap = new HashMap();
/**
* 鏌ヨ涓変竴杞﹁締
@@ -108,7 +115,7 @@
*/
@Override
public int insertArdSyCar(ArdSyCar ardSyCar) {
- return ardSyCarMapper.insertArdSyCar(ardSyCar);
+ return ardSyCarMapper.insertArdSyCar(ardSyCar);
}
/**
@@ -132,8 +139,8 @@
public int deleteArdSyCarByIds(String[] ids) {
List<ArdSyCar> result = ardSyCarMapper.selectArdSyCarByIds(ids);
List<String> objectNames = new ArrayList();
- for(ArdSyCar ardSyCar : result){
- if(ardSyCar.getCarPicture() != null && !ardSyCar.getCarPicture().equals("")){
+ for (ArdSyCar ardSyCar : result) {
+ if (ardSyCar.getCarPicture() != null && !ardSyCar.getCarPicture().equals("")) {
objectNames.add(ardSyCar.getCarPicture().split("/sycar/")[1]);
}
}
@@ -156,54 +163,54 @@
* 鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締
*/
@Override
- public Map<String,Object> getArdSyCarNoRight(String userId) {
+ public Map<String, Object> getArdSyCarNoRight(String userId) {
SysConfig config = new SysConfig();
config.setConfigKey("syCarPT");
List<SysConfig> sysConfigResult = sysConfigMapper.selectConfigList(config);
String syURL = "";
- Map<String,Object> result = new HashMap();
- if(sysConfigResult.size() == 0){
- result.put("data","涓変竴杞﹁締url娌℃湁褰曞叆");
- result.put("code","500");
+ Map<String, Object> result = new HashMap();
+ if (sysConfigResult.size() == 0) {
+ result.put("data", "涓変竴杞﹁締url娌℃湁褰曞叆");
+ result.put("code", "500");
return result;
- }else{
+ } else {
syURL = sysConfigResult.get(0).getConfigValue();
ArdSyUser ardSyUserPara = new ArdSyUser();
ardSyUserPara.setSysUserId(userId);
List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(ardSyUserPara);
- if(ardSyUserList.size() == 0){
- result.put("data","鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
- result.put("code","500");
+ if (ardSyUserList.size() == 0) {
+ result.put("data", "鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
+ result.put("code", "500");
return result;
- }else{
+ } else {
ArdSyUser ardSyUser = ardSyUserList.get(0);
//Map<String,Object> LogInResult = SYCarClient.logIn(syURL,ardSyUser.getUserId(), ardSyUser.getPassword());
String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword());
- Map<String,Object> LogInResult = sYClient.logIn(syURL,passwordMd5,ardSyUser.getUserId());
+ Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, ardSyUser.getUserId());
String sessionId = (String) LogInResult.get("sessionId");
//Map<String,Object> carListMap = SYCarClient.getCarList(syURL,sessionId);
- Map<String,Object> carListMap = sYClient.getCarList(syURL,sessionId);
- if(((String)carListMap.get("rspCode")).equals("1")){
- List<Map<String,Object>> list = (List<Map<String,Object>>) carListMap.get("list");
+ Map<String, Object> carListMap = sYClient.getCarList(syURL, sessionId);
+ if (((String) carListMap.get("rspCode")).equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) carListMap.get("list");
ArdSyCar ardSyCar = new ArdSyCar();
List<ArdSyCar> ardSyCarList = ardSyCarMapper.selectArdSyCarList(ardSyCar);
List<String> carIdList = new ArrayList();
- for(ArdSyCar innerArdSyCar : ardSyCarList){
+ for (ArdSyCar innerArdSyCar : ardSyCarList) {
carIdList.add(innerArdSyCar.getCarId());
}
- List<Map<String,Object>> carList = list.stream().filter(new Predicate<Map<String,Object>>(){
+ List<Map<String, Object>> carList = list.stream().filter(new Predicate<Map<String, Object>>() {
@Override
- public boolean test(Map<String,Object> map) {
- return !carIdList.contains((String)map.get("carId"));
+ public boolean test(Map<String, Object> map) {
+ return !carIdList.contains((String) map.get("carId"));
}
}).collect(Collectors.toList());
- result.put("data",carList);
- result.put("code","200");
+ result.put("data", carList);
+ result.put("code", "200");
return result;
- }else{
- result.put("data","涓変竴杞﹁締骞冲彴鍑洪敊");
- result.put("code","500");
+ } else {
+ result.put("data", "涓変竴杞﹁締骞冲彴鍑洪敊");
+ result.put("code", "500");
return result;
}
}
@@ -216,36 +223,36 @@
config.setConfigKey("syCarPT");
List<SysConfig> sysConfigResult = sysConfigMapper.selectConfigList(config);
String syURL = "";
- Map<String,Object> result = new HashMap();
- if(sysConfigResult.size() == 0){
- result.put("data","涓変竴杞﹁締url娌℃湁褰曞叆");
- result.put("code","500");
+ Map<String, Object> result = new HashMap();
+ if (sysConfigResult.size() == 0) {
+ result.put("data", "涓変竴杞﹁締url娌℃湁褰曞叆");
+ result.put("code", "500");
return result;
- }else{
+ } else {
syURL = sysConfigResult.get(0).getConfigValue();
ArdSyUser ardSyUserPara = new ArdSyUser();
ardSyUserPara.setSysUserId(userId);
List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(ardSyUserPara);
- if(ardSyUserList.size() == 0){
- result.put("data","鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
- result.put("code","500");
+ if (ardSyUserList.size() == 0) {
+ result.put("data", "鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
+ result.put("code", "500");
return result;
- }else{
+ } else {
ArdSyUser ardSyUser = ardSyUserList.get(0);
//Map<String,Object> LogInResult = SYCarClient.logIn(syURL,ardSyUser.getUserId(), ardSyUser.getPassword());
String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword());
- Map<String,Object> LogInResult = sYClient.logIn(syURL,passwordMd5,ardSyUser.getUserId());
+ Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, ardSyUser.getUserId());
String sessionId = (String) LogInResult.get("sessionId");
//Map<String,Object> carListMap = SYCarClient.getCarList(syURL,sessionId);
- Map<String,Object> carListMap = sYClient.getCarList(syURL,sessionId);
- if(((String)carListMap.get("rspCode")).equals("1")){
- List<Map<String,Object>> list = (List<Map<String,Object>>) carListMap.get("list");
- result.put("data",list);
- result.put("code","200");
+ Map<String, Object> carListMap = sYClient.getCarList(syURL, sessionId);
+ if (((String) carListMap.get("rspCode")).equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) carListMap.get("list");
+ result.put("data", list);
+ result.put("code", "200");
return result;
- }else{
- result.put("data","涓変竴杞﹁締骞冲彴鍑洪敊");
- result.put("code","500");
+ } else {
+ result.put("data", "涓変竴杞﹁締骞冲彴鍑洪敊");
+ result.put("code", "500");
return result;
}
}
@@ -253,30 +260,54 @@
}
@Override
- public List<Map<String,String>> getAllCarModel() {
+ public List<Map<String, String>> getAllCarModel() {
boolean exsit = MinioUtils.exitsBucket("sycar");
if (exsit) {
- List<Map<String,String>> listObjetcName = new ArrayList<>();
+ List<Map<String, String>> listObjetcName = new ArrayList<>();
try {
ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder().prefix("carmodel/").bucket("sycar").build();
Iterable<Result<Item>> myObjects = MinioClientSingleton.getMinioClient().listObjects(listObjectsArgs);
for (Result<Item> result : myObjects) {
Item item = result.get();
- Map<String,String> map = new HashMap();
- map.put("carModel","sycar/" + item.objectName());
- switch(item.objectName()){
- case "carmodel/aodi.glb":map.put("carType","濂ヨ开");break;
- case "carmodel/baolai.glb":map.put("carType","瀹濇潵");break;
- case "carmodel/bieke.glb":map.put("carType","鍒厠");break;
- case "carmodel/bus1.glb":map.put("carType","澶у杞�");break;
- case "carmodel/car.glb":map.put("carType","灏忓瀷杞�");break;
- case "carmodel/fire(1).glb":map.put("carType","娑堥槻杞�");break;
- case "carmodel/fute.glb":map.put("carType","绂忕壒");break;
- case "carmodel/jingche_a.glb":map.put("carType","璀﹁溅");break;
- case "carmodel/jiuhu.glb":map.put("carType","鏁戞姢杞�");break;
- case "carmodel/oil.glb":map.put("carType","娌圭綈杞�");break;
- case "carmodel/truck.glb":map.put("carType","宸ョ▼鐢ㄨ溅");break;
- case "carmodel/van1.glb":map.put("carType","澶ц揣杞�");break;
+ Map<String, String> map = new HashMap();
+ map.put("carModel", "sycar/" + item.objectName());
+ switch (item.objectName()) {
+ case "carmodel/aodi.glb":
+ map.put("carType", "濂ヨ开");
+ break;
+ case "carmodel/baolai.glb":
+ map.put("carType", "瀹濇潵");
+ break;
+ case "carmodel/bieke.glb":
+ map.put("carType", "鍒厠");
+ break;
+ case "carmodel/bus1.glb":
+ map.put("carType", "澶у杞�");
+ break;
+ case "carmodel/car.glb":
+ map.put("carType", "灏忓瀷杞�");
+ break;
+ case "carmodel/fire(1).glb":
+ map.put("carType", "娑堥槻杞�");
+ break;
+ case "carmodel/fute.glb":
+ map.put("carType", "绂忕壒");
+ break;
+ case "carmodel/jingche_a.glb":
+ map.put("carType", "璀﹁溅");
+ break;
+ case "carmodel/jiuhu.glb":
+ map.put("carType", "鏁戞姢杞�");
+ break;
+ case "carmodel/oil.glb":
+ map.put("carType", "娌圭綈杞�");
+ break;
+ case "carmodel/truck.glb":
+ map.put("carType", "宸ョ▼鐢ㄨ溅");
+ break;
+ case "carmodel/van1.glb":
+ map.put("carType", "澶ц揣杞�");
+ break;
default:
break;
}
@@ -292,10 +323,10 @@
@Override
public String uploadCarPicture(String id, MultipartFile carPicture) {
- if(id != null && !id.equals("")){//id涓洪潪蹇呰
+ if (id != null && !id.equals("")) {//id涓洪潪蹇呰
ArdSyCar ardSyCarr = ardSyCarMapper.selectArdSyCarById(id);
List<String> objectNames = new ArrayList();
- if(ardSyCarr.getCarPicture() != null || !ardSyCarr.getCarPicture().equals("")){
+ if (ardSyCarr.getCarPicture() != null || !ardSyCarr.getCarPicture().equals("")) {
String objectName = ardSyCarr.getCarPicture().split("/sycar/")[1];
objectNames.add(objectName);
MinioUtils.removeObjects("sycar", objectNames);
@@ -312,7 +343,7 @@
//鏂囦欢鍚�
String originalFilename = carPicture.getOriginalFilename();
//鏂扮殑鏂囦欢鍚�
- String fileName = "carpicture/" + IdUtils.fastSimpleUUID()+"_"+ originalFilename;
+ String fileName = "carpicture/" + IdUtils.fastSimpleUUID() + "_" + originalFilename;
try {
InputStream inputStream = carPicture.getInputStream();
/*涓婁紶瀵硅薄*/
@@ -333,8 +364,8 @@
.method(Method.GET)
.build();
String presignedObjectUrl = MinioClientSingleton.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs);
- String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?"));
- if(id != null && !id.equals("")){//id涓洪潪蹇呰
+ String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?"));
+ if (id != null && !id.equals("")) {//id涓洪潪蹇呰
ArdSyCar ardSyCar = new ArdSyCar();
ardSyCar.setId(id);
ardSyCar.setCarPicture(ObjectUrl);
@@ -357,10 +388,10 @@
public Results carListById(String id) {
try {
List<ArdSyCar> list = ardSyCarMapper.carListById(id);
- if(list.size()>0){
+ if (list.size() > 0) {
ArdSyCar ardSyCar = list.get(0);
return Results.succeed(ardSyCar);
- }else {
+ } else {
return Results.succeed();
}
} catch (Exception e) {
@@ -371,12 +402,12 @@
@Override
public Map<String, Object> getArdSyCarAndDeptByCarId(String carId) {
Map<String, Object> result = ardSyCarMapper.getArdSyCarAndDeptByCarId(carId);
- if(result != null){
- if(result.get("carPicture") != null){
- if(!((String)result.get("carPicture")).equals("")){
- String url = ((String)result.get("carPicture")).split("sycar")[0];
- String carModel = url + (String)result.get("carModel");
- result.put("carModel",carModel);
+ if (result != null) {
+ if (result.get("carPicture") != null) {
+ if (!((String) result.get("carPicture")).equals("")) {
+ String url = ((String) result.get("carPicture")).split("sycar")[0];
+ String carModel = url + (String) result.get("carModel");
+ result.put("carModel", carModel);
}
}
}
@@ -385,41 +416,41 @@
@Override
public void sendArdSyCarPosition() {
- for(String key : ONLINE_USER_SESSIONS.keySet()){
- if(PositionContainer.getUserPositionMap().keySet().contains(key)){//褰撹拷韪殑杞﹁締瀹瑰櫒鍖呭惈姝ょ敤鎴稩d锛屽垯瀹炴椂浣嶇疆鎺ㄩ�侀渶瑕佸墧闄よ杞﹁締
+ for (String key : ONLINE_USER_SESSIONS.keySet()) {
+ if (PositionContainer.getUserPositionMap().keySet().contains(key)) {//褰撹拷韪殑杞﹁締瀹瑰櫒鍖呭惈姝ょ敤鎴稩d锛屽垯瀹炴椂浣嶇疆鎺ㄩ�侀渶瑕佸墧闄よ杞﹁締
SysUser sysUser = userMapper.selectUserById(key);
- if(sysUser == null){
+ if (sysUser == null) {
//return;
continue;
}
String deptId = String.valueOf(sysUser.getDeptId());
- Map<String,Map<String,Object>> map = PositionContainer.getDeptPositionMap().get(deptId);
+ Map<String, Map<String, Object>> map = PositionContainer.getDeptPositionMap().get(deptId);
List<String> carIdList = new ArrayList();
carIdList.addAll(PositionContainer.getUserPositionMap().get(key).keySet());
String carId = carIdList.get(0);
map.remove(carId);
- if(map != null){
- Map<String,Object> data = new HashMap();
+ if (map != null) {
+ Map<String, Object> data = new HashMap();
data.put("30000", map.values());
WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(key), JSON.toJSONString(data));
}
- }else{
+ } else {
SysUser sysUser = userMapper.selectUserById(key);
- if(sysUser == null){
+ if (sysUser == null) {
//return;
continue;
}
String deptId = String.valueOf(sysUser.getDeptId());
- Map<String,Map<String,Object>> map = PositionContainer.getDeptPositionMap().get(deptId);
- if(map != null){
- Map<String,Object> data = new HashMap();
+ Map<String, Map<String, Object>> map = PositionContainer.getDeptPositionMap().get(deptId);
+ if (map != null) {
+ Map<String, Object> data = new HashMap();
data.put("30000", map.values());
WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(key), JSON.toJSONString(data));
}
}
}
- for(String userId : userCarTimerMap.keySet()){//鐢ㄦ埛绂荤嚎鍚庡皢杞﹁締杩借釜璧勬簮閲婃斁
- if(!ONLINE_USER_SESSIONS.keySet().contains(userId)){
+ for (String userId : userCarTimerMap.keySet()) {//鐢ㄦ埛绂荤嚎鍚庡皢杞﹁締杩借釜璧勬簮閲婃斁
+ if (!ONLINE_USER_SESSIONS.keySet().contains(userId)) {
userCarTimerMap.get(userId).cancel();
userCarTimerMap.remove(userId);
PositionContainer.getUserPositionMap().remove(userId);
@@ -428,125 +459,139 @@
}
@Override
- public void sendArdSyCarAlarmByCarId(String carId, Map<String,Object> data) {
+ public void sendArdSyCarAlarmByCarId(String carId, Map<String, Object> data) {
List<SysUser> result = userMapper.getSysUserByCarId(carId);
- for(SysUser sysUser : result){
+ for (SysUser sysUser : result) {
WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(sysUser.getUserId()), JSON.toJSONString(data));
}
}
/**
* 鏍规嵁鐢ㄦ埛鑾峰彇涓変竴鍒楄〃
+ *
* @return
*/
@Override
- public Map<String,Object> allListByUser(ArdSyUser ardSyUser,String syURL,String usersId){
- Map<String,Object> result0 = new HashMap();
+ public Map<String, Object> allListByUser(ArdSyUser ardSyUser, String syURL, String usersId) {
+ Map<String, Object> result0 = new HashMap();
//鍒ゆ柇鍏宠仈琛ㄦ槸鍚︽湁鏁版嵁
- if(ardSyUser!=null){
+ if (ardSyUser != null) {
Map<String, String> result = logInMap.get(Integer.parseInt(usersId));
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
String password31 = ardSyUser.getPassword();
String passwordMd5 = DigestUtils.md5Hex(password31);
- Map<String, Object> result1 = sYClient.logIn(syURL,passwordMd5, username31);
+ Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31);
result = new HashMap();
result.put("userId", username31);
result.put("sessionId", (String) result1.get("sessionId"));
try {
- result0 = sYClient.getTeamList(syURL,result.get("userId"),result.get("sessionId"));
+ result0 = sYClient.getTeamList(syURL, result.get("userId"), result.get("sessionId"));
} catch (Exception e) {
- Map<String,Object> map = new HashMap();
+ Map<String, Object> map = new HashMap();
map.put("rspCode", 0);
map.put("list", new ArrayList());
return map;
}
int online = 0;
- for(Map<String,Object> map : (List<Map<String,Object>>) result0.get("list")){
- Map<String,Object> resultMap = sYClient.getTeamCarList(syURL,(String)map.get("teamId"),result.get("sessionId"));
- List<Map<String,Object>> carList = (List<Map<String, Object>>) resultMap.get("carList");
- for(Map<String,Object> m : carList){
- if(((String) m.get("stateCn")).contains("鍦ㄧ嚎")){
+ for (Map<String, Object> map : (List<Map<String, Object>>) result0.get("list")) {
+ Map<String, Object> resultMap = sYClient.getTeamCarList(syURL, (String) map.get("teamId"), result.get("sessionId"));
+ List<Map<String, Object>> carList = (List<Map<String, Object>>) resultMap.get("carList");
+ for (Map<String, Object> m : carList) {
+ if (((String) m.get("stateCn")).contains("鍦ㄧ嚎")) {
online = online + 1;
- }else{
+ } else {
continue;
}
}
- for(Map<String,Object> m : (List<Map<String,Object>>) result0.get("list")){
- if(((String) m.get("teamId")).equals(((String) map.get("teamId")))){
+ for (Map<String, Object> m : (List<Map<String, Object>>) result0.get("list")) {
+ if (((String) m.get("teamId")).equals(((String) map.get("teamId")))) {
map.put("count", Integer.parseInt((String) m.get("carNum")));
}
}
map.put("online", online);
online = 0;
}
- }else {
- result0.put("鍒楄〃涓虹┖锛�","鏃犲叧鑱旇处鍙凤紒");
+ } else {
+ result0.put("鍒楄〃涓虹┖锛�", "鏃犲叧鑱旇处鍙凤紒");
}
return result0;
}
@Override
- public List<Map<String,String>> getCarList(ArdSyUser ardSyUser, String syURL, String usersId,String teamId){
- List<Map<String,String>> list = new ArrayList<>();
+ public List<Map<String, String>> getCarList(ArdSyUser ardSyUser, String syURL, String usersId, String teamId) {
+ List<Map<String, String>> list = new ArrayList<>();
Map<String, String> result = logInMap.get(Integer.parseInt(usersId));
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
String password31 = ardSyUser.getPassword();
String passwordMd5 = DigestUtils.md5Hex(password31);
- Map<String, Object> result1 = sYClient.logIn(syURL,passwordMd5, username31);
+ Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31);
result = new HashMap();
result.put("userId", username31);
result.put("sessionId", (String) result1.get("sessionId"));
//鏌ヨ璇eamId涓嬬殑杞﹁締鏁版嵁
- Map<String,Object> carList31 = new HashMap();
- carList31 = sYClient.getCarList1(syURL,teamId, result.get("userId"),result.get("sessionId"));
+ Map<String, Object> carList31 = new HashMap();
+ carList31 = sYClient.getCarList1(syURL, teamId, result.get("userId"), result.get("sessionId"));
//鎷垮埌杞﹁締鏁版嵁
- list= (List) carList31.get("list");
- if(list.isEmpty()){
+ list = (List) carList31.get("list");
+ if (list.isEmpty()) {
return list;
- }else {
+ } else {
List<String> carIdList = new ArrayList();
//鎵�鏈塩arId
- for(Map<String,String> m : list){
+ for (Map<String, String> m : list) {
carIdList.add(m.get("carId"));
}
- if(carIdList.size() == 0){
- Map<String,String> map0 = new HashMap();
+ if (carIdList.size() == 0) {
+ Map<String, String> map0 = new HashMap();
map0.put("list", "{}");
map0.put("rspCode", "1");
list.add(map0);
return list;
}
//娣诲姞杞﹁締灞炴��
- for(Map<String,String> m : list){
+ for (Map<String, String> m : list) {
switch (m.get("state")) {
case "1":
- m.put("carState", "绂荤嚎-浠庢湭鎶ュ畾浣�");break;
+ m.put("carState", "绂荤嚎-浠庢湭鎶ュ畾浣�");
+ break;
case "2":
- m.put("carState", "绂荤嚎-娆犺垂");break;
+ m.put("carState", "绂荤嚎-娆犺垂");
+ break;
case "3":
- m.put("carState", "绂荤嚎");break;
+ m.put("carState", "绂荤嚎");
+ break;
case "4":
- m.put("carState", "绂荤嚎-鎶ヨ");break;
+ m.put("carState", "绂荤嚎-鎶ヨ");
+ break;
case "5":
- m.put("carState", "鍦ㄧ嚎-浠庢湭鎶ュ畾浣�");break;
+ m.put("carState", "鍦ㄧ嚎-浠庢湭鎶ュ畾浣�");
+ break;
case "6":
- m.put("carState", "鍦ㄧ嚎-娆犺垂");break;
+ m.put("carState", "鍦ㄧ嚎-娆犺垂");
+ break;
case "7":
- m.put("carState", "鍦ㄧ嚎-琛岄┒");break;
+ m.put("carState", "鍦ㄧ嚎-琛岄┒");
+ break;
case "8":
- m.put("carState", "鍦ㄧ嚎-琛岄┒-鎶ヨ");break;
+ m.put("carState", "鍦ㄧ嚎-琛岄┒-鎶ヨ");
+ break;
case "9":
- m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC鍏�");break;
+ m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC鍏�");
+ break;
case "10":
- m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC寮�");break;
+ m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC寮�");
+ break;
case "11":
- m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC鍏�-鎶ヨ");break;
+ m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC鍏�-鎶ヨ");
+ break;
case "12":
- m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC寮�-鎶ヨ");break;
+ m.put("carState", "鍦ㄧ嚎-鍋滆溅-ACC寮�-鎶ヨ");
+ break;
case "13":
- m.put("carState", "鍦ㄧ嚎-鏃犳晥瀹氫綅");break;
+ m.put("carState", "鍦ㄧ嚎-鏃犳晥瀹氫綅");
+ break;
default:
break;
}
@@ -557,31 +602,32 @@
/**
* 鏍规嵁dept闆嗗悎鏌ヨ鍑烘墍鏈夊搴旂殑carId
+ *
* @param deptList
* @return
*/
@Override
- public List<Map<String,String>> carIdByDeptList(List<Long> deptList,List<Map<String,String>> list){
+ public List<Map<String, String>> carIdByDeptList(List<Long> deptList, List<Map<String, String>> list) {
QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>();
- queryWrapper.in("dept_id",deptList);
+ queryWrapper.in("dept_id", deptList);
List<ArdSyCar> carList = ardSyCarMapper.selectList(queryWrapper);
//瀵规瘮鎶婂尮閰嶅埌鐨勬暟鎹坊鍔犲埌list涓�
- for(Map<String,String> m : list){
+ for (Map<String, String> m : list) {
String carId = m.get("carId");
for (int i = 0; i < carList.size(); i++) {
ArdSyCar ardSyCar = carList.get(i);
- if(carId.equals(ardSyCar.getCarId())){
+ if (carId.equals(ardSyCar.getCarId())) {
String url = "";
- if(ardSyCar.getCarPicture() != null){
- if(!ardSyCar.getCarPicture().equals("")){
+ if (ardSyCar.getCarPicture() != null) {
+ if (!ardSyCar.getCarPicture().equals("")) {
url = ardSyCar.getCarPicture().split("sycar")[0];
}
}
- m.put("carModel",url + ardSyCar.getCarModel());//zns
+ m.put("carModel", url + ardSyCar.getCarModel());//zns
//m.put("carModel",ardSyCar.getCarModel());
- m.put("carTypeArd",ardSyCar.getCarType());
- m.put("carBrand",ardSyCar.getCarBrand());
- m.put("carPicture",ardSyCar.getCarPicture());
+ m.put("carTypeArd", ardSyCar.getCarType());
+ m.put("carBrand", ardSyCar.getCarBrand());
+ m.put("carPicture", ardSyCar.getCarPicture());
}
}
}
@@ -589,27 +635,27 @@
}
@Override
- public Results getCarGPSTrack(Map<String,String> map,String syURL, ArdSyUser ardSyUser){
+ public Results getCarGPSTrack(Map<String, String> map, String syURL, ArdSyUser ardSyUser) {
String carId = map.get("carId");
//String startTime = map.get("startTime").replace(" ", "").replace("-", "").replace(":", "");
//String endTime = map.get("endTime").replace(" ", "").replace("-", "").replace(":", "");
String time = map.get("time");
time = time.replace("-", "");
String startTime = time + "000000";
- String endTime = time +"235959";
+ String endTime = time + "235959";
String maxSpeed = map.get("maxSpeed");
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
String password31 = ardSyUser.getPassword();
String passwordMd5 = DigestUtils.md5Hex(password31);
- Map<String, Object> result1 = sYClient.logIn(syURL,passwordMd5, username31);
- Map<String,Object> result0 = new HashMap();
- result0 = sYClient.getCarGPSTrack(syURL,carId,startTime,endTime,maxSpeed,(String) result1.get("sessionId"));
- List<Map<String,Object>> list = (List<Map<String, Object>>) result0.get("list");
- if(list.isEmpty()){
+ Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31);
+ Map<String, Object> result0 = new HashMap();
+ result0 = sYClient.getCarGPSTrack(syURL, carId, startTime, endTime, maxSpeed, (String) result1.get("sessionId"));
+ List<Map<String, Object>> list = (List<Map<String, Object>>) result0.get("list");
+ if (list.isEmpty()) {
return Results.succeed();
- }else {
- for(Map<String,Object> m : list) {
+ } else {
+ for (Map<String, Object> m : list) {
String alarmStts = (String) m.get("alarmStts");
Map<String, List<String>> alarmMap = getInfo("alarm", alarmStts);
m.putAll(alarmMap);
@@ -625,30 +671,30 @@
}
- public Map<String,List<String>> getInfo(String type,String stts){
- if(stts.isEmpty()){
+ public Map<String, List<String>> getInfo(String type, String stts) {
+ if (stts.isEmpty()) {
return new HashMap<>();
}
- String[] alarmTypes = {"绱ф�ユ姤璀�","瓒呴�熸姤璀�","鐤插姵椹鹃┒","鍗遍櫓棰勮","GNSS 妯″潡鍙戠敓鏁呴殰","GNSS 澶╃嚎鏈帴鎴栬鍓柇","GNSS 澶╃嚎鐭矾",
- "缁堢涓荤數婧愭瑺鍘�","缁堢涓荤數婧愭帀鐢�","缁堢LCD 鎴栨樉绀哄櫒鏁呴殰","TTS 妯″潡鏁呴殰","鎽勫儚澶存晠闅�","閬撹矾杩愯緭璇両C 鍗℃ā鍧楁晠闅�","瓒呴�熼璀�",
- "鐤插姵椹鹃┒棰勮","杩濊琛岄┒鎶ヨ","鑳庡帇棰勮","鍙宠浆鐩插尯寮傚父鎶ヨ","褰撳ぉ绱椹鹃┒瓒呮椂","瓒呮椂鍋滆溅","杩涘嚭鍖哄煙","杩涘嚭璺嚎","璺琛岄┒鏃堕棿涓嶈冻/杩囬暱",
- "璺嚎鍋忕鎶ヨ","杞﹁締VSS 鏁呴殰","杞﹁締娌归噺寮傚父","杞﹁締琚洍","杞﹁締闈炴硶鐐圭伀","杞﹁締闈炴硶浣嶇Щ","纰版挒棰勮","渚х炕棰勮","闈炴硶寮�闂ㄦ姤璀�"};
+ String[] alarmTypes = {"绱ф�ユ姤璀�", "瓒呴�熸姤璀�", "鐤插姵椹鹃┒", "鍗遍櫓棰勮", "GNSS 妯″潡鍙戠敓鏁呴殰", "GNSS 澶╃嚎鏈帴鎴栬鍓柇", "GNSS 澶╃嚎鐭矾",
+ "缁堢涓荤數婧愭瑺鍘�", "缁堢涓荤數婧愭帀鐢�", "缁堢LCD 鎴栨樉绀哄櫒鏁呴殰", "TTS 妯″潡鏁呴殰", "鎽勫儚澶存晠闅�", "閬撹矾杩愯緭璇両C 鍗℃ā鍧楁晠闅�", "瓒呴�熼璀�",
+ "鐤插姵椹鹃┒棰勮", "杩濊琛岄┒鎶ヨ", "鑳庡帇棰勮", "鍙宠浆鐩插尯寮傚父鎶ヨ", "褰撳ぉ绱椹鹃┒瓒呮椂", "瓒呮椂鍋滆溅", "杩涘嚭鍖哄煙", "杩涘嚭璺嚎", "璺琛岄┒鏃堕棿涓嶈冻/杩囬暱",
+ "璺嚎鍋忕鎶ヨ", "杞﹁締VSS 鏁呴殰", "杞﹁締娌归噺寮傚父", "杞﹁締琚洍", "杞﹁締闈炴硶鐐圭伀", "杞﹁締闈炴硶浣嶇Щ", "纰版挒棰勮", "渚х炕棰勮", "闈炴硶寮�闂ㄦ姤璀�"};
- String[] carTypes89 = {"绌鸿溅","鍗婅浇","淇濈暀","婊¤浇"};
+ String[] carTypes89 = {"绌鸿溅", "鍗婅浇", "淇濈暀", "婊¤浇"};
- Object[] carTypes = {"ACC寮�","瀹氫綅","鍗楃含","瑗跨粡","鍋滆繍鐘舵��","缁忕含搴﹀凡缁忎繚瀵嗘彃浠跺姞瀵�","淇濈暀","淇濈暀",carTypes89,"杞﹁締娌硅矾鏂紑","杞﹂棬鍔犻攣",
- "杞﹁締鐢佃矾鏂紑","闂�1寮�锛堝墠闂級","闂�2寮�锛堜腑闂級","闂�3寮�锛堝悗闂�","闂�4寮�锛堥┚椹跺腑闂�","闂�5寮�","浣跨敤GPS 鍗槦杩涜瀹氫綅","浣跨敤鍖楁枟鍗槦杩涜瀹氫綅",
- "浣跨敤GLONASS鍗槦杩涜瀹氫綅","浣跨敤Galileo鍗槦杩涜瀹氫綅","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀"};
+ Object[] carTypes = {"ACC寮�", "瀹氫綅", "鍗楃含", "瑗跨粡", "鍋滆繍鐘舵��", "缁忕含搴﹀凡缁忎繚瀵嗘彃浠跺姞瀵�", "淇濈暀", "淇濈暀", carTypes89, "杞﹁締娌硅矾鏂紑", "杞﹂棬鍔犻攣",
+ "杞﹁締鐢佃矾鏂紑", "闂�1寮�锛堝墠闂級", "闂�2寮�锛堜腑闂級", "闂�3寮�锛堝悗闂�", "闂�4寮�锛堥┚椹跺腑闂�", "闂�5寮�", "浣跨敤GPS 鍗槦杩涜瀹氫綅", "浣跨敤鍖楁枟鍗槦杩涜瀹氫綅",
+ "浣跨敤GLONASS鍗槦杩涜瀹氫綅", "浣跨敤Galileo鍗槦杩涜瀹氫綅", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀"};
- String[] sgnTypes = {"杩戝厜鐏俊鍙�","杩滃厜鐏俊鍙�","鍙宠浆鍚戠伅淇″彿","宸﹁浆鍚戠伅淇″彿","鍒跺姩淇″彿","鍊掓。淇″彿","闆剧伅淇″彿","绀哄粨鐏�","鍠囧彮淇″彿","绌鸿皟鐘舵��",
- "绌烘尅淇″彿","缂撻�熷櫒宸ヤ綔","ABS 宸ヤ綔","鍔犵儹鍣ㄥ伐浣�","绂诲悎鍣ㄧ姸鎬�","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀",
- "淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀","淇濈暀"};
+ String[] sgnTypes = {"杩戝厜鐏俊鍙�", "杩滃厜鐏俊鍙�", "鍙宠浆鍚戠伅淇″彿", "宸﹁浆鍚戠伅淇″彿", "鍒跺姩淇″彿", "鍊掓。淇″彿", "闆剧伅淇″彿", "绀哄粨鐏�", "鍠囧彮淇″彿", "绌鸿皟鐘舵��",
+ "绌烘尅淇″彿", "缂撻�熷櫒宸ヤ綔", "ABS 宸ヤ綔", "鍔犵儹鍣ㄥ伐浣�", "绂诲悎鍣ㄧ姸鎬�", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀",
+ "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀", "淇濈暀"};
//Integer sttsHex = Integer.parseInt(stts, 16);
Long sttsHex = Long.parseLong(stts, 16);
//String sttsBin = Integer.toBinaryString(sttsHex);
String sttsBin = Long.toBinaryString(sttsHex);
- if(sttsBin.length() < 32){
- while(sttsBin.length() < 32){
+ if (sttsBin.length() < 32) {
+ while (sttsBin.length() < 32) {
sttsBin = "0" + sttsBin;
}
}
@@ -657,22 +703,22 @@
case "alarm":
List<String> alarmTypeArray = new ArrayList();
for (int i = 0; i < sttsBinArray.length; i++) {
- if(sttsBinArray[i].equals("1")){
+ if (sttsBinArray[i].equals("1")) {
alarmTypeArray.add(alarmTypes[i]);
}
}
- Map<String,List<String>> alarmMap = new HashMap();
+ Map<String, List<String>> alarmMap = new HashMap();
alarmMap.put(type, alarmTypeArray);
return alarmMap;
case "car":
List<String> carTypeArray = new ArrayList();
for (int i = 0; i < sttsBinArray.length; i++) {
- if(i <= 7 || i >= 10){
- if(sttsBinArray[i].equals("1")){
+ if (i <= 7 || i >= 10) {
+ if (sttsBinArray[i].equals("1")) {
carTypeArray.add(alarmTypes[i]);
}
- }else if(i == 8){
- switch (sttsBinArray[8]+sttsBinArray[9]) {
+ } else if (i == 8) {
+ switch (sttsBinArray[8] + sttsBinArray[9]) {
case "00":
carTypeArray.add(carTypes89[0]);
break;
@@ -688,16 +734,16 @@
default:
break;
}
- }else if(i == 9){
+ } else if (i == 9) {
continue;
- }else{
+ } else {
break;
}
}
- Map<String,List<String>> carMap = new HashMap();
+ Map<String, List<String>> carMap = new HashMap();
List<String> carTypeArray0 = new ArrayList();
- for(String str : carTypeArray){
- if(!str.equals("淇濈暀")){
+ for (String str : carTypeArray) {
+ if (!str.equals("淇濈暀")) {
carTypeArray0.add(str);
}
}
@@ -706,104 +752,104 @@
case "sgn":
List<String> sgnTypeArray = new ArrayList();
for (int i = 0; i < sttsBinArray.length; i++) {
- if(sttsBinArray[i].equals("1")){
+ if (sttsBinArray[i].equals("1")) {
sgnTypeArray.add(alarmTypes[i]);
}
}
- Map<String,List<String>> sgnMap = new HashMap();
+ Map<String, List<String>> sgnMap = new HashMap();
List<String> sgnTypeArray0 = new ArrayList();
- for(String str : sgnTypeArray){
- if(!str.equals("淇濈暀")){
+ for (String str : sgnTypeArray) {
+ if (!str.equals("淇濈暀")) {
sgnTypeArray0.add(str);
}
}
sgnMap.put(type, sgnTypeArray0);
return sgnMap;
default:
- return new HashMap<String,List<String>>();
+ return new HashMap<String, List<String>>();
}
}
@Override
- public Results getCarGPSBycarId(String usersId,String carId,String syURL,ArdSyUser ardSyUser){
+ public Results getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser) {
Map<String, String> result = logInMap.get(Integer.parseInt(usersId));
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
String password31 = ardSyUser.getPassword();
String passwordMd5 = DigestUtils.md5Hex(password31);
- Map<String, Object> result1 = sYClient.logIn(syURL,passwordMd5, username31);
+ Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31);
result = new HashMap();
result.put("userId", username31);
result.put("sessionId", (String) result1.get("sessionId"));
- Map<String,Object> result0 = new HashMap();
- result0 = sYClient.getCarNearPositionByCarId(syURL,carId,result.get("userId"),result.get("sessionId"));
+ Map<String, Object> result0 = new HashMap();
+ result0 = sYClient.getCarNearPositionByCarId(syURL, carId, result.get("userId"), result.get("sessionId"));
return Results.succeed(result0);
}
@Override
public Results chaseCarByCarId(String usersId, String carId, String cycle) {
- try{
+ try {
/*Map<String,Map<String,Object>> map = new HashMap();
map.put(carId,new HashMap());
PositionContainer.getUserPositionMap().put(usersId,map);*/
- if(cycle.equals("0")){
- if(userCarTimerMap.get(usersId) != null){
+ if (cycle.equals("0")) {
+ if (userCarTimerMap.get(usersId) != null) {
userCarTimerMap.get(usersId).cancel();
userCarTimerMap.remove(usersId);
PositionContainer.getUserPositionMap().remove(usersId);
}
return Results.succeed("鍋滄杩借釜");
- }else{
- if(userCarTimerMap.get(usersId) != null){
+ } else {
+ if (userCarTimerMap.get(usersId) != null) {
userCarTimerMap.get(usersId).cancel();
userCarTimerMap.remove(usersId);
PositionContainer.getUserPositionMap().remove(usersId);
- Map<String,Map<String,Object>> map = new HashMap();
- map.put(carId,new HashMap());
- PositionContainer.getUserPositionMap().put(usersId,map);
+ Map<String, Map<String, Object>> map = new HashMap();
+ map.put(carId, new HashMap());
+ PositionContainer.getUserPositionMap().put(usersId, map);
Date date = new Date();
Timer carPositionTimer = new Timer();//瀹氭椂鎺ㄩ�佸疄鏃朵綅缃�
- TimerTask carPositionTask =new TimerTask(){
+ TimerTask carPositionTask = new TimerTask() {
@Override
- public void run(){
- Map<String,Object> position = PositionContainer.getUserPositionMap().get(usersId).get(carId);
- if(position != null){
- if(position.size() != 0){
- Map<String,Map<String,Object>> data = new HashMap();
- data.put("31000",position);
+ public void run() {
+ Map<String, Object> position = PositionContainer.getUserPositionMap().get(usersId).get(carId);
+ if (position != null) {
+ if (position.size() != 0) {
+ Map<String, Map<String, Object>> data = new HashMap();
+ data.put("31000", position);
WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
}
}
}
};
- carPositionTimer.scheduleAtFixedRate(carPositionTask,date,Integer.parseInt(cycle));//鍚敤
- this.userCarTimerMap.put(usersId,carPositionTimer);
+ carPositionTimer.scheduleAtFixedRate(carPositionTask, date, Integer.parseInt(cycle));//鍚敤
+ this.userCarTimerMap.put(usersId, carPositionTimer);
return Results.succeed("寮�濮嬭拷韪�");
- }else{
- Map<String,Map<String,Object>> map = new HashMap();
- map.put(carId,new HashMap());
- PositionContainer.getUserPositionMap().put(usersId,map);
+ } else {
+ Map<String, Map<String, Object>> map = new HashMap();
+ map.put(carId, new HashMap());
+ PositionContainer.getUserPositionMap().put(usersId, map);
Date date = new Date();
Timer carPositionTimer = new Timer();//瀹氭椂鎺ㄩ�佸疄鏃朵綅缃�
- TimerTask carPositionTask =new TimerTask(){
+ TimerTask carPositionTask = new TimerTask() {
@Override
- public void run(){
- Map<String,Object> position = PositionContainer.getUserPositionMap().get(usersId).get(carId);
- if(position != null){
- if(position.size() != 0){
- Map<String,Map<String,Object>> data = new HashMap();
- data.put("31000",position);
+ public void run() {
+ Map<String, Object> position = PositionContainer.getUserPositionMap().get(usersId).get(carId);
+ if (position != null) {
+ if (position.size() != 0) {
+ Map<String, Map<String, Object>> data = new HashMap();
+ data.put("31000", position);
WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
}
}
}
};
- carPositionTimer.scheduleAtFixedRate(carPositionTask,date,Integer.parseInt(cycle));//鍚敤
- this.userCarTimerMap.put(usersId,carPositionTimer);
+ carPositionTimer.scheduleAtFixedRate(carPositionTask, date, Integer.parseInt(cycle));//鍚敤
+ this.userCarTimerMap.put(usersId, carPositionTimer);
return Results.succeed("寮�濮嬭拷韪�");
}
}
- }catch(Exception e){
+ } catch (Exception e) {
e.printStackTrace();
return Results.error("杩借釜澶辫触");
}
@@ -835,17 +881,17 @@
@Override
public Results getExistTraceByCarIdAndMonth(String userId, String carId, String time) {
- List<ArdSyCarDay> result = ardSyCarDayMapper.selectArdSyCarDayByCarIdAndDay(carId,time + "%");
+ List<ArdSyCarDay> result = ardSyCarDayMapper.selectArdSyCarDayByCarIdAndDay(carId, time + "%");
List<String> list = new ArrayList();
- for(ArdSyCarDay ardSyCarDay : result){
+ for (ArdSyCarDay ardSyCarDay : result) {
// list.add(ardSyCarDay.getDay().split("-")[2]);
list.add(ardSyCarDay.getDay());
}
return Results.succeed(list);
}
- public Map<String,Integer> getExistTraceByCarIdAndMonth(String url,String usersId,String password,String carId,String time){
- Map<String,Object> LogInResult = sYClient.logIn(url,password,usersId);
+ public Map<String, Integer> getExistTraceByCarIdAndMonth(String url, String usersId, String password, String carId, String time) {
+ Map<String, Object> LogInResult = sYClient.logIn(url, password, usersId);
String sessionId = (String) LogInResult.get("sessionId");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
@@ -858,49 +904,49 @@
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int maxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);//鑾峰彇璇ユ湀澶╂暟
- Map<String,Integer> existTraceMap = new HashMap();
+ Map<String, Integer> existTraceMap = new HashMap();
ExecutorService newCachedThreadPoll = Executors.newCachedThreadPool();
for (int i = 1; i <= maxDay; i = i + 7) {
int temp = i;
- String finalTime = time.replace("-","");
+ String finalTime = time.replace("-", "");
String finalsyURL = url;
- newCachedThreadPoll.execute(new Runnable(){
+ newCachedThreadPoll.execute(new Runnable() {
@Override
public void run() {
int temp0 = temp + 6;
- if(temp0 > maxDay){
+ if (temp0 > maxDay) {
temp0 = maxDay;
}
for (int j = temp; j <= temp0; j++) {
- if(j <= 9){
+ if (j <= 9) {
existTraceMap.put("0" + String.valueOf(j), -1);
- }else{
+ } else {
existTraceMap.put(String.valueOf(j), -1);
}
}
- if(temp <= 9){
- if(temp0 <= 9){
+ if (temp <= 9) {
+ if (temp0 <= 9) {
String startTime = finalTime + "0" + temp + "000000";
String endTime = finalTime + "0" + temp0 + "235959";
- Map<String,Object> result = getCarGPSTrack(finalsyURL,carId,startTime,endTime,sessionId);
- String rspCode = (String)result.get("rspCode");
- if(rspCode.equals("1")){
- List<Map<String,Object>> list = (List<Map<String, Object>>) result.get("list");
- for(Map<String,Object> m : list){
+ Map<String, Object> result = getCarGPSTrack(finalsyURL, carId, startTime, endTime, sessionId);
+ String rspCode = (String) result.get("rspCode");
+ if (rspCode.equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) result.get("list");
+ for (Map<String, Object> m : list) {
String time = (String) m.get("time");
time = time.split(" ")[0];
time = time.split("-")[2];
existTraceMap.put(time, 1);
}
}
- }else{
+ } else {
String startTime = finalTime + "0" + temp + "000000";
String endTime = finalTime + temp0 + "235959";
- Map<String,Object> result = getCarGPSTrack(finalsyURL,carId,startTime,endTime,sessionId);
- String rspCode = (String)result.get("rspCode");
- if(rspCode.equals("1")){
- List<Map<String,Object>> list = (List<Map<String, Object>>) result.get("list");
- for(Map<String,Object> m : list){
+ Map<String, Object> result = getCarGPSTrack(finalsyURL, carId, startTime, endTime, sessionId);
+ String rspCode = (String) result.get("rspCode");
+ if (rspCode.equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) result.get("list");
+ for (Map<String, Object> m : list) {
String time = (String) m.get("time");
time = time.split(" ")[0];
time = time.split("-")[2];
@@ -908,14 +954,14 @@
}
}
}
- }else{
+ } else {
String startTime = finalTime + temp + "000000";
String endTime = finalTime + temp0 + "235959";
- Map<String,Object> result = getCarGPSTrack(finalsyURL,carId,startTime,endTime,sessionId);
- String rspCode = (String)result.get("rspCode");
- if(rspCode.equals("1")){
- List<Map<String,Object>> list = (List<Map<String, Object>>) result.get("list");
- for(Map<String,Object> m : list){
+ Map<String, Object> result = getCarGPSTrack(finalsyURL, carId, startTime, endTime, sessionId);
+ String rspCode = (String) result.get("rspCode");
+ if (rspCode.equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) result.get("list");
+ for (Map<String, Object> m : list) {
String time = (String) m.get("time");
time = time.split(" ")[0];
time = time.split("-")[2];
@@ -923,14 +969,14 @@
}
}
}
- for(int j = temp; j <= temp0; j++){
+ for (int j = temp; j <= temp0; j++) {
String key = "";
- if(j <= 9){
+ if (j <= 9) {
key = "0" + j;
- }else{
+ } else {
key = String.valueOf(j);
}
- if(existTraceMap.get(key) == -1){
+ if (existTraceMap.get(key) == -1) {
existTraceMap.put(key, 0);
}
@@ -938,9 +984,9 @@
}
});
}
- while(true){
- if(!existTraceMap.values().contains(-1)){
- if(existTraceMap.size() == maxDay){
+ while (true) {
+ if (!existTraceMap.values().contains(-1)) {
+ if (existTraceMap.size() == maxDay) {
break;
}
}
@@ -952,11 +998,11 @@
}
}
- public static Map<String,Object> getCarGPSTrack(String syURL,String carId,String startTime,String endTime,String sessionId){
+ public static Map<String, Object> getCarGPSTrack(String syURL, String carId, String startTime, String endTime, String sessionId) {
OkHttpClient okHttpClient = new OkHttpClient();
Request request = new Request.Builder()
- .url(syURL + "/gps-web/api/get_gps_h.jsp?carId="+carId+"&startTime="+startTime+"&endTime="+endTime+"&filter0=true&maxSpeed=&stopLong=5&queryAlarm=false&userId=yanshi&loginType=user&loginWay=android&loginLang=zh_CN&appDevId=&sessionId="+sessionId)
+ .url(syURL + "/gps-web/api/get_gps_h.jsp?carId=" + carId + "&startTime=" + startTime + "&endTime=" + endTime + "&filter0=true&maxSpeed=&stopLong=5&queryAlarm=false&userId=yanshi&loginType=user&loginWay=android&loginLang=zh_CN&appDevId=&sessionId=" + sessionId)
.build();
Response response = null;
@@ -973,7 +1019,7 @@
try {
String message = responseBody.string();// 鍝嶅簲浣�
- Map<String,Object> map = (Map<String, Object>) JSON.parse(message);
+ Map<String, Object> map = (Map<String, Object>) JSON.parse(message);
//System.out.println(message);
return map;
} catch (IOException e) {
@@ -982,4 +1028,66 @@
return new HashMap();
}
}
+
+ /**
+ * 鑾峰彇闄勮繎鑼冨洿鍐呯殑杞﹁締淇℃伅
+ */
+
+ @Override
+ public List<Map<String, Object>> getNearCar(SchedulingParam param) {
+ Double longitude = param.getLongitude();
+ Double latitude = param.getLatitude();
+ Integer radius = param.getSealingRadius();
+ if (longitude == null && latitude == null) {
+ log.debug("鍘熺偣鍧愭爣涓虹┖");
+ return null;
+ }
+ if (radius == null) {
+ log.debug("鍗婂緞璺濈涓虹┖");
+ return null;
+ }
+ String userId = SecurityUtils.getUserId();
+ ArdSyUser syUser = new ArdSyUser();
+ syUser.setSysUserId(userId);
+ List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(syUser);
+ if (ardSyUserList.size() == 0) {
+ log.debug("鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
+ return null;
+ }
+ ArdSyUser ardSyUser = ardSyUserList.get(0);
+ String syUrl = redisCache.getCacheObject("sys_config:syCarPT");
+ String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword());
+ Map<String, Object> LogInResult = sYClient.logIn(syUrl, passwordMd5, ardSyUser.getUserId());
+ String sessionId = (String) LogInResult.get("sessionId");
+
+ Map<String, Object> teamList = sYClient.getTeamList(syUrl, ardSyUser.getUserId(), sessionId);
+ List<Map<String, Object>> listMap = (List<Map<String, Object>>) teamList.get("list");
+ List<Map<String, Object>> allList = new ArrayList<>();
+ for (Map<String, Object> team : listMap) {
+ String teamId = (String) team.get("teamId");
+ Map<String, Object> carListMap = sYClient.getCarList1(syUrl, teamId, ardSyUser.getUserId(), sessionId);
+ if (((String) carListMap.get("rspCode")).equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) carListMap.get("list");
+ allList.addAll(list);
+ }
+ }
+ //杩囨护鍦ㄧ嚎杞﹁締
+ List<Map<String, Object>> onlineList = allList.stream()
+ .filter(map -> !"绂荤嚎".equals(map.get("stateCn")))
+ .collect(Collectors.toList());
+ List<Map<String, Object>> filteredList = new ArrayList<>();
+ //杩囨护鍗婂緞
+ for (Map<String, Object> carMap : onlineList) {
+ String carId = (String) carMap.get("carId");
+ Map<String, Object> carGPSTrack = sYClient.getCarNearPositionByCarId(syUrl, carId, ardSyUser.getUserId(), sessionId);
+ List<Map<String, Object>> carGPSMap = (List<Map<String, Object>>) carGPSTrack.get("list");
+ Double lng = Double.valueOf((String) carGPSMap.get(0).get("lng"));
+ Double lat = Double.valueOf((String) carGPSMap.get(0).get("lat"));
+ double distance = GisTool.getDistance( new double[]{longitude,latitude}, new double[]{lng, lat});
+ if (distance <= radius) {
+ filteredList.add(carMap); // 灏嗘弧瓒虫潯浠剁殑杞﹁締娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ }
+ return filteredList;
+ }
}
diff --git a/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml b/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
index fb9ab8e..90c8603 100644
--- a/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
+++ b/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
@@ -49,6 +49,7 @@
c.altitude,
c.user_id,
c.dept_id,
+ c.login_id,
c.cam_heading,
c.cam_pitch,
c.cam_roll,
diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml
index bd4e2c0..dfa352c 100644
--- a/ruoyi-admin/src/main/resources/logback.xml
+++ b/ruoyi-admin/src/main/resources/logback.xml
@@ -198,11 +198,25 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
+ <!--鏃犱汉鏈烘棩蹇楄緭鍑�-->
<appender name="uav" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/uav.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--鎸夊ぉ鍥炴粴daily-->
<fileNamePattern>${log.path}/uav.%d{yyyy-MM-dd}.log</fileNamePattern>
+ <!--鏃ュ織鏈�澶х殑鍘嗗彶60澶�-->
+ <maxHistory>60</maxHistory>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${log.pattern}</pattern>
+ </encoder>
+ </appender>
+ <!--涓変竴杞﹁締鏃ュ織杈撳嚭-->
+ <appender name="sy" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/sy.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!--鎸夊ぉ鍥炴粴daily-->
+ <fileNamePattern>${log.path}/sy.%d{yyyy-MM-dd}.log</fileNamePattern>
<!--鏃ュ織鏈�澶х殑鍘嗗彶60澶�-->
<maxHistory>60</maxHistory>
</rollingPolicy>
@@ -268,7 +282,12 @@
<logger name="cmd" level="INFO">
<appender-ref ref="cmd"/>
</logger>
+ <!--鏃犱汉鏈烘棩蹇楁墦鍗扮瓑绾�-->
<logger name="uav" level="INFO">
<appender-ref ref="uav"/>
</logger>
+ <!--涓変竴杞﹁締鏃ュ織鎵撳嵃绛夌骇-->
+ <logger name="sy" level="INFO">
+ <appender-ref ref="sy"/>
+ </logger>
</configuration>
\ No newline at end of file
--
Gitblit v1.9.3