diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/BdListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/BdListQryExe.java index d949adef..40a9f662 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/BdListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/BdListQryExe.java @@ -54,7 +54,7 @@ public class BdListQryExe { .eq(Objects.nonNull(qryCmd.getCreateUser()), BusinessDevelopmentBaseInfo::getCreateUser, qryCmd.getCreateUser()) .eq(Objects.nonNull(qryCmd.getBdLeadUserId()), - BusinessDevelopmentBaseInfo::getBdLeadUserId, qryCmd.getBdLeadUserId()) + BusinessDevelopmentBaseInfo::getBdLeadUserId, qryCmd.getUserId()) .orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime) .page(qryCmd.getPageQuery()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/RechargeUserServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/RechargeUserServiceImpl.java index 95e063d4..800bbd0b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/RechargeUserServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/RechargeUserServiceImpl.java @@ -14,11 +14,14 @@ import com.red.circle.order.inner.model.dto.UserMonthlyRechargeDTO; import com.red.circle.other.app.dto.h5.RechargePageVO; import com.red.circle.other.app.dto.h5.RechargeVO; import com.red.circle.other.app.service.recharge.RechargeUserService; +import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentBaseInfo; import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.date.LocalDateUtils; +import com.red.circle.tool.core.text.StringUtils; import com.red.circle.wallet.inner.endpoint.freight.FreightGoldClient; import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd; import com.red.circle.wallet.inner.model.dto.UserFreightBalanceDTO; @@ -28,8 +31,10 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; @Service @@ -40,6 +45,7 @@ public class RechargeUserServiceImpl implements RechargeUserService { private final FreightGoldClient freightGoldClient; private final UserProfileClient userProfileClient; private final AdministratorService administratorService; + private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService; @Override public PageResult getRechargePage(PageUserIdCmd page, AppExtCommand cmd) { @@ -48,31 +54,43 @@ public class RechargeUserServiceImpl implements RechargeUserService { ResponseAssert.failure(CommonErrorCode.OPERATING_FAILURE); } - UserFreightBalancePageQryCmd qryCmd = new UserFreightBalancePageQryCmd(); - qryCmd.setSysOrigin(cmd.getReqSysOrigin().getOrigin()); - qryCmd.setPageQuery(page.getPageQuery()); - PageResult pageResult = freightGoldClient.pageFreight(qryCmd).getBody(); - - - if (pageResult == null || pageResult.getRecords().isEmpty()) { + List bdList = businessDevelopmentBaseInfoService.query() + .eq(BusinessDevelopmentBaseInfo::getSysOrigin,cmd.getReqSysOrigin()) + .eq(BusinessDevelopmentBaseInfo::getBdLeadUserId, cmd.getReqUserId()) + .orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime) + .list(); + if (bdList.isEmpty()) { + return null; + } + + List collect = bdList.stream().map(e -> { + UserFreightBalanceDTO result = freightGoldClient.getByUserId(e.getUserId()).getBody(); + return result != null ? result.getUserId() : null; + }).filter(Objects::nonNull).toList(); + + if (CollectionUtils.isEmpty(collect)) { return null; } - List collect = pageResult.getRecords().stream().map(UserFreightBalanceDTO::getUserId).toList(); Map userMonthlyAmountMap = getThisMonthRechargeAmount(collect); Map userLastMonthAmountMap = getLastMonthRechargeAmount(collect); - return pageResult.convert(e -> { - UserProfileDTO body = userProfileClient.getByUserId(e.getUserId()).getBody(); - + List list = collect.stream().map(userId -> { + UserProfileDTO body = userProfileClient.getByUserId(userId).getBody(); return new RechargePageVO() - .setUserId(e.getUserId()) + .setUserId(userId) .setAccount(body.getAccount()) .setUserNickname(body.getUserNickname()) .setUserAvatar(body.getUserAvatar()) - .setThisMonth(userMonthlyAmountMap.get(e.getUserId())) - .setLastMonth(userLastMonthAmountMap.get(e.getUserId())); - }); + .setThisMonth(userMonthlyAmountMap.get(userId)) + .setLastMonth(userLastMonthAmountMap.get(userId)); + }).toList(); + + PageResult result = PageResult.newPageResult(list.size()); + result.setCurrent(1L); + result.setTotal(list.size()); + result.setRecords(list); + return result; } @Override