兑换码优化

This commit is contained in:
张松 2025-10-22 11:09:02 +08:00
parent 328cd3bb66
commit 87da3e9bb2
2 changed files with 7 additions and 14 deletions

View File

@ -22,21 +22,12 @@ public class MkRedemptionDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* recharge充值码 coupon券兑换码
*/
@NotBlank(message = "类型不为空")
private String type;
/**
* 券码
*/
@NotBlank(message = "券码不为空")
private String code;
/**
* 门店id
*/
@NotNull(message = "门店不为空")
private Long shopId;
}

View File

@ -285,12 +285,14 @@ public class MkRedemptionConfigServiceImpl extends ServiceImpl<MkCouponRedemptio
@Override
@Transactional(rollbackFor = Exception.class)
public void exchange(long userId, MkRedemptionDTO dto) {
Long mainShopId = shopInfoService.getMainIdByShopId(dto.getShopId());
enableConfigService.checkEnable(mainShopId, dto.getShopId(), TableValueConstant.EnableConfig.Type.RECHARGE_REDEMPTION, true);
ShopUser shopUserInfo = shopUserService.getShopUserInfo(dto.getShopId(), userId);
MkRedemptionCode redemptionCode = codeService.getOne(new QueryWrapper().eq(MkRedemptionCode::getMainShopId, mainShopId).eq(MkRedemptionCode::getCode, dto.getCode()));
MkRedemptionCode redemptionCode = codeService.getOne(new QueryWrapper().eq(MkRedemptionCode::getCode, dto.getCode()));
AssertUtil.isNull(redemptionCode, "兑换码不存在");
Long mainShopId = redemptionCode.getMainShopId();
enableConfigService.checkEnable(mainShopId, mainShopId, TableValueConstant.EnableConfig.Type.RECHARGE_REDEMPTION, true);
ShopUser shopUserInfo = shopUserService.getShopUserInfo(mainShopId, userId);
AssertUtil.isTrue(redemptionCode.getStatus() != 0, "兑换码不存在");
MkRedemptionConfigVO config = detail(mainShopId, redemptionCode.getId());