diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabUserRedPacketCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabUserRedPacketCmdExe.java index b7a94a8b..4d90a041 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabUserRedPacketCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabUserRedPacketCmdExe.java @@ -68,8 +68,6 @@ public class GrabUserRedPacketCmdExe { ResponseAssert.isTrue(OtherErrorCode.RED_PACKET_ALREADY_GRABBED, UserRedPacketStatus.PENDING.getCode().equals(status)); Long amount = Long.valueOf(String.valueOf(packetData.get("totalAmount"))); - Long handlingFee = Long.valueOf(String.valueOf(packetData.get("handlingFee"))); - Long receiveAmount = amount - handlingFee; Long senderUserId = Long.valueOf(String.valueOf(packetData.get("senderUserId"))); long expireSeconds = Math.max(60, Duration.between(LocalDateTime.now(), expireTime).getSeconds()); @@ -77,12 +75,12 @@ public class GrabUserRedPacketCmdExe { ResponseAssert.isTrue(OtherErrorCode.RED_PACKET_ALREADY_GRABBED, setSuccess); CompletableFuture.runAsync(() -> { - asyncProcessGrab(packetId, cmd.getReqSysOrigin().getOrigin(), userId, receiveAmount); + asyncProcessGrab(packetId, cmd.getReqSysOrigin().getOrigin(), userId, amount); }, redPacketAsyncExecutor); - log.info("领取用户红包成功 userId={} packetId={} amount={}", userId, packetId, receiveAmount); + log.info("领取用户红包成功 userId={} packetId={} amount={}", userId, packetId, amount); - return UserRedPacketAppConvertor.toGrabResultCO(packetId, receiveAmount, senderUserId); + return UserRedPacketAppConvertor.toGrabResultCO(packetId, amount, senderUserId); } /** diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java index 73bbf0e4..4606b998 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java @@ -73,7 +73,7 @@ public class SendUserRedPacketCmdExe { UserRedPacket redPacket = buildRedPacket(cmd, senderUserId, receiverUserId, packetId, expireTime, handlingFee); userRedPacketGateway.save(redPacket); - deductUserGold(senderUserId, cmd, packetId, handlingFee); + deductUserGold(senderUserId, cmd, packetId); cacheRedPacketData(redPacket); @@ -106,7 +106,7 @@ public class SendUserRedPacketCmdExe { /** * 扣除用户金币(红包金额 + 手续费) */ - private void deductUserGold(Long userId, SendUserRedPacketCmd cmd, String packetId, Long handlingFee) { + private void deductUserGold(Long userId, SendUserRedPacketCmd cmd, String packetId) { // 发红包不再扣除手续费 Long totalDeduct = cmd.getTotalAmount(); @@ -138,7 +138,7 @@ public class SendUserRedPacketCmdExe { .senderUserId(senderUserId) .receiverUserId(receiverUserId) .packetType(RoomRedPacketType.FIXED.getCode()) - .totalAmount(cmd.getTotalAmount()) + .totalAmount(cmd.getTotalAmount() - handlingFee) .handlingFee(handlingFee) .expireTime(expireTime) .status(UserRedPacketStatus.PENDING.getCode())