Compare commits

...

2 Commits

Author SHA1 Message Date
luyya 5b9e36dc3f 宣城修改module名 2025-06-05 18:11:09 +08:00
luyya caf03c1efb 宣城修改module名 2025-06-05 17:52:16 +08:00
267 changed files with 83 additions and 59 deletions

View File

@ -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;
}
} }

View File

@ -9,15 +9,15 @@
<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>
<module>stwzhj-workflow</module> <module>stwzhj-workflow</module>
<module>stwzhj-data2es</module> <module>wzhj-data2es</module>
<module>stwzhj-baseToSt</module> <module>stwzhj-baseToSt</module>
<module>stwzhj-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>

View File

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>stwzhj-consumer</artifactId> <artifactId>wzhj-consumer</artifactId>
<dependencies> <dependencies>

View File

@ -9,10 +9,10 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>stwzhj-data2es</artifactId> <artifactId>wzhj-data2es</artifactId>
<description> <description>
stwzhj-data2es位置汇聚数据处理 wzhj-data2es位置汇聚数据处理
</description> </description>
<dependencies> <dependencies>

View File

@ -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=nulldeviceType={},deviceCode={}",info.getDeviceType(),info.getDeviceCode()); logger.error("redis或者mysql中的Object=nulldeviceType={},deviceCode={}",deviceType,deviceCode);
continue; continue;
} }
//redis //redis

View File

@ -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>

View File

@ -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
@ -44,11 +46,10 @@ 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); List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
String key = keys + s + ":["+type+"]:*"; // key值为 online_users:3401xxxx:[01,02]:* list.removeAll(Collections.singleton(null));
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key); List<JSONObject> matchedObjects = list.stream()
list.removeAll(Collections.singleton(null)); .filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
dlist.addAll(list); .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); List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key);
String key = keys + s + ":*"; list.removeAll(Collections.singleton(null));
List<JSONObject> list = RedisUtils.searchAndGetKeysValues(key); List<JSONObject> matchedObjects = list.stream()
list.removeAll(Collections.singleton(null)); .filter(obj -> targetSet.contains(obj.getStr("zzjgdm")))
dlist.addAll(list); .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");
@ -138,12 +140,12 @@ public class LocationController {
} }
/* /*
* ID * ID
* */ * */
@PostMapping("/getLocationByDeviceId") @PostMapping("/getLocationByDeviceId")
public R getLocationByDeviceId(@RequestBody Map<String,Object> params){ public R getLocationByDeviceId(@RequestBody Map<String,Object> params){
if(CollectionUtils.isEmpty(params)){ if(CollectionUtils.isEmpty(params)){
return R.fail("参数不能为空"); return R.fail("参数不能为空");
} }
String keys = "online_users:"; String keys = "online_users:";
String key = ""; String key = "";
@ -166,8 +168,8 @@ public class LocationController {
/* /*
* *
* */ * */
@PostMapping("/getLocationByPoint") @PostMapping("/getLocationByPoint")
public R getLocationByPoint(@RequestBody Map<String,Object> params){ public R getLocationByPoint(@RequestBody Map<String,Object> params){
String keys = "online_users:"; String keys = "online_users:";
@ -177,28 +179,25 @@ 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);
} }
/*+ /*+
* *
* */ * */
@PostMapping("/getObjByCondition") @PostMapping("/getObjByCondition")
public R getObjByCondition(@RequestBody Map<String,Object> params){ public R getObjByCondition(@RequestBody Map<String,Object> params){
if(CollectionUtils.isEmpty(params)){ if(CollectionUtils.isEmpty(params)){

View File

@ -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>

View File

@ -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
*/ */

Some files were not shown because too many files have changed in this diff Show More