|
@@ -2,10 +2,8 @@ package com.fjhx.common.service.on.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.entity.on.po.OnLineInfo;
|
|
|
import com.fjhx.common.entity.on.vo.OnLineInfoReturnData;
|
|
|
import com.fjhx.common.entity.on.vo.OnLineInfoVo;
|
|
@@ -49,13 +47,13 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
|
|
|
|
|
|
//部门负责人:可查看负责部门/部门总监:可以查看对应部门及级联部门
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
List<SysDept> deptList = sysDeptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
.eq(SysDept::getLeaderId, userId)
|
|
|
.or()
|
|
|
.eq(SysDept::getDirectorId, userId)
|
|
|
);
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
|
|
|
//递归获取子数据
|
|
|
List<OnLineInfoReturnData.Dept> deptList1 = getDeptList(deptList, userId, 0);
|
|
@@ -97,9 +95,9 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
|
|
|
//如果部门总监是我 查询部门下的子部门(type=1是递归进来的需要查子部门)
|
|
|
if (type == 1 || userId.equals(sysDept.getDirectorId())) {
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
List<SysDept> deptList11 = sysDeptService.list(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getParentId, sysDept.getDeptId()));
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
//赋值子部门
|
|
|
List<OnLineInfoReturnData.Dept> deptList2 = getDeptList(deptList11, userId, 1);
|
|
|
dept1.setDeptList(deptList2);
|
|
@@ -123,9 +121,9 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
WebSocketServer webSocketServer = webSocketOnOpenEvent.getWebSocketServer();
|
|
|
Long userId = webSocketServer.getUserId();
|
|
|
//记录上线时间
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
OnLineInfo onLineInfo = this.getOne(q -> q.eq(OnLineInfo::getUserId, userId).apply("DATE(on_line_date) = DATE(NOW())"));
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
if (ObjectUtil.isEmpty(onLineInfo)) {
|
|
|
onLineInfo = new OnLineInfo();
|
|
|
onLineInfo.setOnLineDuration(0L);
|
|
@@ -134,9 +132,9 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
onLineInfo.setTenantId(webSocketServer.getTenantId());
|
|
|
}
|
|
|
onLineInfo.setLastOnlineTime(new Date());
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
this.saveOrUpdate(onLineInfo);
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -152,9 +150,9 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
JSONObject json = JSONObject.parseObject(message);
|
|
|
if (ObjectUtil.isNotEmpty(json.get("heartbeat"))) {
|
|
|
//保存在线时长信息
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
OnLineInfo onLineInfo = this.getOne(q -> q.eq(OnLineInfo::getUserId, userId).apply("DATE(on_line_date) = DATE(NOW())"));
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
if (ObjectUtil.isEmpty(onLineInfo)) {
|
|
|
onLineInfo = new OnLineInfo();
|
|
|
onLineInfo.setOnLineDuration(0L);
|
|
@@ -172,9 +170,9 @@ public class OnLineInfoServiceImpl extends ServiceImpl<OnLineInfoMapper, OnLineI
|
|
|
//记录在线时长
|
|
|
onLineInfo.setOnLineDuration(onLineInfo.getOnLineDuration() + onLineTime);
|
|
|
onLineInfo.setLastOnlineTime(endDate);
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
this.saveOrUpdate(onLineInfo);
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
}
|
|
|
}
|
|
|
|