|
@@ -19,8 +19,12 @@ import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
|
|
|
import com.cyksj.dto.UserSharedDto;
|
|
import com.cyksj.dto.UserSharedDto;
|
|
|
import com.cyksj.mapper.*;
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.channel.ChannelPopularizeMapper;
|
|
import com.cyksj.mapper.channel.ChannelPopularizeMapper;
|
|
|
|
|
+import com.cyksj.mapper.claudecode.ClaudeCodeUserPopularizeTrialTicketRecordMapper;
|
|
|
import com.cyksj.mapper.corp.*;
|
|
import com.cyksj.mapper.corp.*;
|
|
|
|
|
+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.cps.UserDistributePopularizeMapper;
|
|
|
|
|
+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;
|
|
@@ -28,9 +32,11 @@ 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.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
|
|
+import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.request.LoginReq;
|
|
import com.cyksj.model.request.LoginReq;
|
|
|
import com.cyksj.model.views.*;
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
|
|
+import com.cyksj.service.claude.ClaudeCodeService;
|
|
|
import com.cyksj.service.distribute.DistributeService;
|
|
import com.cyksj.service.distribute.DistributeService;
|
|
|
import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
|
|
import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
|
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
@@ -137,6 +143,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
|
|
|
|
|
private final VipUserMapper vipUserMapper;
|
|
private final VipUserMapper vipUserMapper;
|
|
|
|
|
|
|
|
|
|
+ private final CouponDistributePopularizeMapper couponDistributePopularizeMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final UserDistributeMapper userDistributeMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final ClaudeCodeService claudeCodeService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ClaudeCodeUserPopularizeTrialTicketRecordMapper claudeCodeUserPopularizeTrialTicketRecordMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final CouponRecommendMapper couponRecommendMapper;
|
|
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -242,14 +258,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public UserWhoami whoami(long userId) {
|
|
|
|
|
- User user = this.getById(userId);
|
|
|
|
|
- Assert.notNull(user, "业务处理失败,请联系客服");
|
|
|
|
|
- UserWhoami userWhoami = new UserWhoami();
|
|
|
|
|
- if (StrUtil.isEmpty(user.getShowId())) {
|
|
|
|
|
- user.setShowId(userCommonService.getUserShowId(userId));
|
|
|
|
|
- }
|
|
|
|
|
- BeanUtil.copyProperties(user, userWhoami);
|
|
|
|
|
|
|
+ public UserWhoami whoami(long userId, Boolean ccCode) {
|
|
|
|
|
+ User user = this.getById(userId);
|
|
|
|
|
+ Assert.notNull(user, "业务处理失败,请联系客服");
|
|
|
|
|
+ UserWhoami userWhoami = new UserWhoami();
|
|
|
|
|
+ if (StrUtil.isEmpty(user.getShowId())) {
|
|
|
|
|
+ user.setShowId(userCommonService.getUserShowId(userId));
|
|
|
|
|
+ }
|
|
|
|
|
+ BeanUtil.copyProperties(user, userWhoami);
|
|
|
|
|
|
|
|
UserBindDetail bindPhone = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
|
|
UserBindDetail bindPhone = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
|
|
|
.eq(StrUtil.isNotEmpty(user.getUnionid()), UserBindDetail::getUserId, userId)
|
|
.eq(StrUtil.isNotEmpty(user.getUnionid()), UserBindDetail::getUserId, userId)
|
|
@@ -260,13 +276,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
userWhoami.setBindPhone(bindPhone.getPhone());
|
|
userWhoami.setBindPhone(bindPhone.getPhone());
|
|
|
userWhoami.setBindEmail(bindPhone.getEmail());
|
|
userWhoami.setBindEmail(bindPhone.getEmail());
|
|
|
}
|
|
}
|
|
|
- Integer type = 3;
|
|
|
|
|
- if (StrUtil.isNotBlank(user.getLoginPhone())) {
|
|
|
|
|
- type = 1;
|
|
|
|
|
- } else if (StrUtil.isNotBlank(user.getEmail())) {
|
|
|
|
|
- type = 2;
|
|
|
|
|
- }
|
|
|
|
|
- userWhoami.setType(type);
|
|
|
|
|
|
|
+ Integer type = 3;
|
|
|
|
|
+ if (StrUtil.isNotBlank(user.getLoginPhone())) {
|
|
|
|
|
+ type = 1;
|
|
|
|
|
+ } else if (StrUtil.isNotBlank(user.getEmail())) {
|
|
|
|
|
+ type = 2;
|
|
|
|
|
+ }
|
|
|
|
|
+ userWhoami.setType(type);
|
|
|
//是否加过企业微信
|
|
//是否加过企业微信
|
|
|
String unionId = user.getUnionid();
|
|
String unionId = user.getUnionid();
|
|
|
if (StrUtil.isEmpty(unionId)) {
|
|
if (StrUtil.isEmpty(unionId)) {
|
|
@@ -295,8 +311,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
.in(OrderDon::getUserId, userIdList)
|
|
.in(OrderDon::getUserId, userIdList)
|
|
|
.notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
.notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
userWhoami.setIsPay(selectCount > 0);
|
|
userWhoami.setIsPay(selectCount > 0);
|
|
|
|
|
+ if (ccCode != null) {
|
|
|
|
|
+ Number number = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getSkuId, Constant.DISTRIBUTE_CLAUDE_CODE_TRIAL_SKU_ID).field(GroupsRelationView::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID).build());
|
|
|
|
|
+ userWhoami.setCcCode(number.intValue() > 0);
|
|
|
|
|
+ Integer selectCount1 = claudeCodeUserPopularizeTrialTicketRecordMapper.selectCount(Wrappers.lambdaQuery(ClaudeCodeUserPopularizeTrialTicketRecord.class).in(ClaudeCodeUserPopularizeTrialTicketRecord::getUserId, userIdList));
|
|
|
|
|
+ if (selectCount1 == 0) {
|
|
|
|
|
+ ClaudeCodeUserPopularizeTrialTicketRecord record = new ClaudeCodeUserPopularizeTrialTicketRecord();
|
|
|
|
|
+ record.setUserId(userId);
|
|
|
|
|
+ claudeCodeUserPopularizeTrialTicketRecordMapper.insert(record);
|
|
|
|
|
+ }
|
|
|
|
|
+ userWhoami.setTc(selectCount1 == 0);
|
|
|
|
|
+ }
|
|
|
return userWhoami;
|
|
return userWhoami;
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public User getSyncUser(String openId, String unionId, WxSyncLog wxSyncLog) {
|
|
public User getSyncUser(String openId, String unionId, WxSyncLog wxSyncLog) {
|
|
@@ -570,6 +597,33 @@ 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优惠码
|
|
|
|
|
+ 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) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//每日活跃记录
|
|
//每日活跃记录
|
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
userLoginRecordService.saveUserLoginDayRecord(user.getId());
|
|
|
return user;
|
|
return user;
|