diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java index c3996d892..c5cd630ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscount/vo/ActiveDiscountPayVO.java @@ -29,6 +29,7 @@ public class ActiveDiscountPayVO implements Serializable { private String participationCondition; //优惠券id private Integer couponId; + private Integer limitAcount; //优惠券金额 private BigDecimal cardFavorableAmount; //优惠券信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index 46ead3685..775c44903 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -23,6 +23,8 @@ import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionV import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO; import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO; +import com.fuint.business.marketingActivity.activeDiscountRecords.entity.ActiveDiscountRecords; +import com.fuint.business.marketingActivity.activeDiscountRecords.service.ActiveDiscountRecordsService; import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO; import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO; import com.fuint.business.marketingActivity.activeExchange.dto.TransferDTO; @@ -31,6 +33,8 @@ import com.fuint.business.marketingActivity.activeExchange.vo.*; import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullminus; import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService; import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusAppletVO; +import com.fuint.business.marketingActivity.activeFullminusRecords.entity.ActiveFullminusRecords; +import com.fuint.business.marketingActivity.activeFullminusRecords.service.ActiveFullminusRecordsService; import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsAppletVO; import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService; @@ -72,6 +76,7 @@ import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -91,6 +96,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; @Service +@Slf4j public class ActiveExchangeServiceImpl implements ActiveExchangeService { @Resource @@ -138,6 +144,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { private ActiveConsumptionChildService activeConsumptionChildService; @Resource private CardFuelDieselService cardFuelDieselService; + @Resource + private ActiveFullminusRecordsService activeFullminusRecordsService; + @Resource + private ActiveDiscountRecordsService activeDiscountRecordsService; /** * 分页查询所有 @@ -490,21 +500,52 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { //获取今日是周几 DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); String displayName = dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault()); + if (displayName.equals("Friday")){ + displayName = "星期五"; + }else if (displayName.equals("Saturday")){ + displayName = "星期六"; + }else if (displayName.equals("Sunday")){ + displayName = "星期日"; + }else if (displayName.equals("Monday")){ + displayName = "星期一"; + }else if (displayName.equals("Tuesday")){ + displayName = "星期二"; + }else if (displayName.equals("Wednesday")){ + displayName = "星期三"; + }else if (displayName.equals("Thursday")){ + displayName = "星期四"; + } + log.info("504:获取今日是周几:"+displayName); //获取今天是几号 LocalDate now = LocalDate.now(); String day = now.getDayOfMonth()+""; ArrayList activeDiscountVOList = new ArrayList<>(); + ArrayList activeDiscountVOListss = new ArrayList<>(); //折扣有限制 - List activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + List activeDiscountVOListssss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + + for (ActiveDiscountPayVO discountV : activeDiscountVOListssss) { + Integer activeId = discountV.getActiveId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveDiscountRecords::getActiveDiscountId, activeId); + queryWrapper.eq(ActiveDiscountRecords::getUserId, paymentActiveDTO.getUserId()); + List list = activeDiscountRecordsService.list(queryWrapper); + if (list.size() activeDiscountVOLists = new ArrayList<>(); //折扣无限制 - List activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + List activeDiscountVOLis = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + + for (ActiveDiscountPayVO discountV : activeDiscountVOLis) { + Integer activeId = discountV.getActiveId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveDiscountRecords::getActiveDiscountId, activeId); + queryWrapper.eq(ActiveDiscountRecords::getUserId, paymentActiveDTO.getUserId()); + List list = activeDiscountRecordsService.list(queryWrapper); + if (list.size() activeFuletVOList = new ArrayList<>(); + ArrayList activeFuletVOListss = new ArrayList<>(); //满减有限制 - List activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + List activeFuletVOListsss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + for (ActiveDiscountPayVO fuletVOListss : activeFuletVOListsss) { + Integer activeId = fuletVOListss.getActiveId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveFullminusRecords::getActiveFullminusId, activeId); + queryWrapper.eq(ActiveFullminusRecords::getUserId, paymentActiveDTO.getUserId()); + List list = activeFullminusRecordsService.list(queryWrapper); + if (list.size() activeFuletVOLists = new ArrayList<>(); //满减无限制 - List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + List activeFuletVOListssss = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId()); + for (ActiveDiscountPayVO fuletVOList : activeFuletVOListssss) { + Integer activeId = fuletVOList.getActiveId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveFullminusRecords::getActiveFullminusId, activeId); + queryWrapper.eq(ActiveFullminusRecords::getUserId, paymentActiveDTO.getUserId()); + List list = activeFullminusRecordsService.list(queryWrapper); + if (list.size() o.getDouble("gasolineRule2"))).get(); - BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1"); - if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) { - //升数 - Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2"); - BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); - paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + if (ObjectUtils.isNotEmpty(jsonObjects1)){ + JSONObject jsonObject = jsonObjects1.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); + BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1"); + if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) { + //升数 + Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2"); + BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); + paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + } } } } 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 0156bcd33..0750415da 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,8 +367,7 @@ 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, - count( adr.id ) sidsss + end)) as discount FROM active_discount ad LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id @@ -382,7 +381,6 @@ AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%') AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%') GROUP BY ad.id - HAVING sidsss limitAcount