From 9e46716280d4c96405fc132396b02ba21e902f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Wed, 24 Apr 2024 13:29:48 +0800 Subject: [PATCH] bug --- .../impl/ActiveDiscountServiceImpl.java | 6 +++++ .../vo/ActiveDiscountPayVO.java | 1 + .../impl/ActiveExchangeServiceImpl.java | 16 +++++++++---- .../impl/ActiveFullminusServiceImpl.java | 9 ++++++++ .../impl/CardFavorableRecordServiceImpl.java | 23 +++++++++++++++++++ .../business/order/mapper/OilOrderMapper.java | 8 +++---- .../order/mapper/xml/OilOrderMapper.xml | 20 +++++++++++----- 7 files changed, 68 insertions(+), 15 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java index 075eab2fc..759b4f2af 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/service/impl/ActiveDiscountServiceImpl.java @@ -98,6 +98,9 @@ public class ActiveDiscountServiceImpl extends ServiceImpl activeDiscountVOList = new ArrayList<>(); //折扣有限制 - List activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + List activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); //会员日筛选 for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOListss) { //周 @@ -518,7 +518,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } } //折扣无限制 - List activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + List activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); //会员日筛选 for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOLists) { //周 @@ -542,7 +542,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { //activeDiscountVOList.addAll(activeDiscountVOLists); ArrayList activeFuletVOList = new ArrayList<>(); //满减有限制 - List activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + List activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); //会员日筛选 for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOListss) { //周 @@ -564,7 +564,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } } //满减无限制 - List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); //会员日筛选 for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOLists) { //周 @@ -857,7 +857,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } else { String gasolineRule = ljUserGrade.getGasolineRule(); List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); + ArrayList jsonObjects1 = new ArrayList<>(); + for (JSONObject jsonObject : jsonObjects) { + if (paymentActiveDTO.getAmount().compareTo(jsonObject.getBigDecimal("gasolineRule1")) >= 0){ + jsonObjects1.add(jsonObject); + } + } + JSONObject jsonObject = jsonObjects1.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1"); if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) { //升数 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java index c2b8fdc83..d65991a25 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminus/service/impl/ActiveFullminusServiceImpl.java @@ -82,6 +82,7 @@ public class ActiveFullminusServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CardFavorableRecord::getMtUserId,mtUserId); + queryWrapper.eq(CardFavorableRecord::getCardFavorableId,cardFavorable.getId()); + List cardFavorableRecordList = cardFavorableRecordMapper.selectList(queryWrapper); + if (ObjectUtils.isNotEmpty(cardFavorableRecordList)){ + return true; + } + }else { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(CardFavorableRecord::getMtUserId,mtUserId); + queryWrapper1.eq(CardFavorableRecord::getCardFavorableId,cardFavorable.getId()); + queryWrapper1.ge(CardFavorableRecord::getCreateTime, LocalDate.now().atStartOfDay()) + .le(CardFavorableRecord::getCreateTime, LocalDate.now().atTime(LocalTime.MAX)); + List cardFavorableRecordList = cardFavorableRecordMapper.selectList(queryWrapper1); + if (ObjectUtils.isNotEmpty(cardFavorableRecordList)){ + return true; + } + } if (ObjectUtils.isNotEmpty(cardFavorable)){ //优惠券的数量 Integer count = cardFavorable.getCount(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java index 1a52e4042..fea6969ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/OilOrderMapper.java @@ -92,8 +92,8 @@ public interface OilOrderMapper extends BaseMapper { * @param amount * @return */ - List selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId); - List selectActiveDiscounts(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId); + List selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId); + List selectActiveDiscounts(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId); /** * 满减 @@ -101,8 +101,8 @@ public interface OilOrderMapper extends BaseMapper { * @param amount * @return */ - List selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId); - List selectActiveFules(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId); + List selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId); + List selectActiveFules(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId); /** * 消费有礼 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml index 31c976ecc..0156bcd33 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml @@ -367,7 +367,8 @@ ad.month_day monthDay, ad.member_day_type memberDayType, max((case ad.store_id when ${storeId} then adc.amount * (1-(adc.discount * 0.1)) - end)) as discount + end)) as discount, + count( adr.id ) sidsss FROM active_discount ad LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id @@ -381,7 +382,7 @@ AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%') AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%') GROUP BY ad.id - HAVING IFNULL(sum(adr.id),0) limitAcount + HAVING sidsss limitAcount