zoujiajian před 2 roky
rodič
revize
1ee1305378

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/station/CollegeStudentStationUseTicketRecordMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper.station;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.CollegeStudentStationUseTicketRecord;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: CollegeStudentStationUseTicketRecordMapper
+ * 创建者: JavaZou
+ * 创建时间:2024/5/29 13:50
+ */
+public interface CollegeStudentStationUseTicketRecordMapper extends BaseMapper<CollegeStudentStationUseTicketRecord> {
+}

+ 3 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/CollegeStudentStationClickRecord.java

@@ -11,7 +11,9 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class CollegeStudentStationClickRecord extends BaseEntity{
+public class CollegeStudentStationClickRecord extends BaseEntity {
 
 	private Long userId;
+
+	private Integer type;
 }

+ 20 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/CollegeStudentStationUseTicketRecord.java

@@ -0,0 +1,20 @@
+package com.cyksj.model.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: CollegeStudentStationUseTicketRecord
+ * 创建者: JavaZou
+ * 创建时间:2024/5/29 12:10
+ */
+@Getter
+@Setter
+public class CollegeStudentStationUseTicketRecord extends BaseEntity{
+	private Long userId;
+
+	@TableField(value = "userToken")
+	private String userToken;
+}

+ 15 - 0
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -1,6 +1,7 @@
 package com.cyksj.service.chatgpt.impl;
 
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.UUID;
 import cn.hutool.http.HttpRequest;
@@ -15,6 +16,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
 import com.cyksj.common.util.StringUtil;
 import com.cyksj.mapper.*;
+import com.cyksj.mapper.station.CollegeStudentStationUseTicketRecordMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.gpt.ConversationRequest;
 import com.cyksj.model.response.ConversationLimitResponse;
@@ -95,6 +97,8 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
 
     private final ChatgptUserCarUsedRecordMapper chatgptUserCarUsedRecordMapper;
 
+    private final CollegeStudentStationUseTicketRecordMapper collegeStudentStationUseTicketRecordMapper;
+
     @Override
     public String addAccount(Account account) {
         if (isAccountExists(account)) {
@@ -355,6 +359,17 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
             chatgptUser.setRelationId(groupsRelation.getId());
             chatgptUser.setUserToken(UUID.randomUUID().toString());
             chatgptUserMapper.insert(chatgptUser);
+
+            //是否是大学生限时车队
+            Date expiryTime = groupsRelation.getExpiryTime();
+            Date startTime = groupsRelation.getStartTime();
+            //大学生站 1天免费试用
+            if (DateUtil.between(startTime, expiryTime, DateUnit.DAY) <= 1) {
+                CollegeStudentStationUseTicketRecord useTicketRecord = new CollegeStudentStationUseTicketRecord();
+                useTicketRecord.setUserId(user.getId());
+                useTicketRecord.setUserToken(chatgptUser.getUserToken());
+                collegeStudentStationUseTicketRecordMapper.insert(useTicketRecord);
+            }
         } catch (DuplicateKeyException e) {
             log.error("重复插入镜像用户:{}token,errmsg:{}", user.getNickname(), StringUtil.getErrorText(e));
         }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/station/CollegeStudentStationFService.java

@@ -7,5 +7,5 @@ package com.cyksj.service.station;
  * 创建时间:2024/5/28 11:59
  */
 public interface CollegeStudentStationFService {
-	void saveCollegeStudent(long userId);
+	void saveCollegeStudent(long userId, Integer type);
 }

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/station/impl/CollegeStudentStationFServiceImpl.java

@@ -18,9 +18,10 @@ public class CollegeStudentStationFServiceImpl implements CollegeStudentStationF
 	private final CollegeStudentStationClickRecordMapper collegeStudentStationClickRecordMapper;
 
 	@Override
-	public void saveCollegeStudent(long userId) {
+	public void saveCollegeStudent(long userId, Integer type) {
 		CollegeStudentStationClickRecord collegeStudentStationClickRecord = new CollegeStudentStationClickRecord();
 		collegeStudentStationClickRecord.setUserId(userId);
+		collegeStudentStationClickRecord.setType(type);
 		collegeStudentStationClickRecordMapper.insert(collegeStudentStationClickRecord);
 	}
 }

+ 7 - 6
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -187,12 +187,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 				}
 				//去关联对应企业微信用户
 				relateCorpUserAndSengWelfare(fUid, unionid);
-
-				//是否是大学生快递站进来的用户
-				Integer cst = re.getCst();
-				if (cst != null) {
-					handlerCollegeStudentUser(fUid, cst);
-				}
 			});
 		} else {
 			if (StrUtil.isEmpty(user.getRegisterEnv())) {
@@ -227,6 +221,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		}
 		//每日活跃记录
 		userLoginRecordService.saveUserLoginDayRecord(user.getId());
+		//是否是大学生快递站进来的用户
+		Integer cst = re.getCst();
+		if (cst != null) {
+			TASK_POOL.execute(() -> {
+				handlerCollegeStudentUser(userId, cst);
+			});
+		}
 		return user;
 	}
 

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/user/CollegeStudentStationController.java

@@ -28,9 +28,9 @@ public class CollegeStudentStationController {
 	 * 大学生 扫码记录
 	 */
 	@PostMapping("/post")
-	public Result<String> saveCollegeStudent() {
+	public Result<String> saveCollegeStudent(Integer type) {
 		long userId = StpUserUtil.getLoginIdAsLong();
-		collegeStudentStationService.saveCollegeStudent(userId);
+		collegeStudentStationService.saveCollegeStudent(userId, type);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 }