From 9828db9febf4ad5cb0b79a72eedca6922b466104 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期日, 27 七月 2025 13:54:52 +0800
Subject: [PATCH] 用户端修改  推广功能

---
 UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 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 291c45f..885a57d 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,6 +27,7 @@
 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;
@@ -50,6 +51,7 @@
 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;
@@ -124,6 +126,10 @@
 
     @Autowired
     private PayMoneyUtil payMoneyUtil;
+
+
+    @Autowired
+    private TDriverPromotionActivityService driverPromotionActivityService;
 
     @Value("${callbackPath}")
     private String callbackPath;
@@ -221,7 +227,7 @@
      * @return
      */
     @Override
-    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType) throws Exception {
+    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,Integer driverId) throws Exception {
         UserInfo userInfo = userInfoMapper.queryByPhone(phone);
         String nickName = null;
         if (null == userInfo) {
@@ -269,6 +275,24 @@
             }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);
+            }
+
+
+
+
             this.insert(userInfo);
 
             this.addCoupon(userInfo);//添加优惠券
@@ -379,7 +403,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);
+        ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,loginType,null);
         if(resultUtil.getCode() == 200 && null != uid){
             if(type == 2){//司机分享
                 Driver driver = driverMapper.selectById(uid);
@@ -1226,7 +1250,7 @@
             if(null == userInfo){
                 return ResultUtil.error("获取用户信息失败");
             }
-            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType);
+            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType,null);
         }else{
             return ResultUtil.error(jsonObject.getString("msg"));
         }

--
Gitblit v1.7.1