update 卖家实收金额 减去手续费

This commit is contained in:
yyb
2026-01-26 10:36:22 +08:00
parent 6a7df1ca6a
commit 62ec516156
3 changed files with 31 additions and 5 deletions

View File

@@ -147,4 +147,17 @@ public class LeasePayRecordMessage implements Serializable {
@TableField(exist = false)
private Long sellerId;
/**
* 卖家实收金额 = 店铺手续费比例 * 买家实际支付金额
*/
@TableField(exist = false)
private BigDecimal receivedAmount;
/**
* 卖家手续费比例
*/
@TableField(exist = false)
private BigDecimal feeRate;
}

View File

@@ -1045,6 +1045,7 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
@Transactional
public Result<UserWalletDataDto> bindWallet(ChainAndCoinVo chainAndCoinVo) {
Long authId = SecurityUtils.getUserId();
String username = SecurityUtils.getUsername();
//同一用户同一个链只会存在一个钱包
List<UserWalletDataDto> userWalletDataDtoList = leaseUserWalletDataMapper.getWalletInfoByChain(chainAndCoinVo.getChain(),authId);
UserWalletDataDto result;
@@ -1054,7 +1055,6 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
if (bindAddress != null){
String address = bindAddress.getAddress();
String qrcode = QrCodeUtils.creatRrCode(bindAddress.getAddress(), 200, 200);
String username = SecurityUtils.getUsername();
String queueId = UuidGeneratorUtil.generateUuidWithoutHyphen();
result = UserWalletDataDto.builder()
.queueId(queueId)
@@ -1080,12 +1080,23 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
leaseAutoAddressMapper.updateById(bindAddress);
//监听钱包
sendMessage(result,username,authId);
}else{
return Result.fail("没有可用的地址,请联系管理员生成可用的钱包地址");
}
}else{
for (UserWalletDataDto userWalletDataDto : userWalletDataDtoList) {
if (userWalletDataDto.getFromSymbol().equals(chainAndCoinVo.getCoin())){
//开发环境
sendMessage(UserWalletDataDto.builder()
.queueId(userWalletDataDto.getQueueId())
.fromAddress(userWalletDataDto.getFromAddress())
.fromChain(chainAndCoinVo.getChain())
.fromSymbol(chainAndCoinVo.getCoin())
.balance(BigDecimal.ZERO)
.userId(userWalletDataDto.getUserId())
.qrcode(userWalletDataDto.getQrcode())
.build(),username,authId);
return Result.success(userWalletDataDto);
}
}
@@ -1169,7 +1180,7 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
*/
public void sendMessage(UserWalletDataDto userWalletDataDto,String username,Long authId){
try {
System.out.println("发送mq消息");
String userKey = username+"--"+authId;
long l = System.currentTimeMillis()/1000;
RabbitmqPayRechargeMessage build = RabbitmqPayRechargeMessage.builder()
.queue_id(userWalletDataDto.getQueueId())
@@ -1178,11 +1189,11 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
.symbol(userWalletDataDto.getFromSymbol())
.timestamp(l)
.sign(HashUtils.sha256(l))
.user_email(username)
.user_email(userKey)
.build();
rabbitTemplate.convertAndSend(PAY_RECHARGE_QUEUE,build);
//记录监听钱包开始时间
ledgerLogService.logOperation(userWalletDataDto.getFromAddress()+"--"+username+"--"+authId, "-----监听钱包开始------","");
ledgerLogService.logOperation(userWalletDataDto.getFromAddress()+"--"+userKey, "-----监听钱包开始------","");
}catch (Exception e){
throw new PaymentException("获取钱包信息失败,请刷新重试");
}

View File

@@ -830,6 +830,7 @@ public class OrderAndPayTask {
.status(1)
.sellerEmail(leaseShop.getUserEmail())
.receivedAmount(totalRealAmount.subtract(totalRealAmount.multiply(leaseShop.getFeeRate())))
.feeRate(leaseShop.getFeeRate())
.build();
reocrdList.add(build);
@@ -863,7 +864,8 @@ public class OrderAndPayTask {
"支付币种" + item.getFromSymbol();
String sellerInfo = "订单号:" + item.getOrderNumber() +
"收款金额:" + item.getRealAmount()+
"收款金额:" + item.getReceivedAmount()+
"手续费率:" + item.getFeeRate()+
"支付地址:" + item.getFromAddress()+
"支付链:" + item.getFromChain()+
"支付币种" + item.getFromSymbol() ;