|
@@ -31,6 +31,7 @@ import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
import com.cyksj.mapper.vip.VipGoodsSkuMapper;
|
|
import com.cyksj.mapper.vip.VipGoodsSkuMapper;
|
|
|
import com.cyksj.mapper.vip.VipUserMapper;
|
|
import com.cyksj.mapper.vip.VipUserMapper;
|
|
|
import com.cyksj.model.dto.ErrorNetflixChangeOtherSkuTicketDto;
|
|
import com.cyksj.model.dto.ErrorNetflixChangeOtherSkuTicketDto;
|
|
|
|
|
+import com.cyksj.model.dto.NetflixRecoverReceivedGptConditionDto;
|
|
|
import com.cyksj.model.dto.TicketChangeDto;
|
|
import com.cyksj.model.dto.TicketChangeDto;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
@@ -232,6 +233,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
|
|
private final UserRenewChangeTicketRecordMapper userRenewChangeTicketRecordMapper;
|
|
private final UserRenewChangeTicketRecordMapper userRenewChangeTicketRecordMapper;
|
|
|
|
|
|
|
|
|
|
+ private final NetflixCompensateReceivedRecordMapper netflixCompensateReceivedRecordMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
|
|
public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
|
|
|
User u = userMapper.selectById(userId);
|
|
User u = userMapper.selectById(userId);
|
|
@@ -2279,6 +2282,101 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
return soraCode.getCode();
|
|
return soraCode.getCode();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public NetflixRecoverReceivedGptConditionDto netflixGptMirrorCondition(long userId) {
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ //是否申请过奈飞恢复
|
|
|
|
|
+ NetflixUserAccountSubmitRecoverRecord last = netflixUserAccountSubmitRecoverRecordMapper.selectOne(Wrappers.lambdaQuery(NetflixUserAccountSubmitRecoverRecord.class).in(NetflixUserAccountSubmitRecoverRecord::getUserId, userIdList).orderByDesc(NetflixUserAccountSubmitRecoverRecord::getId).last("limit 1"));
|
|
|
|
|
+ NetflixRecoverReceivedGptConditionDto receivedGptConditionDto = new NetflixRecoverReceivedGptConditionDto();
|
|
|
|
|
+ if (last == null) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ //是否存在奈飞车票
|
|
|
|
|
+ List<RenewalView> tickets = beanSearcher.searchAll(RenewalView.class, MapUtils.builder()
|
|
|
|
|
+ .field(RenewalView::getUserId, userIdList).op(Operator.InList)
|
|
|
|
|
+ .field(RenewalView::getGoodsId, Constant.NETFLIX_GID)
|
|
|
|
|
+ .field(RenewalView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan)
|
|
|
|
|
+ .onlySelect(RenewalView::getRelationId)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ if (CollUtil.isEmpty(tickets)) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ //多张奈飞车票 不给领取
|
|
|
|
|
+ if (tickets.size() > 1) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ Long submitRelationId = last.getRelationId();
|
|
|
|
|
+ receivedGptConditionDto.setNfRelationId(submitRelationId);
|
|
|
|
|
+
|
|
|
|
|
+ RenewalView renewalView = tickets.get(0);
|
|
|
|
|
+ Long presentRelationId = renewalView.getRelationId();
|
|
|
|
|
+ //是否领取过 并且现在是否有效
|
|
|
|
|
+ NetflixCompensateReceivedRecord netflixCompensateReceivedRecord = netflixCompensateReceivedRecordMapper.selectOne(Wrappers.lambdaQuery(NetflixCompensateReceivedRecord.class).in(NetflixCompensateReceivedRecord::getUserId, userIdList).orderByDesc(NetflixCompensateReceivedRecord::getId));
|
|
|
|
|
+ if (netflixCompensateReceivedRecord != null) {
|
|
|
|
|
+ //是否 有效
|
|
|
|
|
+ Long gptRelationId = netflixCompensateReceivedRecord.getRelationId();
|
|
|
|
|
+ Integer expiryCount = groupsRelationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getId, gptRelationId).in(GroupsRelation::getUserId, userIdList).gt(GroupsRelation::getExpiryTime, DateTime.now()));
|
|
|
|
|
+ if (expiryCount > 0) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ //领取后已过期
|
|
|
|
|
+ Long compensateReceivedRecordNfRelationId = netflixCompensateReceivedRecord.getNfRelationId();
|
|
|
|
|
+ //是否通过当前车票已经获取过 镜像车票
|
|
|
|
|
+ if (compensateReceivedRecordNfRelationId.equals(presentRelationId)) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ //恢复中 可获取
|
|
|
|
|
+ if (last.getStatus() == 0) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.TRUE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ //不是正常恢复 不可获取
|
|
|
|
|
+ if (last.getStatus() != 1) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Long replaceRelationId = last.getReplaceRelationId();
|
|
|
|
|
+ //非同一张车票 存在更换过
|
|
|
|
|
+ if (!presentRelationId.equals(replaceRelationId)) {
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.FALSE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ receivedGptConditionDto.setStatus(Boolean.TRUE);
|
|
|
|
|
+ return receivedGptConditionDto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
|
|
+ public void netflixRecoverGetGptMirror(long userId) {
|
|
|
|
|
+ NetflixRecoverReceivedGptConditionDto receivedGptConditionDto = netflixGptMirrorCondition(userId);
|
|
|
|
|
+ if (receivedGptConditionDto.getStatus()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ NetflixCompensateReceivedRecord netflixCompensateReceivedRecord = new NetflixCompensateReceivedRecord();
|
|
|
|
|
+ netflixCompensateReceivedRecord.setUserId(userId);
|
|
|
|
|
+ netflixCompensateReceivedRecord.setNfRelationId(receivedGptConditionDto.getNfRelationId());
|
|
|
|
|
+ netflixCompensateReceivedRecord.setGoodsId(Constant.GPT_PLUS_GID);
|
|
|
|
|
+ netflixCompensateReceivedRecordMapper.insert(netflixCompensateReceivedRecord);
|
|
|
|
|
+
|
|
|
|
|
+ Long relationId = this.getTicket(userId, Constant.GPT_MIRROR_SKU_ID, Boolean.FALSE);
|
|
|
|
|
+ if (relationId == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("获取车票失败,请重新领取");
|
|
|
|
|
+ }
|
|
|
|
|
+ netflixCompensateReceivedRecord.setRelationId(relationId);
|
|
|
|
|
+ netflixCompensateReceivedRecordMapper.updateById(netflixCompensateReceivedRecord);
|
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
|
|
private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
|
|
|
DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());
|
|
.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());
|