|
@@ -8,8 +8,8 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.Brokerag
|
|
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserMySummaryRespVO;
|
|
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
|
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
|
|
-import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO;
|
|
|
-import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO;
|
|
|
+import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO;
|
|
|
+import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO;
|
|
|
import org.mapstruct.Mapper;
|
|
|
import org.mapstruct.MappingTarget;
|
|
|
import org.mapstruct.factory.Mappers;
|
|
@@ -32,29 +32,27 @@ public interface BrokerageUserConvert {
|
|
|
|
|
|
List<BrokerageUserRespVO> convertList(List<BrokerageUserDO> list);
|
|
|
|
|
|
- PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page, Map<Long, MemberUserRespDTO> userMap, Map<Long, Long> brokerageUserCountMap, Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap);
|
|
|
+ PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page, Map<Long, MemberUserRespDTO> userMap, Map<Long, Long> brokerageUserCountMap, Map<Long, UserBrokerageSummaryRespBO> userOrderSummaryMap);
|
|
|
|
|
|
default PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> pageResult,
|
|
|
Map<Long, MemberUserRespDTO> userMap,
|
|
|
Map<Long, Long> brokerageUserCountMap,
|
|
|
- Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap,
|
|
|
- Map<Long, UserWithdrawSummaryBO> withdrawMap) {
|
|
|
+ Map<Long, UserBrokerageSummaryRespBO> userOrderSummaryMap,
|
|
|
+ Map<Long, BrokerageWithdrawSummaryRespBO> withdrawMap) {
|
|
|
PageResult<BrokerageUserRespVO> result = convertPage(pageResult, userMap, brokerageUserCountMap, userOrderSummaryMap);
|
|
|
for (BrokerageUserRespVO userVO : result.getList()) {
|
|
|
// 用户信息
|
|
|
copyTo(userMap.get(userVO.getId()), userVO);
|
|
|
-
|
|
|
// 推广用户数量
|
|
|
userVO.setBrokerageUserCount(MapUtil.getInt(brokerageUserCountMap, userVO.getId(), 0));
|
|
|
// 推广订单数量、推广订单金额
|
|
|
- Optional<UserBrokerageSummaryBO> orderSummaryOptional = Optional.ofNullable(userOrderSummaryMap.get(userVO.getId()));
|
|
|
- userVO.setBrokerageOrderCount(orderSummaryOptional.map(UserBrokerageSummaryBO::getCount).orElse(0))
|
|
|
- .setBrokerageOrderPrice(orderSummaryOptional.map(UserBrokerageSummaryBO::getPrice).orElse(0));
|
|
|
+ Optional<UserBrokerageSummaryRespBO> orderSummaryOptional = Optional.ofNullable(userOrderSummaryMap.get(userVO.getId()));
|
|
|
+ userVO.setBrokerageOrderCount(orderSummaryOptional.map(UserBrokerageSummaryRespBO::getCount).orElse(0))
|
|
|
+ .setBrokerageOrderPrice(orderSummaryOptional.map(UserBrokerageSummaryRespBO::getPrice).orElse(0));
|
|
|
// 已提现次数、已提现金额
|
|
|
- Optional<UserWithdrawSummaryBO> withdrawSummaryOptional = Optional.ofNullable(withdrawMap.get(userVO.getId()));
|
|
|
- userVO.setWithdrawCount(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getCount).orElse(0))
|
|
|
- .setWithdrawPrice(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getPrice).orElse(0));
|
|
|
- userVO.setWithdrawCount(0).setWithdrawPrice(0);
|
|
|
+ Optional<BrokerageWithdrawSummaryRespBO> withdrawSummaryOptional = Optional.ofNullable(withdrawMap.get(userVO.getId()));
|
|
|
+ userVO.setWithdrawCount(withdrawSummaryOptional.map(BrokerageWithdrawSummaryRespBO::getCount).orElse(0))
|
|
|
+ .setWithdrawPrice(withdrawSummaryOptional.map(BrokerageWithdrawSummaryRespBO::getPrice).orElse(0));
|
|
|
}
|
|
|
return result;
|
|
|
}
|