From 55517e16da5e7205770bf61fc27c3d06b7d189b5 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 15 六月 2023 21:03:16 +0800
Subject: [PATCH] bug修改

---
 Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
index 9072185..4502b3c 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
@@ -19,6 +19,7 @@
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.vci.ubcs.system.cache.DictCache;
@@ -308,6 +309,10 @@
 		}
 		//鑾峰彇鐢ㄦ埛閲囩敤鐨勫瘑鐮佺瓥鐣�
 		Strategy strategy = sysClient.getByUserId(userId).getData();
+		// 鍑犱箮涓嶄細鍑虹幇杩欑鎯呭喌
+		if(ObjectUtil.isEmpty(strategy)) {
+			throw new ServiceException("褰撳墠鐢ㄦ埛鏈簲鐢ㄥ瘑鐮佺瓥鐣ワ紒");
+		}
 		//瀵嗙爜闀垮害鏍¢獙
 		if(newPassword1.length() < strategy.getMinPwdLen() || newPassword1.length() > strategy.getMaxPwdLen()){
 			throw new ServiceException("瀵嗙爜涓繀椤诲惈鏈夈��"+strategy.getCombinationNames()+"銆戜腑鐨勩��"+strategy.getRequiredType()+"銆戠瀵嗙爜缁勫悎鏂瑰紡锛屼笖瀵嗙爜闀垮害蹇呴』鍦ㄣ��"+strategy.getMinPwdLen()+"-"+strategy.getMaxPwdLen()+"銆戣寖鍥村唴");
@@ -319,7 +324,7 @@
 			if(reqType>=strategy.getRequiredType()){
 				break;
 			}
-			if(!Func.isEmpty(RegexUtil.findResult(regexs.get(i),newPassword1))){
+			if(RegexUtil.find(regexs.get(i),newPassword1)){
 				reqType++;
 			}
 		}
@@ -327,12 +332,13 @@
 		if(reqType<strategy.getRequiredType()){
 			throw new ServiceException(resException);
 		}
-		// 鏄惁灞炰簬缁勫悎鏂瑰紡涓殑绫诲瀷
+		// 鏄惁灞炰簬缁勫悎鏂瑰紡涓殑绫诲瀷,浠ュ墠鏄瘑鐮佸繀椤绘槸鍖呭惈鍦ㄧ粍鍚堟柟寮忎腑鐨勭被鍨�
 		String regex = sysClient.getRegex(Arrays.asList(strategy.getCombinationIds().split(","))).getData();
 		regex = "^"+regex+"{"+strategy.getRequiredType()+",}$";
 		boolean result = RegexUtil.find(regex, newPassword1);
 		if(!result){
-			throw new ServiceException(resException);
+			throw new ServiceException("瀵嗙爜涓彧鑳藉瓨鍦ㄣ��"+strategy.getCombinationNames()+"銆戜腑鍖呭惈鐨勫瓧绗︼紒");
+			//throw new ServiceException(resException);
 		}
 		//淇敼瀵嗙爜鍚屾椂锛屾敼鍙樼敤鎴蜂俊鎭腑鐨勫瘑鐮佷慨鏀圭姸鎬佸瓧娈�,瀵嗙爜淇敼鏃堕棿
 		return this.update(Wrappers.<User>update().lambda()
@@ -418,6 +424,7 @@
 		boolean oauthTemp = userOauthService.updateById(userOauth);
 		return (userTemp && oauthTemp);
 	}
+
 	@Override
 	public boolean updatePlatform(Long userId, Integer userType, String userExt) {
 		if (userType.equals(UserEnum.WEB.getCategory())) {
@@ -482,8 +489,9 @@
 		if(adminUserId.equals(userId)){
 			return 0L;
 		}
+		QueryWrapper<User> wrapper = Wrappers.<User>query().eq("ID", userId);
 		//鑾峰彇鍒板瘑鐮佷慨鏀规椂闂�
-		Date pwdUpdateTime = this.getOne(Wrappers.<User>query().eq("ID", userId)).getPwdUpdateTime();
+		Date pwdUpdateTime = this.getOne(wrapper).getPwdUpdateTime();
 		Long pwdupdateday = 0L;
 		if(!Func.isEmpty(pwdUpdateTime)){
 			pwdupdateday = dateToDay(pwdUpdateTime);

--
Gitblit v1.9.3