宣城修改module名
parent
caf03c1efb
commit
5b9e36dc3f
|
|
@ -751,4 +751,12 @@ public class RedisUtils {
|
|||
return count1;
|
||||
}
|
||||
|
||||
// 查询半径周边 米内的成员
|
||||
public static List<String> nearByXYReadonly(double centerLon,double centerLat,double distance){
|
||||
RGeo<String> geo = CLIENT.getGeo(RedisConstants.ONLINE_USERS_GEO);
|
||||
List<String> members = geo.radius(centerLon, centerLat, distance, GeoUnit.METERS);
|
||||
return members;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modules>
|
||||
<module>stwzhj-system</module>
|
||||
<module>wzhj-system</module>
|
||||
<module>stwzhj-gen</module>
|
||||
<module>stwzhj-job</module>
|
||||
<module>stwzhj-resource</module>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<module>wzhj-data2es</module>
|
||||
<module>stwzhj-baseToSt</module>
|
||||
<module>wzhj-consumer</module>
|
||||
<module>stwzhj-location</module>
|
||||
<module>wzhj-location</module>
|
||||
<module>stwzhj-dataToGas</module>
|
||||
<module>wzhj-webscoket</module>
|
||||
<module>wzhj-extract</module>
|
||||
|
|
|
|||
|
|
@ -110,11 +110,12 @@ public class GpsServiceImpl implements IGpsService {
|
|||
List<String> deleteKeys = new ArrayList<>();
|
||||
BulkRequest bulkRequest = new BulkRequest();
|
||||
for (EsGpsInfoVO2 info : list) {
|
||||
|
||||
String deviceType = info.getDeviceType();
|
||||
String deviceCode = info.getDeviceCode();
|
||||
//设置地市zzjgdm
|
||||
info = getInfo(info);
|
||||
info = getInfo(info);
|
||||
if (Objects.isNull(info)) {
|
||||
logger.error("redis中的Object=null,deviceType={},deviceCode={}",info.getDeviceType(),info.getDeviceCode());
|
||||
logger.error("redis或者mysql中的Object=null,deviceType={},deviceCode={}",deviceType,deviceCode);
|
||||
continue;
|
||||
}
|
||||
//redis
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>stwzhj-location</artifactId>
|
||||
<artifactId>wzhj-location</artifactId>
|
||||
|
||||
<description>
|
||||
stwzhj-location位置汇聚坐标点位历史轨迹
|
||||
wzhj-location位置汇聚坐标点位历史轨迹
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.RedisConstants;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.system.api.RemoteDeviceService;
|
||||
import org.dromara.system.api.domain.bo.RemoteDeviceBo;
|
||||
|
|
@ -26,6 +27,7 @@ import redis.clients.jedis.resps.GeoRadiusResponse;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Configuration
|
||||
@RestController
|
||||
|
|
@ -44,11 +46,10 @@ public class LocationController {
|
|||
|
||||
|
||||
/*
|
||||
* 根据条件获取设备坐标信息集合
|
||||
* */
|
||||
* 根据条件获取设备坐标信息集合
|
||||
* */
|
||||
@PostMapping("/getAllLocation")
|
||||
public R getAllLocaltion(@RequestBody Map<String,Object> params){
|
||||
String now = DateUtil.format(new Date(),"YYYY-MM-dd");
|
||||
String keys = "online_users:";
|
||||
String key = null; // 在不同条件下赋值 最后根据此key取值
|
||||
if(CollectionUtils.isEmpty(params)){
|
||||
|
|
@ -61,9 +62,9 @@ public class LocationController {
|
|||
}
|
||||
if (null != params.get("type")){
|
||||
String type = params.get("type").toString();
|
||||
key = keys + "*:[" +type+"]:*";
|
||||
key = keys + "[" +type+"]:*";
|
||||
if (null != params.get("deptId")){
|
||||
key = keys + params.get("deptId").toString() + "*:["+type+"]:*"; // key值为 online_users:2022-04-20:3401*:[01,02]:*
|
||||
key = keys + params.get("deptId").toString() + ":["+type+"]:*"; // key值为 online_users:2022-04-20:3401*:[01,02]:*
|
||||
}
|
||||
|
||||
}else {
|
||||
|
|
@ -97,33 +98,34 @@ public class LocationController {
|
|||
times = params.get("times").toString();
|
||||
}
|
||||
String zzjgdms = "";
|
||||
List<Object> dlist = new ArrayList<>();
|
||||
List<JSONObject> dlist = new ArrayList<>();
|
||||
if (null != params.get("type")){ //类型不为空时 查询Redis数据
|
||||
String type = params.get("type").toString();
|
||||
// String[] types = Convert.toStrArray(type);
|
||||
String key = keys + "["+type+"]:*"; // key值为 online_users:[01,02]:*
|
||||
zzjgdms = params.get("zzjgdm").toString();
|
||||
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
||||
for (String s : zzjgdm) {
|
||||
s = deptIdSub(s);
|
||||
String key = keys + s + ":["+type+"]:*"; // key值为 online_users:3401xxxx:[01,02]:*
|
||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
dlist.addAll(list);
|
||||
}
|
||||
Set<String> targetSet = new HashSet<>(List.of(zzjgdm)); // 转为HashSet提高查询效率
|
||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
List<JSONObject> matchedObjects = list.stream()
|
||||
.filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
|
||||
.collect(Collectors.toList()); //根据前端勾选机构和全部的redis记录匹配是否包含 这样减少多次查询和查库
|
||||
dlist.addAll(matchedObjects);
|
||||
}else {
|
||||
String key = keys + "*"; // key值为 online_users:*
|
||||
zzjgdms = params.get("zzjgdm").toString();
|
||||
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
||||
for (String s : zzjgdm) {
|
||||
s = deptIdSub(s);
|
||||
String key = keys + s + ":*";
|
||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
dlist.addAll(list);
|
||||
}
|
||||
Set<String> targetSet = new HashSet<>(List.of(zzjgdm)); // 转为HashSet提高查询效率
|
||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
List<JSONObject> matchedObjects = list.stream()
|
||||
.filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
|
||||
.collect(Collectors.toList()); //根据前端勾选机构和全部的redis记录匹配是否包含 这样减少多次查询和查库
|
||||
dlist.addAll(matchedObjects);
|
||||
}
|
||||
JSONArray.toJSONString(dlist);
|
||||
if ("1".equals(times)){
|
||||
List<Object> nearList = new ArrayList<>();
|
||||
if ("1".equals(times)){ List<Object> nearList = new ArrayList<>();
|
||||
for (Object o : dlist) {
|
||||
JSONObject object = JSONUtil.parseObj(o);
|
||||
Integer online = object.getInt("online");
|
||||
|
|
@ -138,12 +140,12 @@ public class LocationController {
|
|||
}
|
||||
|
||||
/*
|
||||
* 根据设备ID 获取设备信息
|
||||
* */
|
||||
* 根据设备ID 获取设备信息
|
||||
* */
|
||||
@PostMapping("/getLocationByDeviceId")
|
||||
public R getLocationByDeviceId(@RequestBody Map<String,Object> params){
|
||||
if(CollectionUtils.isEmpty(params)){
|
||||
return R.fail("参数不能为空");
|
||||
return R.fail("参数不能为空");
|
||||
}
|
||||
String keys = "online_users:";
|
||||
String key = "";
|
||||
|
|
@ -166,8 +168,8 @@ public class LocationController {
|
|||
|
||||
|
||||
/*
|
||||
* 根据坐标和距离返回范围内设备
|
||||
* */
|
||||
* 根据坐标和距离返回范围内设备
|
||||
* */
|
||||
@PostMapping("/getLocationByPoint")
|
||||
public R getLocationByPoint(@RequestBody Map<String,Object> params){
|
||||
String keys = "online_users:";
|
||||
|
|
@ -177,28 +179,25 @@ public class LocationController {
|
|||
String lat = params.get("lat").toString();
|
||||
String lng = params.get("lng").toString();
|
||||
String dist = params.get("distance").toString();
|
||||
/* List<GeoRadiusResponse> geoRadiusResponses = redisUtil.nearByXYReadonly(RedisConstants.ONLINE_USERS_GEO,
|
||||
Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(dist));
|
||||
List<Device> list = new ArrayList<>();
|
||||
for (GeoRadiusResponse geoRadiusRespons : geoRadiusResponses) {
|
||||
String memberByString = geoRadiusRespons.getMemberByString();
|
||||
logger.info("member:"+memberByString);
|
||||
String[] strs = memberByString.split("#");
|
||||
logger.info("key值:"+keys+":"+strs[0]+":"+strs[1]+":"+strs[2]);
|
||||
Object object = redisUtil.get(keys+":"+strs[0]+":"+strs[1]+":"+strs[2]);
|
||||
List<String> geoRadiusResponses = RedisUtils.nearByXYReadonly(
|
||||
Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(dist));
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
for (String geoRadiusRespons : geoRadiusResponses) {
|
||||
logger.info("member:"+geoRadiusRespons);
|
||||
String[] strs = geoRadiusRespons.split("#");
|
||||
logger.info("key值:"+keys+":"+strs[0]+":"+strs[1]);
|
||||
JSONObject object = RedisUtils.getBucket(keys+":"+strs[0]+":"+strs[1]);
|
||||
if (null != object){
|
||||
Device device = FastJSONUtil.parsePojo(object.toString(), Device.class);
|
||||
//device = rebuildDevice(device);
|
||||
list.add(device);
|
||||
list.add(object);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/*+
|
||||
* 根据机构、类型和模糊条件匹配设备
|
||||
* */
|
||||
* 根据机构、类型和模糊条件匹配设备
|
||||
* */
|
||||
@PostMapping("/getObjByCondition")
|
||||
public R getObjByCondition(@RequestBody Map<String,Object> params){
|
||||
if(CollectionUtils.isEmpty(params)){
|
||||
|
|
@ -9,10 +9,10 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>stwzhj-system</artifactId>
|
||||
<artifactId>wzhj-system</artifactId>
|
||||
|
||||
<description>
|
||||
stwzhj-system系统模块
|
||||
wzhj-system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package org.dromara.system.controller;
|
||||
package org.dromara.system.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
|
@ -11,6 +12,7 @@ import org.dromara.common.excel.core.ExcelResult;
|
|||
import org.dromara.system.domain.vo.SysUserImportVo;
|
||||
import org.dromara.system.domain.vo.TDeviceExportVo;
|
||||
import org.dromara.system.domain.vo.TDeviceImportVo;
|
||||
import org.dromara.system.exception.MyBusinessException;
|
||||
import org.dromara.system.listener.SysUserImportListener;
|
||||
import org.dromara.system.listener.TDeviceImportListener;
|
||||
import org.springframework.http.MediaType;
|
||||
|
|
@ -55,6 +57,17 @@ public class TDeviceController extends BaseController {
|
|||
return tDeviceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@PostMapping("/getDeviceList")
|
||||
public TableDataInfo<TDeviceVo> getDeviceList(@RequestBody TDeviceBo bo){
|
||||
PageQuery pageQuery = new PageQuery();
|
||||
if (Objects.isNull(bo)) {
|
||||
throw new MyBusinessException("请求参数不能为空");
|
||||
}
|
||||
pageQuery.setPageNum(bo.getPageNum());
|
||||
pageQuery.setPageSize(bo.getPageSize());
|
||||
return tDeviceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出device列表
|
||||
*/
|
||||
|
|
@ -95,5 +95,8 @@ public class TDeviceBo extends BaseEntity {
|
|||
private String[] zzjgdms;
|
||||
|
||||
|
||||
private int pageNum;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue