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 21db756ed..779383f55 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 @@ -487,7 +487,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) { if (activeDiscountPayVO.getParticipationCondition().equals("1")){ for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { - if(cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){ + if(cardFavorableRecordVO.getExclusiveFunction().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){ ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); @@ -500,21 +500,24 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); cardAndDisPays.add(activeDiscountPayVO1); - }else if( !cardFavorableRecordVO.getExclusiveFunction().equals("0")){ + }else if( cardFavorableRecordVO.getExclusiveFunction().equals("0")){ ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); String[] split = cardFavorableRecordVO.getOilType().split(","); - if(paymentActiveDTO.getOilId().equals(split)){ - 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 (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); + } } + } } } @@ -536,21 +539,24 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); cardAndComPays.add(activeDiscountPayVO1); - }else if (!cardFavorableRecordVO.getExclusiveFunction().equals("0")){ + }else if (cardFavorableRecordVO.getExclusiveFunction().equals("0")){ ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1); String[] split = cardFavorableRecordVO.getOilType().split(","); - if(paymentActiveDTO.getOilId().equals(split)){ - 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 (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); + } } + } } }