admin-center 两个接口修改
This commit is contained in:
parent
04502b5685
commit
21ff36763d
@ -54,7 +54,7 @@ public class BdListQryExe {
|
|||||||
.eq(Objects.nonNull(qryCmd.getCreateUser()), BusinessDevelopmentBaseInfo::getCreateUser,
|
.eq(Objects.nonNull(qryCmd.getCreateUser()), BusinessDevelopmentBaseInfo::getCreateUser,
|
||||||
qryCmd.getCreateUser())
|
qryCmd.getCreateUser())
|
||||||
.eq(Objects.nonNull(qryCmd.getBdLeadUserId()),
|
.eq(Objects.nonNull(qryCmd.getBdLeadUserId()),
|
||||||
BusinessDevelopmentBaseInfo::getBdLeadUserId, qryCmd.getBdLeadUserId())
|
BusinessDevelopmentBaseInfo::getBdLeadUserId, qryCmd.getUserId())
|
||||||
.orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime)
|
.orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime)
|
||||||
.page(qryCmd.getPageQuery());
|
.page(qryCmd.getPageQuery());
|
||||||
|
|
||||||
|
|||||||
@ -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.RechargePageVO;
|
||||||
import com.red.circle.other.app.dto.h5.RechargeVO;
|
import com.red.circle.other.app.dto.h5.RechargeVO;
|
||||||
import com.red.circle.other.app.service.recharge.RechargeUserService;
|
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.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.endpoint.user.user.UserProfileClient;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import com.red.circle.tool.core.date.LocalDateUtils;
|
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.endpoint.freight.FreightGoldClient;
|
||||||
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
|
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
|
||||||
import com.red.circle.wallet.inner.model.dto.UserFreightBalanceDTO;
|
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.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -40,6 +45,7 @@ public class RechargeUserServiceImpl implements RechargeUserService {
|
|||||||
private final FreightGoldClient freightGoldClient;
|
private final FreightGoldClient freightGoldClient;
|
||||||
private final UserProfileClient userProfileClient;
|
private final UserProfileClient userProfileClient;
|
||||||
private final AdministratorService administratorService;
|
private final AdministratorService administratorService;
|
||||||
|
private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<RechargePageVO> getRechargePage(PageUserIdCmd page, AppExtCommand cmd) {
|
public PageResult<RechargePageVO> getRechargePage(PageUserIdCmd page, AppExtCommand cmd) {
|
||||||
@ -48,31 +54,43 @@ public class RechargeUserServiceImpl implements RechargeUserService {
|
|||||||
ResponseAssert.failure(CommonErrorCode.OPERATING_FAILURE);
|
ResponseAssert.failure(CommonErrorCode.OPERATING_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserFreightBalancePageQryCmd qryCmd = new UserFreightBalancePageQryCmd();
|
List<BusinessDevelopmentBaseInfo> bdList = businessDevelopmentBaseInfoService.query()
|
||||||
qryCmd.setSysOrigin(cmd.getReqSysOrigin().getOrigin());
|
.eq(BusinessDevelopmentBaseInfo::getSysOrigin,cmd.getReqSysOrigin())
|
||||||
qryCmd.setPageQuery(page.getPageQuery());
|
.eq(BusinessDevelopmentBaseInfo::getBdLeadUserId, cmd.getReqUserId())
|
||||||
PageResult<UserFreightBalanceDTO> pageResult = freightGoldClient.pageFreight(qryCmd).getBody();
|
.orderByDesc(BusinessDevelopmentBaseInfo::getCreateTime)
|
||||||
|
.list();
|
||||||
|
if (bdList.isEmpty()) {
|
||||||
if (pageResult == null || pageResult.getRecords().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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> collect = pageResult.getRecords().stream().map(UserFreightBalanceDTO::getUserId).toList();
|
|
||||||
Map<Long, BigDecimal> userMonthlyAmountMap = getThisMonthRechargeAmount(collect);
|
Map<Long, BigDecimal> userMonthlyAmountMap = getThisMonthRechargeAmount(collect);
|
||||||
Map<Long, BigDecimal> userLastMonthAmountMap = getLastMonthRechargeAmount(collect);
|
Map<Long, BigDecimal> userLastMonthAmountMap = getLastMonthRechargeAmount(collect);
|
||||||
|
|
||||||
return pageResult.convert(e -> {
|
List<RechargePageVO> list = collect.stream().map(userId -> {
|
||||||
UserProfileDTO body = userProfileClient.getByUserId(e.getUserId()).getBody();
|
UserProfileDTO body = userProfileClient.getByUserId(userId).getBody();
|
||||||
|
|
||||||
return new RechargePageVO()
|
return new RechargePageVO()
|
||||||
.setUserId(e.getUserId())
|
.setUserId(userId)
|
||||||
.setAccount(body.getAccount())
|
.setAccount(body.getAccount())
|
||||||
.setUserNickname(body.getUserNickname())
|
.setUserNickname(body.getUserNickname())
|
||||||
.setUserAvatar(body.getUserAvatar())
|
.setUserAvatar(body.getUserAvatar())
|
||||||
.setThisMonth(userMonthlyAmountMap.get(e.getUserId()))
|
.setThisMonth(userMonthlyAmountMap.get(userId))
|
||||||
.setLastMonth(userLastMonthAmountMap.get(e.getUserId()));
|
.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
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user