消费有礼
This commit is contained in:
parent
41b52c140a
commit
564865783a
@ -59,11 +59,15 @@ public class PayCenterController extends BaseController {
|
||||
**/
|
||||
@PostMapping("/cashRegisterSpendWisely")
|
||||
public ResponseObject cashRegisterSpendWisely(@RequestBody Map<String,String> map,HttpServletRequest request) throws Exception {
|
||||
map.put("storeId","157");
|
||||
map.put("userId","309");
|
||||
map.put("orderId","2012");
|
||||
logger.info("收银台获取可用优惠券参数:{}", map);
|
||||
return getSuccessResult("查询成功",payCenterService.cashRegisterSpendWisely(map));
|
||||
}
|
||||
|
||||
@PostMapping("/cashRegisterSpendWiselyApp")
|
||||
public ResponseObject cashRegisterSpendWiselyApp(@RequestBody Map<String,String> map,HttpServletRequest request) throws Exception {
|
||||
logger.info("收银台获取可用优惠券参数:{}", map);
|
||||
return getSuccessResult("查询成功",payCenterService.cashRegisterSpendWiselyApp(map));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -27,4 +27,6 @@ public interface PayCenterService {
|
||||
Object getCoupon(Map<String,String> map);
|
||||
|
||||
Object cashRegisterSpendWisely(Map<String,String> map);
|
||||
|
||||
Object cashRegisterSpendWiselyApp(Map<String,String> map);
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import com.fuint.module.AlipayApi.service.impl.AlipayServiceImpl1;
|
||||
import com.fuint.pay.service.PayCenterService;
|
||||
import com.fuint.pay.util.CheckUtil;
|
||||
import com.fuint.pay.vo.ActivityVO;
|
||||
import com.fuint.pay.vo.AppCardVO;
|
||||
import com.fuint.pay.vo.CouponVO;
|
||||
import com.fuint.pay.vo.GoodsVO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -69,6 +70,7 @@ import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class PayCenterServiceImpl implements PayCenterService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PayCenterServiceImpl.class);
|
||||
@ -485,12 +487,18 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
return rtnList;
|
||||
}
|
||||
|
||||
// 消费有礼 屎山代码
|
||||
// 消费有礼
|
||||
@Override
|
||||
public Object cashRegisterSpendWisely(Map<String, String> map) {
|
||||
// 订单id
|
||||
// 用户id
|
||||
// 店铺id
|
||||
// 返回 消费者 领取的东西 积分 成长值 优惠卷
|
||||
HashMap<String, Object> resMap = new HashMap<>();
|
||||
resMap.put("points", 0);
|
||||
resMap.put("growthValue", 0);
|
||||
resMap.put("carList", new ArrayList<AppCardVO>());
|
||||
|
||||
// 1.查询当前用户在当前店铺的 会员信息
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(Integer.parseInt(map.get("userId")), Integer.parseInt(map.get("storeId")));
|
||||
// 2.查询出 当前用户 在当前店铺 参与过的活动记录
|
||||
@ -540,7 +548,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
if (order.getShengshu() >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b1 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order);
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order,resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
@ -552,7 +560,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
if (order.getPayMoney() >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b2 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order);
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order,resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
@ -565,7 +573,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
if (order.getGoodsMoney() >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b3 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order);
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, order,resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
@ -687,14 +695,14 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
// 此活动上架 收银台可送 且 已领取 + 活动发放数量 < 总数量 且 未超过 总上限 当日上限
|
||||
if (card.getStatus().equals("1") &&
|
||||
card.getSySend().equals("1") &&
|
||||
card.getTfGetNum()+child.getGiftCardTotal() < card.getTfTotal() &&
|
||||
card.getTfGetNum() + child.getGiftCardTotal() < card.getTfTotal() &&
|
||||
list1.size() < card.getGetNumLimit() &&
|
||||
list2.count() < card.getDayGetLimit()) {
|
||||
// 将优惠卷 与 当前用户关联 并且 优惠卷 领取数量 + 方法数量
|
||||
card.setTfGetNum(card.getTfGetNum() + child.getGiftCardTotal());
|
||||
cardCouponService.updateById(card);
|
||||
|
||||
for (int i = 0; i <child.getGiftCardTotal() ; i++) {
|
||||
for (int i = 0; i < child.getGiftCardTotal(); i++) {
|
||||
CardCouponUser cardUser = new CardCouponUser();
|
||||
cardUser.setChainStoreId(invitationBalance.getChainStoreId());
|
||||
cardUser.setStoreId(invitationBalance.getStoreId());
|
||||
@ -738,8 +746,279 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object cashRegisterSpendWiselyApp(Map<String, String> map) {
|
||||
// 用户id userId
|
||||
// 店铺id storeId
|
||||
// 加油升数 liters
|
||||
// 订单金额 goodsMoney
|
||||
// 实收金额 payMoney
|
||||
// 支付方式 payType
|
||||
// 油品id oils
|
||||
Double liters = Double.valueOf(map.get("liters"));
|
||||
Double goodsMoney = Double.valueOf(map.get("goodsMoney"));
|
||||
Double payMoney = Double.valueOf(map.get("payMoney"));
|
||||
String payType = map.get("payType");
|
||||
String oils = map.get("oils");
|
||||
|
||||
|
||||
// 返回 消费者 领取的东西 积分 成长值 优惠卷
|
||||
HashMap<String, Object> resMap = new HashMap<>();
|
||||
resMap.put("points", 0);
|
||||
resMap.put("growthValue", 0);
|
||||
resMap.put("carList", new ArrayList<AppCardVO>());
|
||||
|
||||
|
||||
// 1.查询当前用户在当前店铺的 会员信息
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(Integer.parseInt(map.get("userId")), Integer.parseInt(map.get("storeId")));
|
||||
// 2.查询出 当前用户 在当前店铺 参与过的活动记录
|
||||
HashMap<String, Object> m1 = new HashMap<>();
|
||||
m1.put("user_id", map.get("userId"));
|
||||
m1.put("store_id", map.get("storeId"));
|
||||
List<ActiveConsumptionRecord> records = activeConsumptionRecordService.selectByMap(m1);
|
||||
// 3.查询出 当前店铺下 isonline=0 能用的所有活动 以及子活动对象
|
||||
HashMap<String, Object> m3 = new HashMap<>();
|
||||
m3.put("storeId", map.get("storeId"));
|
||||
m3.put("isonline", "0");
|
||||
List<ActiveConsumptionVOS> actives = activeConsumptionService.selectByMap(m3);
|
||||
// 4.查询出当前订单相关信息
|
||||
// AllOrderActivityVo order = allOrderInfoService.getOneByOrderId(Integer.parseInt(map.get("orderId")));
|
||||
// 先排除所有时间条件
|
||||
Date nowDate = new Date();
|
||||
//会员标签,会有多个,一个集和
|
||||
List<Integer> labelIdList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(userBalance.getUserLabelId())) {
|
||||
List<String> labelIdStrList = Arrays.asList(userBalance.getUserLabelId().split(StrUtil.COMMA));
|
||||
labelIdStrList.forEach(str -> labelIdList.add(Integer.parseInt(str)));
|
||||
}
|
||||
// 过滤
|
||||
List<ActiveConsumptionVOS> f1 = actives.stream()
|
||||
// 过滤支付方式
|
||||
.filter(active -> checkUtil.checkPayWay(payType, active.getPaymentType()))
|
||||
// 过滤 活动时间 以及 适用时间
|
||||
.filter(active -> this.checkTimeConsumptionPrex(active, nowDate))
|
||||
// 过滤会员标签
|
||||
.filter(active -> checkUtil.checkLabelId(active.getUserLabelIds(), labelIdList))
|
||||
// 过滤会员等级
|
||||
.filter(active -> checkUtil.checkGradeId(userBalance.getGradeId(), active.getDieselUserLevel()))
|
||||
// 过滤掉当前会员 没有参与次数的活动
|
||||
.filter(active -> checkUtil.checkRecordNum(active.getEveryDayCeiling(), active.getMonthlyCeiling(), active.getAccumulateCeiling(), records, active.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 然后根据过滤后的 活动主表 再去匹配子表
|
||||
for (ActiveConsumptionVOS active : f1) {
|
||||
|
||||
Boolean b1 = true;
|
||||
Boolean b2 = true;
|
||||
Boolean b3 = true;
|
||||
String str = "";
|
||||
for (ActiveConsumptionChild child : active.getActiveConsumptionChildList()) {
|
||||
// 先判断 订单是否包含油品 活动是否有油品活动 当前查询结果集的sql语句已经按照金额排序了 所以直接从头遍历即可 (并且保证一种活动类型 只能参与一次 并且是金额最高的一次)
|
||||
if (liters != null && child.getOrderType().equals("2") && b1 == true) {
|
||||
if (liters >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b1 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, null, resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
// 判断实收金额
|
||||
if (payMoney != null && child.getOrderType().equals("1") && b2 == true) {
|
||||
if (payMoney >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b2 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, null, resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 判断订单金额
|
||||
if (goodsMoney != null && child.getOrderType().equals("0") && b3 == true) {
|
||||
if (goodsMoney >= Double.parseDouble(child.getConsumeAmount())) {
|
||||
// 如果以上条件都满足那么用户成功参与了这个活动
|
||||
b3 = false;
|
||||
Boolean aBoolean = setActiveGift(child, userBalance, null, resMap);
|
||||
// 奖励发放成功 将此 活动奖励子表 id 拼接
|
||||
if (aBoolean) {
|
||||
str += child.getId() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 如果拼接后的 id 长度 >1 说明参与本活动了 新增 用户活动参与表
|
||||
if (str.length() > 1) {
|
||||
ActiveConsumptionRecord record = new ActiveConsumptionRecord();
|
||||
record.setActiveConsumptionId(active.getId());
|
||||
record.setUserId(userBalance.getMtUserId());
|
||||
record.setStoreId(userBalance.getStoreId());
|
||||
record.setActiveConsumptionChildIds(str);
|
||||
boolean save = activeConsumptionRecordService.save(record);
|
||||
}
|
||||
|
||||
}
|
||||
// 上面处理完 当前消费用户的赠送 下面处理 邀请人赠送
|
||||
HashMap<String, Object> m2 = new HashMap<>();
|
||||
m2.put("userId", userBalance.getMtUserId());
|
||||
m2.put("storeId", userBalance.getStoreId());
|
||||
MtInvitation invitation = mtInvitationService.getOneByMap(m2);
|
||||
// 当推荐人 不为null时 再去判断推荐人是否有资格参与活动
|
||||
if (invitation != null) {
|
||||
// 根据店铺id 和 邀请人id 查询出 邀请人会员信息
|
||||
UserBalance invitationBalance = userBalanceService.selectUserBalanceByStorId(invitation.getInviterId(), Integer.parseInt(map.get("storeId")));
|
||||
|
||||
|
||||
// 1.查询出推荐消费有礼 当前店铺下 isonline=0 能用的所有活动 以及子活动对象 active_user_consume
|
||||
HashMap<String, Object> m4 = new HashMap<>();
|
||||
m4.put("store_id", userBalance.getStoreId());
|
||||
m4.put("isonline", 0);
|
||||
List<ActiveUserConsume> activeUserConsumes = activeUserConsumeService.selectListByMap(m4);
|
||||
|
||||
// 2. 过滤 会员等级 支付方式 适用油品 这是针对消费者的条件
|
||||
List<ActiveUserConsume> f2 = activeUserConsumes.stream()
|
||||
// 过滤会员等级
|
||||
.filter(consume -> checkUtil.checkGradeId(userBalance.getGradeId(), consume.getUserGradeIds()))
|
||||
// 过滤 支付方式
|
||||
.filter(consume -> checkUtil.checkPayWay(payType, consume.getPaymentType()))
|
||||
// 过滤油品 order.oils f2.suit_oil_ids
|
||||
.filter(consume -> checkUtil.checkPayWay(oils, consume.getSuitOilIds()))
|
||||
// 过滤 活动时间
|
||||
.filter(consume -> this.checkTimeConsumptionPrex(consume, nowDate))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ActiveUserConsume active : f2) {
|
||||
// 先根据当前活动id 与 推荐人 id 查询历史参加次数
|
||||
HashMap<String, Object> m8 = new HashMap<>();
|
||||
m8.put("active_user_consume_id", active.getId());
|
||||
m8.put("store_id", Integer.parseInt(map.get("storeId")));
|
||||
// 这里指的是被邀请人id
|
||||
m8.put("user_id", invitationBalance.getMtUserId());
|
||||
List<ActiveUserConsumeRecords> r = (List<ActiveUserConsumeRecords>) activeUserConsumeRecordsService.listByMap(m8);
|
||||
// 活动领取次数 必须 > 领取过的次数
|
||||
if (active.getFrequencyLimit() > r.size()) {
|
||||
|
||||
// 无论是 参与积分 成长值 优惠券 都算参与活动
|
||||
Boolean b1 = false;
|
||||
// 积分不为空赠送积分
|
||||
if (active.getPoints() != null) {
|
||||
//
|
||||
invitationBalance.setPoints(invitationBalance.getPoints() + active.getPoints());
|
||||
userBalanceService.updateUserBalance(invitationBalance);
|
||||
// 新增积分变更记录表
|
||||
IntegralDetail i = new IntegralDetail();
|
||||
i.setUserId(invitationBalance.getMtUserId());
|
||||
i.setPointsChange(Double.valueOf(active.getPoints()));
|
||||
i.setCurrentPoints(invitationBalance.getPoints());
|
||||
i.setType("推荐消费有礼活动赠送");
|
||||
i.setStoreId(invitationBalance.getStoreId());
|
||||
i.setChangeType("1");
|
||||
i.setChainStoreId(invitationBalance.getChainStoreId());
|
||||
integralDetailService.insert(i);
|
||||
b1 = true;
|
||||
}
|
||||
|
||||
// 成长值不为空赠送成长值
|
||||
if (active.getGrowthValue() != null) {
|
||||
//
|
||||
invitationBalance.setGrowthValue(invitationBalance.getGrowthValue() + active.getGrowthValue());
|
||||
userBalanceService.updateUserBalance(invitationBalance);
|
||||
//
|
||||
GrowthValueChange g = new GrowthValueChange();
|
||||
g.setUserId(invitationBalance.getMtUserId());
|
||||
g.setChainStoreId(invitationBalance.getChainStoreId());
|
||||
g.setStoreId(invitationBalance.getStoreId());
|
||||
g.setChangeType("1");
|
||||
g.setFromType("推荐消费有礼活动赠送");
|
||||
g.setGrowthValue(active.getGrowthValue());
|
||||
g.setAfterTheChange(invitationBalance.getGrowthValue());
|
||||
int i = growthValueChangeService.insertGrowthValueChangeActive(g);
|
||||
b1 = true;
|
||||
}
|
||||
|
||||
// 优惠卷不为空 赠送优惠卷
|
||||
List<ActiveUserConsumeChild> list = activeUserConsumeChildService.selectByActiveUserConsumeId(active.getId());
|
||||
if (list.size() > 0) {
|
||||
|
||||
for (ActiveUserConsumeChild child : list) {
|
||||
// 优惠卷还得判断自身的活动限制 (因为这是 给某个用户 赠送某个优惠卷 只需要判断 每日每人领取上限 每人总领取上限 优惠卷数量不 <=0)
|
||||
HashMap<String, Object> m9 = new HashMap<>();
|
||||
m9.put("store_id", Integer.parseInt(map.get("storeId")));
|
||||
m9.put("mt_user_id", invitationBalance.getMtUserId());
|
||||
m9.put("card_coupon_id", child.getVouchersId());
|
||||
// 获取当前优惠卷信息
|
||||
CardCoupon card = cardCouponService.getById(child.getVouchersId());
|
||||
|
||||
// 获取 总的 当前用户 领取优惠卷的列表
|
||||
List<CardCouponUser> list1 = cardCouponUserService.selectByMap(m9);
|
||||
// 获取今天 领取次数
|
||||
Stream<CardCouponUser> list2 = list1.stream()
|
||||
.filter(cardCouponUser -> checkUtil.isBetween(cardCouponUser.getCreateTime(), DateUtil.getTodayMidnight(), DateUtil.getTomorrowMidnight()));
|
||||
|
||||
// 此活动上架 收银台可送 且 已领取 + 活动发放数量 < 总数量 且 未超过 总上限 当日上限
|
||||
if (card.getStatus().equals("1") &&
|
||||
card.getSySend().equals("1") &&
|
||||
card.getTfGetNum() + child.getGiftCardTotal() < card.getTfTotal() &&
|
||||
list1.size() < card.getGetNumLimit() &&
|
||||
list2.count() < card.getDayGetLimit()) {
|
||||
// 将优惠卷 与 当前用户关联 并且 优惠卷 领取数量 + 方法数量
|
||||
card.setTfGetNum(card.getTfGetNum() + child.getGiftCardTotal());
|
||||
cardCouponService.updateById(card);
|
||||
// 累加当前用户获得的优惠卷
|
||||
ArrayList<AppCardVO> carList = (ArrayList<AppCardVO>) resMap.get("carList");
|
||||
AppCardVO appCardVO = new AppCardVO();
|
||||
appCardVO.setType(card.getType());
|
||||
appCardVO.setNum(child.getGiftCardTotal());
|
||||
carList.add(appCardVO);
|
||||
|
||||
for (int i = 0; i < child.getGiftCardTotal(); i++) {
|
||||
CardCouponUser cardUser = new CardCouponUser();
|
||||
cardUser.setChainStoreId(invitationBalance.getChainStoreId());
|
||||
cardUser.setStoreId(invitationBalance.getStoreId());
|
||||
cardUser.setMtUserId(invitationBalance.getMtUserId());
|
||||
// 手机号码 需要连表 空着
|
||||
cardUser.setFromType("3");
|
||||
cardUser.setActiveId(child.getActiveUserConsumeId());
|
||||
cardUser.setCardCouponId(child.getVouchersId());
|
||||
cardUser.setStartTime(card.getEffectiveDateStart());
|
||||
cardUser.setEndTime(card.getEffectiveDateEnd());
|
||||
cardUser.setStatus("0");
|
||||
cardCouponUserService.save(cardUser);
|
||||
}
|
||||
b1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b1) {
|
||||
// 新增活动关系表
|
||||
ActiveUserConsumeRecords userRecord = new ActiveUserConsumeRecords();
|
||||
userRecord.setActiveUserConsumeId(active.getId()); //活动id
|
||||
userRecord.setStoreId(Integer.parseInt(map.get("storeId"))); // 店铺id
|
||||
userRecord.setUserId(String.valueOf(invitationBalance.getMtUserId())); // 邀请人id
|
||||
userRecord.setInviteeUserId(String.valueOf(userBalance.getMtUserId())); // 被邀请人id
|
||||
userRecord.setRemark("推荐消费有礼");
|
||||
// 被邀请人姓名 需要连表 先空着
|
||||
boolean save = activeUserConsumeRecordsService.save(userRecord);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 根据不同的 活动赠送 0:赠送积分1:赠送优惠券 2. 赠送兑换券 3:赠送成长值 4. 赠送实物 处理不同的业务逻辑
|
||||
private Boolean setActiveGift(ActiveConsumptionChild child, UserBalance userBalance, AllOrderActivityVo order) {
|
||||
private Boolean setActiveGift(ActiveConsumptionChild child, UserBalance userBalance, AllOrderActivityVo order, HashMap<String, Object> resMap) {
|
||||
Boolean b1 = false;
|
||||
if (child.getActiveGift().equals("0")) {
|
||||
//
|
||||
@ -755,7 +1034,8 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
i.setChangeType("1");
|
||||
i.setChainStoreId(userBalance.getChainStoreId());
|
||||
integralDetailService.insert(i);
|
||||
|
||||
// 需要计算叠加 转Integer
|
||||
resMap.put("points", Integer.parseInt(resMap.get("points").toString()) + Integer.parseInt(child.getGivePoints()));
|
||||
b1 = true;
|
||||
return b1;
|
||||
}
|
||||
@ -774,8 +1054,12 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
g.setGrowthValue(Integer.parseInt(child.getGiveGrowthValue()));
|
||||
// 成长变化后的值
|
||||
g.setAfterTheChange(userBalance.getGrowthValue());
|
||||
g.setOrderNo(order.getOrderNo());
|
||||
if (order != null) {
|
||||
g.setOrderNo(order.getOrderNo());
|
||||
}
|
||||
int i = growthValueChangeService.insertGrowthValueChangeActive(g);
|
||||
// 需要计算叠加
|
||||
resMap.put("growthValue", Integer.parseInt(resMap.get("growthValue").toString()) + Integer.parseInt(child.getGiveGrowthValue()));
|
||||
b1 = true;
|
||||
return b1;
|
||||
}
|
||||
@ -794,9 +1078,9 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
.filter(cardCouponUser -> checkUtil.isBetween(cardCouponUser.getCreateTime(), DateUtil.getTodayMidnight(), DateUtil.getTomorrowMidnight()));
|
||||
|
||||
// 此 优惠卷 上架 收银台可送 且 活动发放数量+已领取 < 总数量 且 未超过 总上限 当日上限 先都判断一下不为 null 防止空指针
|
||||
card.setTfGetNum( (card.getTfGetNum() == null) ? 0 : card.getTfGetNum());
|
||||
card.setTfGetNum((card.getTfGetNum() == null) ? 0 : card.getTfGetNum());
|
||||
|
||||
if ( card.getStatus().equals("1") &&
|
||||
if (card.getStatus().equals("1") &&
|
||||
card.getSySend().equals("1") &&
|
||||
(child.getGiftCardTotal() + card.getTfGetNum()) < card.getTfTotal() &&
|
||||
list1.size() < card.getGetNumLimit() &&
|
||||
@ -804,7 +1088,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
) {
|
||||
|
||||
// 将优惠卷 与 当前用户关联 并且 优惠卷 领取数量 + 活动设定赠送优惠卷数量
|
||||
card.setTfGetNum(card.getTfGetNum()+child.getGiftCardTotal());
|
||||
card.setTfGetNum(card.getTfGetNum() + child.getGiftCardTotal());
|
||||
cardCouponService.updateById(card);
|
||||
// 并且 循环 添加多张优惠卷与用户领取记录表
|
||||
for (int i = 0; i < child.getGiftCardTotal(); i++) {
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.pay.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppCardVO {
|
||||
// 卡类型
|
||||
private String type;
|
||||
// 卡数量
|
||||
private Integer num;
|
||||
}
|
Loading…
Reference in New Issue
Block a user