|
|
|
@ -69,20 +69,14 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
if(StringUtils.isNotBlank(params.getOrderId())){ |
|
|
|
wrapper.eq(WithdrawLog::getOrderId,params.getOrderId()); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(params.getBankNo())){ |
|
|
|
wrapper.eq(WithdrawLog::getBankNo, Sm4Util.sm4Encryption(params.getBankNo())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(params.getPhone())){ |
|
|
|
wrapper.eq(WithdrawLog::getPhone, Sm4Util.sm4Encryption(params.getPhone())); |
|
|
|
if(StringUtils.isNotBlank(params.getAccountNo())){ |
|
|
|
wrapper.eq(WithdrawLog::getAccountNo, Sm4Util.sm4Encryption(params.getAccountNo())); |
|
|
|
} |
|
|
|
wrapper.orderByDesc(WithdrawLog::getCreateTime); |
|
|
|
List<WithdrawLog> withdrawLogs = withdrawLogMapper.selectList(wrapper); |
|
|
|
for (WithdrawLog withdrawLog : withdrawLogs) { |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
|
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getPhone())){ |
|
|
|
withdrawLog.setPhone(Sm4Util.sm4Decrypt(withdrawLog.getPhone())); |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getAccountNo())){ |
|
|
|
withdrawLog.setAccountNo(Sm4Util.sm4Decrypt(withdrawLog.getAccountNo())); |
|
|
|
} |
|
|
|
DesensitizedUtils.getJsonNoCopy(withdrawLog); |
|
|
|
} |
|
|
|
@ -92,11 +86,8 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
@Override |
|
|
|
public WithdrawLog queryDetails(Long id) { |
|
|
|
WithdrawLog withdrawLog = withdrawLogMapper.selectById(id); |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
|
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getPhone())){ |
|
|
|
withdrawLog.setPhone(Sm4Util.sm4Decrypt(withdrawLog.getPhone())); |
|
|
|
if(StringUtils.isNotBlank(withdrawLog.getAccountNo())){ |
|
|
|
withdrawLog.setAccountNo(Sm4Util.sm4Decrypt(withdrawLog.getAccountNo())); |
|
|
|
} |
|
|
|
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class); |
|
|
|
return withdrawLog; |
|
|
|
@ -181,6 +172,11 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
withdrawLog.setReason(params.getReason()); |
|
|
|
if(params.getVerifyStatus().equals(WithdrawConstant.UNPASS)){ |
|
|
|
//审核拒绝
|
|
|
|
//归还账户额度
|
|
|
|
Creator creator = creatorMapper.selectById(withdrawLog.getCreatorId()); |
|
|
|
BigDecimal amt = creator.getAmt().add(withdrawLog.getAmt()); |
|
|
|
creator.setAmt(amt); |
|
|
|
creatorMapper.updateById(creator); |
|
|
|
withdrawLog.setStatus("4"); |
|
|
|
withdrawLog.setUpdateTime(new Date()); |
|
|
|
return withdrawLogMapper.updateById(withdrawLog); |
|
|
|
@ -194,7 +190,7 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
CreatorAccountVo creatorAccount = creatorAccountService.queryListByType(withdrawLog.getCreatorId(), "1"); |
|
|
|
if(creatorAccount != null){ |
|
|
|
try{ |
|
|
|
AlipayFundTransUniTransferResponse body = this.trans(withdrawLog.getOrderId(), creatorAccount.getAliPayNo(), creatorAccount.getName(), withdrawLog.getAmt()); |
|
|
|
AlipayFundTransUniTransferResponse body = this.trans(withdrawLog.getOrderId(), creatorAccount.getAccountNo(), creatorAccount.getName(), withdrawLog.getAmt()); |
|
|
|
if(!body.getCode().equals(WithdrawConstant.SUCCESS)){ |
|
|
|
//提现失败
|
|
|
|
withdrawLog.setStatus("3"); |
|
|
|
@ -202,11 +198,6 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
log.error("艺术家【{}】订单【{}】提现失败!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),body.getSubMsg()); |
|
|
|
return withdrawLogMapper.updateById(withdrawLog); |
|
|
|
} |
|
|
|
//扣除账户余额
|
|
|
|
Creator creator = creatorMapper.selectById(withdrawLog.getCreatorId()); |
|
|
|
BigDecimal amt = creator.getAmt().subtract(withdrawLog.getAmt()); |
|
|
|
creator.setAmt(amt); |
|
|
|
creatorMapper.updateById(creator); |
|
|
|
//TODO 分布式锁
|
|
|
|
}catch (AlipayApiException e){ |
|
|
|
log.error("艺术家【{}】订单【{}】提现异常!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),e); |
|
|
|
@ -218,10 +209,11 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService { |
|
|
|
}else{ |
|
|
|
throw new ServiceException("该艺术家未绑定支付宝账户!请手动设置!"); |
|
|
|
} |
|
|
|
}else if(withdrawLog.getChannel().equals(WithdrawConstant.BANK)){ |
|
|
|
//TODO 转账到银行卡待开发
|
|
|
|
}else if(withdrawLog.getChannel().equals(WithdrawConstant.WECHAT)){ |
|
|
|
//TODO 转账到微信待开发
|
|
|
|
} |
|
|
|
log.info("艺术家【{}】订单【{}】提现【{}】元成功!",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),withdrawLog.getAmt()); |
|
|
|
//TODO 微信推送/企业微信推送提现成功通知
|
|
|
|
return withdrawLogMapper.updateById(withdrawLog); |
|
|
|
} |
|
|
|
} |
|
|
|
|