| | |
| | | log.error(String.format(" ---->收到定位数据:%s",JSON.toJSONString(gpsMap)));*/ |
| | | String carId = (String)gpsMap.get("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(); |
| | | } |
| | | deptMapp.put((String)gpsMap.get("carId"),gpsMap);//首次加入容器,再次去重 |
| | | PositionContainer.getDeptPositionMap().put(deptIdp,deptMap); |
| | | 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(); |
| | | } |
| | | deptMapp.put((String)gpsMap.get("carId"),gpsMap);//首次加入容器,再次去重 |
| | | PositionContainer.getDeptPositionMap().put(deptIdp,deptMap); |
| | | } |
| | | } |
| | | } |
| | | /** |