From 0892d843cd394f383ff50f480f7f22f2ec3829bc Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 27 六月 2025 20:24:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java b/ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java
index a1c5506..3a7da03 100644
--- a/ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java
+++ b/ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java
@@ -37,6 +37,7 @@
 import com.ltkj.framework.manager.AsyncManager;
 import com.ltkj.framework.manager.factory.AsyncFactory;
 import com.ltkj.framework.security.context.AuthenticationContextHolder;
+import org.springframework.util.DigestUtils;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -96,7 +97,7 @@
     public String login(String username, String password, Boolean type,String code,String uuid) {
 
         String aSwitch = configService.selectConfigByKey("captcha_switch");
-        if(null !=aSwitch && aSwitch.equals("Y")){
+        if(null !=aSwitch && aSwitch.equalsIgnoreCase("Y")){
             String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
             String captcha = redisCache.getCacheObject(verifyKey);
             redisCache.deleteObject(verifyKey);
@@ -216,10 +217,10 @@
      * @param password 瀵嗙爜
      * @return 缁撴灉
      */
-    public String Cuslogin(String username, String password, Boolean type,String code,String uuid) {
+    public String Cuslogin(String username,String sfzh, String password, Boolean type,String code,String uuid) {
 
         String aSwitch = configService.selectConfigByKey("captcha_switch");
-        if(null !=aSwitch && aSwitch.equals("Y")){
+        if(null !=aSwitch && aSwitch.equalsIgnoreCase("Y")){
             String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
             String captcha = redisCache.getCacheObject(verifyKey);
             redisCache.deleteObject(verifyKey);
@@ -236,9 +237,9 @@
         }
 
 
-        LoginUser loginUser = loadCusByCusname(username, password);
+        LoginUser loginUser = loadCusByCusname(username,sfzh, password);
         if (loginUser == null) {
-            return "鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒";
+            return null;
         }
 //       闄愬埗璐︽埛涓嶅厑璁稿缁堢鐧诲綍
         if (!soloLogin) {
@@ -258,19 +259,24 @@
         return tokenService.createToken(loginUser);
     }
 
-    public LoginUser loadCusByCusname(String username, String password) {
+    public LoginUser loadCusByCusname(String username,String sfzh, String password) {
         LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
         wq.eq(TjCustomer::getCusPhone, username);
+        wq.eq(TjCustomer::getCusIdcard, sfzh);
         List<TjCustomer> customerList = customerService.list(wq);
-        if (null == customerList || customerList.size() == 0) {
+        if (null == customerList || customerList.isEmpty()) {
             //throw new ServiceException("鐧诲綍鐢ㄦ埛锛�" + username + " 涓嶅瓨鍦�");
-            throw new ServiceException("璐︽埛鎴栧瘑鐮侀敊璇紝璇锋鏌ワ紒");
+            throw new ServiceException("璐﹀彿鎴栧瘑鐮侀敊璇紝璇锋鏌ワ紒");
         }
         for (TjCustomer tjCustomer : customerList) {
             try {
-                password = RsaUtils.decryptByPrivateKey(password);
-                boolean b = SecurityUtils.matchesPassword(password, tjCustomer.getCusPassword());
-                if (b) {
+//                password = RsaUtils.decryptByPrivateKey(password);
+//                boolean b = SecurityUtils.matchesPassword(password, tjCustomer.getCusPassword());
+//                if (b) {
+//                    return createLoginCus(tjCustomer);
+//                }
+                password = DigestUtils.md5DigestAsHex(password.getBytes());
+                if (password.equals(tjCustomer.getCusPassword())){
                     return createLoginCus(tjCustomer);
                 }
             } catch (Exception e) {

--
Gitblit v1.8.0