|
|
@@ -15,6 +15,7 @@ import com.cyksj.model.dto.VipDeductDto;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.response.VipUserPageResp;
|
|
|
+import com.cyksj.model.views.RenewalView;
|
|
|
import com.cyksj.service.chatgpt.ChatGptAccountService;
|
|
|
import com.cyksj.service.claude.ClaudeService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
@@ -91,8 +92,6 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
//会员规格
|
|
|
Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
|
|
|
- //todo 临时处理 nano先不参与抵扣
|
|
|
- goodsIds.remove(Constant.NANO_GOODS_ID);
|
|
|
Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList).field(GroupsRelationView::getIsMirror, Boolean.TRUE).field(GroupsRelationView::getExpiryTime, now).op(Operator.GreaterThan).build());
|
|
|
//可抵扣车票
|
|
|
if (count.intValue() > 0) {
|
|
|
@@ -174,6 +173,25 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
if (deductGoodsIds.contains(goodsId)) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (goodsId == Constant.NANO_GOODS_ID) {
|
|
|
+ NanoUserQuota nanoUserQuota = nanoUserQuotaMapper.selectOne(Wrappers.lambdaQuery(NanoUserQuota.class).in(NanoUserQuota::getUid, userIdList).orderByDesc(NanoUserQuota::getRemainingQuota).last("limit 1"));
|
|
|
+ if (nanoUserQuota != null) {
|
|
|
+ if (!ObjectUtil.equal(nanoUserQuota.getRelationId(), relation.getId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //规格最高
|
|
|
+ RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
|
|
|
+ .field(RenewalView::getGoodsId, goodsId)
|
|
|
+ .field(RenewalView::getUserId, userIdList).op(Operator.InList)
|
|
|
+ .orderBy(RenewalView::getSkuNanoQuota).desc()
|
|
|
+ .onlySelect(RenewalView::getRelationId)
|
|
|
+ .build());
|
|
|
+ if (renewalView != null && !ObjectUtil.equal(renewalView.getRelationId(), relation.getId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Long skuId = relation.getSkuId();
|
|
|
deductGoodsIds.add(goodsId);
|
|
|
Long relationId = relation.getId();
|