From 88141ff7e83f44feb56f8cbcaaf84260d0626883 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 15 八月 2025 10:07:04 +0800
Subject: [PATCH] 添加时间

---
 UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java |   98 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 74 insertions(+), 24 deletions(-)

diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
index 885a57d..82c8c82 100644
--- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
+++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
@@ -27,7 +27,6 @@
 import com.stylefeng.guns.modular.taxi.model.PaymentRecord;
 import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService;
 import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService;
-import org.apache.commons.lang.time.DateUtils;
 import org.apache.shiro.authc.SimpleAuthenticationInfo;
 import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
@@ -51,7 +50,6 @@
 import java.net.URLConnection;
 import java.security.spec.AlgorithmParameterSpec;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
@@ -128,8 +126,7 @@
     private PayMoneyUtil payMoneyUtil;
 
 
-    @Autowired
-    private TDriverPromotionActivityService driverPromotionActivityService;
+
 
     @Value("${callbackPath}")
     private String callbackPath;
@@ -227,7 +224,7 @@
      * @return
      */
     @Override
-    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,Integer driverId) throws Exception {
+    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType) throws Exception {
         UserInfo userInfo = userInfoMapper.queryByPhone(phone);
         String nickName = null;
         if (null == userInfo) {
@@ -237,6 +234,7 @@
         }
         //调中台接口查询用户
         List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone);
+        String onconUUID = null;
         if (null == infoByPhone || infoByPhone.isEmpty()) {
             RegisterViaMobileRequest request = new RegisterViaMobileRequest();
             request.setMobile(phone);
@@ -249,6 +247,7 @@
             if (!"0".equals(register.getStatus())) {
                 return ResultUtil.error(register.getDesc());
             }
+            onconUUID = register.getOnconUUID();
         } else {
             boolean b = this.checkCaptcha(phone, code);
             if (!b) {
@@ -258,6 +257,7 @@
     
         if (null == userInfo) {
             userInfo = new UserInfo();
+            userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
             userInfo.setPhone(phone);
             userInfo.setPassWord(ShiroKit.md5("", salt));
             userInfo.setNickName(nickName);
@@ -266,6 +266,9 @@
             userInfo.setConsumption(0D);
             userInfo.setBalance(0D);
             userInfo.setState(1);
+            if(null != onconUUID){
+                userInfo.setOnconUUID(onconUUID);
+            }
 
             //用户所属企业
             if(null != registAreaCode){
@@ -275,21 +278,6 @@
             }else {
                 userInfo.setCompanyId(1);
             }
-
-
-
-
-
-            // 是否需要绑定司机
-            TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1"));
-            if(tDriverPromotionActivity!=null){
-                Integer bindingDays = tDriverPromotionActivity.getBindingDays();
-                // 当前时间+绑定天数
-                Date endTime = DateUtils.addDays(new Date(), bindingDays);
-                userInfo.setBindDriverId(driverId);
-                userInfo.setBindExpireDate(endTime);
-            }
-
 
 
 
@@ -350,6 +338,7 @@
         UserInfo userInfo = userInfoMapper.queryByPhone(phone);
         if (null == userInfo) {
             userInfo = new UserInfo();
+            userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
             userInfo.setPhone(phone);
             userInfo.setPassWord(ShiroKit.md5("", salt));
             userInfo.setNickName(this.getDefaultName());
@@ -403,7 +392,7 @@
     }
     @Override
     public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType,String loginType) throws Exception {
-        ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,loginType,null);
+        ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,loginType);
         if(resultUtil.getCode() == 200 && null != uid){
             if(type == 2){//司机分享
                 Driver driver = driverMapper.selectById(uid);
@@ -540,6 +529,7 @@
         }
         if (null == userInfo) {
             userInfo = new UserInfo();
+            userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
             userInfo.setPassWord(ShiroKit.md5("", salt));
             userInfo.setRegistIp(registIp);
             userInfo.setSex(sex);
@@ -669,6 +659,7 @@
         int i =0;
         if(null == userInfo){
             userInfo = new UserInfo();
+            userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
             if(ToolUtil.isEmpty(phone)){
                 String phone2 = getPhone(sessionKey, encryptedData, iv);
                 List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone2).eq("state",1).ne("flag",3));
@@ -884,7 +875,8 @@
             nickName = userInfo.getNickName();
         }
         //调中台接口查询用户
-        List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone);
+        String onconUUID = null;
+                List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone);
         if (null == infoByPhone || infoByPhone.isEmpty()) {
             RegisterViaMobileRequest request = new RegisterViaMobileRequest();
             request.setMobile(phone);
@@ -897,6 +889,7 @@
             if (!"0".equals(register.getStatus())) {
                 return ResultUtil.error(register.getDesc());
             }
+            onconUUID = register.getOnconUUID();
         } else {
             boolean b = this.checkCaptcha(phone, code);
             if (!b) {
@@ -911,6 +904,7 @@
             userInfo1.setAvatar(userInfo.getAvatar());
             userInfo1.setSex(userInfo.getSex());
             userInfo1.setNickName(userInfo.getNickName());
+            userInfo1.setOnconUUID(onconUUID);
             this.updateById(userInfo1);
         
             if (ToolUtil.isNotEmpty(loginType) && loginType.equals("Applets")) {//小程序登录后绑定手机号码
@@ -960,7 +954,7 @@
             loginWarpper.setPhone(2);
             return ResultUtil.success(loginWarpper);
         }
-    
+        userInfo.setOnconUUID(onconUUID);
         userInfo.setPhone(phone);
         userInfo.setUpdateTime(new Date());
         userInfo.setUpdateUser(userInfo.getId());
@@ -1250,7 +1244,7 @@
             if(null == userInfo){
                 return ResultUtil.error("获取用户信息失败");
             }
-            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType,null);
+            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType);
         }else{
             return ResultUtil.error(jsonObject.getString("msg"));
         }
@@ -1643,4 +1637,60 @@
         }
         return ResultUtil.success(loginWarpper);
     }
+    
+    
+    @Override
+    public String addAppUser(String phone, String code, String areaCode) throws Exception {
+        UserInfo userInfo = userInfoMapper.queryByPhone(phone);
+        String nickName = null;
+        if (null == userInfo) {
+            nickName = this.getDefaultName();
+        } else {
+            nickName = userInfo.getNickName();
+        }
+        //调中台接口查询用户
+        List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone);
+        String onconUUID = null;
+        if (null == infoByPhone || infoByPhone.isEmpty()) {
+            RegisterViaMobileRequest request = new RegisterViaMobileRequest();
+            request.setMobile(phone);
+            request.setEncryptType("aesbase64");
+            request.setPassword(AESUtils.encryptBase64("123456"));
+            request.setNickname(nickName);
+            request.setVerify_code(code);
+            request.setVerify_code_type("0");
+            RegisterViaMobile register = UserUtil.registerViaMobile(request);
+            if (!"0".equals(register.getStatus())) {
+                return null;
+            }
+            onconUUID = register.getOnconUUID();
+        }
+    
+        if (null == userInfo) {
+            userInfo = new UserInfo();
+            userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png");
+            userInfo.setPhone(phone);
+            userInfo.setPassWord(ShiroKit.md5("", salt));
+            userInfo.setNickName(nickName);
+            userInfo.setIsAuth(1);
+            userInfo.setConsumption(0D);
+            userInfo.setBalance(0D);
+            userInfo.setState(1);
+            if(null != onconUUID){
+                userInfo.setOnconUUID(onconUUID);
+            }
+        
+            //用户所属企业
+            if(null != areaCode){
+                Company query = companyCityService.query(areaCode);
+                userInfo.setCompanyId(null != query ? query.getId() : 1);
+                userInfo.setRegistAreaCode(areaCode);
+            }else {
+                userInfo.setCompanyId(1);
+            }
+        
+            this.insert(userInfo);
+        }
+        return userInfo.getId().toString();
+    }
 }

--
Gitblit v1.7.1