更新9.21

This commit is contained in:
许允枞 2024-09-21 14:21:08 +08:00
parent ca6c095895
commit 14f7e66ffc
3 changed files with 44 additions and 0 deletions

View File

@ -243,5 +243,15 @@ public class CardGiftController extends BaseController {
public ResponseObject countGiftValue(CardGift cardGift) {
return getSuccessResult(this.cardGiftService.countGiftValue(cardGift));
}
/**
* 根据卡号和卡密获取礼品卡面值
* @param cardGift
* @return
*/
@GetMapping("getCardAmount")
public ResponseObject getCardAmount(CardGift cardGift){
return getSuccessResult(this.cardGiftService.getCardAmount(cardGift));
}
}

View File

@ -66,5 +66,12 @@ public interface CardGiftService extends IService<CardGift> {
List<CardGift> selectGiftValue(CardGift cardGift);
List<Map<String,Integer>> countGiftValue(CardGift cardGift);
/**
* 获取礼品卡面值
* @param cardGift
* @return
*/
Double getCardAmount(CardGift cardGift);
}

View File

@ -1,5 +1,7 @@
package com.fuint.business.marketingActivity.cardGift.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcelFactory;
import com.alipay.api.domain.LoginUserDTO;
@ -318,5 +320,30 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
cardGift.setStoreId(nowAccountInfo.getStoreId());
return cardGiftMapper.countGiftValue(cardGift);
}
/**
* 获取礼品卡面值
*
* @param cardGift
* @return
*/
@Override
public Double getCardAmount(CardGift cardGift) {
if (ObjectUtil.isEmpty(cardGift.getNumber()) && ObjectUtil.isEmpty(cardGift.getCardPassword())){
throw new RuntimeException("请输入卡号或卡密");
}
DateTime now = DateUtil.date();
CardGift cardGift1 = cardGiftMapper.selectOne(new LambdaQueryWrapper<CardGift>()
.eq(CardGift::getNumber, cardGift.getNumber())
.eq(CardGift::getCardPassword, cardGift.getCardPassword())
.eq(CardGift::getStoreId, cardGift.getStoreId())
.eq(CardGift::getUseStatus, 0)
.le(CardGift::getEffectiveTimeStart, now)
.ge(CardGift::getEffectiveTimeEnd, now));
if (ObjectUtil.isEmpty(cardGift1)) {
throw new RuntimeException("卡号或卡密不存在或已过期");
}
return cardGift1.getCardAmount();
}
}