zoujiajian 1 éve
szülő
commit
11a508f2da

+ 11 - 8
netflix-service/src/main/java/com/cyksj/service/vip/impl/VipFrontServiceImpl.java

@@ -72,11 +72,14 @@ public class VipFrontServiceImpl implements VipFrontService {
 		List<Long> vipSkuIds = vipGoodsSkuMapper.selectList(null).stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
 		//可有抵扣车票
 		DateTime now = DateTime.now();
-		Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getSkuId, vipSkuIds).op(Operator.InList).field(GroupsRelationView::getExpiryTime, now).op(Operator.GreaterThan).build());
+		//会员规格
+		Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
+				.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
+		Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList).field(GroupsRelationView::getExpiryTime, now).op(Operator.GreaterThan).build());
 		//可抵扣车票
 		if (count.intValue() > 0) {
 			//处理vip抵扣金额
-			VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds, 12);
+			VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, goodsIds, 12);
 			deductMoney = vipDeductDto.getDeductMoney();
 			vipUserPageResp.setRelationUserViews(vipDeductDto.getRelationUserViews());
 		}
@@ -90,16 +93,19 @@ public class VipFrontServiceImpl implements VipFrontService {
 	public VipDeductDto checkAndGetOrderDeductMoney(Long userId, Integer months) {
 		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
 		List<Long> vipSkuIds = vipGoodsSkuMapper.selectList(null).stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
+		//会员规格
+		Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
+				.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
 		Number count = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
 				.field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)
-				.field(GroupsRelationView::getSkuId, vipSkuIds).op(Operator.InList)
+				.field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList)
 				.field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan)
 				.field(GroupsRelationView::getIsVip, false)
 				.build());
 		if (count.intValue() == 0) {
 			throw BusinessRuntimeException.getInstance("暂无可抵扣AI车票");
 		}
-		VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, vipSkuIds, months);
+		VipDeductDto vipDeductDto = commonHandleVipDeductMoney(userIdList, goodsIds, months);
 		return vipDeductDto;
 	}
 
@@ -116,15 +122,12 @@ public class VipFrontServiceImpl implements VipFrontService {
 	/**
 	 * 统一处理vip抵扣金额
 	 */
-	public VipDeductDto commonHandleVipDeductMoney(List<Long> userIdList, List<Long> vipSkuIds, Integer months) {
+	public VipDeductDto commonHandleVipDeductMoney(List<Long> userIdList, Set<Long> goodsIds, Integer months) {
 		VipDeductDto vipDeductDto = new VipDeductDto();
 		DateTime now = DateTime.now();
 		List<Long> deductRelationIds = new ArrayList<>();
 		BigDecimal deductMoney = BigDecimal.ZERO;
 		BigDecimal vipMoney = getVipMoney(months);
-		//会员规格
-		Set<Long> goodsIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
-				.in(GoodsDonSku::getId, vipSkuIds)).stream().map(GoodsDonSku::getGoodsId).collect(Collectors.toSet());
 		List<GroupsRelationView> relations = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
 				.field(GroupsRelationView::getGoodsId, goodsIds).op(Operator.InList)
 				.field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)

+ 0 - 1
netflix-web/src/main/java/com/cyksj/web/controller/vip/VipController.java

@@ -5,7 +5,6 @@ import com.cyksj.enums.GatewayResponse;
 import com.cyksj.model.response.VipUserPageResp;
 import com.cyksj.model.views.VipGoodsSkuFrontView;
 import com.cyksj.service.vip.VipFrontService;
-import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;