|
|
@@ -59,6 +59,7 @@ import com.cyksj.service.order.OrderRefundService;
|
|
|
import com.cyksj.service.relation.GroupRelationClearService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.relation.GroupsRelationChangeService;
|
|
|
+import com.cyksj.service.sora.SoraCodeFrontService;
|
|
|
import com.cyksj.service.translations.BackInfoTranslationsFrontService;
|
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
@@ -223,6 +224,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final AccountNetflixFrozenTicketReceivedRecordMapper accountNetflixFrozenTicketReceivedRecordMapper;
|
|
|
|
|
|
+ private final SoraCodeMapper soraCodeMapper;
|
|
|
+
|
|
|
+ private final SoraCodeFrontService soraCodeFrontService;
|
|
|
+
|
|
|
@Override
|
|
|
public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -2145,6 +2150,53 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String getSoraCode(Long userId, Long relationId) {
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
+ if (relation == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
+ }
|
|
|
+ if (!userIdList.contains(relation.getUserId())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
+ }
|
|
|
+ if (relation.getStatus() != GroupsRelation.Status.validity) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
+ }
|
|
|
+ if (relation.getExpiryTime() != null && relation.getExpiryTime().before(DateTime.now())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票已过期");
|
|
|
+ }
|
|
|
+
|
|
|
+ GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
|
|
|
+
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(groupsTrips.getSkuId());
|
|
|
+
|
|
|
+ //非GPT独立
|
|
|
+ if (sku.getGoodsId() != Constant.GPT_PLUS_GID || sku.getNum() != 1) {
|
|
|
+ throw BusinessRuntimeException.getInstance("非GPT独立会员车票");
|
|
|
+ }
|
|
|
+
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).in(OrderDon::getUserId, userIdList).eq(OrderDon::getRelationId, relationId).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).orderByDesc(OrderDon::getId).last("limit 1"));
|
|
|
+
|
|
|
+ if (orderDon.getCreatedTime().before(DateUtil.parse("2025-10-24 19:00:00"))) {
|
|
|
+ throw BusinessRuntimeException.getInstance("系统异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ SoraCode soraCode = soraCodeMapper.selectOne(Wrappers.lambdaQuery(SoraCode.class).eq(SoraCode::getOrderId, orderDon.getId()).last("limit 1"));
|
|
|
+ if (soraCode == null) {
|
|
|
+ try {
|
|
|
+ soraCodeFrontService.grantSoraCodeForGptMember(relation.getUserId(), orderDon.getId());
|
|
|
+ soraCode = soraCodeMapper.selectOne(Wrappers.lambdaQuery(SoraCode.class).eq(SoraCode::getOrderId, orderDon.getId()).last("limit 1"));
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (soraCode == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("暂无可用sora邀请码,请联系客服");
|
|
|
+ }
|
|
|
+ return soraCode.getCode();
|
|
|
+ }
|
|
|
+
|
|
|
private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
|
|
|
DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());
|