|
|
@@ -13,13 +13,18 @@ import com.cyksj.dto.UserSharedDto;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.mapper.WxAppMapper;
|
|
|
import com.cyksj.mapper.gzh.UserGzhRelationMapper;
|
|
|
+import com.cyksj.mapper.manage.coupon.CouponDistributePopularizeMapper;
|
|
|
+import com.cyksj.mapper.manage.coupon.CouponRecommendMapper;
|
|
|
import com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper;
|
|
|
+import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
|
|
|
import com.cyksj.mapper.station.CollegeStudentStationUserRelateMapper;
|
|
|
import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
+import com.cyksj.service.claude.ClaudeCodeService;
|
|
|
import com.cyksj.service.distribute.DistributeService;
|
|
|
import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
|
|
|
+import com.cyksj.service.mange.coupon.CouponCommonService;
|
|
|
import com.cyksj.service.market.task.BindTaskService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.shop.YhShopDistributeService;
|
|
|
@@ -73,6 +78,16 @@ public class EventMsgService implements GzhMsgService {
|
|
|
|
|
|
private final YhShopDistributeService yhShopDistributeService;
|
|
|
|
|
|
+ private final UserDistributeMapper userDistributeMapper;
|
|
|
+
|
|
|
+ private final CouponDistributePopularizeMapper couponDistributePopularizeMapper;
|
|
|
+
|
|
|
+ private final CouponRecommendMapper couponRecommendMapper;
|
|
|
+
|
|
|
+ private final CouponCommonService couponCommonService;
|
|
|
+
|
|
|
+ private final ClaudeCodeService claudeCodeService;
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
@Override
|
|
|
@@ -248,6 +263,8 @@ public class EventMsgService implements GzhMsgService {
|
|
|
distributeService.saveDistributionInvitation(sharedId, user.getId(), dsPopularizeId);
|
|
|
}
|
|
|
}
|
|
|
+ //查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ setClaudeCodePopularize(sharedId, dsPopularizeId, user);
|
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
|
//是否是大学生快递站进来的用户
|
|
|
@@ -351,4 +368,47 @@ public class EventMsgService implements GzhMsgService {
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ */
|
|
|
+ public void setClaudeCodePopularize(Long sharedId, Long dsPopularizeId, User user) {
|
|
|
+ //查找渠道是否有设置了对应的claude code优惠码
|
|
|
+ if (sharedId != null) {
|
|
|
+ UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, sharedId).eq(UserDistribute::getDeleted, Boolean.TRUE).last("limit 1"));
|
|
|
+ if (userDistribute != null) {
|
|
|
+ if (dsPopularizeId == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UserDistributePopularize userDistributePopularize = distributePopularizeMapper.selectById(dsPopularizeId);
|
|
|
+ if (userDistributePopularize == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //是否是cc推广
|
|
|
+ if (StrUtil.isEmpty(userDistributePopularize.getOtherUrl()) || !"cc".equals(userDistributePopularize.getOtherUrl())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ 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())) {
|
|
|
+ //发送claude code 体验卡
|
|
|
+ groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|