Ver código fonte

不限时vip购买数量

licailing 4 anos atrás
pai
commit
910dffc2d0

+ 36 - 36
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -75,34 +75,34 @@ import java.util.stream.Collectors;
 @Slf4j
 public class OrderService {
 
-    private OrderRepo                     orderRepo;
-    private CollectionRepo                collectionRepo;
-    private UserAddressRepo               userAddressRepo;
-    private UserRepo                      userRepo;
-    private Environment                   env;
-    private AlipayClient                  alipayClient;
-    private AlipayProperties              alipayProperties;
-    private WxPayService                  wxPayService;
-    private WxPayProperties               wxPayProperties;
-    private AssetService                  assetService;
-    private SysConfigService              sysConfigService;
-    private AssetRepo                     assetRepo;
-    private UserCouponRepo                userCouponRepo;
-    private CollectionService             collectionService;
-    private CommissionRecordRepo          commissionRecordRepo;
-    private AdapayProperties              adapayProperties;
-    private GeneralProperties             generalProperties;
-    private RocketMQTemplate              rocketMQTemplate;
+    private OrderRepo orderRepo;
+    private CollectionRepo collectionRepo;
+    private UserAddressRepo userAddressRepo;
+    private UserRepo userRepo;
+    private Environment env;
+    private AlipayClient alipayClient;
+    private AlipayProperties alipayProperties;
+    private WxPayService wxPayService;
+    private WxPayProperties wxPayProperties;
+    private AssetService assetService;
+    private SysConfigService sysConfigService;
+    private AssetRepo assetRepo;
+    private UserCouponRepo userCouponRepo;
+    private CollectionService collectionService;
+    private CommissionRecordRepo commissionRecordRepo;
+    private AdapayProperties adapayProperties;
+    private GeneralProperties generalProperties;
+    private RocketMQTemplate rocketMQTemplate;
     private RedisTemplate<String, Object> redisTemplate;
-    private SnowflakeIdWorker             snowflakeIdWorker;
-    private SmsService                    smsService;
-    private ErrorOrderRepo                errorOrderRepo;
-    private ShowCollectionRepo            showCollectionRepo;
-    private ShowroomService               showroomService;
-    private CollectionPrivilegeRepo       collectionPrivilegeRepo;
-    private UserBankCardRepo              userBankCardRepo;
-    private CacheService                  cacheService;
-    private UserPropertyRepo              userPropertyRepo;
+    private SnowflakeIdWorker snowflakeIdWorker;
+    private SmsService smsService;
+    private ErrorOrderRepo errorOrderRepo;
+    private ShowCollectionRepo showCollectionRepo;
+    private ShowroomService showroomService;
+    private CollectionPrivilegeRepo collectionPrivilegeRepo;
+    private UserBankCardRepo userBankCardRepo;
+    private CacheService cacheService;
+    private UserPropertyRepo userPropertyRepo;
 
     public Page<Order> all(PageQuery pageQuery) {
         return orderRepo.findAll(JpaUtils.toSpecification(pageQuery, Order.class), JpaUtils.toPageRequest(pageQuery));
@@ -266,16 +266,16 @@ public class OrderService {
                 }
 
                 if (vip) {
-                    int purchase = orderRepo
-                            .countByUserIdAndCollectionIdAndVipTrueAndStatusIn(userId, collectionId, Arrays
-                                    .asList(OrderStatus.FINISH, OrderStatus.NOT_PAID, OrderStatus.PROCESSING));
-                    if (user.getVipPurchase() - purchase <= 0) {
-                        throw new BusinessException("vip名额已使用完毕!");
-                    }
-                    // vip扣除额度
-                    if (ObjectUtils.isNotEmpty(collection.getVipQuota())) {
-                        collectionService.decreaseQuota(collectionId, 1);
+//                    int purchase = orderRepo
+//                            .countByUserIdAndCollectionIdAndVipTrueAndStatusIn(userId, collectionId, Arrays
+//                                    .asList(OrderStatus.FINISH, OrderStatus.NOT_PAID, OrderStatus.PROCESSING));
+                    if (user.getVipPurchase() < 1) {
+                        throw new BusinessException("非vip!");
                     }
+//                    // vip扣除额度
+//                    if (ObjectUtils.isNotEmpty(collection.getVipQuota())) {
+//                        collectionService.decreaseQuota(collectionId, 1);
+//                    }
                 } else {
                     if (user.getVipPoint() < 1) {
                         throw new BusinessException("没有购买名额");