admin-center 两个接口修改

This commit is contained in:
tianfeng 2025-09-09 22:21:41 +08:00
parent 04502b5685
commit 21ff36763d
2 changed files with 34 additions and 16 deletions

View File

@ -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());

View File

@ -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<RechargePageVO> 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<UserFreightBalanceDTO> pageResult = freightGoldClient.pageFreight(qryCmd).getBody();
if (pageResult == null || pageResult.getRecords().isEmpty()) {
List<BusinessDevelopmentBaseInfo> bdList = businessDevelopmentBaseInfoService.query()
.eq(BusinessDevelopmentBaseInfo::getSysOrigin,cmd.getReqSysOrigin())
.eq(BusinessDevelopmentBaseInfo::getBdLeadUserId, cmd.getReqUserId())
.orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime)
.list();
if (bdList.isEmpty()) {
return null;
}
List<Long> 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<Long> collect = pageResult.getRecords().stream().map(UserFreightBalanceDTO::getUserId).toList();
Map<Long, BigDecimal> userMonthlyAmountMap = getThisMonthRechargeAmount(collect);
Map<Long, BigDecimal> userLastMonthAmountMap = getLastMonthRechargeAmount(collect);
return pageResult.convert(e -> {
UserProfileDTO body = userProfileClient.getByUserId(e.getUserId()).getBody();
List<RechargePageVO> 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<RechargePageVO> result = PageResult.newPageResult(list.size());
result.setCurrent(1L);
result.setTotal(list.size());
result.setRecords(list);
return result;
}
@Override