| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"}) |
| | | public R<AgentApplication> detail(@RequestParam Long id) { |
| | | AgentApplication agentApplication = agentApplicationService.getById(id); |
| | | AppUser appUser = appUserService.getById(agentApplication.getAppUserId()); |
| | | agentApplication.setShopPoint(appUser.getShopPoint()); |
| | | agentApplication.setSharePoint(appUser.getSharePoint()); |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(agentApplication.getApplicationVipId()); |
| | | VipSettingDto vipSettingDto = new VipSettingDto(); |
| | | BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); |
| | | agentApplication.setVipSettingDto(vipSettingDto); |
| | | // List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | // .ne(AppUser::getStatus, 3) |
| | | // .eq(AppUser::getDelFlag, 0)); |
| | | // ArrayList<Long> userIds = new ArrayList<>(); |
| | | // userIds.add(appUser.getId()); |
| | | // getUserAncestorList(appUser,userIds,new ArrayList<>(),appUserList); |
| | | agentApplication.setVipId(agentApplication.getApplicationVipId()); |
| | | return R.ok(agentApplication); |
| | | } |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { |
| | | children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); |
| | | user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); |
| | | user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); |
| | | user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); |
| | | user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); |
| | | user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); |
| | | user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); |
| | | List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | getUserAncestorList(user,userIdList, children,list); |
| | | } |
| | | } |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |