|
@@ -29,6 +29,7 @@ import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
|
|
|
import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
|
|
import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
|
|
|
import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
|
import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
|
|
import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
|
|
|
|
|
+import com.cyksj.mapper.nano.NanoUserTrialReceiveRecordMapper;
|
|
|
import com.cyksj.mapper.station.CollegeStudentStationUserRelateMapper;
|
|
import com.cyksj.mapper.station.CollegeStudentStationUserRelateMapper;
|
|
|
import com.cyksj.mapper.vip.VipUserMapper;
|
|
import com.cyksj.mapper.vip.VipUserMapper;
|
|
|
import com.cyksj.model.dto.*;
|
|
import com.cyksj.model.dto.*;
|
|
@@ -156,6 +157,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
|
|
|
|
|
private final ClaudeCodeUserTrialReceiveRecordMapper claudeCodeUserTrialReceiveRecordMapper;
|
|
private final ClaudeCodeUserTrialReceiveRecordMapper claudeCodeUserTrialReceiveRecordMapper;
|
|
|
|
|
|
|
|
|
|
+ private final NanoUserTrialReceiveRecordMapper nanoUserTrialReceiveRecordMapper;
|
|
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -248,8 +251,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
if (sharedId != null && dsType != null && dsType == 2) {
|
|
if (sharedId != null && dsType != null && dsType == 2) {
|
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
|
}
|
|
}
|
|
|
- //查找渠道是否有设置了对应的claude code优惠码
|
|
|
|
|
- setClaudeCodePopularize(sharedId, dsPopularizeId, user);
|
|
|
|
|
|
|
+ //处理特殊推广
|
|
|
|
|
+ handlerSpecialPopularize(sharedId, dsPopularizeId, user);
|
|
|
//每日活跃记录
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
|
//是否是大学生快递站进来的用户
|
|
//是否是大学生快递站进来的用户
|
|
@@ -603,7 +606,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
|
|
|
}
|
|
}
|
|
|
//查找渠道是否有设置了对应的claude code优惠码
|
|
//查找渠道是否有设置了对应的claude code优惠码
|
|
|
- setClaudeCodePopularize(sharedId, dsPopularizeId, user);
|
|
|
|
|
|
|
+ handlerSpecialPopularize(sharedId, dsPopularizeId, user);
|
|
|
|
|
|
|
|
//每日活跃记录
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
@@ -947,7 +950,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
/**
|
|
/**
|
|
|
* 查找渠道是否有设置了对应的claude code优惠码
|
|
* 查找渠道是否有设置了对应的claude code优惠码
|
|
|
*/
|
|
*/
|
|
|
- public void setClaudeCodePopularize(Long sharedId, Long dsPopularizeId, User user) {
|
|
|
|
|
|
|
+ public void handlerSpecialPopularize(Long sharedId, Long dsPopularizeId, User user) {
|
|
|
//查找渠道是否有设置了对应的claude code优惠码
|
|
//查找渠道是否有设置了对应的claude code优惠码
|
|
|
if (sharedId != null) {
|
|
if (sharedId != null) {
|
|
|
UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, sharedId).eq(UserDistribute::getDeleted, Boolean.TRUE).last("limit 1"));
|
|
UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, sharedId).eq(UserDistribute::getDeleted, Boolean.TRUE).last("limit 1"));
|
|
@@ -960,33 +963,58 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
//是否是cc推广
|
|
//是否是cc推广
|
|
|
- if (StrUtil.isEmpty(userDistributePopularize.getOtherUrl()) || !"cc".equals(userDistributePopularize.getOtherUrl())) {
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (Constant.CC_DISTRIBUTE_MARK.equals(userDistributePopularize.getOtherUrl())) {
|
|
|
|
|
+ Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID));
|
|
|
|
|
+ //是否设置claude cod优惠券
|
|
|
|
|
+ if (selectCount > 0) {
|
|
|
|
|
+ //设置了 直接发送优惠券
|
|
|
|
|
+ Boolean b = couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
|
|
+ if (!b) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (redisService.setNx(RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getTimeout())) {
|
|
|
|
|
+ //存在Claude code车票不发送体验卡
|
|
|
|
|
+ if (!claudeCodeService.checkClaudeCodeUser(user.getId())) {
|
|
|
|
|
+ Integer receiveRecord = claudeCodeUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(ClaudeCodeUserTrialReceiveRecord.class).eq(ClaudeCodeUserTrialReceiveRecord::getUserId, user.getId()));
|
|
|
|
|
+ if (receiveRecord > 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //发送claude code 体验卡
|
|
|
|
|
+ Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID, 1);
|
|
|
|
|
+ recordReceiveClaudeCodeRecord(user.getId(), relationId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //该优惠券是否处于推荐中
|
|
|
|
|
+ int isTj = couponRecommendMapper.checkPresentRecommendByCouponId(Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID);
|
|
|
|
|
+ if (isTj != 0) {
|
|
|
|
|
+ //发送无优惠码的 优惠券
|
|
|
|
|
+ couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID));
|
|
|
|
|
- //是否设置claude cod优惠券
|
|
|
|
|
- if (selectCount > 0) {
|
|
|
|
|
- //设置了 直接发送优惠券
|
|
|
|
|
- couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
|
|
- if (redisService.setNx(RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.CLAUDE_CODE_TY_DAY_CARD_KEY.getTimeout())) {
|
|
|
|
|
- //存在Claude code车票不发送体验卡
|
|
|
|
|
- if (!claudeCodeService.checkClaudeCodeUser(user.getId())) {
|
|
|
|
|
- Integer receiveRecord = claudeCodeUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(ClaudeCodeUserTrialReceiveRecord.class).eq(ClaudeCodeUserTrialReceiveRecord::getUserId, user.getId()));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //是否是nano 推广
|
|
|
|
|
+ if (Constant.NANO_DISTRIBUTE_MARK.equals(userDistributePopularize.getOtherUrl())) {
|
|
|
|
|
+ Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_NANO_COUPON_ID));
|
|
|
|
|
+ //是否设置claude cod优惠券
|
|
|
|
|
+ if (selectCount > 0) {
|
|
|
|
|
+ //设置了 直接发送优惠券
|
|
|
|
|
+ Boolean b = couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_NANO_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
|
|
+ if (!b) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (redisService.setNx(RedisService.key.NANO_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.NANO_TY_DAY_CARD_KEY.getTimeout())) {
|
|
|
|
|
+ //存在Claude code车票不发送体验卡
|
|
|
|
|
+ Integer receiveRecord = nanoUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(NanoUserTrialReceiveRecord.class).eq(NanoUserTrialReceiveRecord::getUserId, user.getId()));
|
|
|
if (receiveRecord > 0) {
|
|
if (receiveRecord > 0) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
//发送claude code 体验卡
|
|
//发送claude code 体验卡
|
|
|
- Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID, 1);
|
|
|
|
|
- recordReceiveClaudeCodeRecord(user.getId(), relationId);
|
|
|
|
|
|
|
+ Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID, 1);
|
|
|
|
|
+ recordReceiveNanoRecord(user.getId(), relationId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- //该优惠券是否处于推荐中
|
|
|
|
|
- int isTj = couponRecommendMapper.checkPresentRecommendByCouponId(Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID);
|
|
|
|
|
- if (isTj != 0) {
|
|
|
|
|
- //发送无优惠码的 优惠券
|
|
|
|
|
- couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_NO_CODE_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1000,4 +1028,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
claudeCodeUserTrialReceiveRecordMapper.insert(record);
|
|
claudeCodeUserTrialReceiveRecordMapper.insert(record);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void recordReceiveNanoRecord(Long userId, Long relationId) {
|
|
|
|
|
+ if (relationId != null) {
|
|
|
|
|
+ NanoUserTrialReceiveRecord record = new NanoUserTrialReceiveRecord();
|
|
|
|
|
+ record.setUserId(userId);
|
|
|
|
|
+ record.setRelationId(relationId);
|
|
|
|
|
+ nanoUserTrialReceiveRecordMapper.insert(record);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|