Commit b1ce971a2f647fa21cc1431d081792e93c2c5ea6
1 parent
9cd36abf
code review:解决分佣的 npe 问题
Showing
14 changed files
with
82 additions
and
69 deletions
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
| @@ -16,7 +16,6 @@ import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; | @@ -16,7 +16,6 @@ import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; | ||
| 16 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; | 16 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; |
| 17 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | 17 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; |
| 18 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | 18 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 19 | -import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; | ||
| 20 | import org.junit.jupiter.api.Test; | 19 | import org.junit.jupiter.api.Test; |
| 21 | import org.springframework.boot.test.mock.mockito.MockBean; | 20 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 22 | import org.springframework.context.annotation.Import; | 21 | import org.springframework.context.annotation.Import; |
| @@ -49,8 +48,6 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -49,8 +48,6 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 49 | private ProductCommentServiceImpl productCommentService; | 48 | private ProductCommentServiceImpl productCommentService; |
| 50 | 49 | ||
| 51 | @MockBean | 50 | @MockBean |
| 52 | - private TradeOrderApi tradeOrderApi; | ||
| 53 | - @MockBean | ||
| 54 | private ProductSpuService productSpuService; | 51 | private ProductSpuService productSpuService; |
| 55 | @MockBean | 52 | @MockBean |
| 56 | private ProductSkuService productSkuService; | 53 | private ProductSkuService productSkuService; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java
| @@ -13,8 +13,8 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum | @@ -13,8 +13,8 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum | ||
| 13 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | 13 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; |
| 14 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; | 14 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; |
| 15 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | 15 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; |
| 16 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; | ||
| 17 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 16 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 17 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; | ||
| 18 | import io.swagger.v3.oas.annotations.Operation; | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 19 | import io.swagger.v3.oas.annotations.Parameter; | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| 20 | import io.swagger.v3.oas.annotations.tags.Tag; | 20 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -88,24 +88,24 @@ public class BrokerageUserController { | @@ -88,24 +88,24 @@ public class BrokerageUserController { | ||
| 88 | // 分页查询 | 88 | // 分页查询 |
| 89 | PageResult<BrokerageUserDO> pageResult = brokerageUserService.getBrokerageUserPage(pageVO); | 89 | PageResult<BrokerageUserDO> pageResult = brokerageUserService.getBrokerageUserPage(pageVO); |
| 90 | 90 | ||
| 91 | - // 涉及到的用户 | ||
| 92 | - Set<Long> userIds = convertSet(pageResult.getList(), BrokerageUserDO::getId); | ||
| 93 | // 查询用户信息 | 91 | // 查询用户信息 |
| 92 | + Set<Long> userIds = convertSet(pageResult.getList(), BrokerageUserDO::getId); | ||
| 94 | Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); | 93 | Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); |
| 95 | - // 合计分佣订单 | ||
| 96 | - Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap = brokerageRecordService.getUserBrokerageSummaryMapByUserId( | 94 | + // 合计分佣的推广订单 |
| 95 | + Map<Long, UserBrokerageSummaryRespBO> brokerageOrderSummaryMap = brokerageRecordService.getUserBrokerageSummaryMapByUserId( | ||
| 97 | userIds, BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus()); | 96 | userIds, BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus()); |
| 98 | - // TODO @芋艿:看看下面 getBrokerageUserCountByBindUserId 有没可能一次性出结果,不然 n 次有点太花性能了; | ||
| 99 | - // 合计推广用户数量 | 97 | + // 合计分佣的推广用户 |
| 98 | + // TODO @疯狂:转成 map 批量读取 | ||
| 100 | Map<Long, Long> brokerageUserCountMap = convertMap(userIds, | 99 | Map<Long, Long> brokerageUserCountMap = convertMap(userIds, |
| 101 | userId -> userId, | 100 | userId -> userId, |
| 102 | userId -> brokerageUserService.getBrokerageUserCountByBindUserId(userId, null)); | 101 | userId -> brokerageUserService.getBrokerageUserCountByBindUserId(userId, null)); |
| 103 | - // 合计提现 | ||
| 104 | - Map<Long, UserWithdrawSummaryBO> withdrawMap = brokerageWithdrawService.getWithdrawSummaryMapByUserId(userIds, | ||
| 105 | - BrokerageWithdrawStatusEnum.AUDIT_SUCCESS); | 102 | + // 合计分佣的提现 |
| 103 | + // TODO @疯狂:如果未来支持了打款这个动作,可能 status 会不对; | ||
| 104 | + Map<Long, BrokerageWithdrawSummaryRespBO> withdrawMap = brokerageWithdrawService.getWithdrawSummaryMapByUserId( | ||
| 105 | + userIds, BrokerageWithdrawStatusEnum.AUDIT_SUCCESS); | ||
| 106 | // 拼接返回 | 106 | // 拼接返回 |
| 107 | return success(BrokerageUserConvert.INSTANCE.convertPage(pageResult, userMap, brokerageUserCountMap, | 107 | return success(BrokerageUserConvert.INSTANCE.convertPage(pageResult, userMap, brokerageUserCountMap, |
| 108 | - userOrderSummaryMap, withdrawMap)); | 108 | + brokerageOrderSummaryMap, withdrawMap)); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | } | 111 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserRespVO.java
| @@ -21,25 +21,25 @@ public class BrokerageUserRespVO extends BrokerageUserBaseVO { | @@ -21,25 +21,25 @@ public class BrokerageUserRespVO extends BrokerageUserBaseVO { | ||
| 21 | 21 | ||
| 22 | // ========== 用户信息 ========== | 22 | // ========== 用户信息 ========== |
| 23 | 23 | ||
| 24 | - @Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png") | 24 | + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xxx.png") |
| 25 | private String avatar; | 25 | private String avatar; |
| 26 | - @Schema(description = "用户昵称", example = "李四") | 26 | + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
| 27 | private String nickname; | 27 | private String nickname; |
| 28 | 28 | ||
| 29 | // ========== 推广信息 ========== | 29 | // ========== 推广信息 ========== |
| 30 | 30 | ||
| 31 | - @Schema(description = "推广用户数量", example = "20019") | 31 | + @Schema(description = "推广用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20019") |
| 32 | private Integer brokerageUserCount; | 32 | private Integer brokerageUserCount; |
| 33 | - @Schema(description = "推广订单数量", example = "20019") | 33 | + @Schema(description = "推广订单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20019") |
| 34 | private Integer brokerageOrderCount; | 34 | private Integer brokerageOrderCount; |
| 35 | - @Schema(description = "推广订单金额", example = "20019") | 35 | + @Schema(description = "推广订单金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20019") |
| 36 | private Integer brokerageOrderPrice; | 36 | private Integer brokerageOrderPrice; |
| 37 | 37 | ||
| 38 | // ========== 提现信息 ========== | 38 | // ========== 提现信息 ========== |
| 39 | 39 | ||
| 40 | - @Schema(description = "已提现金额", example = "20019") | 40 | + @Schema(description = "已提现金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20019") |
| 41 | private Integer withdrawPrice; | 41 | private Integer withdrawPrice; |
| 42 | - @Schema(description = "已提现次数", example = "20019") | 42 | + @Schema(description = "已提现次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20019") |
| 43 | private Integer withdrawCount; | 43 | private Integer withdrawCount; |
| 44 | 44 | ||
| 45 | } | 45 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageUserController.java
| @@ -15,7 +15,7 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum | @@ -15,7 +15,7 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum | ||
| 15 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | 15 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; |
| 16 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; | 16 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; |
| 17 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | 17 | import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; |
| 18 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 18 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; |
| 19 | import io.swagger.v3.oas.annotations.Operation; | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 20 | import io.swagger.v3.oas.annotations.Parameter; | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 21 | import io.swagger.v3.oas.annotations.tags.Tag; | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -88,7 +88,7 @@ public class AppBrokerageUserController { | @@ -88,7 +88,7 @@ public class AppBrokerageUserController { | ||
| 88 | // 统计用户提现的佣金 | 88 | // 统计用户提现的佣金 |
| 89 | Integer withdrawPrice = brokerageWithdrawService.getWithdrawSummaryListByUserId(Collections.singleton(brokerageUser.getId()), | 89 | Integer withdrawPrice = brokerageWithdrawService.getWithdrawSummaryListByUserId(Collections.singleton(brokerageUser.getId()), |
| 90 | BrokerageWithdrawStatusEnum.AUDIT_SUCCESS).stream() | 90 | BrokerageWithdrawStatusEnum.AUDIT_SUCCESS).stream() |
| 91 | - .findFirst().map(UserWithdrawSummaryBO::getPrice).orElse(0); | 91 | + .findFirst().map(BrokerageWithdrawSummaryRespBO::getPrice).orElse(0); |
| 92 | // 统计分销用户数量(一级) | 92 | // 统计分销用户数量(一级) |
| 93 | Long firstBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), 1); | 93 | Long firstBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), 1); |
| 94 | // 统计分销用户数量(二级) | 94 | // 统计分销用户数量(二级) |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageUserConvert.java
| @@ -8,8 +8,8 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.Brokerag | @@ -8,8 +8,8 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.Brokerag | ||
| 8 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserMySummaryRespVO; | 8 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserMySummaryRespVO; |
| 9 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO; | 9 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO; |
| 10 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | 10 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; |
| 11 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; | ||
| 12 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 11 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 12 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; | ||
| 13 | import org.mapstruct.Mapper; | 13 | import org.mapstruct.Mapper; |
| 14 | import org.mapstruct.MappingTarget; | 14 | import org.mapstruct.MappingTarget; |
| 15 | import org.mapstruct.factory.Mappers; | 15 | import org.mapstruct.factory.Mappers; |
| @@ -32,29 +32,27 @@ public interface BrokerageUserConvert { | @@ -32,29 +32,27 @@ public interface BrokerageUserConvert { | ||
| 32 | 32 | ||
| 33 | List<BrokerageUserRespVO> convertList(List<BrokerageUserDO> list); | 33 | List<BrokerageUserRespVO> convertList(List<BrokerageUserDO> list); |
| 34 | 34 | ||
| 35 | - PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page, Map<Long, MemberUserRespDTO> userMap, Map<Long, Long> brokerageUserCountMap, Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap); | 35 | + PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page, Map<Long, MemberUserRespDTO> userMap, Map<Long, Long> brokerageUserCountMap, Map<Long, UserBrokerageSummaryRespBO> userOrderSummaryMap); |
| 36 | 36 | ||
| 37 | default PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> pageResult, | 37 | default PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> pageResult, |
| 38 | Map<Long, MemberUserRespDTO> userMap, | 38 | Map<Long, MemberUserRespDTO> userMap, |
| 39 | Map<Long, Long> brokerageUserCountMap, | 39 | Map<Long, Long> brokerageUserCountMap, |
| 40 | - Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap, | ||
| 41 | - Map<Long, UserWithdrawSummaryBO> withdrawMap) { | 40 | + Map<Long, UserBrokerageSummaryRespBO> userOrderSummaryMap, |
| 41 | + Map<Long, BrokerageWithdrawSummaryRespBO> withdrawMap) { | ||
| 42 | PageResult<BrokerageUserRespVO> result = convertPage(pageResult, userMap, brokerageUserCountMap, userOrderSummaryMap); | 42 | PageResult<BrokerageUserRespVO> result = convertPage(pageResult, userMap, brokerageUserCountMap, userOrderSummaryMap); |
| 43 | for (BrokerageUserRespVO userVO : result.getList()) { | 43 | for (BrokerageUserRespVO userVO : result.getList()) { |
| 44 | // 用户信息 | 44 | // 用户信息 |
| 45 | copyTo(userMap.get(userVO.getId()), userVO); | 45 | copyTo(userMap.get(userVO.getId()), userVO); |
| 46 | - | ||
| 47 | // 推广用户数量 | 46 | // 推广用户数量 |
| 48 | userVO.setBrokerageUserCount(MapUtil.getInt(brokerageUserCountMap, userVO.getId(), 0)); | 47 | userVO.setBrokerageUserCount(MapUtil.getInt(brokerageUserCountMap, userVO.getId(), 0)); |
| 49 | // 推广订单数量、推广订单金额 | 48 | // 推广订单数量、推广订单金额 |
| 50 | - Optional<UserBrokerageSummaryBO> orderSummaryOptional = Optional.ofNullable(userOrderSummaryMap.get(userVO.getId())); | ||
| 51 | - userVO.setBrokerageOrderCount(orderSummaryOptional.map(UserBrokerageSummaryBO::getCount).orElse(0)) | ||
| 52 | - .setBrokerageOrderPrice(orderSummaryOptional.map(UserBrokerageSummaryBO::getPrice).orElse(0)); | 49 | + Optional<UserBrokerageSummaryRespBO> orderSummaryOptional = Optional.ofNullable(userOrderSummaryMap.get(userVO.getId())); |
| 50 | + userVO.setBrokerageOrderCount(orderSummaryOptional.map(UserBrokerageSummaryRespBO::getCount).orElse(0)) | ||
| 51 | + .setBrokerageOrderPrice(orderSummaryOptional.map(UserBrokerageSummaryRespBO::getPrice).orElse(0)); | ||
| 53 | // 已提现次数、已提现金额 | 52 | // 已提现次数、已提现金额 |
| 54 | - Optional<UserWithdrawSummaryBO> withdrawSummaryOptional = Optional.ofNullable(withdrawMap.get(userVO.getId())); | ||
| 55 | - userVO.setWithdrawCount(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getCount).orElse(0)) | ||
| 56 | - .setWithdrawPrice(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getPrice).orElse(0)); | ||
| 57 | - userVO.setWithdrawCount(0).setWithdrawPrice(0); | 53 | + Optional<BrokerageWithdrawSummaryRespBO> withdrawSummaryOptional = Optional.ofNullable(withdrawMap.get(userVO.getId())); |
| 54 | + userVO.setWithdrawCount(withdrawSummaryOptional.map(BrokerageWithdrawSummaryRespBO::getCount).orElse(0)) | ||
| 55 | + .setWithdrawPrice(withdrawSummaryOptional.map(BrokerageWithdrawSummaryRespBO::getPrice).orElse(0)); | ||
| 58 | } | 56 | } |
| 59 | return result; | 57 | return result; |
| 60 | } | 58 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java
| @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordPageReqVO; | 7 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordPageReqVO; |
| 8 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByPriceRespVO; | 8 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByPriceRespVO; |
| 9 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | 9 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; |
| 10 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; | 10 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 11 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 11 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 12 | import com.baomidou.mybatisplus.core.metadata.IPage; | 12 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 13 | import com.github.yulichang.toolkit.MPJWrappers; | 13 | import com.github.yulichang.toolkit.MPJWrappers; |
| @@ -56,18 +56,18 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> { | @@ -56,18 +56,18 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> { | ||
| 56 | BrokerageRecordDO::getUserId, userId); | 56 | BrokerageRecordDO::getUserId, userId); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | - default List<UserBrokerageSummaryBO> selectCountAndSumPriceByUserIdInAndBizTypeAndStatus(Collection<Long> userIds, | ||
| 60 | - Integer bizType, | ||
| 61 | - Integer status) { | 59 | + default List<UserBrokerageSummaryRespBO> selectCountAndSumPriceByUserIdInAndBizTypeAndStatus(Collection<Long> userIds, |
| 60 | + Integer bizType, | ||
| 61 | + Integer status) { | ||
| 62 | List<Map<String, Object>> list = selectMaps(MPJWrappers.lambdaJoin(BrokerageRecordDO.class) | 62 | List<Map<String, Object>> list = selectMaps(MPJWrappers.lambdaJoin(BrokerageRecordDO.class) |
| 63 | .select(BrokerageRecordDO::getUserId) | 63 | .select(BrokerageRecordDO::getUserId) |
| 64 | - .selectCount(BrokerageRecordDO::getId, UserBrokerageSummaryBO::getCount) | 64 | + .selectCount(BrokerageRecordDO::getId, UserBrokerageSummaryRespBO::getCount) |
| 65 | .selectSum(BrokerageRecordDO::getPrice) | 65 | .selectSum(BrokerageRecordDO::getPrice) |
| 66 | .in(BrokerageRecordDO::getUserId, userIds) | 66 | .in(BrokerageRecordDO::getUserId, userIds) |
| 67 | .eq(BrokerageRecordDO::getBizId, bizType) | 67 | .eq(BrokerageRecordDO::getBizId, bizType) |
| 68 | .eq(BrokerageRecordDO::getStatus, status) | 68 | .eq(BrokerageRecordDO::getStatus, status) |
| 69 | .groupBy(BrokerageRecordDO::getUserId)); | 69 | .groupBy(BrokerageRecordDO::getUserId)); |
| 70 | - return BeanUtil.copyToList(list, UserBrokerageSummaryBO.class); | 70 | + return BeanUtil.copyToList(list, UserBrokerageSummaryRespBO.class); |
| 71 | // selectJoinList有BUG,会与租户插件冲突:解析SQL时,发生异常 https://gitee.com/best_handsome/mybatis-plus-join/issues/I84GYW | 71 | // selectJoinList有BUG,会与租户插件冲突:解析SQL时,发生异常 https://gitee.com/best_handsome/mybatis-plus-join/issues/I84GYW |
| 72 | // return selectJoinList(UserBrokerageSummaryBO.class, MPJWrappers.lambdaJoin(BrokerageRecordDO.class) | 72 | // return selectJoinList(UserBrokerageSummaryBO.class, MPJWrappers.lambdaJoin(BrokerageRecordDO.class) |
| 73 | // .select(BrokerageRecordDO::getUserId) | 73 | // .select(BrokerageRecordDO::getUserId) |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java
| @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO; | 7 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO; |
| 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; |
| 9 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 9 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; |
| 10 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 10 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 11 | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 11 | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| 12 | import org.apache.ibatis.annotations.Mapper; | 12 | import org.apache.ibatis.annotations.Mapper; |
| @@ -41,15 +41,15 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO | @@ -41,15 +41,15 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO | ||
| 41 | .eq(BrokerageWithdrawDO::getStatus, status)); | 41 | .eq(BrokerageWithdrawDO::getStatus, status)); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - default List<UserWithdrawSummaryBO> selectCountAndSumPriceByUserIdAndStatus(Collection<Long> userIds, Integer status) { | 44 | + default List<BrokerageWithdrawSummaryRespBO> selectCountAndSumPriceByUserIdAndStatus(Collection<Long> userIds, Integer status) { |
| 45 | List<Map<String, Object>> list = selectMaps(new MPJLambdaWrapper<BrokerageWithdrawDO>() | 45 | List<Map<String, Object>> list = selectMaps(new MPJLambdaWrapper<BrokerageWithdrawDO>() |
| 46 | .select(BrokerageWithdrawDO::getUserId) | 46 | .select(BrokerageWithdrawDO::getUserId) |
| 47 | - .selectCount(BrokerageWithdrawDO::getId, UserWithdrawSummaryBO::getCount) | 47 | + .selectCount(BrokerageWithdrawDO::getId, BrokerageWithdrawSummaryRespBO::getCount) |
| 48 | .selectSum(BrokerageWithdrawDO::getPrice) | 48 | .selectSum(BrokerageWithdrawDO::getPrice) |
| 49 | .in(BrokerageWithdrawDO::getUserId, userIds) | 49 | .in(BrokerageWithdrawDO::getUserId, userIds) |
| 50 | .eq(BrokerageWithdrawDO::getStatus, status) | 50 | .eq(BrokerageWithdrawDO::getStatus, status) |
| 51 | .groupBy(BrokerageWithdrawDO::getUserId)); | 51 | .groupBy(BrokerageWithdrawDO::getUserId)); |
| 52 | - return BeanUtil.copyToList(list, UserWithdrawSummaryBO.class); | 52 | + return BeanUtil.copyToList(list, BrokerageWithdrawSummaryRespBO.class); |
| 53 | // selectJoinList有BUG,会与租户插件冲突:解析SQL时,发生异常 https://gitee.com/best_handsome/mybatis-plus-join/issues/I84GYW | 53 | // selectJoinList有BUG,会与租户插件冲突:解析SQL时,发生异常 https://gitee.com/best_handsome/mybatis-plus-join/issues/I84GYW |
| 54 | // return selectJoinList(UserWithdrawSummaryBO.class, new MPJLambdaWrapper<BrokerageWithdrawDO>() | 54 | // return selectJoinList(UserWithdrawSummaryBO.class, new MPJLambdaWrapper<BrokerageWithdrawDO>() |
| 55 | // .select(BrokerageWithdrawDO::getUserId) | 55 | // .select(BrokerageWithdrawDO::getUserId) |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordService.java
| @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokera | @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokera | ||
| 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; |
| 9 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | 9 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 10 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; | 10 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; |
| 11 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; | 11 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 12 | 12 | ||
| 13 | import javax.validation.Valid; | 13 | import javax.validation.Valid; |
| 14 | import java.time.LocalDateTime; | 14 | import java.time.LocalDateTime; |
| @@ -85,7 +85,8 @@ public interface BrokerageRecordService { | @@ -85,7 +85,8 @@ public interface BrokerageRecordService { | ||
| 85 | * @param status 佣金状态 | 85 | * @param status 佣金状态 |
| 86 | * @return 用户佣金汇总 List | 86 | * @return 用户佣金汇总 List |
| 87 | */ | 87 | */ |
| 88 | - List<UserBrokerageSummaryBO> getUserBrokerageSummaryListByUserId(Collection<Long> userIds, Integer bizType, Integer status); | 88 | + List<UserBrokerageSummaryRespBO> getUserBrokerageSummaryListByUserId(Collection<Long> userIds, |
| 89 | + Integer bizType, Integer status); | ||
| 89 | 90 | ||
| 90 | /** | 91 | /** |
| 91 | * 按照 userId,汇总每个用户的佣金 | 92 | * 按照 userId,汇总每个用户的佣金 |
| @@ -95,8 +96,10 @@ public interface BrokerageRecordService { | @@ -95,8 +96,10 @@ public interface BrokerageRecordService { | ||
| 95 | * @param status 佣金状态 | 96 | * @param status 佣金状态 |
| 96 | * @return 用户佣金汇总 Map | 97 | * @return 用户佣金汇总 Map |
| 97 | */ | 98 | */ |
| 98 | - default Map<Long, UserBrokerageSummaryBO> getUserBrokerageSummaryMapByUserId(Collection<Long> userIds, Integer bizType, Integer status) { | ||
| 99 | - return convertMap(getUserBrokerageSummaryListByUserId(userIds, bizType, status), UserBrokerageSummaryBO::getUserId); | 99 | + default Map<Long, UserBrokerageSummaryRespBO> getUserBrokerageSummaryMapByUserId(Collection<Long> userIds, |
| 100 | + Integer bizType, Integer status) { | ||
| 101 | + return convertMap(getUserBrokerageSummaryListByUserId(userIds, bizType, status), | ||
| 102 | + UserBrokerageSummaryRespBO::getUserId); | ||
| 100 | } | 103 | } |
| 101 | 104 | ||
| 102 | /** | 105 | /** |
| @@ -116,7 +119,8 @@ public interface BrokerageRecordService { | @@ -116,7 +119,8 @@ public interface BrokerageRecordService { | ||
| 116 | * @param pageReqVO 分页查询 | 119 | * @param pageReqVO 分页查询 |
| 117 | * @return 排行榜分页 | 120 | * @return 排行榜分页 |
| 118 | */ | 121 | */ |
| 119 | - PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice(AppBrokerageUserRankPageReqVO pageReqVO); | 122 | + PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice( |
| 123 | + AppBrokerageUserRankPageReqVO pageReqVO); | ||
| 120 | 124 | ||
| 121 | /** | 125 | /** |
| 122 | * 获取用户的排名(基于佣金总数) | 126 | * 获取用户的排名(基于佣金总数) |
| @@ -135,4 +139,5 @@ public interface BrokerageRecordService { | @@ -135,4 +139,5 @@ public interface BrokerageRecordService { | ||
| 135 | * @return 用户佣金 | 139 | * @return 用户佣金 |
| 136 | */ | 140 | */ |
| 137 | AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long spuId, Long userId); | 141 | AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long spuId, Long userId); |
| 142 | + | ||
| 138 | } | 143 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java
| @@ -26,7 +26,7 @@ import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper; | @@ -26,7 +26,7 @@ import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper; | ||
| 26 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | 26 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 27 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; | 27 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; |
| 28 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; | 28 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; |
| 29 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; | 29 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 30 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; | 30 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; |
| 31 | import com.baomidou.mybatisplus.core.metadata.IPage; | 31 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 32 | import lombok.extern.slf4j.Slf4j; | 32 | import lombok.extern.slf4j.Slf4j; |
| @@ -232,18 +232,24 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService { | @@ -232,18 +232,24 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService { | ||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | @Override | 234 | @Override |
| 235 | - public List<UserBrokerageSummaryBO> getUserBrokerageSummaryListByUserId(Collection<Long> userIds, Integer bizType, Integer status) { | 235 | + public List<UserBrokerageSummaryRespBO> getUserBrokerageSummaryListByUserId(Collection<Long> userIds, |
| 236 | + Integer bizType, Integer status) { | ||
| 237 | + if (CollUtil.isEmpty(userIds)) { | ||
| 238 | + return Collections.emptyList(); | ||
| 239 | + } | ||
| 236 | return brokerageRecordMapper.selectCountAndSumPriceByUserIdInAndBizTypeAndStatus(userIds, bizType, status); | 240 | return brokerageRecordMapper.selectCountAndSumPriceByUserIdInAndBizTypeAndStatus(userIds, bizType, status); |
| 237 | } | 241 | } |
| 238 | 242 | ||
| 239 | @Override | 243 | @Override |
| 240 | public Integer getSummaryPriceByUserId(Long userId, Integer bizType, LocalDateTime beginTime, LocalDateTime endTime) { | 244 | public Integer getSummaryPriceByUserId(Long userId, Integer bizType, LocalDateTime beginTime, LocalDateTime endTime) { |
| 241 | - return brokerageRecordMapper.selectSummaryPriceByUserIdAndBizTypeAndCreateTimeBetween(userId, bizType, beginTime, endTime); | 245 | + return brokerageRecordMapper.selectSummaryPriceByUserIdAndBizTypeAndCreateTimeBetween(userId, bizType, |
| 246 | + beginTime, endTime); | ||
| 242 | } | 247 | } |
| 243 | 248 | ||
| 244 | @Override | 249 | @Override |
| 245 | public PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice(AppBrokerageUserRankPageReqVO pageReqVO) { | 250 | public PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice(AppBrokerageUserRankPageReqVO pageReqVO) { |
| 246 | - IPage<AppBrokerageUserRankByPriceRespVO> pageResult = brokerageRecordMapper.selectSummaryPricePageGroupByUserId(MyBatisUtils.buildPage(pageReqVO), | 251 | + IPage<AppBrokerageUserRankByPriceRespVO> pageResult = brokerageRecordMapper.selectSummaryPricePageGroupByUserId( |
| 252 | + MyBatisUtils.buildPage(pageReqVO), | ||
| 247 | BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), | 253 | BrokerageRecordBizTypeEnum.ORDER.getType(), BrokerageRecordStatusEnum.SETTLEMENT.getStatus(), |
| 248 | ArrayUtil.get(pageReqVO.getTimes(), 0), ArrayUtil.get(pageReqVO.getTimes(), 1)); | 254 | ArrayUtil.get(pageReqVO.getTimes(), 0), ArrayUtil.get(pageReqVO.getTimes(), 1)); |
| 249 | return new PageResult<>(pageResult.getRecords(), pageResult.getTotal()); | 255 | return new PageResult<>(pageResult.getRecords(), pageResult.getTotal()); |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
| @@ -26,10 +26,7 @@ import org.springframework.validation.annotation.Validated; | @@ -26,10 +26,7 @@ import org.springframework.validation.annotation.Validated; | ||
| 26 | 26 | ||
| 27 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
| 28 | import java.time.LocalDateTime; | 28 | import java.time.LocalDateTime; |
| 29 | -import java.util.Collection; | ||
| 30 | -import java.util.List; | ||
| 31 | -import java.util.Objects; | ||
| 32 | -import java.util.Optional; | 29 | +import java.util.*; |
| 33 | 30 | ||
| 34 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 31 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 35 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | 32 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| @@ -304,6 +301,9 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { | @@ -304,6 +301,9 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { | ||
| 304 | * @return 绑定用户编号列表 | 301 | * @return 绑定用户编号列表 |
| 305 | */ | 302 | */ |
| 306 | private List<Long> buildBindUserIdsByLevel(Long bindUserId, Integer level) { | 303 | private List<Long> buildBindUserIdsByLevel(Long bindUserId, Integer level) { |
| 304 | + if (bindUserId == null) { | ||
| 305 | + return Collections.emptyList(); | ||
| 306 | + } | ||
| 307 | Assert.isTrue(level == null || level <= 2, "目前只支持 level 小于等于 2"); | 307 | Assert.isTrue(level == null || level <= 2, "目前只支持 level 小于等于 2"); |
| 308 | List<Long> bindUserIds = CollUtil.newArrayList(); | 308 | List<Long> bindUserIds = CollUtil.newArrayList(); |
| 309 | if (level == null || level == 1) { | 309 | if (level == null || level == 1) { |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawService.java
| @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.Brok | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.Brok | ||
| 5 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO; | 5 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | 6 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; |
| 7 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | 7 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; |
| 8 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 8 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; |
| 9 | 9 | ||
| 10 | import java.util.Collection; | 10 | import java.util.Collection; |
| 11 | import java.util.List; | 11 | import java.util.List; |
| @@ -62,7 +62,7 @@ public interface BrokerageWithdrawService { | @@ -62,7 +62,7 @@ public interface BrokerageWithdrawService { | ||
| 62 | * @param status 提现状态 | 62 | * @param status 提现状态 |
| 63 | * @return 用户提现汇总 List | 63 | * @return 用户提现汇总 List |
| 64 | */ | 64 | */ |
| 65 | - List<UserWithdrawSummaryBO> getWithdrawSummaryListByUserId(Collection<Long> userIds, BrokerageWithdrawStatusEnum status); | 65 | + List<BrokerageWithdrawSummaryRespBO> getWithdrawSummaryListByUserId(Collection<Long> userIds, BrokerageWithdrawStatusEnum status); |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * 按照 userId,汇总每个用户的提现 | 68 | * 按照 userId,汇总每个用户的提现 |
| @@ -71,8 +71,9 @@ public interface BrokerageWithdrawService { | @@ -71,8 +71,9 @@ public interface BrokerageWithdrawService { | ||
| 71 | * @param status 提现状态 | 71 | * @param status 提现状态 |
| 72 | * @return 用户提现汇总 Map | 72 | * @return 用户提现汇总 Map |
| 73 | */ | 73 | */ |
| 74 | - default Map<Long, UserWithdrawSummaryBO> getWithdrawSummaryMapByUserId(Set<Long> userIds, BrokerageWithdrawStatusEnum status) { | ||
| 75 | - return convertMap(getWithdrawSummaryListByUserId(userIds, status), UserWithdrawSummaryBO::getUserId); | 74 | + default Map<Long, BrokerageWithdrawSummaryRespBO> getWithdrawSummaryMapByUserId(Set<Long> userIds, |
| 75 | + BrokerageWithdrawStatusEnum status) { | ||
| 76 | + return convertMap(getWithdrawSummaryListByUserId(userIds, status), BrokerageWithdrawSummaryRespBO::getUserId); | ||
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | } | 79 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java
| 1 | package cn.iocoder.yudao.module.trade.service.brokerage; | 1 | package cn.iocoder.yudao.module.trade.service.brokerage; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | import cn.hutool.core.map.MapUtil; | 5 | import cn.hutool.core.map.MapUtil; |
| 5 | import cn.hutool.core.util.ObjectUtil; | 6 | import cn.hutool.core.util.ObjectUtil; |
| @@ -17,7 +18,7 @@ import cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants; | @@ -17,7 +18,7 @@ import cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants; | ||
| 17 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | 18 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 18 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | 19 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; |
| 19 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawTypeEnum; | 20 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawTypeEnum; |
| 20 | -import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | 21 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO; |
| 21 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; | 22 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; |
| 22 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 23 | import org.springframework.transaction.annotation.Transactional; | 24 | import org.springframework.transaction.annotation.Transactional; |
| @@ -27,6 +28,7 @@ import javax.annotation.Resource; | @@ -27,6 +28,7 @@ import javax.annotation.Resource; | ||
| 27 | import javax.validation.Validator; | 28 | import javax.validation.Validator; |
| 28 | import java.time.LocalDateTime; | 29 | import java.time.LocalDateTime; |
| 29 | import java.util.Collection; | 30 | import java.util.Collection; |
| 31 | +import java.util.Collections; | ||
| 30 | import java.util.List; | 32 | import java.util.List; |
| 31 | import java.util.Map; | 33 | import java.util.Map; |
| 32 | 34 | ||
| @@ -144,7 +146,11 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -144,7 +146,11 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 144 | } | 146 | } |
| 145 | 147 | ||
| 146 | @Override | 148 | @Override |
| 147 | - public List<UserWithdrawSummaryBO> getWithdrawSummaryListByUserId(Collection<Long> userIds, BrokerageWithdrawStatusEnum status) { | 149 | + public List<BrokerageWithdrawSummaryRespBO> getWithdrawSummaryListByUserId(Collection<Long> userIds, |
| 150 | + BrokerageWithdrawStatusEnum status) { | ||
| 151 | + if (CollUtil.isEmpty(userIds)) { | ||
| 152 | + return Collections.emptyList(); | ||
| 153 | + } | ||
| 148 | return brokerageWithdrawMapper.selectCountAndSumPriceByUserIdAndStatus(userIds, status.getStatus()); | 154 | return brokerageWithdrawMapper.selectCountAndSumPriceByUserIdAndStatus(userIds, status.getStatus()); |
| 149 | } | 155 | } |
| 150 | 156 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/bo/UserWithdrawSummaryBO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/bo/BrokerageWithdrawSummaryRespBO.java
| @@ -5,14 +5,14 @@ import lombok.Data; | @@ -5,14 +5,14 @@ import lombok.Data; | ||
| 5 | import lombok.NoArgsConstructor; | 5 | import lombok.NoArgsConstructor; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | - * 用户佣金提现合计 BO | 8 | + * 佣金提现合计 BO |
| 9 | * | 9 | * |
| 10 | * @author owen | 10 | * @author owen |
| 11 | */ | 11 | */ |
| 12 | @Data | 12 | @Data |
| 13 | @NoArgsConstructor | 13 | @NoArgsConstructor |
| 14 | @AllArgsConstructor | 14 | @AllArgsConstructor |
| 15 | -public class UserWithdrawSummaryBO { | 15 | +public class BrokerageWithdrawSummaryRespBO { |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * 用户编号 | 18 | * 用户编号 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/bo/UserBrokerageSummaryBO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/bo/UserBrokerageSummaryRespBO.java
| @@ -12,7 +12,7 @@ import lombok.NoArgsConstructor; | @@ -12,7 +12,7 @@ import lombok.NoArgsConstructor; | ||
| 12 | @Data | 12 | @Data |
| 13 | @NoArgsConstructor | 13 | @NoArgsConstructor |
| 14 | @AllArgsConstructor | 14 | @AllArgsConstructor |
| 15 | -public class UserBrokerageSummaryBO { | 15 | +public class UserBrokerageSummaryRespBO { |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * 用户编号 | 18 | * 用户编号 |