Jelajahi Sumber

fix 账号列表未邀请人数

chenbiao 3 tahun lalu
induk
melakukan
0fdc628182

+ 5 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -66,10 +66,12 @@ public class CmsAccountController {
 
         SearchResult<AccountView> search = beanSearcher.search(AccountView.class, mapBuilder.build());
         search.getDataList().forEach((accountView)->{
-            Integer invited = homeGroupMapper.selectCount(Wrappers.lambdaQuery(HomeGroup.class).eq(HomeGroup::getAccountId, accountView.getId()).eq(HomeGroup::getStatus, "uninvited"));
+            Integer invited = homeGroupMapper.selectCount(Wrappers.lambdaQuery(HomeGroup.class).eq(HomeGroup::getAccountId, accountView.getId()).eq(HomeGroup::getStatus, "invited"));
             GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getAccountId, accountView.getId()).last(" limit 1"));
-            accountView.setUnInvited(invited);
-            accountView.setTotal(groupsTrips == null ? 0 : groupsTrips.getNum() - groupsTrips.getAvailableNum());
+            int total = groupsTrips == null ? 0 : groupsTrips.getNum() - groupsTrips.getAvailableNum();
+            Integer unInvited = Math.max(total - invited, 0);
+            accountView.setUnInvited(unInvited);
+            accountView.setTotal(total);
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }