宣城修改县分局登录在线数不对和图上数据全部展示问题
parent
57f6441457
commit
634b80fb8f
|
|
@ -11,6 +11,7 @@ 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.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.api.RemoteDeviceService;
|
||||
import org.dromara.system.api.domain.bo.RemoteDeviceBo;
|
||||
import org.dromara.system.api.domain.vo.RemoteDeviceVo;
|
||||
|
|
@ -50,6 +51,8 @@ public class LocationController {
|
|||
* */
|
||||
@PostMapping("/getAllLocation")
|
||||
public R getAllLocaltion(@RequestBody Map<String,Object> params){
|
||||
String userType = LoginHelper.getLoginUser().getUserType();
|
||||
|
||||
String keys = "online_users:";
|
||||
String key = null; // 在不同条件下赋值 最后根据此key取值
|
||||
if(CollectionUtils.isEmpty(params)){
|
||||
|
|
@ -70,20 +73,41 @@ public class LocationController {
|
|||
}else {
|
||||
key = keys +"[1,2,3,4,5,7,8]:*";
|
||||
}
|
||||
|
||||
|
||||
list = RedisUtils.searchAndGetKeysValues(key);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
if ("1".equals(times)){
|
||||
List<Object> nearList = new ArrayList<>();
|
||||
for (Object o : list) {
|
||||
JSONObject object = JSONUtil.parseObj(o);
|
||||
Integer online = object.getInt("online");
|
||||
Long gpstime = object.getLong("gpsTime");
|
||||
if (1 == online && DateUtil.between(new Date(gpstime),new Date(), DateUnit.SECOND)<pointTime){
|
||||
nearList.add(o);
|
||||
|
||||
if ("sys_user".equals(userType)){ //如果是系统用户 根据权限过滤自己单位下的数据
|
||||
String roleDept = LoginHelper.getLoginUser().getManageDeptId();
|
||||
List<Object> roleList = new ArrayList<>();
|
||||
if (!"341800000000".equals(roleDept)){ //如果不是全市数据权限 根据截取单位 判断包含过滤
|
||||
String deptId = deptIdSub(roleDept);
|
||||
for (Object o : list) {
|
||||
JSONObject object = JSONUtil.parseObj(o);
|
||||
String zzjgdm = object.getStr("zzjgdm");
|
||||
if (zzjgdm.contains(deptId)){ //341822440000
|
||||
roleList.add(o);
|
||||
}
|
||||
}
|
||||
}else { //全市数据权限 不用过滤
|
||||
roleList.addAll(list);
|
||||
}
|
||||
return R.ok(nearList);
|
||||
if ("1".equals(times)){
|
||||
List<Object> nearList = new ArrayList<>();
|
||||
for (Object o : roleList) {
|
||||
JSONObject object = JSONUtil.parseObj(o);
|
||||
Integer online = object.getInt("online");
|
||||
Long gpstime = object.getLong("gpsTime");
|
||||
if (1 == online && DateUtil.between(new Date(gpstime),new Date(), DateUnit.SECOND)<pointTime){
|
||||
nearList.add(o);
|
||||
}
|
||||
}
|
||||
return R.ok(nearList);
|
||||
}
|
||||
return R.ok(roleList);
|
||||
}
|
||||
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +149,8 @@ public class LocationController {
|
|||
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");
|
||||
|
|
@ -200,6 +225,7 @@ public class LocationController {
|
|||
* */
|
||||
@PostMapping("/getObjByCondition")
|
||||
public R getObjByCondition(@RequestBody Map<String,Object> params){
|
||||
String userType = LoginHelper.getLoginUser().getUserType();
|
||||
if(CollectionUtils.isEmpty(params)){
|
||||
return R.fail("参数不能为空");
|
||||
}
|
||||
|
|
@ -210,7 +236,13 @@ public class LocationController {
|
|||
}
|
||||
if (null != params.get("zzjgdm")){
|
||||
zzjgdms = params.get("zzjgdm").toString();
|
||||
}else {
|
||||
if ("sys_user".equals(userType)){
|
||||
String roleDept = LoginHelper.getLoginUser().getManageDeptId();
|
||||
zzjgdms = roleDept;
|
||||
}
|
||||
}
|
||||
|
||||
if (null != params.get("type")){
|
||||
String type = params.get("type").toString();
|
||||
RemoteDeviceBo device = new RemoteDeviceBo();
|
||||
|
|
@ -265,14 +297,14 @@ public class LocationController {
|
|||
|
||||
public String deptIdSub(String zzjgdm){
|
||||
if (zzjgdm.endsWith("0000000000")){ // 省厅 即全部
|
||||
zzjgdm = zzjgdm.substring(0,2)+"*";
|
||||
zzjgdm = zzjgdm.substring(0,2);
|
||||
}else if(zzjgdm.endsWith("00000000")){ //地市
|
||||
zzjgdm = zzjgdm.substring(0,4)+"*";
|
||||
zzjgdm = zzjgdm.substring(0,4);
|
||||
|
||||
}else if(zzjgdm.endsWith("000000")){ // 分局
|
||||
zzjgdm = zzjgdm.substring(0,6)+"*";
|
||||
zzjgdm = zzjgdm.substring(0,6);
|
||||
}else{ // 支队
|
||||
zzjgdm = zzjgdm.substring(0,8)+"*";
|
||||
zzjgdm = zzjgdm.substring(0,8);
|
||||
}
|
||||
return zzjgdm;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class DeviceRedisServiceImpl implements IDeviceRedisService {
|
|||
public Long countByZzjgdm(DeviceRedis deviceRedis) {
|
||||
LambdaQueryWrapper<DeviceRedis> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.ne(DeviceRedis::getDeviceType,"9");
|
||||
lqw.eq(DeviceRedis::getOnline,"1");
|
||||
String depts = remoteDataScopeService.getDeptAndChild(deviceRedis.getZzjgdm());
|
||||
lqw.inSql(DeviceRedis::getZzjgdm,depts);
|
||||
return baseMapper.countByzzjgdm(lqw);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@
|
|||
LEFT JOIN
|
||||
(select substring(zzjgdm,1,8) as zzjgdm ,count(*) as allCount from t_device where device_type = #{deviceType} and valid =1 group by SUBSTRING(zzjgdm,1,8)) a
|
||||
on SUBSTRING(d.dept_id,1,8) = SUBSTRING(a.zzjgdm,1,8)
|
||||
where `status` = '0' and del_flag =0 and is_visible = '1' and parent_id = '340100000000' and dept_id like '340100%'
|
||||
where `status` = '0' and del_flag =0 and is_visible = '1' and parent_id = '341800000000' and dept_id like '341800%'
|
||||
|
||||
union
|
||||
|
||||
|
|
@ -188,7 +188,7 @@
|
|||
LEFT JOIN
|
||||
(select substring(zzjgdm,1,6) as zzjgdm ,count(*) as allCount from t_device where device_type = #{deviceType} and valid =1 group by SUBSTRING(zzjgdm,1,6)) a
|
||||
on SUBSTRING(d.dept_id,1,6) = SUBSTRING(a.zzjgdm,1,6)
|
||||
where `status` = '0' and del_flag =0 and is_visible = '1' and parent_id = '340100000000' and dept_id not like '340100%'
|
||||
where `status` = '0' and del_flag =0 and is_visible = '1' and parent_id = '341800000000' and dept_id not like '341800%'
|
||||
|
||||
union
|
||||
<!--派出所等三级四级机构-->
|
||||
|
|
|
|||
Loading…
Reference in New Issue