|
@@ -44,6 +44,7 @@ import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YaoPinXiangMu;
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YaoPinXiangMu;
|
|
import thyyxxk.webserver.service.externalhttp.WebSocketService;
|
|
import thyyxxk.webserver.service.externalhttp.WebSocketService;
|
|
import thyyxxk.webserver.service.hutoolcache.ExtraCache;
|
|
import thyyxxk.webserver.service.hutoolcache.ExtraCache;
|
|
|
|
+import thyyxxk.webserver.service.hutoolcache.UserCache;
|
|
import thyyxxk.webserver.utils.*;
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
@@ -68,15 +69,17 @@ public class PublicServer {
|
|
private final WebSocketService socketService;
|
|
private final WebSocketService socketService;
|
|
private final SqlSessionFactory sqlSessionFactory;
|
|
private final SqlSessionFactory sqlSessionFactory;
|
|
private final ExtraCache extraCache;
|
|
private final ExtraCache extraCache;
|
|
|
|
+ private final UserCache userCache;
|
|
|
|
|
|
|
|
|
|
- public PublicServer(PublicDao dao, TransferInOfExpensesDao transferInOfExpensesDao, WebSocketService socketService, SettingsDao settingsDao, SqlSessionFactory sqlSessionFactory, ExtraCache extraCache) {
|
|
|
|
|
|
+ public PublicServer(PublicDao dao, TransferInOfExpensesDao transferInOfExpensesDao, WebSocketService socketService, SettingsDao settingsDao, SqlSessionFactory sqlSessionFactory, ExtraCache extraCache, UserCache userCache) {
|
|
this.dao = dao;
|
|
this.dao = dao;
|
|
this.transferInOfExpensesDao = transferInOfExpensesDao;
|
|
this.transferInOfExpensesDao = transferInOfExpensesDao;
|
|
this.settingsDao = settingsDao;
|
|
this.settingsDao = settingsDao;
|
|
this.extraCache = extraCache;
|
|
this.extraCache = extraCache;
|
|
this.socketService = socketService;
|
|
this.socketService = socketService;
|
|
this.sqlSessionFactory = sqlSessionFactory;
|
|
this.sqlSessionFactory = sqlSessionFactory;
|
|
|
|
+ this.userCache = userCache;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -106,7 +109,7 @@ public class PublicServer {
|
|
* @return 返回角色
|
|
* @return 返回角色
|
|
*/
|
|
*/
|
|
public ResultVo<List<Integer>> getRoleCode() {
|
|
public ResultVo<List<Integer>> getRoleCode() {
|
|
- return ResultVoUtil.success(redisLikeService.getUserInfoByToken().getRoles());
|
|
|
|
|
|
+ return ResultVoUtil.success(userCache.getUserInfoByToken().getRoles());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -389,7 +392,7 @@ public class PublicServer {
|
|
}
|
|
}
|
|
|
|
|
|
public Set<String> getChildDeptByUserCode(boolean needPartTimeDept, String userCode) {
|
|
public Set<String> getChildDeptByUserCode(boolean needPartTimeDept, String userCode) {
|
|
- UserInfo userInfo = redisLikeService.getUserInfoByCode(userCode);
|
|
|
|
|
|
+ UserInfo userInfo = userCache.get(userCode);
|
|
return getDept(needPartTimeDept, userInfo);
|
|
return getDept(needPartTimeDept, userInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -399,13 +402,24 @@ public class PublicServer {
|
|
* @return 返回科室
|
|
* @return 返回科室
|
|
*/
|
|
*/
|
|
public Set<String> getChildDeptByUserCode(boolean needPartTimeDept) {
|
|
public Set<String> getChildDeptByUserCode(boolean needPartTimeDept) {
|
|
- UserInfo userInfo = redisLikeService.getUserInfoByToken();
|
|
|
|
|
|
+ UserInfo userInfo = userCache.getUserInfoByToken();
|
|
return getDept(needPartTimeDept, userInfo);
|
|
return getDept(needPartTimeDept, userInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
public Set<String> getDept(boolean needPartTimeDept, UserInfo userInfo) {
|
|
public Set<String> getDept(boolean needPartTimeDept, UserInfo userInfo) {
|
|
- return redisLikeService.getDept(needPartTimeDept, userInfo);
|
|
|
|
|
|
+ Set<String> list = new HashSet<>();
|
|
|
|
+ if (needPartTimeDept && ListUtil.notBlank(userInfo.getPartTimeDept())) {
|
|
|
|
+ list.addAll(userInfo.getPartTimeDept());
|
|
|
|
+ }
|
|
|
|
+ list.add(userInfo.getDeptCode());
|
|
|
|
+ QueryWrapper<?> qw = new QueryWrapper<>();
|
|
|
|
+ qw.in("parent_code", list);
|
|
|
|
+ List<String> temp = dao.selectChildDeptByCodeList(qw);
|
|
|
|
+ if (ListUtil.notBlank(temp)) {
|
|
|
|
+ list.addAll(temp);
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -720,7 +734,7 @@ public class PublicServer {
|
|
}
|
|
}
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
- UserInfo userInfo = redisLikeService.getUserInfoByCode(sender);
|
|
|
|
|
|
+ UserInfo userInfo = userCache.get(sender);
|
|
json.put("avatar", userInfo.getAvatar());
|
|
json.put("avatar", userInfo.getAvatar());
|
|
json.put("deptName", userInfo.getDeptName());
|
|
json.put("deptName", userInfo.getDeptName());
|
|
json.put("name", userInfo.getName());
|
|
json.put("name", userInfo.getName());
|
|
@@ -856,7 +870,7 @@ public class PublicServer {
|
|
|
|
|
|
|
|
|
|
public void sendSystemAnnouncement() {
|
|
public void sendSystemAnnouncement() {
|
|
- Map<String, String> map = redisLikeService.getMessage();
|
|
|
|
|
|
+ Map<String, String> map = extraCache.getMessage();
|
|
JSONObject obj = new JSONObject();
|
|
JSONObject obj = new JSONObject();
|
|
obj.put("data", map);
|
|
obj.put("data", map);
|
|
String msgContent = SocketMsg.socketVo(Message.SYSTEM_ANNOUNCEMENT, obj);
|
|
String msgContent = SocketMsg.socketVo(Message.SYSTEM_ANNOUNCEMENT, obj);
|
|
@@ -887,7 +901,7 @@ public class PublicServer {
|
|
}
|
|
}
|
|
|
|
|
|
public ResultVo<UserInfo> getUserInfoByCode(String code) {
|
|
public ResultVo<UserInfo> getUserInfoByCode(String code) {
|
|
- return ResultVoUtil.success(redisLikeService.getUserInfoByCode(code));
|
|
|
|
|
|
+ return ResultVoUtil.success(userCache.get(code));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -911,7 +925,7 @@ public class PublicServer {
|
|
}
|
|
}
|
|
|
|
|
|
public ResultVo<String> refreshUserInfo(String code) {
|
|
public ResultVo<String> refreshUserInfo(String code) {
|
|
- redisLikeService.updateUserInfo(code);
|
|
|
|
|
|
+ userCache.refreshCache(code);
|
|
return ResultVoUtil.success();
|
|
return ResultVoUtil.success();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -921,7 +935,7 @@ public class PublicServer {
|
|
|
|
|
|
public Set<String> getUserDeptList(String code) {
|
|
public Set<String> getUserDeptList(String code) {
|
|
Set<String> deptList;
|
|
Set<String> deptList;
|
|
- UserInfo userInfo = redisLikeService.getUserInfoByCode(code);
|
|
|
|
|
|
+ UserInfo userInfo = userCache.get(code);
|
|
if (userInfo.getDeptCode().startsWith("8")) {
|
|
if (userInfo.getDeptCode().startsWith("8")) {
|
|
deptList = dao.chaXunZhiZXinKeShi(userInfo.getDeptCode());
|
|
deptList = dao.chaXunZhiZXinKeShi(userInfo.getDeptCode());
|
|
deptList.add(userInfo.getDeptCode());
|
|
deptList.add(userInfo.getDeptCode());
|