宣城修改module名
parent
caf03c1efb
commit
5b9e36dc3f
|
|
@ -751,4 +751,12 @@ public class RedisUtils {
|
||||||
return count1;
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>stwzhj-system</module>
|
<module>wzhj-system</module>
|
||||||
<module>stwzhj-gen</module>
|
<module>stwzhj-gen</module>
|
||||||
<module>stwzhj-job</module>
|
<module>stwzhj-job</module>
|
||||||
<module>stwzhj-resource</module>
|
<module>stwzhj-resource</module>
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<module>wzhj-data2es</module>
|
<module>wzhj-data2es</module>
|
||||||
<module>stwzhj-baseToSt</module>
|
<module>stwzhj-baseToSt</module>
|
||||||
<module>wzhj-consumer</module>
|
<module>wzhj-consumer</module>
|
||||||
<module>stwzhj-location</module>
|
<module>wzhj-location</module>
|
||||||
<module>stwzhj-dataToGas</module>
|
<module>stwzhj-dataToGas</module>
|
||||||
<module>wzhj-webscoket</module>
|
<module>wzhj-webscoket</module>
|
||||||
<module>wzhj-extract</module>
|
<module>wzhj-extract</module>
|
||||||
|
|
|
||||||
|
|
@ -110,11 +110,12 @@ public class GpsServiceImpl implements IGpsService {
|
||||||
List<String> deleteKeys = new ArrayList<>();
|
List<String> deleteKeys = new ArrayList<>();
|
||||||
BulkRequest bulkRequest = new BulkRequest();
|
BulkRequest bulkRequest = new BulkRequest();
|
||||||
for (EsGpsInfoVO2 info : list) {
|
for (EsGpsInfoVO2 info : list) {
|
||||||
|
String deviceType = info.getDeviceType();
|
||||||
|
String deviceCode = info.getDeviceCode();
|
||||||
//设置地市zzjgdm
|
//设置地市zzjgdm
|
||||||
info = getInfo(info);
|
info = getInfo(info);
|
||||||
if (Objects.isNull(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;
|
continue;
|
||||||
}
|
}
|
||||||
//redis
|
//redis
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>stwzhj-location</artifactId>
|
<artifactId>wzhj-location</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
stwzhj-location位置汇聚坐标点位历史轨迹
|
wzhj-location位置汇聚坐标点位历史轨迹
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.utils.RedisConstants;
|
||||||
import org.dromara.common.redis.utils.RedisUtils;
|
import org.dromara.common.redis.utils.RedisUtils;
|
||||||
import org.dromara.system.api.RemoteDeviceService;
|
import org.dromara.system.api.RemoteDeviceService;
|
||||||
import org.dromara.system.api.domain.bo.RemoteDeviceBo;
|
import org.dromara.system.api.domain.bo.RemoteDeviceBo;
|
||||||
|
|
@ -26,6 +27,7 @@ import redis.clients.jedis.resps.GeoRadiusResponse;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -48,7 +50,6 @@ public class LocationController {
|
||||||
* */
|
* */
|
||||||
@PostMapping("/getAllLocation")
|
@PostMapping("/getAllLocation")
|
||||||
public R getAllLocaltion(@RequestBody Map<String,Object> params){
|
public R getAllLocaltion(@RequestBody Map<String,Object> params){
|
||||||
String now = DateUtil.format(new Date(),"YYYY-MM-dd");
|
|
||||||
String keys = "online_users:";
|
String keys = "online_users:";
|
||||||
String key = null; // 在不同条件下赋值 最后根据此key取值
|
String key = null; // 在不同条件下赋值 最后根据此key取值
|
||||||
if(CollectionUtils.isEmpty(params)){
|
if(CollectionUtils.isEmpty(params)){
|
||||||
|
|
@ -61,9 +62,9 @@ public class LocationController {
|
||||||
}
|
}
|
||||||
if (null != params.get("type")){
|
if (null != params.get("type")){
|
||||||
String type = params.get("type").toString();
|
String type = params.get("type").toString();
|
||||||
key = keys + "*:[" +type+"]:*";
|
key = keys + "[" +type+"]:*";
|
||||||
if (null != params.get("deptId")){
|
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 {
|
}else {
|
||||||
|
|
@ -97,33 +98,34 @@ public class LocationController {
|
||||||
times = params.get("times").toString();
|
times = params.get("times").toString();
|
||||||
}
|
}
|
||||||
String zzjgdms = "";
|
String zzjgdms = "";
|
||||||
List<Object> dlist = new ArrayList<>();
|
List<JSONObject> dlist = new ArrayList<>();
|
||||||
if (null != params.get("type")){ //类型不为空时 查询Redis数据
|
if (null != params.get("type")){ //类型不为空时 查询Redis数据
|
||||||
String type = params.get("type").toString();
|
String type = params.get("type").toString();
|
||||||
// String[] types = Convert.toStrArray(type);
|
// String[] types = Convert.toStrArray(type);
|
||||||
|
String key = keys + "["+type+"]:*"; // key值为 online_users:[01,02]:*
|
||||||
zzjgdms = params.get("zzjgdm").toString();
|
zzjgdms = params.get("zzjgdm").toString();
|
||||||
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
||||||
for (String s : zzjgdm) {
|
Set<String> targetSet = new HashSet<>(List.of(zzjgdm)); // 转为HashSet提高查询效率
|
||||||
s = deptIdSub(s);
|
|
||||||
String key = keys + s + ":["+type+"]:*"; // key值为 online_users:3401xxxx:[01,02]:*
|
|
||||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||||
list.removeAll(Collections.singleton(null));
|
list.removeAll(Collections.singleton(null));
|
||||||
dlist.addAll(list);
|
List<JSONObject> matchedObjects = list.stream()
|
||||||
}
|
.filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
|
||||||
|
.collect(Collectors.toList()); //根据前端勾选机构和全部的redis记录匹配是否包含 这样减少多次查询和查库
|
||||||
|
dlist.addAll(matchedObjects);
|
||||||
}else {
|
}else {
|
||||||
|
String key = keys + "*"; // key值为 online_users:*
|
||||||
zzjgdms = params.get("zzjgdm").toString();
|
zzjgdms = params.get("zzjgdm").toString();
|
||||||
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
String[] zzjgdm = Convert.toStrArray(zzjgdms);
|
||||||
for (String s : zzjgdm) {
|
Set<String> targetSet = new HashSet<>(List.of(zzjgdm)); // 转为HashSet提高查询效率
|
||||||
s = deptIdSub(s);
|
|
||||||
String key = keys + s + ":*";
|
|
||||||
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
|
||||||
list.removeAll(Collections.singleton(null));
|
list.removeAll(Collections.singleton(null));
|
||||||
dlist.addAll(list);
|
List<JSONObject> matchedObjects = list.stream()
|
||||||
}
|
.filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
|
||||||
|
.collect(Collectors.toList()); //根据前端勾选机构和全部的redis记录匹配是否包含 这样减少多次查询和查库
|
||||||
|
dlist.addAll(matchedObjects);
|
||||||
}
|
}
|
||||||
JSONArray.toJSONString(dlist);
|
JSONArray.toJSONString(dlist);
|
||||||
if ("1".equals(times)){
|
if ("1".equals(times)){ List<Object> nearList = new ArrayList<>();
|
||||||
List<Object> nearList = new ArrayList<>();
|
|
||||||
for (Object o : dlist) {
|
for (Object o : dlist) {
|
||||||
JSONObject object = JSONUtil.parseObj(o);
|
JSONObject object = JSONUtil.parseObj(o);
|
||||||
Integer online = object.getInt("online");
|
Integer online = object.getInt("online");
|
||||||
|
|
@ -177,23 +179,20 @@ public class LocationController {
|
||||||
String lat = params.get("lat").toString();
|
String lat = params.get("lat").toString();
|
||||||
String lng = params.get("lng").toString();
|
String lng = params.get("lng").toString();
|
||||||
String dist = params.get("distance").toString();
|
String dist = params.get("distance").toString();
|
||||||
/* List<GeoRadiusResponse> geoRadiusResponses = redisUtil.nearByXYReadonly(RedisConstants.ONLINE_USERS_GEO,
|
List<String> geoRadiusResponses = RedisUtils.nearByXYReadonly(
|
||||||
Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(dist));
|
Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(dist));
|
||||||
List<Device> list = new ArrayList<>();
|
List<JSONObject> list = new ArrayList<>();
|
||||||
for (GeoRadiusResponse geoRadiusRespons : geoRadiusResponses) {
|
for (String geoRadiusRespons : geoRadiusResponses) {
|
||||||
String memberByString = geoRadiusRespons.getMemberByString();
|
logger.info("member:"+geoRadiusRespons);
|
||||||
logger.info("member:"+memberByString);
|
String[] strs = geoRadiusRespons.split("#");
|
||||||
String[] strs = memberByString.split("#");
|
logger.info("key值:"+keys+":"+strs[0]+":"+strs[1]);
|
||||||
logger.info("key值:"+keys+":"+strs[0]+":"+strs[1]+":"+strs[2]);
|
JSONObject object = RedisUtils.getBucket(keys+":"+strs[0]+":"+strs[1]);
|
||||||
Object object = redisUtil.get(keys+":"+strs[0]+":"+strs[1]+":"+strs[2]);
|
|
||||||
if (null != object){
|
if (null != object){
|
||||||
Device device = FastJSONUtil.parsePojo(object.toString(), Device.class);
|
list.add(object);
|
||||||
//device = rebuildDevice(device);
|
}
|
||||||
list.add(device);
|
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
return R.ok();
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*+
|
/*+
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>stwzhj-system</artifactId>
|
<artifactId>wzhj-system</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
stwzhj-system系统模块
|
wzhj-system系统模块
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package org.dromara.system.controller;
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
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.SysUserImportVo;
|
||||||
import org.dromara.system.domain.vo.TDeviceExportVo;
|
import org.dromara.system.domain.vo.TDeviceExportVo;
|
||||||
import org.dromara.system.domain.vo.TDeviceImportVo;
|
import org.dromara.system.domain.vo.TDeviceImportVo;
|
||||||
|
import org.dromara.system.exception.MyBusinessException;
|
||||||
import org.dromara.system.listener.SysUserImportListener;
|
import org.dromara.system.listener.SysUserImportListener;
|
||||||
import org.dromara.system.listener.TDeviceImportListener;
|
import org.dromara.system.listener.TDeviceImportListener;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
|
@ -55,6 +57,17 @@ public class TDeviceController extends BaseController {
|
||||||
return tDeviceService.queryPageList(bo, pageQuery);
|
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列表
|
* 导出device列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,5 +95,8 @@ public class TDeviceBo extends BaseEntity {
|
||||||
private String[] zzjgdms;
|
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