feat:【MALL 商城】佣金提现,支持提现失败时,重新发起
This commit is contained in:
parent
423c0b7ea7
commit
fe8871b5f1
|
@ -16,6 +16,9 @@ public class BrokerageWithdrawRespVO extends BrokerageWithdrawBaseVO {
|
|||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "转账错误提示", example = "余额不足")
|
||||
private String transferErrorMsg;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
|
|
@ -28,17 +28,17 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO
|
|||
.eqIfPresent(BrokerageWithdrawDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(BrokerageWithdrawDO::getType, reqVO.getType())
|
||||
.likeIfPresent(BrokerageWithdrawDO::getUserName, reqVO.getUserName())
|
||||
.eqIfPresent(BrokerageWithdrawDO::getUserAccount, reqVO.getUserAccount())
|
||||
.likeIfPresent(BrokerageWithdrawDO::getUserAccount, reqVO.getUserAccount())
|
||||
.likeIfPresent(BrokerageWithdrawDO::getBankName, reqVO.getBankName())
|
||||
.eqIfPresent(BrokerageWithdrawDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(BrokerageWithdrawDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(BrokerageWithdrawDO::getStatus).orderByDesc(BrokerageWithdrawDO::getId));
|
||||
.orderByDesc(BrokerageWithdrawDO::getId));
|
||||
}
|
||||
|
||||
default int updateByIdAndStatus(Long id, Integer status, BrokerageWithdrawDO updateObj) {
|
||||
default int updateByIdAndStatus(Long id, Integer whereStatus, BrokerageWithdrawDO updateObj) {
|
||||
return update(updateObj, new LambdaUpdateWrapper<BrokerageWithdrawDO>()
|
||||
.eq(BrokerageWithdrawDO::getId, id)
|
||||
.eq(BrokerageWithdrawDO::getStatus, status));
|
||||
.eq(BrokerageWithdrawDO::getStatus, whereStatus));
|
||||
}
|
||||
|
||||
default List<BrokerageWithdrawSummaryRespBO> selectCountAndSumPriceByUserIdAndStatus(Collection<Long> userIds,
|
||||
|
|
|
@ -86,15 +86,24 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|||
public void auditBrokerageWithdraw(Long id, BrokerageWithdrawStatusEnum status, String auditReason, String userIp) {
|
||||
// 1.1 校验存在
|
||||
BrokerageWithdrawDO withdraw = validateBrokerageWithdrawExists(id);
|
||||
// 1.2 特殊:【重新转账】如果是提现失败,并且状态是审核中,那么更新状态为审核中,并且清空 transferErrorMsg
|
||||
if (BrokerageWithdrawStatusEnum.WITHDRAW_FAIL.getStatus().equals(withdraw.getStatus())) {
|
||||
int updateCount = brokerageWithdrawMapper.updateByIdAndStatus(id, withdraw.getStatus(),
|
||||
new BrokerageWithdrawDO().setStatus(BrokerageWithdrawStatusEnum.AUDITING.getStatus()).setTransferErrorMsg(""));
|
||||
if (updateCount == 0) {
|
||||
throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING);
|
||||
}
|
||||
withdraw.setStatus(BrokerageWithdrawStatusEnum.AUDITING.getStatus()).setTransferErrorMsg("");
|
||||
}
|
||||
// 1.2 校验状态为审核中
|
||||
if (ObjectUtil.notEqual(BrokerageWithdrawStatusEnum.AUDITING.getStatus(), withdraw.getStatus())) {
|
||||
throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING);
|
||||
}
|
||||
|
||||
// 2. 更新状态
|
||||
int rows = brokerageWithdrawMapper.updateByIdAndStatus(id, BrokerageWithdrawStatusEnum.AUDITING.getStatus(),
|
||||
int updateCount = brokerageWithdrawMapper.updateByIdAndStatus(id, withdraw.getStatus(),
|
||||
new BrokerageWithdrawDO().setStatus(status.getStatus()).setAuditReason(auditReason).setAuditTime(LocalDateTime.now()));
|
||||
if (rows == 0) {
|
||||
if (updateCount == 0) {
|
||||
throw exception(BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue