From 8e6cb5413b26d66f8942ce3421479da41d41196d 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: Mon, 11 Mar 2024 10:45:22 +0800 Subject: [PATCH] bug --- .../vo/ActiveDiscountPayVO.java | 6 + .../impl/ActiveExchangeServiceImpl.java | 949 +++++++++--------- .../service/ActiveNewlywedsService.java | 2 +- .../ActiveNewlywedsRecordsServiceImpl.java | 93 +- .../impl/ActiveNewlywedsServiceImpl.java | 50 +- .../CardExchangeRecordController.java | 3 + .../mapper/xml/CardFavorableRecordMapper.xml | 4 - 7 files changed, 574 insertions(+), 533 deletions(-) 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 be78dbfac..a4d110c5b 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 @@ -33,4 +33,10 @@ public class ActiveDiscountPayVO implements Serializable { private BigDecimal cardFavorableAmount; //优惠券信息 private String cardFavorableInfo; + //会员日类型 1:周 2:月 + private String memberDayType; + //每周的会员日 + private String weekDay; + //每月的会员日 + private String monthDay; } 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 2a5848746..82e53104c 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 @@ -81,6 +81,9 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.format.TextStyle; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -133,44 +136,46 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { private ActiveConsumptionChildService activeConsumptionChildService; @Resource private CardFuelDieselService cardFuelDieselService; + /** * 分页查询所有 + * * @param * @param cardExchangeRecord * @return */ @Override - public List select(Integer pageNo,Integer pageSize, CardExchangeRecord cardExchangeRecord) { + public List select(Integer pageNo, Integer pageSize, CardExchangeRecord cardExchangeRecord) { //兑换券 LambdaQueryWrapper exchangeRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); - if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){ - exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getMobile,cardExchangeRecord.getMobile()); + if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())) { + exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getMobile, cardExchangeRecord.getMobile()); } - if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())){ - exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getTicketCode,cardExchangeRecord.getTicketCode()); + if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())) { + exchangeRecordLambdaQueryWrapper.eq(CardExchangeRecord::getTicketCode, cardExchangeRecord.getTicketCode()); } List cardExchangeRecordList = cardExchangeRecordService.list(exchangeRecordLambdaQueryWrapper); //封装兑换券vo - List activeExchangeRecordVOList = cardExchangeRecordList.stream().map(s->{ + List activeExchangeRecordVOList = cardExchangeRecordList.stream().map(s -> { ActiveExchangeRecordVO activeExchangeRecordVO = new ActiveExchangeRecordVO(); - BeanUtils.copyProperties(s,activeExchangeRecordVO); + BeanUtils.copyProperties(s, activeExchangeRecordVO); activeExchangeRecordVO.setCardType("1"); return activeExchangeRecordVO; }).collect(Collectors.toList()); //优惠券 LambdaQueryWrapper cardFavorableRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); - if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){ - cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getMobile,cardExchangeRecord.getMobile()); + if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())) { + cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getMobile, cardExchangeRecord.getMobile()); } - if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())){ - cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getTicketCode,cardExchangeRecord.getTicketCode()); + if (ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())) { + cardFavorableRecordLambdaQueryWrapper.eq(CardFavorableRecord::getTicketCode, cardExchangeRecord.getTicketCode()); } List cardFavorableRecordList = cardFavorableRecordService.list(cardFavorableRecordLambdaQueryWrapper); //封装兑换券vo - List activeExchangeRecordVOList1 = cardFavorableRecordList.stream().map(s->{ + List activeExchangeRecordVOList1 = cardFavorableRecordList.stream().map(s -> { ActiveExchangeRecordVO activeExchangeRecordVO1 = new ActiveExchangeRecordVO(); - BeanUtils.copyProperties(s,activeExchangeRecordVO1); + BeanUtils.copyProperties(s, activeExchangeRecordVO1); activeExchangeRecordVO1.setCardType("0"); return activeExchangeRecordVO1; }).collect(Collectors.toList()); @@ -182,7 +187,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { //自定义分页 Integer count = collect.size(); // 记录总数 Integer pageCount = 0; // 页数 - if (count % pageSize == 0) { + if (count % pageSize == 0) { pageCount = count / pageSize; } else { pageCount = count / pageSize + 1; @@ -203,6 +208,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { /** * 核销卡券 + * * @param activeExchangeRecordDTO * @return */ @@ -211,14 +217,14 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { public boolean updateOneById(ActiveExchangeRecordDTO activeExchangeRecordDTO) { boolean update = false; //核销优惠券 - if (ObjectUtils.isNotEmpty(activeExchangeRecordDTO) && activeExchangeRecordDTO.getCardType().equals("0")){ + if (ObjectUtils.isNotEmpty(activeExchangeRecordDTO) && activeExchangeRecordDTO.getCardType().equals("0")) { CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - BeanUtils.copyProperties(activeExchangeRecordDTO,cardFavorableRecord); + BeanUtils.copyProperties(activeExchangeRecordDTO, cardFavorableRecord); update = cardFavorableRecordService.updateById(cardFavorableRecord); - }else { + } else { //核销兑换券 CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); - BeanUtils.copyProperties(activeExchangeRecordDTO,cardExchangeRecord); + BeanUtils.copyProperties(activeExchangeRecordDTO, cardExchangeRecord); update = cardExchangeRecordService.updateById(cardExchangeRecord); } return update; @@ -226,6 +232,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { /** * 查询满减活动 + * * @param pageNo * @param pageSize * @param transferDTO @@ -236,9 +243,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { ArrayList maxoutVOArrayList = new ArrayList<>(); //构造满减券查询条件 LambdaQueryWrapper fullminusLambdaQueryWrapper = new LambdaQueryWrapper<>(); - fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStoreId,transferDTO.getStoreId()); - fullminusLambdaQueryWrapper.eq(ActiveFullminus::getIsonline,0); - fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStatus,0); + fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStoreId, transferDTO.getStoreId()); + fullminusLambdaQueryWrapper.eq(ActiveFullminus::getIsonline, 0); + fullminusLambdaQueryWrapper.eq(ActiveFullminus::getStatus, 0); fullminusLambdaQueryWrapper.orderByDesc(ActiveFullminus::getCreateTime); List activeFullminusList = activeFullminusService.list(fullminusLambdaQueryWrapper); for (ActiveFullminus activeFullminus : activeFullminusList) { @@ -247,28 +254,28 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { String[] split = activeFullminus.getDieselUserLevel().split(","); for (String s : split) { if (transferDTO.getGradeId().equals(Integer.parseInt(s))) { - if (/*activeFullminus.getDieselUserLevel().contains(String.valueOf(userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId())) &&*/ - activeFullminus.getAdaptOil().contains(String.valueOf(transferDTO.getOilName())) && - activeFullminus.getActiveStartTime().getTime() <= new Date().getTime() && - new Date().getTime() <= activeFullminus.getActiveEndTime().getTime()) { - BeanUtils.copyProperties(activeFullminus, maxoutVO); - LambdaQueryWrapper queryWrappers = new LambdaQueryWrapper<>(); - queryWrappers.eq(ActiveDiscountChild::getActiveFullminusId, activeFullminus.getId()); - //判断符合金额 - queryWrappers.le(ActiveDiscountChild::getAmount, transferDTO.getOilPrice() * transferDTO.getOilLiters()); - queryWrappers.orderByDesc(ActiveDiscountChild::getAmount); - maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers)); - maxoutVOArrayList.add(maxoutVO); + if (/*activeFullminus.getDieselUserLevel().contains(String.valueOf(userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId())) &&*/ + activeFullminus.getAdaptOil().contains(String.valueOf(transferDTO.getOilName())) && + activeFullminus.getActiveStartTime().getTime() <= new Date().getTime() && + new Date().getTime() <= activeFullminus.getActiveEndTime().getTime()) { + BeanUtils.copyProperties(activeFullminus, maxoutVO); + LambdaQueryWrapper queryWrappers = new LambdaQueryWrapper<>(); + queryWrappers.eq(ActiveDiscountChild::getActiveFullminusId, activeFullminus.getId()); + //判断符合金额 + queryWrappers.le(ActiveDiscountChild::getAmount, transferDTO.getOilPrice() * transferDTO.getOilLiters()); + queryWrappers.orderByDesc(ActiveDiscountChild::getAmount); + maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers)); + maxoutVOArrayList.add(maxoutVO); + } } } - } } //构造折扣券查询条件 LambdaQueryWrapper discountLambdaQueryWrapper = new LambdaQueryWrapper<>(); - discountLambdaQueryWrapper.eq(ActiveDiscount::getStoreId,transferDTO.getStoreId()); - discountLambdaQueryWrapper.eq(ActiveDiscount::getIsonline,0); - discountLambdaQueryWrapper.eq(ActiveDiscount::getStatus,0); + discountLambdaQueryWrapper.eq(ActiveDiscount::getStoreId, transferDTO.getStoreId()); + discountLambdaQueryWrapper.eq(ActiveDiscount::getIsonline, 0); + discountLambdaQueryWrapper.eq(ActiveDiscount::getStatus, 0); discountLambdaQueryWrapper.orderByDesc(ActiveDiscount::getCreateTime); //符合油号判断 List activeDiscountList = activeDiscountService.list(discountLambdaQueryWrapper); @@ -277,22 +284,22 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { MaxoutVO maxoutVO = new MaxoutVO(); String[] split = activeDiscount.getDieselUserLevel().split(","); for (String s : split) { - if(transferDTO.getGradeId().equals(Integer.parseInt(s))){ + if (transferDTO.getGradeId().equals(Integer.parseInt(s))) { - // 会员等级判断、符合油号判断 - if (activeDiscount.getDieselUserLevel().contains(String.valueOf(userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId())) && - activeDiscount.getAdaptOil().contains(String.valueOf(transferDTO.getOilName()))&& - activeDiscount.getActiveStartTime().getTime()<=new Date().getTime() && - new Date().getTime()<=activeDiscount.getActiveEndTime().getTime()){ - BeanUtils.copyProperties(activeDiscount,maxoutVO); - LambdaQueryWrapper queryWrappers = new LambdaQueryWrapper<>(); - queryWrappers.eq(ActiveDiscountChild::getActiveDiscountId,activeDiscount.getId()); - //判断符合金额 - queryWrappers.le(ActiveDiscountChild::getAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters()); - queryWrappers.orderByDesc(ActiveDiscountChild::getAmount); - maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers)); - maxoutVOArrayList.add(maxoutVO); - } + // 会员等级判断、符合油号判断 + if (activeDiscount.getDieselUserLevel().contains(String.valueOf(userGradeService.selectUserGradeById(transferDTO.getGradeId()).getId())) && + activeDiscount.getAdaptOil().contains(String.valueOf(transferDTO.getOilName())) && + activeDiscount.getActiveStartTime().getTime() <= new Date().getTime() && + new Date().getTime() <= activeDiscount.getActiveEndTime().getTime()) { + BeanUtils.copyProperties(activeDiscount, maxoutVO); + LambdaQueryWrapper queryWrappers = new LambdaQueryWrapper<>(); + queryWrappers.eq(ActiveDiscountChild::getActiveDiscountId, activeDiscount.getId()); + //判断符合金额 + queryWrappers.le(ActiveDiscountChild::getAmount, transferDTO.getOilPrice() * transferDTO.getOilLiters()); + queryWrappers.orderByDesc(ActiveDiscountChild::getAmount); + maxoutVO.setActiveDiscountChildList(activeDiscountChildService.list(queryWrappers)); + maxoutVOArrayList.add(maxoutVO); + } } } } @@ -303,23 +310,23 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { public List selectCardFavorableList(Integer pageNo, Integer pageSize, TransferDTO transferDTO) { //查询优惠券领取记录 LambdaQueryWrapper recordLambdaQueryWrapper = new LambdaQueryWrapper<>(); - if (ObjectUtils.isNotEmpty(transferDTO.getUserId())){ - recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId,transferDTO.getUserId()); + if (ObjectUtils.isNotEmpty(transferDTO.getUserId())) { + recordLambdaQueryWrapper.eq(CardFavorableRecord::getMtUserId, transferDTO.getUserId()); } - recordLambdaQueryWrapper.eq(CardFavorableRecord::getStoreId,transferDTO.getStoreId()); - recordLambdaQueryWrapper.eq(CardFavorableRecord::getStatus,"0"); + recordLambdaQueryWrapper.eq(CardFavorableRecord::getStoreId, transferDTO.getStoreId()); + recordLambdaQueryWrapper.eq(CardFavorableRecord::getStatus, "0"); List list = cardFavorableRecordService.list(recordLambdaQueryWrapper); //筛查优惠券 ArrayList exchangeFavorableVOArrayList = new ArrayList<>(); for (CardFavorableRecord cardFavorableRecord : list) { ExchangeFavorableVO exchangeFavorableVO = new ExchangeFavorableVO(); LambdaQueryWrapper cardFavorableLambdaQueryWrapper = new LambdaQueryWrapper<>(); - cardFavorableLambdaQueryWrapper.eq(CardFavorable::getId,cardFavorableRecord.getCardFavorableId()); + cardFavorableLambdaQueryWrapper.eq(CardFavorable::getId, cardFavorableRecord.getCardFavorableId()); //cardFavorableLambdaQueryWrapper.in(CardFavorable::getOilType,transferDTO.getOilName()); - cardFavorableLambdaQueryWrapper.le(CardFavorable::getSatisfiedAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters()); + cardFavorableLambdaQueryWrapper.le(CardFavorable::getSatisfiedAmount, transferDTO.getOilPrice() * transferDTO.getOilLiters()); //OilName oilName = oilNameService.selectOilNameById(transferDTO.getOilName()); List list1 = cardFavorableService.list(cardFavorableLambdaQueryWrapper); - if (list1.size()>0) { + if (list1.size() > 0) { CardFavorable cardFavorable = list1.get(0); //符合油号判断 if (cardFavorable.getOilType().contains(String.valueOf(transferDTO.getOilName()))) { @@ -342,8 +349,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } return exchangeFavorableVOArrayList; } + /** * 分页查询所有数据 + * * @return */ @Override @@ -353,13 +362,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { CardValue cardValue = new CardValue(); cardValue.setStoreId(activeExchangeRecordDTO.getStoreId()); List cardValueAppletVOS = cardValueService.selectAllApplet(cardValue); - if (CollectionUtils.isNotEmpty(cardValueAppletVOS)){ + if (CollectionUtils.isNotEmpty(cardValueAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("储值卡充值活动"); activeAppletVO.setDes(cardValueAppletVOS.get(0).getDiscountActiveDescribe()); activeAppletVO.setTime(cardValueAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("储值卡充值活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -369,13 +378,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { CardFuelDiesel cardFuelDiesel = new CardFuelDiesel(); cardFuelDiesel.setStoreId(activeExchangeRecordDTO.getStoreId()); List cardFuelDieselVOS = cardFuelDieselService.selectAllAppletByStorId(cardFuelDiesel); - if (CollectionUtils.isNotEmpty(cardFuelDieselVOS)){ + if (CollectionUtils.isNotEmpty(cardFuelDieselVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("囤油卡充值活动"); activeAppletVO.setDes(cardFuelDieselVOS.get(0).getDiscountActiveDescribe()); activeAppletVO.setTime(cardFuelDieselVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("囤油卡充值活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -385,13 +394,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { ActiveConsumption consumption = new ActiveConsumption(); consumption.setStoreId(activeExchangeRecordDTO.getStoreId()); List activeConsumptionAppletVOS = activeConsumptionService.selectAllApplet(consumption); - if (CollectionUtils.isNotEmpty(activeConsumptionAppletVOS)){ + if (CollectionUtils.isNotEmpty(activeConsumptionAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("消费有礼活动"); activeAppletVO.setDes(activeConsumptionAppletVOS.get(0).getActiveDescribe()); activeAppletVO.setTime(activeConsumptionAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("消费有礼活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -401,13 +410,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { ActiveDiscount activeDiscount = new ActiveDiscount(); activeDiscount.setStoreId(activeExchangeRecordDTO.getStoreId()); List activeDiscountAppletVOS = activeDiscountService.selectAllApplet(activeDiscount); - if (CollectionUtils.isNotEmpty(activeDiscountAppletVOS)){ + if (CollectionUtils.isNotEmpty(activeDiscountAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("折扣营销活动"); activeAppletVO.setDes(activeDiscountAppletVOS.get(0).getDiscountActiveDescribe()); activeAppletVO.setTime(activeDiscountAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("折扣营销活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -417,13 +426,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { ActiveFullminus activeFullminus = new ActiveFullminus(); activeFullminus.setStoreId(activeExchangeRecordDTO.getStoreId()); List activeFullminusAppletVOS = activeFullminusService.selectAllApplet(activeFullminus); - if (CollectionUtils.isNotEmpty(activeFullminusAppletVOS)){ + if (CollectionUtils.isNotEmpty(activeFullminusAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("满减营销活动"); activeAppletVO.setDes(activeFullminusAppletVOS.get(0).getFullminusActiveDescribe()); activeAppletVO.setTime(activeFullminusAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("满减营销活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -431,13 +440,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } //新人有礼 List activeNewlywedsAppletVOS = activeNewlywedsService.selectApplet(consumption); - if (ObjectUtils.isNotEmpty(activeNewlywedsAppletVOS)){ + if (ObjectUtils.isNotEmpty(activeNewlywedsAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("新人有礼活动"); activeAppletVO.setDes(activeNewlywedsAppletVOS.get(0).getNewlywedsActiveDescribe()); activeAppletVO.setTime(activeNewlywedsAppletVOS.get(0).getTime()); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("新人有礼活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -445,13 +454,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { } //推荐有礼 List activeRecommendAppletVOS = activeRecommendService.selectApplet(consumption); - if (ObjectUtils.isNotEmpty(activeRecommendAppletVOS)){ + if (ObjectUtils.isNotEmpty(activeRecommendAppletVOS)) { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("推荐有礼活动"); activeAppletVO.setDes(activeRecommendAppletVOS.get(0).getRecommendActiveDescribeIn()); activeAppletVO.setTime("永久有效"); activeAppletVOS.add(activeAppletVO); - }else { + } else { ActiveAppletVO activeAppletVO = new ActiveAppletVO(); activeAppletVO.setName("推荐有礼活动"); activeAppletVO.setDes("活动准备中,敬请期待!"); @@ -463,6 +472,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { /** * 优惠活动接口 + * * @param paymentActiveDTO * @return */ @@ -472,203 +482,220 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { Integer storeId = paymentActiveDTO.getStoreId(); double finalAmount = 0.00; Integer userId = TokenUtil.getNowAccountInfo().getId(); + //获取今日是周几 + DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); + String displayName = dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault()); + //折扣有限制 - List activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); - //折扣无限制 - List activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); - activeDiscountVOList.addAll(activeDiscountVOLists); - //满减有限制 - List activeFuletVOList = oilOrderMapper.selectActiveFule(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); - //满减无限制 - List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); - activeFuletVOList.addAll(activeFuletVOLists); - //优惠券 - paymentActiveDTO.setUserId(userId); - if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){ - userId = paymentActiveDTO.getUserId(); - } - paymentActiveDTO.setUserId(userId); + List activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { + //周 + if (activeDiscountPayVO.getMemberDayType().equals("1")) { + String weekDay = activeDiscountPayVO.getWeekDay(); + if (weekDay.contains(displayName)) { + } else if (activeDiscountPayVO.getMemberDayType().equals("2")) { - List canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO); - //如果是储值卡付款,直接过滤掉 - if(paymentActiveDTO.getType().equals("0")){ - canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> cardFavorableRecordVO.getExclusiveFunction().equals("0")) - .collect(Collectors.toList()); - } - //会员等级当前优惠力度最大 + } else { - //无限制条件的活动列表 - List resList =new ArrayList<>(); - //无限制条件的优惠券的列表 - ArrayList cardFavorableRecordVOS = new ArrayList<>(); - //优惠券和折扣活动的组合列表 - ArrayList cardAndDisPays = new ArrayList<>(); - //优惠券和满减活动的组合列表 - ArrayList cardAndComPays = new ArrayList<>(); - //折扣 - if (CollectionUtils.isNotEmpty(activeDiscountVOList)){ - for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { - //if (activeDiscountPayVO.getParticipationCondition().equals("0")){ + } + //月 + } + } + //折扣无限制 + List activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + activeDiscountVOList.addAll(activeDiscountVOLists); + //满减有限制 + List activeFuletVOList = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + //满减无限制 + List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel()); + activeFuletVOList.addAll(activeFuletVOLists); + //优惠券 + paymentActiveDTO.setUserId(userId); + if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())) { + userId = paymentActiveDTO.getUserId(); + } + paymentActiveDTO.setUserId(userId); + + List canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO); + //如果是储值卡付款,直接过滤掉 + if (paymentActiveDTO.getType().equals("0")) { + canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> cardFavorableRecordVO.getExclusiveFunction().equals("0")) + .collect(Collectors.toList()); + } + //会员等级当前优惠力度最大 + + //无限制条件的活动列表 + List resList = new ArrayList<>(); + //无限制条件的优惠券的列表 + ArrayList cardFavorableRecordVOS = new ArrayList<>(); + //优惠券和折扣活动的组合列表 + ArrayList cardAndDisPays = new ArrayList<>(); + //优惠券和满减活动的组合列表 + ArrayList cardAndComPays = new ArrayList<>(); + //折扣 + if (CollectionUtils.isNotEmpty(activeDiscountVOList)) { + for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { + //if (activeDiscountPayVO.getParticipationCondition().equals("0")){ activeDiscountPayVO.setType("2"); activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount()); resList.add(activeDiscountPayVO); - //} + //} + } } - } - //满减 - if (CollectionUtils.isNotEmpty(activeFuletVOList)){ - for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) { - //if (activeDiscountPayVO.getParticipationCondition().equals("0")){ + //满减 + if (CollectionUtils.isNotEmpty(activeFuletVOList)) { + for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) { + //if (activeDiscountPayVO.getParticipationCondition().equals("0")){ activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount()); activeDiscountPayVO.setType("1"); resList.add(activeDiscountPayVO); - // } - } - } - //优惠券 - if (CollectionUtils.isNotEmpty(canUserCardFavorableList)){ - for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { - if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){ - cardFavorableRecordVOS.add(cardFavorableRecordVO); + // } } } - } - //折扣+优惠券 - for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { - if (ObjectUtil.isNotEmpty(activeDiscountPayVO.getParticipationCondition()) - && !activeDiscountPayVO.getParticipationCondition().equals("1")){ + //优惠券 + if (CollectionUtils.isNotEmpty(canUserCardFavorableList)) { for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { - if(StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("2") - && StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){ - ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); - BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); - activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); - double discountAmount = cardFavorableRecordVO.getDiscountAmount(); - BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); - activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); - BigDecimal discount = activeDiscountPayVO1.getDiscount(); - activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); - - activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); - activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); - cardAndDisPays.add(activeDiscountPayVO1); - }else if( StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){ - ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); - BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); - String[] split = cardFavorableRecordVO.getOilType().split(","); - for (String oilId : split) { - if((paymentActiveDTO.getOilId()).toString().equals(oilId)){ - activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); - double discountAmount = cardFavorableRecordVO.getDiscountAmount(); - activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); - BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); - BigDecimal discount = activeDiscountPayVO1.getDiscount(); - activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); - activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); - activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); - cardAndDisPays.add(activeDiscountPayVO1); - } - } - + if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { + cardFavorableRecordVOS.add(cardFavorableRecordVO); } } } + //折扣+优惠券 + for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { + if (ObjectUtil.isNotEmpty(activeDiscountPayVO.getParticipationCondition()) + && !activeDiscountPayVO.getParticipationCondition().equals("1")) { + for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { + if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("2") + && StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().equals("0")) { + ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); + BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); + activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); + double discountAmount = cardFavorableRecordVO.getDiscountAmount(); + BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); + activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); + BigDecimal discount = activeDiscountPayVO1.getDiscount(); + activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); - } - //满减+优惠券 - for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) { - if (ObjectUtils.isNotEmpty(activeDiscountPayVO.getParticipationCondition()) - && !activeDiscountPayVO.getParticipationCondition().equals("1")){ - for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { - if(StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && ObjectUtils.isNotEmpty(cardFavorableRecordVO) && cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){ - ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); - BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); - activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); - double discountAmount = cardFavorableRecordVO.getDiscountAmount(); - activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); - BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); - BigDecimal discount = activeDiscountPayVO1.getDiscount(); - activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); - activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); - activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); - cardAndComPays.add(activeDiscountPayVO1); - }else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){ - ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); - BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); - String[] split = cardFavorableRecordVO.getOilType().split(","); - for (String oilId : split) { - if((paymentActiveDTO.getOilId()).toString().equals(oilId)){ - activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); - double discountAmount = cardFavorableRecordVO.getDiscountAmount(); - activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); - BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); - BigDecimal discount = activeDiscountPayVO1.getDiscount(); - activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); - activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); - activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); - cardAndComPays.add(activeDiscountPayVO1); + activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); + activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); + cardAndDisPays.add(activeDiscountPayVO1); + } else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { + ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); + BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); + String[] split = cardFavorableRecordVO.getOilType().split(","); + for (String oilId : split) { + if ((paymentActiveDTO.getOilId()).toString().equals(oilId)) { + activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); + double discountAmount = cardFavorableRecordVO.getDiscountAmount(); + activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); + BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); + BigDecimal discount = activeDiscountPayVO1.getDiscount(); + activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); + activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); + activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); + cardAndDisPays.add(activeDiscountPayVO1); + } } - } + } + } + } + + } + //满减+优惠券 + for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) { + if (ObjectUtils.isNotEmpty(activeDiscountPayVO.getParticipationCondition()) + && !activeDiscountPayVO.getParticipationCondition().equals("1")) { + for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { + if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && ObjectUtils.isNotEmpty(cardFavorableRecordVO) && cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")) { + ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); + BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); + activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); + double discountAmount = cardFavorableRecordVO.getDiscountAmount(); + activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); + BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); + BigDecimal discount = activeDiscountPayVO1.getDiscount(); + activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); + activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); + activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); + cardAndComPays.add(activeDiscountPayVO1); + } else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { + ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); + BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); + String[] split = cardFavorableRecordVO.getOilType().split(","); + for (String oilId : split) { + if ((paymentActiveDTO.getOilId()).toString().equals(oilId)) { + activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); + double discountAmount = cardFavorableRecordVO.getDiscountAmount(); + activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount()); + BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount); + BigDecimal discount = activeDiscountPayVO1.getDiscount(); + activeDiscountPayVO1.setDiscount(bigDecimal.add(discount)); + activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); + activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); + cardAndComPays.add(activeDiscountPayVO1); + } + } + + } } } } - } - for (ActiveDiscountPayVO activeDiscountPayVO : resList) { - double v = activeDiscountPayVO.getDiscount().doubleValue(); - activeDiscountPayVO.setDiscounts(v); - } - for (ActiveDiscountPayVO activeDiscountPayVO : cardAndDisPays) { - double v = activeDiscountPayVO.getDiscount().doubleValue(); - activeDiscountPayVO.setDiscounts(v); - } - for (ActiveDiscountPayVO activeDiscountPayVO : cardAndComPays) { - double v = activeDiscountPayVO.getDiscount().doubleValue(); - activeDiscountPayVO.setDiscounts(v); - } + for (ActiveDiscountPayVO activeDiscountPayVO : resList) { + double v = activeDiscountPayVO.getDiscount().doubleValue(); + activeDiscountPayVO.setDiscounts(v); + } + for (ActiveDiscountPayVO activeDiscountPayVO : cardAndDisPays) { + double v = activeDiscountPayVO.getDiscount().doubleValue(); + activeDiscountPayVO.setDiscounts(v); + } + for (ActiveDiscountPayVO activeDiscountPayVO : cardAndComPays) { + double v = activeDiscountPayVO.getDiscount().doubleValue(); + activeDiscountPayVO.setDiscounts(v); + } - ArrayList activeDiscountPayVOS = new ArrayList<>(); - //1.无限制条件的活动和优惠券分别选出一个优惠最大的来 - //活动 - if (CollectionUtils.isNotEmpty(resList)){ - ActiveDiscountPayVO activeDiscountPayVO = resList.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); - activeDiscountPayVOS.add(activeDiscountPayVO); - } - //优惠券 - CardFavorableRecordVO cardFavorableRecordVO = new CardFavorableRecordVO(); - if (CollectionUtils.isNotEmpty(cardFavorableRecordVOS)){ - cardFavorableRecordVO = cardFavorableRecordVOS.stream().max(Comparator.comparingDouble(CardFavorableRecordVO::getDiscountAmount)).get(); - } - //2.有限制条件的活动和优惠券组合比较出一个优惠最大的来 - //满减+优惠券 - if (CollectionUtils.isNotEmpty(cardAndDisPays)){ - ActiveDiscountPayVO activeDiscountPayVO1 = cardAndDisPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); - activeDiscountPayVOS.add(activeDiscountPayVO1); - } - //折扣+优惠券 - if (CollectionUtils.isNotEmpty(cardAndComPays)){ - ActiveDiscountPayVO activeDiscountPayVO2 = cardAndComPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); - activeDiscountPayVOS.add(activeDiscountPayVO2); - } - //3.活动和活动+优惠券的组合比较 - ActiveDiscountPayVO activeDiscountPayVO3 = new ActiveDiscountPayVO(); - if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)) { - activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); - } + ArrayList activeDiscountPayVOS = new ArrayList<>(); + //1.无限制条件的活动和优惠券分别选出一个优惠最大的来 + //活动 + if (CollectionUtils.isNotEmpty(resList)) { + ActiveDiscountPayVO activeDiscountPayVO = resList.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + activeDiscountPayVOS.add(activeDiscountPayVO); + } + //优惠券 + CardFavorableRecordVO cardFavorableRecordVO = new CardFavorableRecordVO(); + if (CollectionUtils.isNotEmpty(cardFavorableRecordVOS)) { + cardFavorableRecordVO = cardFavorableRecordVOS.stream().max(Comparator.comparingDouble(CardFavorableRecordVO::getDiscountAmount)).get(); + } + //2.有限制条件的活动和优惠券组合比较出一个优惠最大的来 + //满减+优惠券 + if (CollectionUtils.isNotEmpty(cardAndDisPays)) { + ActiveDiscountPayVO activeDiscountPayVO1 = cardAndDisPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + activeDiscountPayVOS.add(activeDiscountPayVO1); + } + //折扣+优惠券 + if (CollectionUtils.isNotEmpty(cardAndComPays)) { + ActiveDiscountPayVO activeDiscountPayVO2 = cardAndComPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + activeDiscountPayVOS.add(activeDiscountPayVO2); + } + //3.活动和活动+优惠券的组合比较 + ActiveDiscountPayVO activeDiscountPayVO3 = new ActiveDiscountPayVO(); + if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)) { + activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + } //4. 3和优惠券比较 - if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){ + if (ObjectUtils.isNotEmpty(activeDiscountPayVO3)) { finalAmount = activeDiscountPayVO3.getDiscounts(); - if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && finalAmount < cardFavorableRecordVO.getDiscountAmount()){ + if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && finalAmount < cardFavorableRecordVO.getDiscountAmount()) { PaymentActiveVO paymentActiveVO1 = new PaymentActiveVO(); //单用优惠券优惠力度最大 paymentActiveVO1.setCardFavorableId(cardFavorableRecordVO.getId()); //金额 paymentActiveVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); //优惠券名字 - paymentActiveVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName() + "满"+cardFavorableRecordVO.getSatisfiedAmount() + "减" + cardFavorableRecordVO.getDiscountAmount() + "元"); - BeanUtils.copyProperties(paymentActiveVO1,paymentActiveVO); + paymentActiveVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName() + "满" + cardFavorableRecordVO.getSatisfiedAmount() + "减" + cardFavorableRecordVO.getDiscountAmount() + "元"); + BeanUtils.copyProperties(paymentActiveVO1, paymentActiveVO); //return paymentActiveVO1; - }else { + } else { PaymentActiveVO paymentActiveVO2 = new PaymentActiveVO(); //活动或活动+优惠券优惠力度最大 paymentActiveVO2.setActiveId(activeDiscountPayVO3.getActiveId()); @@ -679,269 +706,269 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { paymentActiveVO2.setCardFavorableId(activeDiscountPayVO3.getCouponId()); paymentActiveVO2.setCardFavorableInfo(activeDiscountPayVO3.getCardFavorableInfo()); paymentActiveVO2.setCardFavorableAmount(activeDiscountPayVO3.getCardFavorableAmount()); - BeanUtils.copyProperties(paymentActiveVO2,paymentActiveVO); + BeanUtils.copyProperties(paymentActiveVO2, paymentActiveVO); //return paymentActiveVO2; } } - //会员等级优惠 + //会员等级优惠 - Integer oilId = paymentActiveDTO.getOilId(); - double oilPriceById = oilNumberMapper.getOilPriceById(oilId,storeId); - BigDecimal bigDecimal1 = BigDecimal.valueOf(oilPriceById); - String oilTypebyId = oilNameMapper.getOilTypebyId(oilId); + Integer oilId = paymentActiveDTO.getOilId(); + double oilPriceById = oilNumberMapper.getOilPriceById(oilId, storeId); + BigDecimal bigDecimal1 = BigDecimal.valueOf(oilPriceById); + String oilTypebyId = oilNameMapper.getOilTypebyId(oilId); - String gradeId = paymentActiveDTO.getMtUserLevel().toString(); - if (StringUtils.isNotEmpty(gradeId)) { - LJStore store = iljStoreService.selectStoreByStoreId(storeId); - ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId()); - if (ObjectUtils.isNotEmpty(chainStoreConfig)) { - String isEnableLevel = chainStoreConfig.getIsEnableLevel(); - if (isEnableLevel.equals("yes")) { + String gradeId = paymentActiveDTO.getMtUserLevel().toString(); + if (StringUtils.isNotEmpty(gradeId)) { + LJStore store = iljStoreService.selectStoreByStoreId(storeId); + ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId()); + if (ObjectUtils.isNotEmpty(chainStoreConfig)) { + String isEnableLevel = chainStoreConfig.getIsEnableLevel(); + if (isEnableLevel.equals("yes")) { - LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId); - if (ObjectUtils.isNotEmpty(ljUserGrade)) { - if (oilTypebyId.equals("汽油")) { - if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { + LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId); + if (ObjectUtils.isNotEmpty(ljUserGrade)) { + if (oilTypebyId.equals("汽油")) { + if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { - } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { - String gasolineRule = ljUserGrade.getGasolineRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); - BigDecimal bigDecimal = jsonObject.getBigDecimal("gasolineRule1"); - if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { - //升数 - BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); - BigDecimal gasolineRule3 = jsonObject.getBigDecimal("gasolineRule3"); - BigDecimal multiply = divide.multiply(gasolineRule3); - paymentActiveVO.setMemberFavorableAmount(multiply); - } - } else { - String gasolineRule = ljUserGrade.getGasolineRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.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); + } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { + String gasolineRule = ljUserGrade.getGasolineRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); + BigDecimal bigDecimal = jsonObject.getBigDecimal("gasolineRule1"); + if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { + //升数 + BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); + BigDecimal gasolineRule3 = jsonObject.getBigDecimal("gasolineRule3"); + BigDecimal multiply = divide.multiply(gasolineRule3); + paymentActiveVO.setMemberFavorableAmount(multiply); + } + } else { + String gasolineRule = ljUserGrade.getGasolineRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.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); + } } } - } - if (oilTypebyId.equals("柴油")) { - if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { + if (oilTypebyId.equals("柴油")) { + if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { - } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { - String gasolineRule = ljUserGrade.getDieselRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); - BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1"); - if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { - //升数 - BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); - BigDecimal bigDecimal2 = jsonObject.getBigDecimal("dieselRule3"); - BigDecimal multiply = divide.multiply(bigDecimal2); - paymentActiveVO.setMemberFavorableAmount(multiply); - } - } else { - String gasolineRule = ljUserGrade.getDieselRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); - BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1"); - if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { - //升数 - Integer gasolineRule3 = jsonObject.getInteger("dieselRule2"); - BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); - paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { + String gasolineRule = ljUserGrade.getDieselRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); + BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1"); + if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { + //升数 + BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); + BigDecimal bigDecimal2 = jsonObject.getBigDecimal("dieselRule3"); + BigDecimal multiply = divide.multiply(bigDecimal2); + paymentActiveVO.setMemberFavorableAmount(multiply); + } + } else { + String gasolineRule = ljUserGrade.getDieselRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); + BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1"); + if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { + //升数 + Integer gasolineRule3 = jsonObject.getInteger("dieselRule2"); + BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); + paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + } } + } + if (oilTypebyId.equals("天然气")) { + if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { - } - if (oilTypebyId.equals("天然气")) { - if (ljUserGrade.getGasolineDiscount().equals("无优惠")) { - - } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { - String gasolineRule = ljUserGrade.getNaturalGasRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); - BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1"); - if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { - //升数 - BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); - BigDecimal bigDecimal2 = jsonObject.getBigDecimal("naturalGas3"); - BigDecimal multiply = divide.multiply(bigDecimal2); - paymentActiveVO.setMemberFavorableAmount(multiply); - } - } else { - String gasolineRule = ljUserGrade.getGasolineRule(); - List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); - JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); - BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1"); - if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { - //升数 - Integer gasolineRule3 = jsonObject.getInteger("naturalGas2"); - BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); - paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + } else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) { + String gasolineRule = ljUserGrade.getNaturalGasRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get(); + BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1"); + if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { + //升数 + BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP); + BigDecimal bigDecimal2 = jsonObject.getBigDecimal("naturalGas3"); + BigDecimal multiply = divide.multiply(bigDecimal2); + paymentActiveVO.setMemberFavorableAmount(multiply); + } + } else { + String gasolineRule = ljUserGrade.getGasolineRule(); + List jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); + JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get(); + BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1"); + if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) { + //升数 + Integer gasolineRule3 = jsonObject.getInteger("naturalGas2"); + BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3); + paymentActiveVO.setMemberFavorableAmount(bigDecimal2); + } } } } } } } - } - //三个优惠都不为空 + //三个优惠都不为空 BigDecimal bigDecimal = new BigDecimal("0.00"); - if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount())&& ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())) { - BigDecimal add3 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getCardFavorableAmount()).add(paymentActiveVO.getMemberFavorableAmount()); - if (add3.compareTo(paymentActiveDTO.getAmount()) > 0){ - BigDecimal add21 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getCardFavorableAmount()); - BigDecimal add22 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()); - BigDecimal add23 = paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()); - if (add21.compareTo(add22)>0 && add21.compareTo(add23)>0){ - paymentActiveVO.setMemberFavorableAmount(bigDecimal); - } - if (add22.compareTo(add21)>0 && add22.compareTo(add23)>0){ - paymentActiveVO.setCardFavorableAmount(bigDecimal); - } - if (add23.compareTo(add21)>0 && add23.compareTo(add22)>0){ - paymentActiveVO.setActiveFavorableAmount(bigDecimal); - } - if (paymentActiveVO.getActiveFavorableAmount().compareTo(add23)>0){ - paymentActiveVO.setCardFavorableAmount(bigDecimal); - paymentActiveVO.setMemberFavorableAmount(bigDecimal); - } - if (paymentActiveVO.getCardFavorableAmount().compareTo(add22)>0){ - paymentActiveVO.setActiveFavorableAmount(bigDecimal); - paymentActiveVO.setMemberFavorableAmount(bigDecimal); - } - if (paymentActiveVO.getMemberFavorableAmount().compareTo(add21)>0){ - paymentActiveVO.setActiveFavorableAmount(bigDecimal); - paymentActiveVO.setCardFavorableAmount(bigDecimal); - } - } - } - //有空值 - if (ObjectUtils.isEmpty(paymentActiveVO.getActiveFavorableAmount()) || ObjectUtils.isEmpty(paymentActiveVO.getCardFavorableAmount()) || ObjectUtils.isEmpty(paymentActiveVO.getMemberFavorableAmount())){ - if (ObjectUtils.isEmpty(paymentActiveVO.getActiveFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount())&& ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())){ - if (paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()).compareTo(paymentActiveDTO.getAmount())>0){ - if (paymentActiveVO.getCardFavorableAmount().compareTo(paymentActiveVO.getMemberFavorableAmount())>0){ + if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())) { + BigDecimal add3 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getCardFavorableAmount()).add(paymentActiveVO.getMemberFavorableAmount()); + if (add3.compareTo(paymentActiveDTO.getAmount()) > 0) { + BigDecimal add21 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getCardFavorableAmount()); + BigDecimal add22 = paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()); + BigDecimal add23 = paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()); + if (add21.compareTo(add22) > 0 && add21.compareTo(add23) > 0) { paymentActiveVO.setMemberFavorableAmount(bigDecimal); - }else { + } + if (add22.compareTo(add21) > 0 && add22.compareTo(add23) > 0) { + paymentActiveVO.setCardFavorableAmount(bigDecimal); + } + if (add23.compareTo(add21) > 0 && add23.compareTo(add22) > 0) { + paymentActiveVO.setActiveFavorableAmount(bigDecimal); + } + if (paymentActiveVO.getActiveFavorableAmount().compareTo(add23) > 0) { + paymentActiveVO.setCardFavorableAmount(bigDecimal); + paymentActiveVO.setMemberFavorableAmount(bigDecimal); + } + if (paymentActiveVO.getCardFavorableAmount().compareTo(add22) > 0) { + paymentActiveVO.setActiveFavorableAmount(bigDecimal); + paymentActiveVO.setMemberFavorableAmount(bigDecimal); + } + if (paymentActiveVO.getMemberFavorableAmount().compareTo(add21) > 0) { + paymentActiveVO.setActiveFavorableAmount(bigDecimal); paymentActiveVO.setCardFavorableAmount(bigDecimal); } } } - if (ObjectUtils.isEmpty(paymentActiveVO.getCardFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount())&& ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())){ - if (paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()).compareTo(paymentActiveDTO.getAmount())>0){ - if (paymentActiveVO.getActiveFavorableAmount().compareTo(paymentActiveVO.getMemberFavorableAmount())>0){ - paymentActiveVO.setMemberFavorableAmount(bigDecimal); - }else { - paymentActiveVO.setActiveFavorableAmount(bigDecimal); - } - } - } - if (ObjectUtils.isEmpty(paymentActiveVO.getMemberFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount())&& ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount())){ - if (paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getActiveFavorableAmount()).compareTo(paymentActiveDTO.getAmount())>0){ - if (paymentActiveVO.getCardFavorableAmount().compareTo(paymentActiveVO.getActiveFavorableAmount())>0){ - paymentActiveVO.setActiveFavorableAmount(bigDecimal); - }else { - paymentActiveVO.setCardFavorableAmount(bigDecimal); + //有空值 + if (ObjectUtils.isEmpty(paymentActiveVO.getActiveFavorableAmount()) || ObjectUtils.isEmpty(paymentActiveVO.getCardFavorableAmount()) || ObjectUtils.isEmpty(paymentActiveVO.getMemberFavorableAmount())) { + if (ObjectUtils.isEmpty(paymentActiveVO.getActiveFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())) { + if (paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()).compareTo(paymentActiveDTO.getAmount()) > 0) { + if (paymentActiveVO.getCardFavorableAmount().compareTo(paymentActiveVO.getMemberFavorableAmount()) > 0) { + paymentActiveVO.setMemberFavorableAmount(bigDecimal); + } else { + paymentActiveVO.setCardFavorableAmount(bigDecimal); + } + } + } + if (ObjectUtils.isEmpty(paymentActiveVO.getCardFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getMemberFavorableAmount())) { + if (paymentActiveVO.getActiveFavorableAmount().add(paymentActiveVO.getMemberFavorableAmount()).compareTo(paymentActiveDTO.getAmount()) > 0) { + if (paymentActiveVO.getActiveFavorableAmount().compareTo(paymentActiveVO.getMemberFavorableAmount()) > 0) { + paymentActiveVO.setMemberFavorableAmount(bigDecimal); + } else { + paymentActiveVO.setActiveFavorableAmount(bigDecimal); + } + } + } + if (ObjectUtils.isEmpty(paymentActiveVO.getMemberFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableAmount()) && ObjectUtils.isNotEmpty(paymentActiveVO.getActiveFavorableAmount())) { + if (paymentActiveVO.getCardFavorableAmount().add(paymentActiveVO.getActiveFavorableAmount()).compareTo(paymentActiveDTO.getAmount()) > 0) { + if (paymentActiveVO.getCardFavorableAmount().compareTo(paymentActiveVO.getActiveFavorableAmount()) > 0) { + paymentActiveVO.setActiveFavorableAmount(bigDecimal); + } else { + paymentActiveVO.setCardFavorableAmount(bigDecimal); + } } } } + return paymentActiveVO; } - return paymentActiveVO; - } - @Override - public void activeConsumption(PaymentActiveDTO paymentActiveDTO) { - //消费有礼 - ArrayList activeConsumptionVOS1 = new ArrayList<>(); - List activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getAmount()); - if (CollectionUtils.isNotEmpty(activeConsumptionVOS)){ - for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) { - BigDecimal amount = new BigDecimal(activeConsumptionVO.getAmount()); - if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("1") - && paymentActiveDTO.getOrderAmount()>=activeConsumptionVO.getAmount()){ - activeConsumptionVOS1.add(activeConsumptionVO); - } - if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("2") - && paymentActiveDTO.getAmount().compareTo(amount)>0){ - activeConsumptionVOS1.add(activeConsumptionVO); + @Override + public void activeConsumption (PaymentActiveDTO paymentActiveDTO){ + //消费有礼 + ArrayList activeConsumptionVOS1 = new ArrayList<>(); + List activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getAmount()); + if (CollectionUtils.isNotEmpty(activeConsumptionVOS)) { + for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) { + BigDecimal amount = new BigDecimal(activeConsumptionVO.getAmount()); + if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("1") + && paymentActiveDTO.getOrderAmount() >= activeConsumptionVO.getAmount()) { + activeConsumptionVOS1.add(activeConsumptionVO); + } + if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("2") + && paymentActiveDTO.getAmount().compareTo(amount) > 0) { + activeConsumptionVOS1.add(activeConsumptionVO); + } } } - } - //连锁店信息 + //连锁店信息 // if (paymentActiveDTO.getUserId()==null){ // paymentActiveDTO.setUserId(TokenUtil.getNowAccountInfo().getId()); // } - LJUser ljUserVo = userService.queryUserByUserId(paymentActiveDTO.getUserId()); - Integer storeId1 = paymentActiveDTO.getStoreId(); - Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId(); - //用户余额 - UserBalance userBalance = userBalanceService.selectUserBalance(paymentActiveDTO.getUserId(),chainStoreId); - UserBalance userBalance1 = new UserBalance(); - if (CollectionUtils.isNotEmpty(activeConsumptionVOS1)){ - for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS1) { - if (activeConsumptionVO.getAdaptUserType().equals("2") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && - StringUtils.isNotEmpty(activeConsumptionVO.getAdaptUser()) && activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString()) || activeConsumptionVO.getAdaptUserType().equals("0") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) - || activeConsumptionVO.getAdaptUserType().equals("1") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && StringUtils.isNotEmpty(paymentActiveDTO.getMtUserLevel().toString())){ - //如果满足条件/给当前用户加积分 - //用户 (新用户新建 老用户叠加) - if (ObjectUtils.isNotEmpty(userBalance)){ - //积分 - if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){ - userBalance.setPoints(userBalance.getPoints() + activeConsumptionVO.getPoints()); + LJUser ljUserVo = userService.queryUserByUserId(paymentActiveDTO.getUserId()); + Integer storeId1 = paymentActiveDTO.getStoreId(); + Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId(); + //用户余额 + UserBalance userBalance = userBalanceService.selectUserBalance(paymentActiveDTO.getUserId(), chainStoreId); + UserBalance userBalance1 = new UserBalance(); + if (CollectionUtils.isNotEmpty(activeConsumptionVOS1)) { + for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS1) { + if (activeConsumptionVO.getAdaptUserType().equals("2") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && + StringUtils.isNotEmpty(activeConsumptionVO.getAdaptUser()) && activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString()) || activeConsumptionVO.getAdaptUserType().equals("0") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) + || activeConsumptionVO.getAdaptUserType().equals("1") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && StringUtils.isNotEmpty(paymentActiveDTO.getMtUserLevel().toString())) { + //如果满足条件/给当前用户加积分 + //用户 (新用户新建 老用户叠加) + if (ObjectUtils.isNotEmpty(userBalance)) { + //积分 + if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())) { + userBalance.setPoints(userBalance.getPoints() + activeConsumptionVO.getPoints()); + } + userBalanceService.updateUserBalance(userBalance); + } else { + userBalance1.setMtUserId(paymentActiveDTO.getUserId()); + userBalance1.setChainStoreId(chainStoreId); + //积分 + if (ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())) { + userBalance1.setPoints(activeConsumptionVO.getPoints()); + } + userBalanceService.save(userBalance1); } - userBalanceService.updateUserBalance(userBalance); - }else { - userBalance1.setMtUserId(paymentActiveDTO.getUserId()); - userBalance1.setChainStoreId(chainStoreId); - //积分 - if (ObjectUtils.isNotEmpty(activeConsumptionVO.getPoints())){ - userBalance1.setPoints(activeConsumptionVO.getPoints()); - } - userBalanceService.save(userBalance1); - } - //查询改活动下的卡券列表 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveConsumptionChild::getActiveConsumptionId,activeConsumptionVO.getActiveId()); - List list = activeConsumptionChildService.list(queryWrapper); - if (ObjectUtils.isNotEmpty(list)){ + //查询改活动下的卡券列表 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveConsumptionChild::getActiveConsumptionId, activeConsumptionVO.getActiveId()); + List list = activeConsumptionChildService.list(queryWrapper); + if (ObjectUtils.isNotEmpty(list)) { - for (ActiveConsumptionChild activeConsumptionChild : list) { - if (ObjectUtils.isNotEmpty(activeConsumptionChild) && activeConsumptionChild.getActiveGift().equals("1")){ - CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - cardFavorableRecord.setCardFavorableId(activeConsumptionChild.getVouchersId()); - cardFavorableRecord.setStoreId(storeId1); - cardFavorableRecord.setMtUserId(paymentActiveDTO.getUserId()); - cardFavorableRecord.setName(ljUserVo.getName()); - cardFavorableRecord.setMobile(ljUserVo.getMobile()); - cardFavorableRecord.setStatus("0"); - cardFavorableRecord.setExchangeFrom("消费有礼"); - cardFavorableRecord.setActiveId(activeConsumptionChild.getActiveConsumptionId()); - cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); - //兑换券 - }else if (ObjectUtils.isNotEmpty(activeConsumptionChild) && activeConsumptionChild.getActiveGift().equals("2")){ - CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); - cardExchangeRecord.setCardExchangeId(activeConsumptionChild.getVouchersId()); - cardExchangeRecord.setStoreId(storeId1); - cardExchangeRecord.setMtUserId(ljUserVo.getId()); - cardExchangeRecord.setName(ljUserVo.getName()); - cardExchangeRecord.setMobile(ljUserVo.getMobile()); - cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); - cardExchangeRecord.setStatus("0"); - cardExchangeRecord.setExchangeFrom("消费有礼"); - cardExchangeRecord.setActiveId(activeConsumptionChild.getActiveConsumptionId()); - cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + for (ActiveConsumptionChild activeConsumptionChild : list) { + if (ObjectUtils.isNotEmpty(activeConsumptionChild) && activeConsumptionChild.getActiveGift().equals("1")) { + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeConsumptionChild.getVouchersId()); + cardFavorableRecord.setStoreId(storeId1); + cardFavorableRecord.setMtUserId(paymentActiveDTO.getUserId()); + cardFavorableRecord.setName(ljUserVo.getName()); + cardFavorableRecord.setMobile(ljUserVo.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("消费有礼"); + cardFavorableRecord.setActiveId(activeConsumptionChild.getActiveConsumptionId()); + cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + //兑换券 + } else if (ObjectUtils.isNotEmpty(activeConsumptionChild) && activeConsumptionChild.getActiveGift().equals("2")) { + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeConsumptionChild.getVouchersId()); + cardExchangeRecord.setStoreId(storeId1); + cardExchangeRecord.setMtUserId(ljUserVo.getId()); + cardExchangeRecord.setName(ljUserVo.getName()); + cardExchangeRecord.setMobile(ljUserVo.getMobile()); + cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); + cardExchangeRecord.setStatus("0"); + cardExchangeRecord.setExchangeFrom("消费有礼"); + cardExchangeRecord.setActiveId(activeConsumptionChild.getActiveConsumptionId()); + cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + } + } } - } - } - //优惠券 - //if (StringUtils.isNotEmpty(activeConsumptionVO.getActiveGift()) && activeConsumptionVO.getActiveGift().equals("1")){ + //优惠券 + //if (StringUtils.isNotEmpty(activeConsumptionVO.getActiveGift()) && activeConsumptionVO.getActiveGift().equals("1")){ /*if (ObjectUtils.isNotEmpty(list) && activeConsumptionVO.getActiveGift().equals("1")){ CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); cardFavorableRecord.setCardFavorableId(activeConsumptionVO.getVouchersId()); @@ -965,8 +992,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { cardExchangeRecord.setExchangeFrom("充值送券"); cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); }*/ + } } } } } -} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java index bd5c6ba59..f4cfbfe29 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java @@ -41,7 +41,7 @@ public interface ActiveNewlywedsService extends IService { * @return */ ActiveNewlywedsVO getOneById(Serializable id); - ActiveNewlywedsVO getOneByStoreId(Serializable id); + List getOneByStoreId(Serializable id); List getOneByIdApplet(ActiveConsumption activeConsumption); /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java index dda56a102..81759bf9a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java @@ -62,54 +62,57 @@ public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList(); - if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ - for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) { - if (activeNewlywedsChild.getActiveGift().equals("1")){ - CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); - cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId()); - cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); - cardFavorableRecord.setMtUserId(ljUserVo.getId()); - cardFavorableRecord.setName(ljUserVo.getName()); - cardFavorableRecord.setMobile(ljUserVo.getMobile()); - cardFavorableRecord.setStatus("0"); - cardFavorableRecord.setExchangeFrom("新人有礼"); - cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); - save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); - }else { - //兑换券 - CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); - cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId()); - cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId()); - cardExchangeRecord.setMtUserId(ljUserVo.getId()); - cardExchangeRecord.setName(ljUserVo.getName()); - cardExchangeRecord.setMobile(ljUserVo.getMobile()); - cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); - cardExchangeRecord.setStatus("0"); - cardExchangeRecord.setExchangeFrom("新人有礼"); - cardExchangeRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); - save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + List activeNewlywedsVOList = activeNewlywedsService.getOneByStoreId(activeNewlywedsRecords.getStoreId()); + for (ActiveNewlywedsVO activeNewlyweds : activeNewlywedsVOList) { + activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId()); + activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId()); + activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId()); + activeNewlywedsRecords.setUserId(userId); + save = save(activeNewlywedsRecords); + //优惠券 + List activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList(); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) { + if (activeNewlywedsChild.getActiveGift().equals("1")){ + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getVouchersId()); + cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); + cardFavorableRecord.setMtUserId(ljUserVo.getId()); + cardFavorableRecord.setName(ljUserVo.getName()); + cardFavorableRecord.setMobile(ljUserVo.getMobile()); + cardFavorableRecord.setStatus("0"); + cardFavorableRecord.setExchangeFrom("新人有礼"); + cardFavorableRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); + save = cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord); + }else { + //兑换券 + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getVouchersId()); + cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId()); + cardExchangeRecord.setMtUserId(ljUserVo.getId()); + cardExchangeRecord.setName(ljUserVo.getName()); + cardExchangeRecord.setMobile(ljUserVo.getMobile()); + cardExchangeRecord.setPhoto(ljUserVo.getAvatar()); + cardExchangeRecord.setStatus("0"); + cardExchangeRecord.setExchangeFrom("新人有礼"); + cardExchangeRecord.setActiveId(activeNewlywedsChild.getActiveNewlywedsId()); + save = cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord); + } } + //用户余额 + UserBalance userBalance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getChainStoreId()); + //积分 + if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeNewlyweds.getPoints())){ + userBalance.setPoints(userBalance.getPoints() + activeNewlyweds.getPoints()); + } + //成长值 + if (ObjectUtils.isNotEmpty(userBalance.getGrowthValue()) && ObjectUtils.isNotEmpty(activeNewlyweds.getGrowthValue())){ + userBalance.setGrowthValue(userBalance.getGrowthValue() + activeNewlyweds.getGrowthValue()); + } + userBalanceService.updateUserBalance(userBalance); } - //用户余额 - UserBalance userBalance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getChainStoreId()); - //积分 - if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(activeNewlyweds.getPoints())){ - userBalance.setPoints(userBalance.getPoints() + activeNewlyweds.getPoints()); - } - //成长值 - if (ObjectUtils.isNotEmpty(userBalance.getGrowthValue()) && ObjectUtils.isNotEmpty(activeNewlyweds.getGrowthValue())){ - userBalance.setGrowthValue(userBalance.getGrowthValue() + activeNewlyweds.getGrowthValue()); - } - userBalanceService.updateUserBalance(userBalance); } + return save; } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java index b7a46ae17..88b3797b1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java @@ -358,35 +358,41 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl getOneByStoreId(Serializable id) { + + ArrayList arrayList = new ArrayList<>(); if (ObjectUtils.isNotEmpty(id)){ //获取新人有礼活动信息 LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id); - ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); - //获取兑换物品信息 - if (ObjectUtils.isNotEmpty(activeNewlyweds)){ - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); - queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); - List activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); - BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); - //封装VO返回 - activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); - if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ - activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + lambdaQueryWrapper.eq(ActiveNewlyweds::getStoreId,id).eq(ActiveNewlyweds::getIsonline,0); + //ActiveNewlyweds activeNewlyweds = getOne(lambdaQueryWrapper); + List newlywedsList = list(lambdaQueryWrapper); + for (ActiveNewlyweds activeNewlyweds : newlywedsList) { + ActiveNewlywedsVO activeNewlywedsVO = new ActiveNewlywedsVO(); + activeNewlywedsVO.setCourtesyReward(new String[0]); + //获取兑换物品信息 + if (ObjectUtils.isNotEmpty(activeNewlyweds)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsChild::getActiveNewlywedsId,activeNewlyweds.getId()); + queryWrapper.orderByDesc(ActiveNewlywedsChild::getCreateTime); + List activeNewlywedsChildList = activeNewlywedsChildService.list(queryWrapper); + BeanUtils.copyProperties(activeNewlyweds,activeNewlywedsVO); + //封装VO返回 + activeNewlywedsVO.setCourtesyReward(activeNewlyweds.getCourtesyReward().split(",")); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + }else { + ArrayList activeNewlywedsChildLists = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + } }else { - ArrayList activeNewlywedsChildLists = new ArrayList<>(); - activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildLists); + ArrayList activeNewlywedsChildList = new ArrayList<>(); + activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); } - }else { - ArrayList activeNewlywedsChildList = new ArrayList<>(); - activeNewlywedsVO.setActiveNewlywedsChildList(activeNewlywedsChildList); + arrayList.add(activeNewlywedsVO); } } - return activeNewlywedsVO; + return arrayList; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java index aacf0512d..f0bd532d4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardExchange/controller/CardExchangeRecordController.java @@ -130,6 +130,9 @@ public class CardExchangeRecordController extends BaseController { CardExchangeRecord byId = cardExchangeRecordService.getById(cardExchangeRecord.getId()); Integer cardExchangeId = byId.getCardExchangeId(); CardExchange cardExchange = cardExchangeService.getById(cardExchangeId); + if (cardExchange.getType().equals("1")){ + return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord)); + } Integer giftId = cardExchange.getGiftId(); LJOrder ljOrder = new LJOrder(); ljOrder.setTerminal("pc"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml index 44b75deb4..33f42c2e2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml @@ -118,9 +118,7 @@ WHERE cer.mt_user_id = #{cardFavorableDTOS.id} and ce.type = 0 - and cer.status = #{cardFavorableDTOS.useStatus} - and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车券' AS couponType, @@ -132,9 +130,7 @@ WHERE cer.mt_user_id = #{cardFavorableDTOS.id} and ce.type = 1 - and cer.status = #{cardFavorableDTOS.useStatus} - and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车卡' AS couponType,