This commit is contained in:
齐天大圣 2024-04-10 22:27:32 +08:00
parent a4a07e39b7
commit c5c7d7c7f5
4 changed files with 28 additions and 9 deletions

View File

@ -515,7 +515,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
} else {
activeDiscountVOList.add(activeDiscountPayVO);
}
}
}
//折扣无限制

View File

@ -46,6 +46,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -271,7 +272,7 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
//优惠券的数量
Integer count = cardFavorable.getCount();
if (count < 1){
throw new Exception("优惠券已领完");
return true;
}
//优惠券开始结束时间
if (ObjectUtils.isNotEmpty(cardFavorable) && ObjectUtils.isNotEmpty(cardFavorable.getTimeType())) {
@ -283,20 +284,25 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
cardFavorableRecord.setEndTime(from);
} else if (cardFavorable.getTimeType().equals("1")) {
cardFavorableRecord.setStartTime(cardFavorable.getEffectiveDate());
LocalDate today = LocalDate.now();
Date effectiveDate = cardFavorable.getEffectiveDate();
LocalDate today = effectiveDate.toInstant().atOffset(ZoneOffset.UTC).toLocalDate();
// LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardFavorable.getValidityOne());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setEndTime(from);
} else {
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardFavorable.getValidityTwo());
LocalDate localDates = today.plusDays(Integer.parseInt(cardFavorable.getValidityDay()));
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant());
LocalDate todays = froms.toInstant().atOffset(ZoneOffset.UTC).toLocalDate();
LocalDate localDate = todays.plusDays(cardFavorable.getValidityTwo());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setStartTime(froms);
cardFavorableRecord.setEndTime(from);
cardFavorable.setCount(count-1);
}
cardFavorable.setCount(count-1);
}
}
cardFavorableService.updateById(cardFavorable);
@ -412,6 +418,7 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId());
cardFavorableRecord.setName(userInfo.getName());
cardFavorableRecord.setMobile(userInfo.getMobile());
cardFavorableRecord.setMtUserId(userInfo.getId());
cardFavorableRecord.setStatus("0");
cardFavorableRecord.setExchangeFrom("店铺一键送券!");
flag = addCardFavorableRecord(cardFavorableRecord);

View File

@ -298,9 +298,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
cardFavorable.setInstruction("消费可用!");
String exclusive = "";
List<String> exclusiveFunctionList = cardFavorableDTO.getExclusiveFunctionList();
for (String s : exclusiveFunctionList) {
exclusive += s + ',';
if (ObjectUtils.isNotEmpty(exclusiveFunctionList)){
for (String s : exclusiveFunctionList) {
exclusive += s + ',';
}
}
cardFavorable.setExclusiveFunction(exclusive);
return updateById(cardFavorable);
}

View File

@ -69,7 +69,9 @@ import io.lettuce.core.dynamic.annotation.Param;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.redisson.api.RLock;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -817,7 +819,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
return true;
}
/**
* 储值卡充值后续处理
* @param orderNo
@ -915,6 +916,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (CollectionUtils.isNotEmpty(cardValueVouchers)) {
for (CardFavorable cardValueVoucher : cardValueVouchers) {
if (ObjectUtils.isNotEmpty(cardValueVoucher)){
//优惠券的数量
Integer count = cardValueVoucher.getCount();
if (count < 1){
continue;
}
cardValueOrders.setCardFavorableId(cardValueVoucher.getId());
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(cardValueVoucher.getId());
@ -954,6 +960,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
}else {
cardFavorableRecord.setDiscountAmount(cardValueVoucher.getDiscountAmount());
}
CardFavorable cardFavorable = new CardFavorable();
BeanUtils.copyProperties(cardValueVoucher,cardFavorable);
cardFavorable.setCount(count-1);
cardFavorableService.updateById(cardFavorable);
cardFavorableRecordService.save(cardFavorableRecord);
}
/*