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 800bbd0b..f45d8a36 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 @@ -27,6 +27,7 @@ import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd; import com.red.circle.wallet.inner.model.dto.UserFreightBalanceDTO; import lombok.RequiredArgsConstructor; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -54,23 +55,8 @@ public class RechargeUserServiceImpl implements RechargeUserService { ResponseAssert.failure(CommonErrorCode.OPERATING_FAILURE); } - 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 = getBdGoldUserIdList(cmd); + if (collect == null) return null; Map userMonthlyAmountMap = getThisMonthRechargeAmount(collect); Map userLastMonthAmountMap = getLastMonthRechargeAmount(collect); @@ -93,6 +79,27 @@ public class RechargeUserServiceImpl implements RechargeUserService { return result; } + private List getBdGoldUserIdList(AppExtCommand cmd) { + List bdList = businessDevelopmentBaseInfoService.query() + .eq(BusinessDevelopmentBaseInfo::getSysOrigin, cmd.getReqSysOrigin().getOrigin()) + .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; + } + return collect; + } + @Override public List getRechargeSummary(AppExtCommand cmd) { return userMonthlyRechargeClient.getMonthlyRechargeSummary().getBody();