优惠券发放

This commit is contained in:
张松
2025-09-18 15:08:58 +08:00
parent 6756f35db6
commit 537aeb09a1
6 changed files with 51 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import com.czg.account.service.UserInfoService;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.exception.CzgException;
import com.czg.market.dto.MkRewardCouponDTO;
import com.czg.market.dto.MkShopCouponGiftDTO;
import com.czg.market.dto.MkShopCouponRecordDTO;
import com.czg.market.entity.MkShopCouponRecord;
@@ -199,4 +200,15 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
public void deleteRecord(Long id) {
updateById(new MkShopCouponRecord().setId(id).setIsDel(1), true);
}
@Override
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO) {
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO().setCouponId(rewardCouponDTO.getCouponId())
.setShopId(shopId)
.setShopUserId(shopUser == null ? null : shopUser.getId())
.setSource("后台发放");
receiveCoupon(giftDTO, rewardCouponDTO.getNum(), false);
return true;
}
}