feat:支付使用优惠券
This commit is contained in:
1 parent
c9f39910f9
commit
667bdac868
19 files changed
+255
-26
No files matched your search
+3
@@ -19,4 +19,7 @@ public class HardAppCreateOrderScancode {
|
||||
@NotNull(message = "自定义金额不能为空")
|
||||
private Integer customPrice;
|
||||
|
||||
@Schema(description = "优惠券id")
|
||||
private Long actCouponRecordId;
|
||||
|
||||
}
|
||||
+3
@@ -48,4 +48,7 @@ public class HardAppCreateOrderDto {
|
||||
// 预约id
|
||||
private Long apptId;
|
||||
|
||||
// 优惠券id
|
||||
private Long actCouponRecordId;
|
||||
|
||||
}
|
||||
+1
@@ -235,6 +235,7 @@ public class HardOrderController {
|
||||
.hardType(HardTypeEnum.MERCHANT_QR_CODE)
|
||||
.orderType(HardOrderTypeEnum.BELOW)
|
||||
.payType(HardPayTypeEnum.WALLET_QR_CODE_SCAN)
|
||||
.actCouponRecordId(body.getActCouponRecordId())
|
||||
.build();
|
||||
return R.ok(hardwareOrderService.appCreateOrderScancode(dto));
|
||||
}
|
||||
|
||||
+14
-2
@@ -97,6 +97,7 @@ import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletXfjDiscounts;
|
||||
import com.bsd.pjcloud.wallet.api.vo.act.ActCancelItemVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.act.ActComItemVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.act.ActCouponRecordVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchPickUpVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -158,6 +159,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
private final RemoteShopSkuService remoteShopSkuService;
|
||||
private final RemoteComActService remoteComActService;
|
||||
private final RemoteActCancelService remoteActCancelService;
|
||||
private final RemoteActCouponCancelService remoteActCouponCancelService;
|
||||
private final RemoteMallProductService remoteMallProductService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
@@ -752,6 +754,15 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
|
||||
Integer balance = wallet.getBalance();
|
||||
int totalPrice = dto.getCustomPrice();
|
||||
|
||||
// 用户是否使用优惠券
|
||||
if (ObjectUtil.isNotEmpty(dto.getActCouponRecordId())) {
|
||||
ActCouponRecordVo actCouponRecord = remoteActCouponCancelService.remoteGetDetail(dto.getActCouponRecordId(), totalPrice).getData();
|
||||
if (ObjectUtil.isEmpty(actCouponRecord)) {
|
||||
throw new RuntimeException("优惠券不存在");
|
||||
}
|
||||
}
|
||||
|
||||
String subject = "未知商品x?";
|
||||
if (balance < totalPrice) {
|
||||
throw new RuntimeException("钱包余额不足");
|
||||
@@ -781,9 +792,10 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
getSelf().fastReduceBalance(orderObj);
|
||||
// 是否需要创建二维码
|
||||
getSelf().generateCode(orderObj);
|
||||
// 扣减库存
|
||||
// getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
// 核销优惠券
|
||||
if (ObjectUtil.isNotEmpty(dto.getActCouponRecordId())) {
|
||||
|
||||
}
|
||||
// 云音箱播报
|
||||
CompletableFuture.runAsync(() -> yyxService.send(orderObj.getMerchantId(), orderObj.getPayPrice(), userDetail.getSysUser().getPhone()));
|
||||
return orderObj.getId();
|
||||
|
||||
Reference in new issue
Block a user