|
|
@@ -36,7 +36,8 @@ import com.cyksj.service.chatgpt.ChatGptAuthService;
|
|
|
import com.cyksj.service.claude.ClaudeService;
|
|
|
import com.cyksj.service.groups.GroupsFuncService;
|
|
|
import com.cyksj.service.luma.LumaService;
|
|
|
-import com.cyksj.service.mail.*;
|
|
|
+import com.cyksj.service.mail.CommonMailService;
|
|
|
+import com.cyksj.service.mail.MailService;
|
|
|
import com.cyksj.service.mange.coupon.CouponCommonService;
|
|
|
import com.cyksj.service.midjourney.MidjourneyAccountService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
@@ -166,6 +167,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final CommonMailService commonMailService;
|
|
|
|
|
|
+ private final GptMirrorDayCardGiveawayActivityMapper gptMirrorDayCardGiveawayActivityMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -208,146 +211,160 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
.field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
|
|
|
.orderBy(RenewalView::getExpiryTime).asc()
|
|
|
.build());
|
|
|
- //过滤邀请制、已失效的车位
|
|
|
- Integer size = list.getTotalCount().intValue();
|
|
|
-
|
|
|
- List<Long> renewReduceSkuIds = userBenefitsMapper.selectList(Wrappers.lambdaQuery(UserBenefits.class)
|
|
|
- .eq(UserBenefits::getType, UserBenefits.Type.RENEW).eq(UserBenefits::getStatus, 1).select(UserBenefits::getSkuId)).stream().map(UserBenefits::getSkuId).collect(Collectors.toList());
|
|
|
-
|
|
|
- list.getDataList().forEach(ticket -> {
|
|
|
- if (ticket.getSkuId() == null || ticket.getGoodsId() == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
|
- ticket.setPassword(null);
|
|
|
- }
|
|
|
- ticket.setIsMulti(false);
|
|
|
- if (ticket.getSkuNum() > 1) {
|
|
|
- ticket.setIsMulti(true);
|
|
|
- }
|
|
|
- //chatGPT直连
|
|
|
- if (ticket.getGoodsId().equals(42l)) {
|
|
|
- if (StrUtil.isNotBlank(ticket.getAccount())) {
|
|
|
- String accessToken;
|
|
|
- try {
|
|
|
- accessToken = chatGptAuthService.getAccessToken(ticket.getAccount());
|
|
|
- ticket.setGptRefreshToken(accessToken);
|
|
|
- } catch (Exception e) {
|
|
|
- redisService.set(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + ticket.getAccount(), ticket.getAccount());
|
|
|
- }
|
|
|
+ if (list.getDataList().size() > 0) {
|
|
|
+ //过滤邀请制、已失效的车位
|
|
|
+ Integer size = list.getTotalCount().intValue();
|
|
|
+ //赠送GPT日卡 参与平台ids
|
|
|
+ List<Long> renewReduceSkuIds = userBenefitsMapper.selectList(Wrappers.lambdaQuery(UserBenefits.class)
|
|
|
+ .eq(UserBenefits::getType, UserBenefits.Type.RENEW).eq(UserBenefits::getStatus, 1).select(UserBenefits::getSkuId)).stream().map(UserBenefits::getSkuId).collect(Collectors.toList());
|
|
|
+ List<Long> gptBuyGids = getGptMirrorGiveawayBuyGids();
|
|
|
+ //gpt日卡活动
|
|
|
+ GptMirrorDayCardGiveawayActivity gptMirrorDayCardGiveawayActivity = gptMirrorDayCardGiveawayActivityMapper.selectOne(Wrappers.lambdaQuery(GptMirrorDayCardGiveawayActivity.class)
|
|
|
+ .last("limit 1"));
|
|
|
+ list.getDataList().forEach(ticket -> {
|
|
|
+ if (ticket.getSkuId() == null || ticket.getGoodsId() == null) {
|
|
|
+ return;
|
|
|
}
|
|
|
- ticket.setAccount(null);
|
|
|
- ticket.setPassword(null);
|
|
|
- } else {
|
|
|
- ticket.setGptRefreshToken(null);
|
|
|
- }
|
|
|
- if (ticket.getSecondType() == 1) {
|
|
|
- ticket.setAccount(null);
|
|
|
- ticket.setPassword(null);
|
|
|
- }
|
|
|
- if (ticket.getGoodsId() != 30l) {
|
|
|
- ticket.setGptEmailPwd(null);
|
|
|
- }
|
|
|
- if (isLoginPopularize != null && isLoginPopularize) {
|
|
|
- GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, ticket.getGoodsId()).build());
|
|
|
- views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
|
- views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, views.getId()).field(GoodsDonSkuFrontView::getStatus, true).build()));
|
|
|
- ticket.setGoodsDonViews(views);
|
|
|
- }
|
|
|
- if (ticket.getMonths() != null && ticket.getMonths() >= 300) {
|
|
|
- ticket.setExpiryTime(null);
|
|
|
- }
|
|
|
- if (ticket.getExpiryTime() != null && ticket.getGoodsType() == 1) {
|
|
|
- String remainDays = DateUtil.formatBetween(now, ticket.getExpiryTime(), BetweenFormater.Level.DAY);
|
|
|
- if ("0天".equals(remainDays)) {
|
|
|
- remainDays = "小于1天";
|
|
|
+ if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
|
+ ticket.setPassword(null);
|
|
|
+ }
|
|
|
+ ticket.setIsMulti(false);
|
|
|
+ if (ticket.getSkuNum() > 1) {
|
|
|
+ ticket.setIsMulti(true);
|
|
|
+ }
|
|
|
+ //chatGPT直连
|
|
|
+ if (ticket.getGoodsId().equals(42l)) {
|
|
|
+ if (StrUtil.isNotBlank(ticket.getAccount())) {
|
|
|
+ String accessToken;
|
|
|
+ try {
|
|
|
+ accessToken = chatGptAuthService.getAccessToken(ticket.getAccount());
|
|
|
+ ticket.setGptRefreshToken(accessToken);
|
|
|
+ } catch (Exception e) {
|
|
|
+ redisService.set(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + ticket.getAccount(), ticket.getAccount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ticket.setAccount(null);
|
|
|
+ ticket.setPassword(null);
|
|
|
} else {
|
|
|
- //当天也算
|
|
|
- int days = Integer.parseInt(remainDays.substring(0, remainDays.indexOf("天")));
|
|
|
- remainDays = days + 1 + "天";
|
|
|
+ ticket.setGptRefreshToken(null);
|
|
|
}
|
|
|
- ticket.setRemainDays(remainDays);
|
|
|
- ticket.setTotal(DateUtil.betweenDay(ticket.getStartTime(), ticket.getExpiryTime(), false));
|
|
|
- }
|
|
|
- OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getRelationId, ticket.getRelationId())
|
|
|
- .eq(OrderDon::getUserId, ticket.getUserId())
|
|
|
- .eq(OrderDon::getOrderType, 1)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .orderByDesc(OrderDon::getId)
|
|
|
- .last("limit 1"));
|
|
|
- if (orderDon != null) {
|
|
|
- ticket.setOrderNo(orderDon.getOrderNo());
|
|
|
- ticket.setOrderId(orderDon.getId());
|
|
|
- ticket.setTransactionId(orderDon.getTransactionId());
|
|
|
if (ticket.getSecondType() == 1) {
|
|
|
- //是否完成邀请 根据订单状态
|
|
|
- ticket.setIsComplete(orderDon.getStatus() == OrderDon.Status.complete ? true : false);
|
|
|
+ ticket.setAccount(null);
|
|
|
+ ticket.setPassword(null);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (size > 1 && ticket.getGoodsId() != 18) {
|
|
|
- Date payTime = null;
|
|
|
+ if (ticket.getGoodsId() != 30l) {
|
|
|
+ ticket.setGptEmailPwd(null);
|
|
|
+ }
|
|
|
+ if (isLoginPopularize != null && isLoginPopularize) {
|
|
|
+ GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, ticket.getGoodsId()).build());
|
|
|
+ views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
|
+ views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, views.getId()).field(GoodsDonSkuFrontView::getStatus, true).build()));
|
|
|
+ ticket.setGoodsDonViews(views);
|
|
|
+ }
|
|
|
+ if (ticket.getMonths() != null && ticket.getMonths() >= 300) {
|
|
|
+ ticket.setExpiryTime(null);
|
|
|
+ }
|
|
|
+ if (ticket.getExpiryTime() != null && ticket.getGoodsType() == 1) {
|
|
|
+ String remainDays = DateUtil.formatBetween(now, ticket.getExpiryTime(), BetweenFormater.Level.DAY);
|
|
|
+ if ("0天".equals(remainDays)) {
|
|
|
+ remainDays = "小于1天";
|
|
|
+ } else {
|
|
|
+ //当天也算
|
|
|
+ int days = Integer.parseInt(remainDays.substring(0, remainDays.indexOf("天")));
|
|
|
+ remainDays = days + 1 + "天";
|
|
|
+ }
|
|
|
+ ticket.setRemainDays(remainDays);
|
|
|
+ ticket.setTotal(DateUtil.betweenDay(ticket.getStartTime(), ticket.getExpiryTime(), false));
|
|
|
+ }
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getRelationId, ticket.getRelationId())
|
|
|
+ .eq(OrderDon::getUserId, ticket.getUserId())
|
|
|
+ .eq(OrderDon::getOrderType, 1)
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
+ .orderByDesc(OrderDon::getId)
|
|
|
+ .last("limit 1"));
|
|
|
if (orderDon != null) {
|
|
|
- payTime = Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime());
|
|
|
+ ticket.setOrderNo(orderDon.getOrderNo());
|
|
|
+ ticket.setOrderId(orderDon.getId());
|
|
|
+ ticket.setTransactionId(orderDon.getTransactionId());
|
|
|
+ if (ticket.getSecondType() == 1) {
|
|
|
+ //是否完成邀请 根据订单状态
|
|
|
+ ticket.setIsComplete(orderDon.getStatus() == OrderDon.Status.complete ? true : false);
|
|
|
+ }
|
|
|
}
|
|
|
- //加购订单
|
|
|
- if (orderDon == null) {
|
|
|
- List<OrderDiscountPlusPurchaseSkuRelation> plusPurchaseSkuRelations = orderDiscountPlusPurchaseSkuRelationMapper.selectPlusRelationByIdAndUserId(ticket.getRelationId(), ticket.getUserId());
|
|
|
- for (OrderDiscountPlusPurchaseSkuRelation data : plusPurchaseSkuRelations) {
|
|
|
- String relationIds = data.getRelationIds();
|
|
|
- if (StrUtil.isEmpty(relationIds)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- try {
|
|
|
- List<Long> relationList = Jsons.parseList(relationIds, Long.class);
|
|
|
- if (relationList.contains(ticket.getRelationId())) {
|
|
|
- OrderDon plusOrder = orderDonMapper.selectById(data.getOrderId());
|
|
|
- if (plusOrder != null) {
|
|
|
- payTime = Optional.ofNullable(plusOrder.getPayTime()).orElse(plusOrder.getCreatedTime());
|
|
|
+
|
|
|
+ if (size > 1 && ticket.getGoodsId() != 18) {
|
|
|
+ Date payTime = null;
|
|
|
+ if (orderDon != null) {
|
|
|
+ payTime = Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime());
|
|
|
+ }
|
|
|
+ //加购订单
|
|
|
+ if (orderDon == null) {
|
|
|
+ List<OrderDiscountPlusPurchaseSkuRelation> plusPurchaseSkuRelations = orderDiscountPlusPurchaseSkuRelationMapper.selectPlusRelationByIdAndUserId(ticket.getRelationId(), ticket.getUserId());
|
|
|
+ for (OrderDiscountPlusPurchaseSkuRelation data : plusPurchaseSkuRelations) {
|
|
|
+ String relationIds = data.getRelationIds();
|
|
|
+ if (StrUtil.isEmpty(relationIds)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ List<Long> relationList = Jsons.parseList(relationIds, Long.class);
|
|
|
+ if (relationList.contains(ticket.getRelationId())) {
|
|
|
+ OrderDon plusOrder = orderDonMapper.selectById(data.getOrderId());
|
|
|
+ if (plusOrder != null) {
|
|
|
+ payTime = Optional.ofNullable(plusOrder.getPayTime()).orElse(plusOrder.getCreatedTime());
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
+ } catch (Exception e) {
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+ ticket.setPayTime(payTime);
|
|
|
}
|
|
|
- ticket.setPayTime(payTime);
|
|
|
- }
|
|
|
- if (ticket.getSkuNum() != null && ticket.getSkuNum() == 1) {
|
|
|
+ if (ticket.getSkuNum() != null && ticket.getSkuNum() == 1) {
|
|
|
|
|
|
- }
|
|
|
- //奈飞、gpt
|
|
|
- if (ticket.getGoodsId() == 1 || ticket.getGoodsId() == 18 || ticket.getGoodsId() == 33l) {
|
|
|
- ticket.setEmail(null);
|
|
|
- }
|
|
|
- //设置镜像车票信息
|
|
|
- setMirrorTicketInfo(ticket);
|
|
|
+ }
|
|
|
+ //奈飞、gpt
|
|
|
+ if (ticket.getGoodsId() == 1 || ticket.getGoodsId() == 18 || ticket.getGoodsId() == 33l) {
|
|
|
+ ticket.setEmail(null);
|
|
|
+ }
|
|
|
+ //设置镜像车票信息
|
|
|
+ setMirrorTicketInfo(ticket);
|
|
|
|
|
|
// List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
|
|
|
// ticket.setRelationViews(relationUserViews);
|
|
|
- if (ticket.getExpiryTime() != null) {
|
|
|
- ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
|
- }
|
|
|
- //查看双重验证码
|
|
|
- if (StrUtil.isNotEmpty(ticket.getApiSecret())) {
|
|
|
- Boolean isHasVerifyCode = StrUtil.isNotBlank(ticket.getVerifyCode()) ? true : false;
|
|
|
- Integer codeNum = getUserCodeNumBySkuId(ticket.getUserId(), ticket.getSkuId(), isHasVerifyCode);
|
|
|
- ticket.setCodeNum(codeNum);
|
|
|
- }
|
|
|
- Long qaId = groupsRelationMapper.selectGoodsDonQaByGoodsId(ticket.getGoodsId());
|
|
|
- ticket.setQa(qaId > 0 ? true : false);
|
|
|
- //是否存在海报
|
|
|
- ticket.setPosterInfo(setGoodsPoster(ticket, u, userIds));
|
|
|
+ if (ticket.getExpiryTime() != null) {
|
|
|
+ ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+ //查看双重验证码
|
|
|
+ if (StrUtil.isNotEmpty(ticket.getApiSecret())) {
|
|
|
+ Boolean isHasVerifyCode = StrUtil.isNotBlank(ticket.getVerifyCode()) ? true : false;
|
|
|
+ Integer codeNum = getUserCodeNumBySkuId(ticket.getUserId(), ticket.getSkuId(), isHasVerifyCode);
|
|
|
+ ticket.setCodeNum(codeNum);
|
|
|
+ }
|
|
|
+ Long qaId = groupsRelationMapper.selectGoodsDonQaByGoodsId(ticket.getGoodsId());
|
|
|
+ ticket.setQa(qaId > 0 ? true : false);
|
|
|
+ //是否存在海报
|
|
|
+ ticket.setPosterInfo(setGoodsPoster(ticket, u, userIds));
|
|
|
|
|
|
- //续费升级折扣
|
|
|
- setRenewDiscount(ticket);
|
|
|
+ //续费升级折扣
|
|
|
+ setRenewDiscount(ticket);
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(renewReduceSkuIds) && renewReduceSkuIds.contains(ticket.getSkuId())) {
|
|
|
- ticket.setIsRenewReduce(true);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (CollUtil.isNotEmpty(renewReduceSkuIds) && renewReduceSkuIds.contains(ticket.getSkuId())) {
|
|
|
+ ticket.setIsRenewReduce(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(gptBuyGids) && gptBuyGids.contains(ticket.getGoodsId())) {
|
|
|
+ if (gptMirrorDayCardGiveawayActivity != null && orderDon.getCreatedTime().compareTo(gptMirrorDayCardGiveawayActivity.getCreatedTime()) > 0) {
|
|
|
+ //是否领取过GPT日卡
|
|
|
+ Long orderId = orderDon.getId();
|
|
|
+ Number count = beanSearcher.searchCount(GptMirrorDayCardActivityRecord.class, MapUtils.builder().field(GptMirrorDayCardActivityRecord::getOrderId, orderId).build());
|
|
|
+ ticket.setReceivedGptGift(count.intValue() > 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
userLoginRecordService.saveUserLoginDayRecord(userId);
|
|
|
return list;
|
|
|
}
|
|
|
@@ -1413,4 +1430,21 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取gpt镜像天卡活动参与平台ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<Long> getGptMirrorGiveawayBuyGids() {
|
|
|
+ GptMirrorDayCardGiveawayActivity gptMirrorDayCardGiveawayActivity = beanSearcher.searchFirst(GptMirrorDayCardGiveawayActivity.class, MapUtils.builder().build());
|
|
|
+ if (gptMirrorDayCardGiveawayActivity != null) {
|
|
|
+ String buyGoodsIds = gptMirrorDayCardGiveawayActivity.getBuyGoodsIds();
|
|
|
+ try {
|
|
|
+ return Jsons.parseList(buyGoodsIds, Long.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|