From 28ca3d9f9e6e7eeeb7a7f2a7f50012350f3934c3 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 13 十一月 2024 18:07:11 +0800 Subject: [PATCH] 优化业务数据的查询接口;修改业务数据保存和编辑接口没有保存基础默认属性问题。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java index eb454b7..b4be78a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java @@ -19,6 +19,7 @@ import com.vci.starter.web.annotation.bus.VciLoginAfter; import com.vci.starter.web.annotation.bus.VciLogoutBefore; import com.vci.starter.web.annotation.bus.VciLogoutPlugin; +import com.vci.starter.web.constant.VConstant; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.interceptor.VciSessionForLoginI; import com.vci.starter.web.pagemodel.RequestClientInfo; @@ -30,7 +31,7 @@ import com.vci.constant.CacheNameConstant; import com.vci.dto.LoginUserDTO; import com.vci.web.properties.WebProperties; -import com.vci.web.redis.RedisService; +import com.vci.starter.web.redis.RedisService; import com.vci.web.service.LoginServiceI; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; @@ -128,11 +129,6 @@ private PlatformClientUtil platformClientUtil; /** - * 褰撳墠鐧诲綍鐨勭敤鎴锋�绘暟key - */ - private static final String CURRENT_LOGGED_USERS_KEY = "current_logged_users"; - - /** * 鎵ц鐧诲綍 * @param userDTO 鐧诲綍淇℃伅 * @param clientInfo 璇锋眰鐨勫鎴风鐨勪俊鎭� @@ -151,7 +147,7 @@ * @return 鎵ц缁撴灉 * @throws VciBaseException 鍙傛暟閿欒锛岀敤鎴蜂笉鑳界櫥褰曠瓑浼氭姏鍑哄紓甯� */ - private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException, PLException { + private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException { LoginResultBO loginResult = new LoginResultBO(); loginResult.setSuccess(false); @@ -172,7 +168,7 @@ String tokenKey = redisService.getCacheObject(userIdTokenKey); redisService.deleteObject(tokenKey); redisService.deleteObject(userIdTokenKey); - redisService.userLogout(CURRENT_LOGGED_USERS_KEY,userDTO.getUserId()); + redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); } //3.鑾峰彇鐢ㄦ埛鐨勫璞★紙瀵硅薄涓寘鍚鑹查儴闂ㄨ繕鏈夊瘑鐮佺瓥鐣ヤ俊鎭�(褰撳墠鐢ㄦ埛娌¤缃瘑鐮佺瓥鐣ュ氨鏄彇鐨勯粯璁ゅ瘑鐮佺瓥鐣�)锛� @@ -249,7 +245,7 @@ //鍒濆鍖栧钩鍙扮殑token sessionForLogin.initInvocationInfo(sessionInfo); //璁板綍褰撳墠鐧诲綍浜烘暟鐨勬�绘暟 - redisService.userLogin(CURRENT_LOGGED_USERS_KEY,userDTO.getUserId()); + redisService.increOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); //鎷疯礉鐢ㄦ埛鍒版柊鐨剆ession浼氳瘽涓� copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode()); //鎷疯礉璇锋眰淇℃伅鍒皊ession浼氳瘽涓� @@ -330,7 +326,7 @@ //3銆佸垽鏂瘑鐮佹槸鍚︽纭� if (checkPassword) { - boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid()); + boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getName()); if (!passwordIsEqual) { if (logger.isDebugEnabled()) { logger.debug("{}瀵嗙爜涓嶆纭�", user.getId()); @@ -567,7 +563,7 @@ }); } //娓呴櫎瀛樺綋鍓嶇櫥褰曠殑鐢ㄦ埛锛堟�绘暟-1锛� - redisService.userLogout(CURRENT_LOGGED_USERS_KEY,WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId()); + redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); sessionForLogin.logout(userToken); if(!CollectionUtils.isEmpty(logoutpluginBeanMap)){ logoutpluginBeanMap.forEach((k,v) -> { -- Gitblit v1.9.3