From ca0391eeab5a1586aed14018510cb4c3c0cd6131 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 28 二月 2024 09:17:12 +0800
Subject: [PATCH] 三一车辆用户查询修改提交
---
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 454 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 411 insertions(+), 43 deletions(-)
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 e6ea43b..837d4fc 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
@@ -1,28 +1,32 @@
package com.ruoyi.app.position.service.impl;
+import com.ruoyi.alarm.wall.domain.ArdAlarmWall;
+import com.ruoyi.alarm.wall.service.IArdAlarmWallService;
+import com.ruoyi.alarmpoints.wall.domain.ArdWall;
+import com.ruoyi.alarmpoints.wall.mapper.ArdWallMapper;
+import com.ruoyi.app.position.appcontainer.AppContainer;
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.core.redis.RedisCache;
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.mapper.SysDeptMapper;
+import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysUserService;
-import com.ruoyi.utils.tools.GisTool;
+import com.ruoyi.utils.gis.GisUtil;
+import com.ruoyi.utils.gis.Point;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
+
+import static com.ruoyi.utils.websocket.util.WebSocketUtils.ONLINE_USER_SESSIONS;
/**
@@ -38,7 +42,18 @@
private ArdAppPositionMapper ardAppPositionMapper;
@Resource
private ISysUserService iSysUserService;
+ @Resource
+ RedisCache redisCache;
+ @Resource
+ ArdWallMapper ardWallMapper;
+ @Resource
+ IArdAlarmWallService ardAlarmWallService;
+ @Resource
+ private SysUserMapper sysUserMapper;
+ @Resource
+ private SysDeptMapper sysDeptMapper;
+ Map<String, String> firstAlarmMap = new HashMap<>();//棣栨鎶ヨ缂撳瓨key:鐢ㄦ埛id_鍥存爮id value: 鎶ヨid
/**
* 鏌ヨapp浣嶇疆
*
@@ -79,10 +94,16 @@
* @return 缁撴灉
*/
@Override
- public int insertArdAppPosition(ArdAppPosition ardAppPosition) {
+ public List<ArdAlarmWall> insertArdAppPosition(ArdAppPosition ardAppPosition) {
ardAppPosition.setId(IdUtils.simpleUUID());
ardAppPosition.setCreateTime(DateUtils.getNowDate());
- return ardAppPositionMapper.insertArdAppPosition(ardAppPosition);
+ ardAppPositionMapper.insertArdAppPosition(ardAppPosition);
+ try{
+ return DetectionWallAlarm(ardAppPosition);
+ }finally {
+ AppContainer.getArdAppPositionMap().put(ardAppPosition.getUserId(),ardAppPosition);//瀹炴椂浣嶇疆瀛樺叆瀹瑰櫒
+ }
+
}
/**
@@ -125,43 +146,390 @@
*/
@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;
+ try {
+ Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
+ 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();
+ user.setDeptId(deptId);
+ List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user);
+ //杩囨护鍦ㄧ嚎鍜屽崟鍏电
+ List<SysUser> onLineList = appUserList.stream()
+ .filter(sysUser -> (sysUser.getAppOnlineState().equals("1")))
+ .filter(sysUser -> (sysUser.getAppUserType().equals("1")))
+ .collect(Collectors.toList());
+ //杩囨护鑼冨洿
+ 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 = GisUtil.getDistance(new double[]{longitude, latitude}, new double[]{lon, lat});
+ if (distance <= radius) {
+ Map<String, Object> params = new HashMap<>();
+ params.put("longitude", lon);
+ params.put("latitude", lat);
+ sysUser.setParams(params);
+ filteredList.add(sysUser); // 灏嗘弧瓒虫潯浠剁殑鐢ㄦ埛娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
}
- double distance = GisTool.getDistance(new double[]{ longitude, latitude}, new double[]{ lon, lat});
- if (distance <= radius) {
- filteredList.add(sysUser); // 灏嗘弧瓒虫潯浠剁殑鐢ㄦ埛娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ } catch (Exception ex) {
+ log.error("鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛寮傚父" + ex.getMessage());
+ }
+ return filteredList;
+ }
+
+ /**
+ * 鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛(澶氳竟褰�)
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ @Override
+ public List<SysUser> getNearAppUsersWithPolygon(SchedulingParam param) {
+ List<SysUser> filteredList = new ArrayList<>();
+ try {
+ Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
+ List<Point> partitionLocation = param.getPartitionLocation();
+
+ SysUser user = new SysUser();
+ user.setDeptId(deptId);
+ List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user);
+ //杩囨护鍦ㄧ嚎
+ List<SysUser> onLineList = appUserList.stream()
+ .filter(sysUser -> (sysUser.getAppOnlineState().equals("1")))
+ .filter(sysUser -> (sysUser.getAppUserType().equals("1")))
+ .collect(Collectors.toList());
+ //杩囨护鑼冨洿
+ for (SysUser sysUser : onLineList) {
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.selectLastArdAppPositionByUserId(sysUser.getUserId());
+ if (ardAppPosition != null) {
+ Double lon = ardAppPosition.getLongitude();
+ Double lat = ardAppPosition.getLatitude();
+ if (lon == null || lat == null) {
+ continue;
+ }
+ Point point2D = new Point(lon, lat);
+ boolean inPolygon = GisUtil.isInPolygon(point2D, partitionLocation);
+ if (inPolygon) {
+ Map<String, Object> params = new HashMap<>();
+ params.put("longitude", lon);
+ params.put("latitude", lat);
+ sysUser.setParams(params);
+ filteredList.add(sysUser); // 灏嗘弧瓒虫潯浠剁殑鐢ㄦ埛娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ }
+ }
+ } catch (Exception ex) {
+ log.error("鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛寮傚父" + ex.getMessage());
+ }
+ return filteredList;
+ }
+
+ /**
+ * 瀹炴椂浣嶇疆妫�娴嬪洿鏍忔姤璀�
+ * 鍒樿嫃涔�
+ * 2023/8/31 8:54:06
+ */
+ /*public List<ArdAlarmWall> DetectionWallAlarm(ArdAppPosition ardAppPosition) {
+ List<ArdAlarmWall> ardAlarmWalls = new ArrayList<>();
+ //鑾峰彇褰撳墠鐢ㄦ埛鐨勯儴闂�
+ String userId = ardAppPosition.getUserId();
+ //鑾峰彇鐢ㄦ埛鍏宠仈鐨勬墍鏈夌數瀛愬洿鏍�
+ List<ArdWall> ardWalls = ardWallMapper.selectArdWallListByUserId(userId);
+ if (ardWalls.size() > 0) {
+ //閬嶅巻鎵�鏈夌數瀛愬洿鏍�
+ for (ArdWall wall : ardWalls) {
+ String wallId = wall.getId();//鍥存爮ID
+ String wallType = wall.getType();//鍥存爮绫诲瀷
+ String wallPoi = wall.getWallPoi();//鍥存爮鍧愭爣闆嗗悎
+ //澶勭悊澶氳竟褰㈢殑姣忎釜鐐圭殑缁忕含搴�
+ String[] parts = wallPoi.split(",");
+ List<Point> pointList = new ArrayList<>();
+ for (int i = 0; i < parts.length; i += 3) {
+ Point point = new Point();
+ point.setLongitude(Double.valueOf(parts[i]));
+ point.setLatitude(Double.valueOf(parts[i + 1]));
+ pointList.add(point);
+ }
+ //褰撳墠鐢ㄦ埛鐨勪綅缃�
+ Point userPoint = new Point(ardAppPosition.getLongitude(), ardAppPosition.getLatitude());
+ boolean inPolygon = GisUtil.isInPolygon(userPoint, pointList);//鍒ゆ柇鏄惁鍦ㄥ洿鏍忓唴
+ //鍒涘缓鍥存爮鎶ヨ瀹炰綋瀵硅薄
+ ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
+ ardAlarmWall.setWallId(wall.getId());
+ ardAlarmWall.setWallName(wall.getWallName());
+ ardAlarmWall.setUserId(userId);
+ ardAlarmWall.setAlarmTime(DateUtils.getNowDate());
+ ardAlarmWall.setAlarmType(wall.getType());
+ ardAlarmWall.setLongitude(ardAppPosition.getLongitude());
+ ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
+ ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
+ String key = userId + "_" + wallId;//鏈�鍚庝竴娆℃姤璀︾紦瀛榢ey
+ //鎸夌被鍨嬪尯鍒嗗洿鏍忕鍏ユ垨鑰呯鍑�
+ if ("1".equals(wallType)) {
+ if (inPolygon) {
+ //绂佸叆鍥存爮鍒欒嫢鍦ㄥ洿鏍忓唴,鑾峰彇棣栨杩涘叆鍥存爮鎶ヨID
+ String lastInAlarmId = firstAlarmMap.get(key);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨杩涘叆鍥存爮鍐�
+ if (lastInAlarmId == null) {
+ //褰撳墠鐢ㄦ埛棣栨杩涘叆鐢熸垚鎶ヨ
+ String uuid = IdUtils.simpleUUID();
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //璁板綍棣栨鎶ヨid
+ firstAlarmMap.put(key, uuid);
+ } else {
+ //鐢ㄦ埛宸茶繘鍏ユ洿鏂版渶鍚庢姤璀�
+ ardAlarmWall.setId(lastInAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
+ } else {
+ //绂佸叆鍥存爮鍒欒嫢鍦ㄥ洿鏍忓鍒欑Щ闄ゆ姤璀︾紦瀛�
+ firstAlarmMap.remove(key);
+ }
+ } else//绂佸嚭
+ {
+ //鍒ゆ柇褰撳墠鐢ㄦ埛浣嶇疆鏄惁鍦ㄥ洿鏍忓
+ if (!inPolygon) {
+ //绂佸嚭鍥存爮鍒欒嫢鍦ㄥ洿鏍忓,鑾峰彇棣栨璧板嚭鍥存爮鎶ヨID
+ String lastAlarmId = firstAlarmMap.get(key);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨鍦ㄥ洿鏍忓
+ if (lastAlarmId == null) {
+ String uuid = IdUtils.simpleUUID();
+ //褰撳墠鐢ㄦ埛棣栨鍑哄洿鏍忕敓鎴愭姤璀�
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //璁板綍棣栨鎶ヨid
+ firstAlarmMap.put(key, uuid);
+ } else {
+ //鐢ㄦ埛宸茬粡鍦ㄥ洿鏍忓鏇存柊鎶ヨ
+ ardAlarmWall.setId(lastAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
+ } else {
+ //绉婚櫎棣栨鎶ヨ缂撳瓨
+ firstAlarmMap.remove(key);
+ }
}
}
}
- return filteredList;
+ return ardAlarmWalls;
+ }*/
+
+ public List<ArdAlarmWall> DetectionWallAlarm(ArdAppPosition ardAppPosition) {
+ List<ArdAlarmWall> ardAlarmWalls = new ArrayList<>();
+ //鑾峰彇褰撳墠鐢ㄦ埛鐨勯儴闂�
+ String userId = ardAppPosition.getUserId();
+ //鑾峰彇鐢ㄦ埛鍏宠仈鐨勬墍鏈夌數瀛愬洿鏍�
+ List<ArdWall> ardWalls = ardWallMapper.selectArdWallListByUserId(userId);
+ List<ArdWall> ardWallsNoIn = new ArrayList();//绂佸叆鐢靛瓙鍥存爮
+ List<ArdWall> ardWallsNoOut = new ArrayList();//绂佸嚭鐢靛瓙鍥存爮
+ ardWallsNoIn = ardWalls.stream().filter(ardWall -> ardWall.getType().equals("1")).collect(Collectors.toList());
+ ardWallsNoOut = ardWalls.stream().filter(ardWall -> ardWall.getType().equals("2")).collect(Collectors.toList());
+ //褰撳墠鐢ㄦ埛鐨勪綅缃�
+ Point userPoint = new Point(ardAppPosition.getLongitude(), ardAppPosition.getLatitude());
+ if(ardWallsNoIn.size() > 0){//鍒ゆ柇绂佸叆
+ for(ArdWall wall : ardWallsNoIn){
+ String wallId = wall.getId();//鍥存爮ID
+ String wallPoi = wall.getWallPoi();//鍥存爮鍧愭爣闆嗗悎
+ //澶勭悊澶氳竟褰㈢殑姣忎釜鐐圭殑缁忕含搴�
+ String[] parts = wallPoi.split(",");
+ List<Point> pointList = new ArrayList<>();
+ for (int i = 0; i < parts.length; i += 3) {
+ Point point = new Point();
+ point.setLongitude(Double.valueOf(parts[i]));
+ point.setLatitude(Double.valueOf(parts[i + 1]));
+ pointList.add(point);
+ }
+ boolean inPolygon = GisUtil.isInPolygon(userPoint, pointList);//鍒ゆ柇鏄惁鍦ㄥ洿鏍忓唴
+ //鍒涘缓鍥存爮鎶ヨ瀹炰綋瀵硅薄
+ ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
+ ardAlarmWall.setWallId(wall.getId());
+ ardAlarmWall.setWallName(wall.getWallName());
+ ardAlarmWall.setUserId(userId);
+ ardAlarmWall.setAlarmTime(DateUtils.getNowDate());
+ ardAlarmWall.setAlarmType(wall.getType());
+ ardAlarmWall.setLongitude(ardAppPosition.getLongitude());
+ ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
+ ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
+ String key = userId + "_" + wallId;//鏈�鍚庝竴娆℃姤璀︾紦瀛榢ey
+ if (inPolygon) {
+ //绂佸叆鍥存爮鍒欒嫢鍦ㄥ洿鏍忓唴,鑾峰彇棣栨杩涘叆鍥存爮鎶ヨID
+ String lastInAlarmId = firstAlarmMap.get(key);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨杩涘叆鍥存爮鍐�
+ if (lastInAlarmId == null) {
+ //褰撳墠鐢ㄦ埛棣栨杩涘叆鐢熸垚鎶ヨ
+ String uuid = IdUtils.simpleUUID();
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //璁板綍棣栨鎶ヨid
+ firstAlarmMap.put(key, uuid);
+ } else {
+ //鐢ㄦ埛宸茶繘鍏ユ洿鏂版渶鍚庢姤璀�
+ ardAlarmWall.setId(lastInAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
+ } else {
+ //绂佸叆鍥存爮鍒欒嫢鍦ㄥ洿鏍忓鍒欑Щ闄ゆ姤璀︾紦瀛�
+ firstAlarmMap.remove(key);
+ }
+ }
+ }
+
+ Boolean noOutFlag = true;
+ if(ardWallsNoOut.size() > 0) {//鍒ゆ柇绂佸嚭
+ for(ArdWall wall : ardWallsNoOut){
+ String wallPoi = wall.getWallPoi();//鍥存爮鍧愭爣闆嗗悎
+ //澶勭悊澶氳竟褰㈢殑姣忎釜鐐圭殑缁忕含搴�
+ String[] parts = wallPoi.split(",");
+ List<Point> pointList = new ArrayList<>();
+ for (int i = 0; i < parts.length; i += 3) {
+ Point point = new Point();
+ point.setLongitude(Double.valueOf(parts[i]));
+ point.setLatitude(Double.valueOf(parts[i + 1]));
+ pointList.add(point);
+ }
+ boolean inPolygon = GisUtil.isInPolygon(userPoint, pointList);//鍒ゆ柇鏄惁鍦ㄥ洿鏍忓唴
+ if (!inPolygon) {
+ noOutFlag = true;
+ } else {
+ noOutFlag = false;
+ break;
+ }
+ }
+ }
+ if(noOutFlag){//鍏ㄩ儴绂佸嚭鐢靛瓙鍥存爮閮藉嚭鍘讳簡
+ for(ArdWall wall : ardWallsNoOut){
+ String wallId = wall.getId();//鍥存爮ID
+ //鍒涘缓鍥存爮鎶ヨ瀹炰綋瀵硅薄
+ ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
+ ardAlarmWall.setWallId(wall.getId());
+ ardAlarmWall.setWallName(wall.getWallName());
+ ardAlarmWall.setUserId(userId);
+ ardAlarmWall.setAlarmTime(DateUtils.getNowDate());
+ ardAlarmWall.setAlarmType(wall.getType());
+ ardAlarmWall.setLongitude(ardAppPosition.getLongitude());
+ ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
+ ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
+ String key = userId + "_" + wallId;//鏈�鍚庝竴娆℃姤璀︾紦瀛榢ey
+ //绂佸嚭鍥存爮鍒欒嫢鍦ㄥ洿鏍忓,鑾峰彇棣栨璧板嚭鍥存爮鎶ヨID
+ String lastAlarmId = firstAlarmMap.get(key);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨鍦ㄥ洿鏍忓
+ if (lastAlarmId == null) {
+ String uuid = IdUtils.simpleUUID();
+ //褰撳墠鐢ㄦ埛棣栨鍑哄洿鏍忕敓鎴愭姤璀�
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //璁板綍棣栨鎶ヨid
+ firstAlarmMap.put(key, uuid);
+ } else {
+ //鐢ㄦ埛宸茬粡鍦ㄥ洿鏍忓鏇存柊鎶ヨ
+ ardAlarmWall.setId(lastAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
+ }
+ }else{
+ for(ArdWall wall : ardWallsNoOut){
+ String wallId = wall.getId();//鍥存爮ID
+ String key = userId + "_" + wallId;//鏈�鍚庝竴娆℃姤璀︾紦瀛榢ey
+ firstAlarmMap.remove(key);
+ }
+ }
+ return ardAlarmWalls;
+ }
+
+ @Override
+ public Map<String, List<SysUser>> getOnlinePCOrCommander(String usersId) {
+ Map<String, List<SysUser>> result = new HashMap();
+ List<SysUser> commanderList = sysUserMapper.getOnlineCommander(usersId);
+ result.put("commander",commanderList);
+ try{
+ List<String> onLinePCIdList = new ArrayList();
+ //onLinePCIdList.addAll(ONLINE_USER_SESSIONS.keySet());
+ for(String id : ONLINE_USER_SESSIONS.keySet()){
+ onLinePCIdList.add(id.split("_")[0]);
+ }
+ List<SysUser> pcList = sysUserMapper.getOnlinePC(usersId,onLinePCIdList);
+ result.put("pc",pcList);
+ }catch(Exception e){
+ result.put("pc",new ArrayList());
+ }
+ return result;
+ }
+
+ @Override
+ public List<Map<String,Object>> getOnlineCommanderPosition(String soilderId) {
+ List<Map<String,Object>> result = ardAppPositionMapper.getOnlineCommanderPosition(soilderId);
+ return result;
+ }
+
+ @Override
+ public List<ArdAppPosition> getAPPPositionByUserIdAndTime(Map<String, String> para) {
+ String userId = para.get("userId");
+ String beginTime = para.get("beginTime");
+ String endTime = para.get("endTime");
+ List<ArdAppPosition> result = ardAppPositionMapper.getAPPPositionByUserIdAndTime(userId,beginTime,endTime);
+ return result;
+ }
+
+ @Override
+ public List<Map<String,Object>> getOnlineAPPSoilderByCommanderId(String userId) {
+ SysUser sysUser = sysUserMapper.selectUserById(userId);//鑾峰彇绯荤粺鐢ㄦ埛
+ List<Long> deptIdList = new ArrayList();
+ deptIdList.add(sysUser.getDeptId());
+ deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//閫掑綊鏌ヨ涓嬪睘閮ㄩ棬涓婚敭
+ List<SysUser> result = sysUserMapper.getOwnAndChildrenOnlineSoilderList(deptIdList);
+ List<Map<String,Object>> resultList = new ArrayList();
+ for(SysUser sysUserIn : result){
+ Map<String,Object> map = new HashMap();
+ map.put("userId",sysUserIn.getUserId());
+ map.put("deptId",sysUserIn.getDeptId());
+ map.put("userName",sysUserIn.getUserName());
+ map.put("nickName",sysUserIn.getNickName());
+ try{
+ map.put("longitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLongitude());
+ map.put("latitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLatitude());
+ map.put("altitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getAltitude());
+ }catch(Exception e){
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.getLastAPPPositionByUserId(sysUserIn.getUserId());
+ map.put("longitude",ardAppPosition.getLongitude());
+ map.put("latitude",ardAppPosition.getLatitude());
+ map.put("altitude",ardAppPosition.getAltitude());
+ }
+ resultList.add(map);
+ }
+ return resultList;
+ }
+
+ public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){
+ deptIdListr.addAll(deptIdList);
+ List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList);
+ if(result.size() != 0){
+ deptIdListr.addAll(result);
+ result = getOwnAndChildrenDeptIdList(result,deptIdListr);
+ }
+ deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList());
+ return deptIdListr;
}
}
--
Gitblit v1.9.3