Commit 962f2bbf69dd42c8d88876519fcdb6b49cbde043
1 parent
de7699d9
code review:提现逻辑
Showing
11 changed files
with
41 additions
and
61 deletions
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/BrokerageWithdrawController.java
| @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | 5 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawAuditReqVO; | 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRejectReqVO; |
| 8 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawPageReqVO; | 8 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawPageReqVO; |
| 9 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; | 9 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; |
| 10 | import cn.iocoder.yudao.module.trade.convert.brokerage.withdraw.BrokerageWithdrawConvert; | 10 | import cn.iocoder.yudao.module.trade.convert.brokerage.withdraw.BrokerageWithdrawConvert; |
| @@ -20,9 +20,7 @@ import org.springframework.web.bind.annotation.*; | @@ -20,9 +20,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 20 | 20 | ||
| 21 | import javax.annotation.Resource; | 21 | import javax.annotation.Resource; |
| 22 | import javax.validation.Valid; | 22 | import javax.validation.Valid; |
| 23 | - | ||
| 24 | import java.util.Map; | 23 | import java.util.Map; |
| 25 | -import java.util.Set; | ||
| 26 | 24 | ||
| 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 25 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 28 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 26 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| @@ -40,7 +38,7 @@ public class BrokerageWithdrawController { | @@ -40,7 +38,7 @@ public class BrokerageWithdrawController { | ||
| 40 | private MemberUserApi memberUserApi; | 38 | private MemberUserApi memberUserApi; |
| 41 | 39 | ||
| 42 | @PutMapping("/approve") | 40 | @PutMapping("/approve") |
| 43 | - @Operation(summary = "佣金提现 - 通过申请") | 41 | + @Operation(summary = "通过申请") |
| 44 | @PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')") | 42 | @PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')") |
| 45 | public CommonResult<Boolean> approveBrokerageWithdraw(@RequestParam("id") Integer id) { | 43 | public CommonResult<Boolean> approveBrokerageWithdraw(@RequestParam("id") Integer id) { |
| 46 | brokerageWithdrawService.auditBrokerageWithdraw(id, BrokerageWithdrawStatusEnum.AUDIT_SUCCESS, ""); | 44 | brokerageWithdrawService.auditBrokerageWithdraw(id, BrokerageWithdrawStatusEnum.AUDIT_SUCCESS, ""); |
| @@ -48,9 +46,9 @@ public class BrokerageWithdrawController { | @@ -48,9 +46,9 @@ public class BrokerageWithdrawController { | ||
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | @PutMapping("/reject") | 48 | @PutMapping("/reject") |
| 51 | - @Operation(summary = "审核佣金提现 - 驳回申请") | 49 | + @Operation(summary = "驳回申请") |
| 52 | @PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')") | 50 | @PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')") |
| 53 | - public CommonResult<Boolean> rejectBrokerageWithdraw(@Valid @RequestBody BrokerageWithdrawAuditReqVO reqVO) { | 51 | + public CommonResult<Boolean> rejectBrokerageWithdraw(@Valid @RequestBody BrokerageWithdrawRejectReqVO reqVO) { |
| 54 | brokerageWithdrawService.auditBrokerageWithdraw(reqVO.getId(), BrokerageWithdrawStatusEnum.AUDIT_FAIL, reqVO.getAuditReason()); | 52 | brokerageWithdrawService.auditBrokerageWithdraw(reqVO.getId(), BrokerageWithdrawStatusEnum.AUDIT_FAIL, reqVO.getAuditReason()); |
| 55 | return success(true); | 53 | return success(true); |
| 56 | } | 54 | } |
| @@ -71,11 +69,9 @@ public class BrokerageWithdrawController { | @@ -71,11 +69,9 @@ public class BrokerageWithdrawController { | ||
| 71 | // 分页查询 | 69 | // 分页查询 |
| 72 | PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage(pageVO); | 70 | PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage(pageVO); |
| 73 | 71 | ||
| 74 | - // 涉及到的用户 | ||
| 75 | - Set<Long> userIds = convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId); | ||
| 76 | - // 查询用户信息 | ||
| 77 | - Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); | ||
| 78 | - | 72 | + // 拼接信息 |
| 73 | + Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap( | ||
| 74 | + convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId)); | ||
| 79 | return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap)); | 75 | return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap)); |
| 80 | } | 76 | } |
| 81 | 77 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawBaseVO.java
| @@ -39,7 +39,7 @@ public class BrokerageWithdrawBaseVO { | @@ -39,7 +39,7 @@ public class BrokerageWithdrawBaseVO { | ||
| 39 | @Schema(description = "真实姓名", example = "赵六") | 39 | @Schema(description = "真实姓名", example = "赵六") |
| 40 | private String name; | 40 | private String name; |
| 41 | 41 | ||
| 42 | - @Schema(description = "账号") | 42 | + @Schema(description = "账号", example = "88677912132") |
| 43 | private String accountNo; | 43 | private String accountNo; |
| 44 | 44 | ||
| 45 | @Schema(description = "银行名称", example = "1") | 45 | @Schema(description = "银行名称", example = "1") |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawPageReqVO.java
| @@ -30,7 +30,7 @@ public class BrokerageWithdrawPageReqVO extends PageParam { | @@ -30,7 +30,7 @@ public class BrokerageWithdrawPageReqVO extends PageParam { | ||
| 30 | @Schema(description = "真实姓名", example = "赵六") | 30 | @Schema(description = "真实姓名", example = "赵六") |
| 31 | private String name; | 31 | private String name; |
| 32 | 32 | ||
| 33 | - @Schema(description = "账号") | 33 | + @Schema(description = "账号", example = "886779132") |
| 34 | private String accountNo; | 34 | private String accountNo; |
| 35 | 35 | ||
| 36 | @Schema(description = "银行名称", example = "1") | 36 | @Schema(description = "银行名称", example = "1") |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawAuditReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawRejectReqVO.java
| @@ -7,10 +7,10 @@ import lombok.ToString; | @@ -7,10 +7,10 @@ import lombok.ToString; | ||
| 7 | import javax.validation.constraints.NotEmpty; | 7 | import javax.validation.constraints.NotEmpty; |
| 8 | import javax.validation.constraints.NotNull; | 8 | import javax.validation.constraints.NotNull; |
| 9 | 9 | ||
| 10 | -@Schema(description = "管理后台 - 佣金提现审核 Request VO") | 10 | +@Schema(description = "管理后台 - 驳回申请 Request VO") |
| 11 | @Data | 11 | @Data |
| 12 | @ToString(callSuper = true) | 12 | @ToString(callSuper = true) |
| 13 | -public class BrokerageWithdrawAuditReqVO { | 13 | +public class BrokerageWithdrawRejectReqVO { |
| 14 | 14 | ||
| 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161") | 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161") |
| 16 | @NotNull(message = "编号不能为空") | 16 | @NotNull(message = "编号不能为空") |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawRespVO.java
| @@ -19,7 +19,7 @@ public class BrokerageWithdrawRespVO extends BrokerageWithdrawBaseVO { | @@ -19,7 +19,7 @@ public class BrokerageWithdrawRespVO extends BrokerageWithdrawBaseVO { | ||
| 19 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 19 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 20 | private LocalDateTime createTime; | 20 | private LocalDateTime createTime; |
| 21 | 21 | ||
| 22 | - @Schema(description = "用户昵称") | 22 | + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") |
| 23 | private String userNickname; | 23 | private String userNickname; |
| 24 | 24 | ||
| 25 | } | 25 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/withdraw/BrokerageWithdrawConvert.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.trade.convert.brokerage.withdraw; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.trade.convert.brokerage.withdraw; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 4 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 5 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawAuditReqVO; | 5 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRejectReqVO; |
| 6 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; | 6 | import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; |
| 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; | 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; |
| 8 | import org.mapstruct.Mapper; | 8 | import org.mapstruct.Mapper; |
| @@ -22,7 +22,7 @@ public interface BrokerageWithdrawConvert { | @@ -22,7 +22,7 @@ public interface BrokerageWithdrawConvert { | ||
| 22 | 22 | ||
| 23 | BrokerageWithdrawConvert INSTANCE = Mappers.getMapper(BrokerageWithdrawConvert.class); | 23 | BrokerageWithdrawConvert INSTANCE = Mappers.getMapper(BrokerageWithdrawConvert.class); |
| 24 | 24 | ||
| 25 | - BrokerageWithdrawDO convert(BrokerageWithdrawAuditReqVO bean); | 25 | + BrokerageWithdrawDO convert(BrokerageWithdrawRejectReqVO bean); |
| 26 | 26 | ||
| 27 | BrokerageWithdrawRespVO convert(BrokerageWithdrawDO bean); | 27 | BrokerageWithdrawRespVO convert(BrokerageWithdrawDO bean); |
| 28 | 28 | ||
| @@ -33,8 +33,9 @@ public interface BrokerageWithdrawConvert { | @@ -33,8 +33,9 @@ public interface BrokerageWithdrawConvert { | ||
| 33 | default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult, Map<Long, MemberUserRespDTO> userMap) { | 33 | default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult, Map<Long, MemberUserRespDTO> userMap) { |
| 34 | PageResult<BrokerageWithdrawRespVO> result = convertPage(pageResult); | 34 | PageResult<BrokerageWithdrawRespVO> result = convertPage(pageResult); |
| 35 | for (BrokerageWithdrawRespVO vo : result.getList()) { | 35 | for (BrokerageWithdrawRespVO vo : result.getList()) { |
| 36 | - vo.setUserNickname(Optional.ofNullable(userMap.get(vo.getUserId())).map(MemberUserRespDTO::getNickname).orElse("")); | 36 | + vo.setUserNickname(Optional.ofNullable(userMap.get(vo.getUserId())).map(MemberUserRespDTO::getNickname).orElse(null)); |
| 37 | } | 37 | } |
| 38 | return result; | 38 | return result; |
| 39 | } | 39 | } |
| 40 | + | ||
| 40 | } | 41 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/withdraw/BrokerageWithdrawDO.java
| @@ -32,18 +32,21 @@ public class BrokerageWithdrawDO extends BaseDO { | @@ -32,18 +32,21 @@ public class BrokerageWithdrawDO extends BaseDO { | ||
| 32 | private Integer id; | 32 | private Integer id; |
| 33 | /** | 33 | /** |
| 34 | * 用户编号 | 34 | * 用户编号 |
| 35 | + * | ||
| 36 | + * 关联 MemberUserDO 的 id 字段 | ||
| 35 | */ | 37 | */ |
| 36 | private Long userId; | 38 | private Long userId; |
| 39 | + | ||
| 37 | /** | 40 | /** |
| 38 | - * 提现金额 | 41 | + * 提现金额,单位:分 |
| 39 | */ | 42 | */ |
| 40 | private Integer price; | 43 | private Integer price; |
| 41 | /** | 44 | /** |
| 42 | - * 提现手续费 | 45 | + * 提现手续费,单位:分 |
| 43 | */ | 46 | */ |
| 44 | private Integer feePrice; | 47 | private Integer feePrice; |
| 45 | /** | 48 | /** |
| 46 | - * 当前总佣金 | 49 | + * 当前总佣金,单位:分 |
| 47 | */ | 50 | */ |
| 48 | private Integer totalPrice; | 51 | private Integer totalPrice; |
| 49 | /** | 52 | /** |
| @@ -52,6 +55,7 @@ public class BrokerageWithdrawDO extends BaseDO { | @@ -52,6 +55,7 @@ public class BrokerageWithdrawDO extends BaseDO { | ||
| 52 | * 枚举 {@link BrokerageWithdrawTypeEnum} | 55 | * 枚举 {@link BrokerageWithdrawTypeEnum} |
| 53 | */ | 56 | */ |
| 54 | private Integer type; | 57 | private Integer type; |
| 58 | + | ||
| 55 | /** | 59 | /** |
| 56 | * 真实姓名 | 60 | * 真实姓名 |
| 57 | */ | 61 | */ |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/withdraw/BrokerageWithdrawMapper.java
| @@ -33,4 +33,5 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO | @@ -33,4 +33,5 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO | ||
| 33 | .eq(BrokerageWithdrawDO::getId, id) | 33 | .eq(BrokerageWithdrawDO::getId, id) |
| 34 | .eq(BrokerageWithdrawDO::getStatus, status)); | 34 | .eq(BrokerageWithdrawDO::getStatus, status)); |
| 35 | } | 35 | } |
| 36 | + | ||
| 36 | } | 37 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/withdraw/BrokerageWithdrawService.java
| @@ -5,9 +5,6 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.Brok | @@ -5,9 +5,6 @@ import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.Brok | ||
| 5 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; | 5 | import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; |
| 6 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | 6 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; |
| 7 | 7 | ||
| 8 | -import java.util.Collection; | ||
| 9 | -import java.util.List; | ||
| 10 | - | ||
| 11 | /** | 8 | /** |
| 12 | * 佣金提现 Service 接口 | 9 | * 佣金提现 Service 接口 |
| 13 | * | 10 | * |
| @@ -34,14 +31,6 @@ public interface BrokerageWithdrawService { | @@ -34,14 +31,6 @@ public interface BrokerageWithdrawService { | ||
| 34 | BrokerageWithdrawDO getBrokerageWithdraw(Integer id); | 31 | BrokerageWithdrawDO getBrokerageWithdraw(Integer id); |
| 35 | 32 | ||
| 36 | /** | 33 | /** |
| 37 | - * 获得佣金提现列表 | ||
| 38 | - * | ||
| 39 | - * @param ids 编号 | ||
| 40 | - * @return 佣金提现列表 | ||
| 41 | - */ | ||
| 42 | - List<BrokerageWithdrawDO> getBrokerageWithdrawList(Collection<Integer> ids); | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | * 获得佣金提现分页 | 34 | * 获得佣金提现分页 |
| 46 | * | 35 | * |
| 47 | * @param pageReqVO 分页查询 | 36 | * @param pageReqVO 分页查询 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/withdraw/BrokerageWithdrawServiceImpl.java
| 1 | package cn.iocoder.yudao.module.trade.service.brokerage.withdraw; | 1 | package cn.iocoder.yudao.module.trade.service.brokerage.withdraw; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.collection.CollUtil; | ||
| 4 | -import cn.hutool.core.collection.ListUtil; | ||
| 5 | import cn.hutool.core.date.LocalDateTimeUtil; | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 6 | import cn.hutool.core.map.MapUtil; | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | +import cn.hutool.core.util.ObjectUtil; | ||
| 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; | 7 | import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; |
| 9 | import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; | 8 | import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; |
| @@ -19,8 +18,6 @@ import org.springframework.validation.annotation.Validated; | @@ -19,8 +18,6 @@ import org.springframework.validation.annotation.Validated; | ||
| 19 | 18 | ||
| 20 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 21 | import java.time.LocalDateTime; | 20 | import java.time.LocalDateTime; |
| 22 | -import java.util.Collection; | ||
| 23 | -import java.util.List; | ||
| 24 | import java.util.Map; | 21 | import java.util.Map; |
| 25 | 22 | ||
| 26 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| @@ -48,15 +45,14 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -48,15 +45,14 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 48 | @Override | 45 | @Override |
| 49 | @Transactional(rollbackFor = Exception.class) | 46 | @Transactional(rollbackFor = Exception.class) |
| 50 | public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) { | 47 | public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) { |
| 51 | - | ||
| 52 | - // 校验存在 | ||
| 53 | - BrokerageWithdrawDO withdrawDO = validateBrokerageWithdrawExists(id); | ||
| 54 | - // 校验状态为审核中 | ||
| 55 | - if (!BrokerageWithdrawStatusEnum.AUDITING.getStatus().equals(withdrawDO.getStatus())) { | 48 | + // 1.1 校验存在 |
| 49 | + BrokerageWithdrawDO withdraw = validateBrokerageWithdrawExists(id); | ||
| 50 | + // 1.2 校验状态为审核中 | ||
| 51 | + if (ObjectUtil.notEqual(BrokerageWithdrawStatusEnum.AUDITING.getStatus(), withdraw.getStatus())) { | ||
| 56 | throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); | 52 | throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); |
| 57 | } | 53 | } |
| 58 | 54 | ||
| 59 | - // 更新 | 55 | + // 2. 更新 |
| 60 | BrokerageWithdrawDO updateObj = new BrokerageWithdrawDO() | 56 | BrokerageWithdrawDO updateObj = new BrokerageWithdrawDO() |
| 61 | .setStatus(status.getStatus()) | 57 | .setStatus(status.getStatus()) |
| 62 | .setAuditReason(auditReason) | 58 | .setAuditReason(auditReason) |
| @@ -66,33 +62,33 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -66,33 +62,33 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 66 | throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); | 62 | throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING); |
| 67 | } | 63 | } |
| 68 | 64 | ||
| 69 | - // 驳回时需要退还用户佣金 | 65 | + // 3. 驳回时需要退还用户佣金 |
| 70 | String templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_APPROVE; | 66 | String templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_APPROVE; |
| 71 | if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) { | 67 | if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) { |
| 72 | templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_REJECT; | 68 | templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_REJECT; |
| 73 | 69 | ||
| 74 | // todo @owen | 70 | // todo @owen |
| 75 | -// brokerageRecordService.addBrokerage(withdrawDO.getUserId(), BrokerageRecordBizTypeEnum.WITHDRAW, withdrawDO.getPrice(), ""); | 71 | +// brokerageRecordService.addBrokerage(withdraw.getUserId(), BrokerageRecordBizTypeEnum.WITHDRAW, withdraw.getPrice(), ""); |
| 76 | } | 72 | } |
| 77 | 73 | ||
| 78 | - // 通知用户 | 74 | + // 4. 通知用户 |
| 79 | Map<String, Object> templateParams = MapUtil.<String, Object>builder() | 75 | Map<String, Object> templateParams = MapUtil.<String, Object>builder() |
| 80 | - .put("createTime", LocalDateTimeUtil.formatNormal(withdrawDO.getCreateTime())) | ||
| 81 | - .put("price", String.format("%.2f", withdrawDO.getPrice() / 100d)) | ||
| 82 | - .put("reason", withdrawDO.getAuditReason()) | 76 | + .put("createTime", LocalDateTimeUtil.formatNormal(withdraw.getCreateTime())) |
| 77 | + .put("price", String.format("%.2f", withdraw.getPrice() / 100d)) | ||
| 78 | + .put("reason", withdraw.getAuditReason()) | ||
| 83 | .build(); | 79 | .build(); |
| 84 | NotifySendSingleToUserReqDTO reqDTO = new NotifySendSingleToUserReqDTO() | 80 | NotifySendSingleToUserReqDTO reqDTO = new NotifySendSingleToUserReqDTO() |
| 85 | - .setUserId(withdrawDO.getUserId()) | 81 | + .setUserId(withdraw.getUserId()) |
| 86 | .setTemplateCode(templateCode).setTemplateParams(templateParams); | 82 | .setTemplateCode(templateCode).setTemplateParams(templateParams); |
| 87 | notifyMessageSendApi.sendSingleMessageToMember(reqDTO); | 83 | notifyMessageSendApi.sendSingleMessageToMember(reqDTO); |
| 88 | } | 84 | } |
| 89 | 85 | ||
| 90 | private BrokerageWithdrawDO validateBrokerageWithdrawExists(Integer id) { | 86 | private BrokerageWithdrawDO validateBrokerageWithdrawExists(Integer id) { |
| 91 | - BrokerageWithdrawDO withdrawDO = brokerageWithdrawMapper.selectById(id); | ||
| 92 | - if (withdrawDO == null) { | 87 | + BrokerageWithdrawDO withdraw = brokerageWithdrawMapper.selectById(id); |
| 88 | + if (withdraw == null) { | ||
| 93 | throw exception(BROKERAGE_WITHDRAW_NOT_EXISTS); | 89 | throw exception(BROKERAGE_WITHDRAW_NOT_EXISTS); |
| 94 | } | 90 | } |
| 95 | - return withdrawDO; | 91 | + return withdraw; |
| 96 | } | 92 | } |
| 97 | 93 | ||
| 98 | @Override | 94 | @Override |
| @@ -101,14 +97,6 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | @@ -101,14 +97,6 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService { | ||
| 101 | } | 97 | } |
| 102 | 98 | ||
| 103 | @Override | 99 | @Override |
| 104 | - public List<BrokerageWithdrawDO> getBrokerageWithdrawList(Collection<Integer> ids) { | ||
| 105 | - if (CollUtil.isEmpty(ids)) { | ||
| 106 | - return ListUtil.empty(); | ||
| 107 | - } | ||
| 108 | - return brokerageWithdrawMapper.selectBatchIds(ids); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - @Override | ||
| 112 | public PageResult<BrokerageWithdrawDO> getBrokerageWithdrawPage(BrokerageWithdrawPageReqVO pageReqVO) { | 100 | public PageResult<BrokerageWithdrawDO> getBrokerageWithdrawPage(BrokerageWithdrawPageReqVO pageReqVO) { |
| 113 | return brokerageWithdrawMapper.selectPage(pageReqVO); | 101 | return brokerageWithdrawMapper.selectPage(pageReqVO); |
| 114 | } | 102 | } |
yudao-module-mall/yudao-module-trade-biz/src/test/java/cn/iocoder/yudao/module/trade/service/withdraw/BrokerageWithdrawServiceImplTest.java
| @@ -18,6 +18,7 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | @@ -18,6 +18,7 @@ import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEq | ||
| 18 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 18 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 19 | import static org.junit.jupiter.api.Assertions.assertEquals; | 19 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 20 | 20 | ||
| 21 | +// TODO 芋艿:后续 review | ||
| 21 | /** | 22 | /** |
| 22 | * {@link BrokerageWithdrawServiceImpl} 的单元测试类 | 23 | * {@link BrokerageWithdrawServiceImpl} 的单元测试类 |
| 23 | * | 24 | * |