This commit is contained in:
齐天大圣 2024-03-11 13:11:54 +08:00
parent 0f7ba19407
commit 13eef7e362

View File

@ -486,29 +486,101 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek();
String displayName = dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault());
//获取今天是几号
LocalDate now = LocalDate.now();
String day = now.getDayOfMonth()+"";
ArrayList<ActiveDiscountPayVO> activeDiscountVOList = new ArrayList<>();
//折扣有限制
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
List<ActiveDiscountPayVO> activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOListss) {
//
if (activeDiscountPayVO.getMemberDayType().equals("1")) {
String weekDay = activeDiscountPayVO.getWeekDay();
if (weekDay.contains(displayName)) {
activeDiscountVOList.add(activeDiscountPayVO);
} else if (activeDiscountPayVO.getMemberDayType().equals("2")) {
String[] split = activeDiscountPayVO.getMonthDay().split(",");
for (String s : split) {
if (day.equals(s)){
activeDiscountVOList.add(activeDiscountPayVO);
}
}
} else {
activeDiscountVOList.add(activeDiscountPayVO);
}
//
}
}
//折扣无限制
List<ActiveDiscountPayVO> activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
activeDiscountVOList.addAll(activeDiscountVOLists);
//满减有限制
List<ActiveDiscountPayVO> activeFuletVOList = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOLists) {
//
if (activeDiscountPayVO.getMemberDayType().equals("1")) {
String weekDay = activeDiscountPayVO.getWeekDay();
if (weekDay.contains(displayName)) {
activeDiscountVOList.add(activeDiscountPayVO);
} else if (activeDiscountPayVO.getMemberDayType().equals("2")) {
String[] split = activeDiscountPayVO.getMonthDay().split(",");
for (String s : split) {
if (day.equals(s)){
activeDiscountVOList.add(activeDiscountPayVO);
}
}
} else {
activeDiscountVOList.add(activeDiscountPayVO);
}
}
}
//activeDiscountVOList.addAll(activeDiscountVOLists);
ArrayList<ActiveDiscountPayVO> activeFuletVOList = new ArrayList<>();
//满减有限制
List<ActiveDiscountPayVO> activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOListss) {
//
if (activeDiscountPayVO.getMemberDayType().equals("1")) {
String weekDay = activeDiscountPayVO.getWeekDay();
if (weekDay.contains(displayName)) {
activeFuletVOList.add(activeDiscountPayVO);
} else if (activeDiscountPayVO.getMemberDayType().equals("2")) {
String[] split = activeDiscountPayVO.getMonthDay().split(",");
for (String s : split) {
if (day.equals(s)){
activeFuletVOList.add(activeDiscountPayVO);
}
}
} else {
activeFuletVOList.add(activeDiscountPayVO);
}
}
}
//满减无限制
List<ActiveDiscountPayVO> activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
activeFuletVOList.addAll(activeFuletVOLists);
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOLists) {
//
if (activeDiscountPayVO.getMemberDayType().equals("1")) {
String weekDay = activeDiscountPayVO.getWeekDay();
if (weekDay.contains(displayName)) {
activeFuletVOList.add(activeDiscountPayVO);
} else if (activeDiscountPayVO.getMemberDayType().equals("2")) {
String[] split = activeDiscountPayVO.getMonthDay().split(",");
for (String s : split) {
if (day.equals(s)){
activeFuletVOList.add(activeDiscountPayVO);
}
}
} else {
activeFuletVOList.add(activeDiscountPayVO);
}
}
}
//activeFuletVOList.addAll(activeFuletVOLists);
//优惠券
paymentActiveDTO.setUserId(userId);
if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())) {