| | |
| | | package com.ruoyi.app.position.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.alarm.wall.domain.ArdAlarmWall; |
| | | import com.ruoyi.alarm.wall.mapper.ArdAlarmWallMapper; |
| | | 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.utils.SecurityUtils; |
| | | 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.gis.GisUtil; |
| | | import com.ruoyi.utils.gis.Point; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.autoconfigure.data.redis.RedisProperties; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | IArdAlarmWallService ardAlarmWallService; |
| | | @Resource |
| | | private SysUserMapper sysUserMapper; |
| | | @Resource |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | Map<String, String> firstAlarmMap = new HashMap<>();//馿¬¡æ¥è¦ç¼åkey:ç¨æ·id_å´æ id value: æ¥è¦id |
| | | /** |
| | |
| | | ardAppPosition.setId(IdUtils.simpleUUID()); |
| | | ardAppPosition.setCreateTime(DateUtils.getNowDate()); |
| | | ardAppPositionMapper.insertArdAppPosition(ardAppPosition); |
| | | return DetectionWallAlarm(ardAppPosition); |
| | | try{ |
| | | return DetectionWallAlarm(ardAppPosition); |
| | | }finally { |
| | | AppContainer.getArdAppPositionMap().put(ardAppPosition.getUserId(),ardAppPosition);//宿¶ä½ç½®åå
¥å®¹å¨ |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | return result; |
| | | } |
| | | |
| | | /*@Override |
| | | public void sendCheckCommandersPosition(String usersId,Map<String, Object> para) { |
| | | String reason = (String) para.get("reason"); |
| | | List<String> usersIdList = (List<String>) para.get("usersIdList"); |
| | | for(String commanderId : usersIdList){ |
| | | //设置key为checkCommanderPosition_ææ¥ç«¯ä¸»é®_åå
µç«¯ä¸»é® |
| | | String key = "checkCommanderPosition_" + commanderId + "_" + usersId; |
| | | Map<String,Object> value = new HashMap(); |
| | | value.put("reason",reason); |
| | | value.put("state","0"); |
| | | value.put("begin",""); |
| | | value.put("commanderId",commanderId); |
| | | value.put("soilderId",usersId); |
| | | redisCache.setCacheObject(key, JSON.toJSONString(value)); |
| | | } |
| | | }*/ |
| | | |
| | | /*@Override |
| | | public void sendCheckSYCarsPosition(String usersId, Map<String, Object> para) { |
| | | String reason = (String) para.get("reason"); |
| | | List<String> usersIdList = (List<String>) para.get("usersIdList"); |
| | | for(String commanderId : usersIdList){ |
| | | //设置key为checkSYCarsPosition_ææ¥ç«¯ä¸»é®/PC端主é®_åå
µç«¯ä¸»é® |
| | | String key = "checkSYCarsPosition_" + commanderId + "_" + usersId; |
| | | Map<String,Object> value = new HashMap(); |
| | | value.put("reason",reason); |
| | | value.put("state","0"); |
| | | value.put("begin",""); |
| | | value.put("commanderId",commanderId); |
| | | value.put("soilderId",usersId); |
| | | redisCache.setCacheObject(key, JSON.toJSONString(value)); |
| | | } |
| | | }*/ |
| | | |
| | | /*@Override |
| | | public List<Map<String, Object>> getCheckCommandersPosition(String usersId) { |
| | | String key = "checkCommanderPosition_" + usersId + "_"; |
| | | List<Object> keyValueList = redisCache.getListKey(key); |
| | | List<Map<String, Object>> result = new ArrayList(); |
| | | for(Object o : keyValueList){ |
| | | Map<String,Object> map = JSON.parseObject((String) o); |
| | | if(((String)map.get("state")).equals("0")){//state为0å°±æ¯æªå®¡æ¹ |
| | | SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId")); |
| | | map.put("userName",sysUser.getUserName()); |
| | | result.add(map); |
| | | @Override |
| | | public List<Map<String,Object>> getAPPSoilderByCommanderId(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.getOwnAndChildrenSoilderList(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 result; |
| | | }*/ |
| | | return resultList; |
| | | } |
| | | |
| | | /*@Override |
| | | public List<Map<String, Object>> getCheckSYCarsPosition(String usersId) { |
| | | String key = "checkSYCarsPosition_" + usersId + "_"; |
| | | List<Object> keyValueList = redisCache.getListKey(key); |
| | | List<Map<String, Object>> result = new ArrayList(); |
| | | for(Object o : keyValueList){ |
| | | Map<String,Object> map = JSON.parseObject((String) o); |
| | | if(((String)map.get("state")).equals("0")){//state为0å°±æ¯æªå®¡æ¹ |
| | | SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId")); |
| | | map.put("userName",sysUser.getUserName()); |
| | | result.add(map); |
| | | } |
| | | 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); |
| | | } |
| | | return result; |
| | | }*/ |
| | | deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList()); |
| | | return deptIdListr; |
| | | } |
| | | |
| | | /*@Override |
| | | public Map<String, List<Map<String, Object>>> getCheckPosition(String usersId) { |
| | | Map<String, List<Map<String, Object>>> result = new HashMap(); |
| | | //æ¥çææ¥ç«¯ä½ç½®ç³è¯· |
| | | String keyCommanderPosition = "checkCommanderPosition_" + usersId + "_"; |
| | | List<Object> keyValueCommanderPositionList = redisCache.getListKey(keyCommanderPosition); |
| | | List<Map<String, Object>> resultCommanderPosition = new ArrayList(); |
| | | for(Object o : keyValueCommanderPositionList){ |
| | | Map<String,Object> map = JSON.parseObject((String) o); |
| | | if(((String)map.get("state")).equals("0")){//state为0å°±æ¯æªå®¡æ¹ |
| | | SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId")); |
| | | map.put("userName",sysUser.getUserName()); |
| | | if(sysUser.getNickName() != null){ |
| | | map.put("nickName",sysUser.getNickName()); |
| | | }else{ |
| | | map.put("nickName",sysUser.getNickName()); |
| | | } |
| | | resultCommanderPosition.add(map); |
| | | } |
| | | } |
| | | //æ¥ç车è¾ä½ç½®ç³è¯· |
| | | String keySYCarsPosition = "checkSYCarsPosition_" + usersId + "_"; |
| | | List<Object> keyValueSYCarsPositionList = redisCache.getListKey(keySYCarsPosition); |
| | | List<Map<String, Object>> resultSYCarsPosition = new ArrayList(); |
| | | for(Object o : keyValueSYCarsPositionList){ |
| | | Map<String,Object> map = JSON.parseObject((String) o); |
| | | if(((String)map.get("state")).equals("0")){//state为0å°±æ¯æªå®¡æ¹ |
| | | SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId")); |
| | | map.put("userName",sysUser.getUserName()); |
| | | if(sysUser.getNickName() != null){ |
| | | map.put("nickName",sysUser.getNickName()); |
| | | }else{ |
| | | map.put("nickName",sysUser.getNickName()); |
| | | } |
| | | resultSYCarsPosition.add(map); |
| | | } |
| | | } |
| | | result.put("commander",resultCommanderPosition); |
| | | result.put("SYCars",resultSYCarsPosition); |
| | | return result; |
| | | }*/ |
| | | } |