From dcd238531d8154633b9c1e2188b81e519760a17e Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 16 七月 2024 16:09:45 +0800
Subject: [PATCH] 调整项目结构,统一DTO、VO、PO、BO等对象到plt-web-api模块下,拷贝vci-file-integration、plt-web-api、vci-framework-api、vci-file-api等依赖下的对象到plt-web-api模块下,并取消对这些jar的引用(为了解决同路径同名独享导致打包运行时对象加载出错问题)。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java |  316 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 234 insertions(+), 82 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 aba5f04..e860eee 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
@@ -1,8 +1,6 @@
 package com.vci.web.service.impl;
 
-import com.vci.client.mw.ClientSessionUtility;
 import com.vci.corba.common.PLException;
-import com.vci.corba.common.data.InvocationInfo;
 import com.vci.corba.framework.data.DeptInfo;
 import com.vci.corba.framework.data.LoginResult;
 import com.vci.corba.framework.data.LoginState;
@@ -10,11 +8,13 @@
 import com.vci.frameworkcore.ajaxTask.SmUserUnLockTask;
 import com.vci.frameworkcore.ajaxTask.SmUserUnLockTaskManager;
 import com.vci.frameworkcore.compatibility.ISmFunctionQueryService;
-import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
+import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI;
 import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
 import com.vci.frameworkcore.enumpck.ResourceControlTypeEnum;
-import com.vci.frameworkcore.pagemodel.SmFunctionVO;
-import com.vci.frameworkcore.pagemodel.SmUserVO;
+import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus;
+import com.vci.pagemodel.SmFunctionVO;
+import com.vci.pagemodel.SmPasswordStrategyVO;
+import com.vci.pagemodel.SmUserVO;
 import com.vci.frameworkcore.properties.VciSecurityManageProperties;
 import com.vci.starter.web.annotation.bus.VciLoginAfter;
 import com.vci.starter.web.annotation.bus.VciLogoutBefore;
@@ -25,27 +25,28 @@
 import com.vci.starter.web.pagemodel.SessionInfo;
 import com.vci.starter.web.pagemodel.TokenVO;
 import com.vci.starter.web.util.*;
-import com.vci.web.bo.LoginResultBO;
-import com.vci.web.constant.CacheNameConstant;
-import com.vci.web.dto.LoginUserDTO;
+
+import com.vci.bo.LoginResultBO;
+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.web.service.LoginServiceI;
+import com.vci.web.util.Func;
 import com.vci.web.util.PlatformClientUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.lang.reflect.Method;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.text.MessageFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
-import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.*;
+import static com.vci.constant.FrameWorkBusLangCodeConstant.*;
 
 /**
  * 鐧诲綍鐨勬湇鍔�
@@ -85,16 +86,28 @@
     private SmUserQueryServiceI userQueryService;
 
     /**
-     * 瑙掕壊鐨勬煡璇㈡湇鍔★紝鍙互鍏煎鑰佸钩鍙�
+     * 瀵嗙爜绛栫暐鏌ヨ鏈嶅姟
      */
     @Resource
-    private SmRoleQueryServiceI roleQueryService;
+    private SmPwdStrategyQueryServiceI pwdStrategyQueryService;
+
+    /**
+     * 鍔熻兘鑿滃崟鐨勬煡璇㈡湇鍔�
+     */
+    @Resource
+    private ISmFunctionQueryService functionQueryService;
+
+    /**
+     * 瑙掕壊鐨勬煡璇㈡湇鍔★紝鍙互鍏煎鑰佸钩鍙�
+     */
+    //@Resource
+    //private SmRoleQueryServiceI roleQueryService;
 
     /**
      * 鏉冮檺鐨勬煡璇㈡湇鍔★紝鍙互鍏煎鑰佸钩鍙�
      */
-    @Resource
-    private ISmFunctionQueryService functionQueryService;
+    //@Resource
+    //private ISmFunctionQueryService functionQueryService;
 
     /**
      * redis鏈嶅姟
@@ -121,7 +134,7 @@
      * @throws VciBaseException 鐧诲綍鍙戠敓寮傚父鐨勬椂鍊欏嚭鐜颁簡閿欒
      */
     @Override
-    public LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo) throws VciBaseException {
+    public LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo) throws PLException {
         return login(userDTO,clientInfo,true);
     }
 
@@ -133,16 +146,16 @@
      * @return 鎵ц缁撴灉
      * @throws VciBaseException 鍙傛暟閿欒锛岀敤鎴蜂笉鑳界櫥褰曠瓑浼氭姏鍑哄紓甯�
      */
-    private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword) throws VciBaseException {
+    private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException, PLException {
         LoginResultBO loginResult = new LoginResultBO();
         loginResult.setSuccess(false);
+
         //1.鍒ゆ柇鐢ㄦ埛鐨勫熀鏈俊鎭�
         VciBaseUtil.alertNotNull(userDTO, "鐧诲綍淇℃伅", userDTO.getUserId(), "鐢ㄦ埛璐﹀彿");
         if (checkPassword) {
             VciBaseUtil.alertNotNull(userDTO.getPassword(), "鐧诲綍瀵嗙爜");
         }
-
-        //闇�瑕佺湅鐪嬫槸鍚﹀凡缁忕櫥褰曚簡
+        //2銆佸垽鏂崟璁惧鐧诲綍,鏄惁宸茬粡鐧诲綍浜�
         String userIdTokenKey = CacheNameConstant.cacheKey(CacheNameConstant.USERID_TOKEN_KEY, userDTO.getUserId().trim());
         if(redisService.hasKey(userIdTokenKey) && !userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()){
             loginResult.setFailCode(USER_IS_LOGINED);
@@ -156,7 +169,151 @@
             redisService.deleteObject(userIdTokenKey);
         }
 
-        //2.鑾峰彇鐢ㄦ埛鐨勫璞�.
+        //3.鑾峰彇鐢ㄦ埛鐨勫璞★紙瀵硅薄涓寘鍚鑹查儴闂ㄨ繕鏈夊瘑鐮佺瓥鐣ヤ俊鎭�(褰撳墠鐢ㄦ埛娌¤缃瘑鐮佺瓥鐣ュ氨鏄彇鐨勯粯璁ゅ瘑鐮佺瓥鐣�)锛�
+        SmUserVO user = getUserByUserId(userDTO.getUserId().trim());
+        if (user == null || StringUtils.isBlank(user.getOid())) {
+            loginResult.setFailCode(USER_NOT_FOUND);
+            loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
+            return loginResult;
+        }
+
+        //4銆佸垽鏂瘑鐮佹槸鍚︽纭紙骞冲彴鐨刢heckLogin鏂规硶濂藉儚鏈夊瀵嗙爜杩涜姣斿鐨勬柟娉曪級
+        /*if (checkPassword) {
+            boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid());
+            if (!passwordIsEqual) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("{}瀵嗙爜涓嶆纭�", user.getId());
+                }
+            }
+        }*/
+
+        //5銆佽皟鐢ㄥ钩鍙扮櫥褰曟帴鍙o紝杩涜鐧诲綍
+        MachineInfo machine = getMachieInfo(clientInfo);
+        machine.country = clientInfo.getCountry();
+        machine.language = clientInfo.getLanguage();
+        machine.osUser = clientInfo.getOsUser();
+        machine.machine = clientInfo.getMachine();
+        String token = null;
+        try {
+            /*ThreeDES des = new ThreeDES();// 瀹炰緥鍖栦竴涓锟�?
+            des.getKey("daliantan0v0");// 鐢熸垚瀵嗗寵
+            String encPassword = des.getDesString(userDTO.getPassword());*/
+            LoginResult chkRes = platformClientUtil.getFrameworkService().checkLogin(userDTO.getUserId(),userDTO.getPassword(), machine);
+            loginResult.setFailCode(getErrorCode(chkRes));
+            //loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), String.valueOf(chkRes.auxInfo)});
+            loginResult.setFailMsgArray(new String[]{String.valueOf(chkRes.auxInfo)});
+            //鏍规嵁涓嶅悓鐘舵�佸鐞嗗钩鍙拌繑鍥炵殑淇℃伅
+            if(chkRes.state.equals(LoginState.Error) || chkRes.state.equals(LoginState.Locked) || chkRes.state.equals(LoginState.Freeze)){
+                return loginResult;
+            }
+            //鍏充簬瀵嗙爜绛栫暐鐩稿叧鐨勮繑鍥炰俊鎭鐞�
+            if(chkRes.state.equals(LoginState.InitialPW)){
+                loginResult.setMustChangePassword(true);
+                loginResult.setPasswordInfo("鎮ㄧ殑瀵嗙爜鏄鐞嗗憳鍒濆鐨勫瘑鐮侊紝闇�瑕佷慨鏀瑰瘑鐮佹墠鑳借繘琛屽叾瀹冩搷浣�!");
+                return loginResult;
+            }else if(chkRes.state.equals(LoginState.PWExpired)){
+                //闇�瑕佺珛鍗充慨鏀瑰瘑鐮�
+                loginResult.setMustChangePassword(true);
+                loginResult.setPasswordInfo("鎮ㄧ殑瀵嗙爜宸茬粡杩囨湡,璇疯繘琛屼慨鏀癸紒");
+                return loginResult;
+            }else if(chkRes.state.equals(LoginState.PWPolicyUpdated)){
+                //绛栫暐淇敼锛岀洿鎺ヨ繑鍥為檺鍒剁敤鎴峰悗缁搷浣�
+                loginResult.setMustChangePassword(true);
+                loginResult.setPasswordInfo("鎮ㄧ殑瀵嗙爜绛栫暐宸茬粡淇敼锛岄渶瑕佷慨鏀瑰瘑鐮佹墠鑳借繘琛屽叾瀹冩搷浣�!");
+                return loginResult;
+            }else if(chkRes.state.equals(LoginState.PWWillExpire)){
+                loginResult.setPasswordInfo(String.format("鎮ㄧ殑瀵嗙爜鏈夋晥鏈熻繕鏈�%s澶�,璇锋敞鎰忎慨鏀�!",chkRes.auxInfo));
+            }
+            token = chkRes.token;
+        } catch (Exception e) {
+            loginResult.setFailCode(SYSTEM_ERROR);
+            loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
+            return loginResult;
+        }
+        if(StringUtils.isBlank(token)){
+            loginResult.setFailMsg(TOKEN_EMPTY);
+            loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
+            return loginResult;
+        }
+        //6銆佺櫥褰曟垚鍔熶箣鍚庨渶瑕佸鐞嗙殑閫昏緫
+        user.setLastLoginTime(new Date());//鏈�鍚庣櫥褰曟椂闂�
+        user.setPwdWrongCount(0);//瀵嗙爜閿欒娆℃暟娓�0
+        //澶勭悊鐢ㄦ埛鐧诲綍鎴愬姛鐨剆ession
+        SessionInfo sessionInfo = new SessionInfo();
+        sessionInfo.setToken(token);
+        //鍒濆鍖栧钩鍙扮殑token
+        sessionForLogin.initInvocationInfo(sessionInfo);
+        //鎷疯礉鐢ㄦ埛鍒版柊鐨剆ession浼氳瘽涓�
+        copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode());
+        //鎷疯礉璇锋眰淇℃伅鍒皊ession浼氳瘽涓�
+        copyRequest2SessionInfo(clientInfo, sessionInfo);
+
+        //鏌ョ湅浜嗗钩鍙扮殑鐧诲綍鏂规硶鍏跺疄鏄湁澶勭悊閮ㄩ棬瑙掕壊绛夌浉鍏充俊鎭殑浣嗘槸涓嶇煡閬撲负浠�涔堟棤娉曡幏鍙栧埌
+        //閮ㄩ棬淇℃伅澶勭悊
+        sessionInfo.setDeptOid(user.getPkDepartment());
+        sessionInfo.setDeptName(user.getPkDepartmentName());
+        sessionInfo.setDeptNum(user.getPkDepartmentNum());
+        //瑙掕壊淇℃伅澶勭悊
+        String roleOids = user.getPkPerson();
+        String roleNames = user.getPkPersonName();
+        HashMap<String, String> roleOidNameMap = new HashMap<>();
+        if(Func.isNotBlank(roleOids) && Func.isNotBlank(roleOids)){
+            String[] oids = roleOids.split(",");
+            String[] names = roleNames.split(",");
+            for (int i = 0; i < oids.length; i++) {
+                roleOidNameMap.put(oids[i],names[i]);
+            }
+        }
+        sessionInfo.setRolesName(roleOidNameMap);
+
+        //鏌ヨ鎵�鏈夌殑鏉冮檺
+        List<SmFunctionVO> functionVOList = functionQueryService.listFunctionByUserOid(user.getOid(), null, ResourceControlTypeEnum.BS);
+        if (!CollectionUtils.isEmpty(functionVOList)) {
+            List<String> functionOidList = functionVOList.stream().map(s -> s.getOid()).collect(Collectors.toList());
+            sessionInfo.setFunctionOids(functionOidList);
+        } else {
+            sessionInfo.setFunctionOids(new ArrayList());
+        }
+
+        //娣诲姞鍒颁細璇濅俊鎭�
+        TokenVO tokenVO = saveSessionInfo(sessionInfo);
+        loginResult.setTokenVO(tokenVO);
+        loginResult.setSuccess(true);
+        return loginResult;
+    }
+
+    /**
+     * 鐧诲綍_搴熷純鏂规硶锛屼富瑕佺敤鏉ュ浠�
+     * @param userDTO 鐢ㄦ埛鐨勬暟鎹紶杈撳璞�
+     * @param clientInfo 瀹㈡埛绔殑淇℃伅
+     * @param checkPassword 鏄惁鏍¢獙瀵嗙爜
+     * @return 鎵ц缁撴灉
+     * @throws VciBaseException 鍙傛暟閿欒锛岀敤鎴蜂笉鑳界櫥褰曠瓑浼氭姏鍑哄紓甯�
+     */
+    private LoginResultBO login_old(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException, PLException {
+        LoginResultBO loginResult = new LoginResultBO();
+        loginResult.setSuccess(false);
+
+        //1.鍒ゆ柇鐢ㄦ埛鐨勫熀鏈俊鎭�
+        VciBaseUtil.alertNotNull(userDTO, "鐧诲綍淇℃伅", userDTO.getUserId(), "鐢ㄦ埛璐﹀彿");
+        if (checkPassword) {
+            VciBaseUtil.alertNotNull(userDTO.getPassword(), "鐧诲綍瀵嗙爜");
+        }
+        //2銆佸垽鏂崟璁惧鐧诲綍,鏄惁宸茬粡鐧诲綍浜�
+        String userIdTokenKey = CacheNameConstant.cacheKey(CacheNameConstant.USERID_TOKEN_KEY, userDTO.getUserId().trim());
+        if(redisService.hasKey(userIdTokenKey) && !userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()){
+            loginResult.setFailCode(USER_IS_LOGINED);
+            loginResult.setFailMsg("褰撳墠鐢ㄦ埛宸茬粡鍦ㄥ叾浠栧湴鏂圭櫥褰曪紒");
+            return loginResult;
+        }
+        //璇存槑宸茬粡鐧诲綍浜嗭紝閭e簲璇ュ彇娑堝師鏉ョ殑鐧诲綍
+        if (redisService.hasKey(userIdTokenKey) && userDTO.isForceLogin() && securityManageProperties.isUserOneLogin()) {
+            String tokenKey = redisService.getCacheObject(userIdTokenKey);
+            redisService.deleteObject(tokenKey);
+            redisService.deleteObject(userIdTokenKey);
+        }
+
+        //3.鑾峰彇鐢ㄦ埛鐨勫璞★紙瀵硅薄涓寘鍚鑹查儴闂ㄨ繕鏈夊瘑鐮佺瓥鐣ヤ俊鎭級
         SmUserVO user = getUserByUserId(userDTO.getUserId().trim());
         if (user == null || StringUtils.isBlank(user.getOid())) {
             loginResult.setFailCode(USER_NOT_FOUND);
@@ -180,7 +337,6 @@
         machine.language = clientInfo.getLanguage();
         machine.osUser = clientInfo.getOsUser();
         machine.machine = clientInfo.getMachine();
-
         String token = null;
         try {
             LoginResult chkRes = platformClientUtil.getFrameworkService().checkLogin(userDTO.getUserId(),userDTO.getPassword(), machine);
@@ -202,9 +358,7 @@
         }
 
         //濡傛灉鐢ㄦ埛宸茬粡琚仠鐢ㄥ拰閿佸畾锛屼笉鑳界櫥褰�
-        //濡傛灉鐢ㄦ埛鐨勫け鏁堟棩鏈熷凡缁忚秴杩囦簡褰撳墠鏃堕棿锛屼笉鑳界櫥褰�
-        //鍙湁鏂板钩鍙扮殑鐢ㄦ埛鎵嶅垽鏂け鏁�
-        /**if (FrameworkDataLCStatus.DISABLED.getValue().equals(user.getLcStatus())) {
+        if (FrameworkDataLCStatus.DISABLED.getValue().equals(user.getLcStatus())) {
             loginResult.setFailCode(USER_IS_DISABLED);
             loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
             return loginResult;
@@ -214,7 +368,10 @@
             loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
             return loginResult;
         }
-        if (user.getDisabledate() != null) {
+
+        //濡傛灉鐢ㄦ埛鐨勫け鏁堟棩鏈熷凡缁忚秴杩囦簡褰撳墠鏃堕棿锛屼笉鑳界櫥褰�
+        //鍙湁鏂板钩鍙扮殑鐢ㄦ埛鎵嶅垽鏂け鏁�
+        /*if (user.getDisabledate() != null) {
             //2021鐗堟湰鎵嶆湁杩欎釜灞炴�х殑鍊硷紝褰撳墠杩欎釜娌℃湁杩欎釜鍊�
             Date disableDate = VciDateUtil.addOrSubDate(user.getDisabledate(), Calendar.DATE, 1);
             if (disableDate != null && disableDate.getTime() < System.currentTimeMillis()) {
@@ -222,45 +379,43 @@
                 loginResult.setFailMsgArray(new String[]{userDTO.getUserId()});
                 return loginResult;
             }
-        }
-
-        SmPasswordStrategyVO passwordStrategyVO = userQueryService.getPasswordStrategyVOByUserOid(user.getOid());
+        }*/
+        //褰撳墠鐢ㄦ埛娌℃湁閰嶇疆灏辨煡璇㈤粯璁ょ殑瀵嗙爜绛栫暐
+        SmPasswordStrategyVO passwordStrategyVO = pwdStrategyQueryService.getPasswordStrategyVOByUserOid(user.getOid());
         if (checkPassword) {
-            boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid());
-            //3.鍒ゆ柇鐢ㄦ埛鐨勫瘑鐮佹槸鍚︽纭�
-            if (!passwordIsEqual) {
-                //鍓嶇闇�瑕佸厛md5涓�娆★紝鐒跺悗鍚庡彴鍐峂D5涓�娆★紝
-                if (logger.isDebugEnabled()) {
-                    logger.debug("{}瀵嗙爜涓嶆纭�", user.getId());
-                }
-                if (passwordStrategyVO == null) {
-                    //鍙兘鏁版嵁闂娌℃湁璁剧疆瀵嗙爜绛栫暐
-                    passwordStrategyVO = new SmPasswordStrategyVO();
-                    passwordStrategyVO.setRetryTime(6);
-                    passwordStrategyVO.setLockTime(30);
-                }
-                if (passwordStrategyVO.getRetryTime() <= (user.getPwdWrongCount() + 1)) {
-                    user.setLockFlag(true);
-                    updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
-                    addUserToUnLock(userDTO.getUserId(), passwordStrategyVO.getLockTime());
-                    updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
-                    loginResult.setFailCode(USER_PWD_LOCK);
-                    loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), passwordStrategyVO.getLockTime() + ""});
-                    return loginResult;
-                } else {
-                    //杩樻病鏈夊埌閿佸畾鐨勬鏁�
-                    updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
-                    //5, 杩欐槸绗竴娆¢敊璇紝鍓╀笅鐨勬槸 5- 锛�0+1锛�
-                    loginResult.setFailCode(USER_PWD_NOT_EQUAL);
-                    loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), (passwordStrategyVO.getRetryTime() - (user.getPwdWrongCount() + 1)) + ""});
-                    return loginResult;
-                }
+            //鍓嶇闇�瑕佸厛md5涓�娆★紝鐒跺悗鍚庡彴鍐峂D5涓�娆★紝
+            if (logger.isDebugEnabled()) {
+                logger.debug("{}瀵嗙爜涓嶆纭�", user.getId());
+            }
+            //鍙鏁版嵁娌℃湁闂灏变笉瀛樺湪瀵嗙爜绛栫暐涓虹┖鐨勬儏鍐�
+            if (passwordStrategyVO == null) {
+                //鍙兘鏁版嵁闂娌℃湁璁剧疆瀵嗙爜绛栫暐
+                passwordStrategyVO = new SmPasswordStrategyVO();
+                passwordStrategyVO.setRetryTime(6);
+                passwordStrategyVO.setLockTime(30);
+            }
+            //鍒ゆ柇瀵嗙爜閿欒娆℃暟鏄惁杈惧埌涓婇檺
+            if (passwordStrategyVO.getRetryTime() <= (user.getPwdWrongCount() + 1)) {
+                user.setLockFlag(true);
+                updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
+                addUserToUnLock(userDTO.getUserId(), passwordStrategyVO.getLockTime());
+                //updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
+                loginResult.setFailCode(USER_PWD_LOCK);
+                loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), passwordStrategyVO.getLockTime() + ""});
+                return loginResult;
+            } else {
+                //杩樻病鏈夊埌閿佸畾鐨勬鏁�
+                updateUserPwdWrongCount(user.getOid(), user.getPwdWrongCount() + 1);
+                //5, 杩欐槸绗竴娆¢敊璇紝鍓╀笅鐨勬槸 5- 锛�0+1锛�
+                loginResult.setFailCode(USER_PWD_NOT_EQUAL);
+                loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), (passwordStrategyVO.getRetryTime() - (user.getPwdWrongCount() + 1)) + ""});
+                return loginResult;
             }
         }
 
         //妫�鏌ユ槸鍚﹁淇敼瀵嗙爜
         if (!clientInfo.isSso() && checkPassword) {
-            //鏈�鍚庝慨鏀规椂闂�+ 澶辨晥鏃堕棿锛屽ぇ浜庣瓑浜庡綋鍓嶆棩鏈燂紝鍒欓渶瑕侀┈涓婁慨鏀瑰瘑鐮�
+            //鏈�鍚庝慨鏀规椂闂� + 澶辨晥鏃堕棿锛屽ぇ浜庣瓑浜庡綋鍓嶆棩鏈燂紝鍒欓渶瑕侀┈涓婁慨鏀瑰瘑鐮�
             Date currentDay = null;
             try {
                 currentDay = VciDateUtil.getNow(VciDateUtil.DateFormat);
@@ -272,7 +427,7 @@
             if (currentDay != null && passwordStrategyVO != null && passwordStrategyVO.getValidDay() != null) {
                 Date inValidDay = null;
                 if (user.getLastModifyPasswordTime() == null) {
-                    //閲嶆潵娌℃湁鐧诲綍杩�
+                    //浠庢潵娌℃湁鐧诲綍杩�
                     loginResult.setMustChangePassword(true);
                 } else {
                     inValidDay = VciDateUtil.addOrSubDate(user.getLastModifyPasswordTime(), Calendar.DATE, passwordStrategyVO.getValidDay());
@@ -289,7 +444,7 @@
                     }
                 }
             }
-        }*/
+        }
 
         //璇存槑瀵嗙爜姝g‘鐨�
         if (logger.isDebugEnabled()) {
@@ -320,21 +475,21 @@
         }
 
         /** //鏌ヨ鎵�鏈夌殑瑙掕壊
-        List<SmRoleVO> roleVOList = roleQueryService.listRoleByUserOid(user.getOid(), null);
-        if (!CollectionUtils.isEmpty(roleVOList)) {
-            Map<String, String> roleOidNameMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t.getName()));
-            sessionInfo.setRolesName(roleOidNameMap);
-        } else {
-            sessionInfo.setRolesName(new HashMap());
-        }
-        //鏌ヨ鎵�鏈夌殑鏉冮檺
-        List<SmFunctionVO> functionVOList = functionQueryService.listFunctionByUserOid(user.getOid(), null, ResourceControlTypeEnum.BS);
-        if (!CollectionUtils.isEmpty(functionVOList)) {
-            List<String> functionOidList = functionVOList.stream().map(s -> s.getOid()).collect(Collectors.toList());
-            sessionInfo.setFunctionOids(functionOidList);
-        } else {
-            sessionInfo.setFunctionOids(new ArrayList());
-        }*/
+         List<SmRoleVO> roleVOList = roleQueryService.listRoleByUserOid(user.getOid(), null);
+         if (!CollectionUtils.isEmpty(roleVOList)) {
+         Map<String, String> roleOidNameMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t.getName()));
+         sessionInfo.setRolesName(roleOidNameMap);
+         } else {
+         sessionInfo.setRolesName(new HashMap());
+         }
+         //鏌ヨ鎵�鏈夌殑鏉冮檺
+         List<SmFunctionVO> functionVOList = functionQueryService.listFunctionByUserOid(user.getOid(), null, ResourceControlTypeEnum.BS);
+         if (!CollectionUtils.isEmpty(functionVOList)) {
+         List<String> functionOidList = functionVOList.stream().map(s -> s.getOid()).collect(Collectors.toList());
+         sessionInfo.setFunctionOids(functionOidList);
+         } else {
+         sessionInfo.setFunctionOids(new ArrayList());
+         }*/
 
         //娣诲姞鍒颁細璇濅俊鎭�
         TokenVO tokenVO = saveSessionInfo(sessionInfo);
@@ -362,7 +517,6 @@
         return userQueryService.getUserByUserId(userId);
     }
 
-
     /**
      * 鍗曠偣鐧诲綍
      *
@@ -372,7 +526,7 @@
      * @throws VciBaseException 鐧诲綍澶辫触鐨勬椂鍊欐姏鍑哄紓甯�
      */
     @Override
-    public LoginResultBO singleLogin(LoginUserDTO userDTO, RequestClientInfo clientInfo) throws VciBaseException {
+    public LoginResultBO singleLogin(LoginUserDTO userDTO, RequestClientInfo clientInfo) throws PLException {
         return login(userDTO,clientInfo,false);
     }
 
@@ -426,8 +580,6 @@
             });
         }
     }
-
-
 
     /**
      * 淇濆瓨浼氳瘽淇℃伅
@@ -533,7 +685,7 @@
         switch(chkRes.state.value())
         {
             case 0:
-                return "";
+                return UNKNOWN;
             case 1:
                 return LOGIN_SUCCESS;
             case 10:

--
Gitblit v1.9.3