From e5bdd46a51ebfda768262ff51c17879241ea2b14 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 08 八月 2025 15:04:57 +0800
Subject: [PATCH] 更换三方账号和添加环境配置

---
 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java
index 8e80ece..8002e42 100644
--- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java
+++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java
@@ -143,8 +143,8 @@
         if (passwordTrueFlag) {
             String token = JwtTokenUtil.generateToken(phone);
             String key = token;
-            if(token.length() > 16){
-                key = token.substring(token.length() - 16);
+            if(token.length() > 32){
+                key = token.substring(token.length() - 32);
             }
             redisUtil.setStrValue(key, appUser.getId().toString(), 94608000);
             redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 94608000);
@@ -189,7 +189,7 @@
             if(null == appUser){
                 appUser = new AppUser();
                 appUser.setNickname("亲爱的用户");
-                appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/9af2cadb5d0d42d5b9da37f0c6789a66.png");
+                appUser.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
                 appUser.setPhone(purePhoneNumber);
                 appUser.setOpenid(openid);
                 appUser.setUnionid(code2Session.getUnionid());
@@ -271,7 +271,7 @@
             if(null == appUser){
                 appUser = new AppUser();
                 appUser.setNickname("亲爱的用户");
-                appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/9af2cadb5d0d42d5b9da37f0c6789a66.png");
+                appUser.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
                 appUser.setPhone(phone);
                 appUser.setOpenid(openid);
                 appUser.setUnionid(code2Session.getUnionid());
@@ -517,16 +517,38 @@
         ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         HttpServletRequest request = servletRequestAttributes.getRequest();
         String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER);
+        String custom = request.getHeader("custom-header");
         if (ToolUtil.isNotEmpty(requestHeader) && requestHeader.startsWith("Bearer ")) {
             requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1);
             String key = null;
             int length = requestHeader.length();
-            if(length > 16){
-                key = requestHeader.substring(length - 16);
+            if(length > 32){
+                key = requestHeader.substring(length - 32);
             }else{
                 key = requestHeader;
             }
             String value = redisUtil.getValue(key);
+            //从打车系统直接带过来的token
+            if(ToolUtil.isNotEmpty(custom) && "1".equals(custom)){
+                AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("taxiUserId", value));
+                if(null != appUser){
+                    value = appUser.getId().toString();
+                }else{
+                    String userPhone = AppUserUtil.getUserPhone(Integer.valueOf(value));
+                    //创建新的用户
+                    appUser = new AppUser();
+                    appUser.setNickname("亲爱的用户");
+                    appUser.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
+                    appUser.setPhone(userPhone);
+                    appUser.setAccountBalance(0D);
+                    appUser.setStatus(1);
+                    appUser.setCreateTime(new Date());
+                    appUser.setIsException(1);
+                    appUser.setTaxiUserId(Integer.valueOf(value));
+                    this.insert(appUser);
+                }
+            }
+            
             return null != value ? Integer.valueOf(value) : null;
         }else{
             return null;

--
Gitblit v1.7.1