Browse Source

删除绑卡加数量逻辑

xiongzhu 3 years ago
parent
commit
c9a1c5c8fd

+ 0 - 3
src/main/java/com/izouma/nineth/service/UserBankCardService.java

@@ -71,9 +71,6 @@ public class UserBankCardService {
             user.setSettleAccountId(request.getBindCardId());
             userService.save(user);
             userRepo.flush();
-            log.info("绑卡成功,加积分{}", user.getId());
-            //加积分加限购
-            userService.savePoint(user);
         }
         userBalanceRepo.unlock(Long.parseLong(request.getUserId()));
     }

+ 0 - 64
src/main/java/com/izouma/nineth/service/UserService.java

@@ -1169,70 +1169,6 @@ public class UserService {
 
     }
 
-    public void savePoint(User user) {
-
-        //给积分
-        Long invitor = user.getCollectionInvitor();
-        if (ObjectUtils.isEmpty(user.getCollectionId()) || ObjectUtils.isEmpty(invitor)) {
-            this.noCollectionId(user);
-            return;
-        }
-
-        if (8573130L != user.getCollectionId()) return;
-
-        Collection collection = collectionRepo.findById(user.getCollectionId()).orElse(null);
-        if (collection == null) {
-            return;
-        }
-        if (user.getVipPoint() < 1) {
-            //有效新用户1个限购
-            user.setVipPoint(100);
-            userRepo.save(user);
-            cacheService.clearUserMy(user.getId());
-            cacheService.clearUser(user.getId());
-        }
-
-        //指标数量
-        int assignment = collection.getAssignment();
-        if (assignment < 1) {
-            return;
-        }
-        int inviteNum = userRepo.countAllByCollectionIdAndCollectionInvitorAndSettleAccountIdIsNotNull(
-                user.getCollectionId(), invitor);
-
-        int point = inviteNum / assignment;
-        log.info("邀请数量,{}-{}", invitor, inviteNum);
-        if (point < 1) {
-            return;
-        }
-        User parent = userRepo.findById(invitor).orElse(null);
-        if (parent == null) {
-            return;
-        }
-        if (parent.getVipPoint() < 1) {
-            //老用户可有一个限购
-            parent.setVipPoint(100);
-            userRepo.save(parent);
-            cacheService.clearUserMy(user.getId());
-            cacheService.clearUser(user.getId());
-        }
-        log.info("修改限购{}", invitor);
-        UserProperty userProperty = userPropertyRepo.findById(invitor).orElse(new UserProperty(invitor, 0));
-        if (userProperty.getMaxCount() < 10) {
-            if (parent.getVipPurchase() > 0 || parent.getCreatedAt().isAfter(LocalDateTime.of(2022, 7, 5, 0, 0, 0))) {
-                if (userProperty.getMaxCount() != point + 1) {
-                    userProperty.setMaxCount(Math.min(point + 1, 10));
-                    userPropertyRepo.save(userProperty);
-                    log.info("邀请绑卡限购+1,{}", invitor);
-                    return;
-                }
-            }
-            userProperty.setMaxCount(Math.min(point, 10));
-            userPropertyRepo.save(userProperty);
-            log.info("邀请绑卡限购+1,{}", invitor);
-        }
-    }
-
     public void noCollectionId(User user) {
         if (user.getCreatedAt().isBefore(LocalDateTime.of(2022, 7, 5, 0, 0, 0))) {
             return;

+ 0 - 6
src/test/java/com/izouma/nineth/service/UserServiceTest.java

@@ -210,10 +210,4 @@ public class UserServiceTest extends ApplicationTests {
     public void checkauth() throws AlipayApiException {
         userService.checkFaceAuth("7160e6a875cb67648bc7a3cce6e5397e");
     }
-
-    @Test
-    public void testSavePoint() {
-        User user = userRepo.findById(7962245L).orElse(null);
-        userService.savePoint(user);
-    }
 }