private boolean evalRecurrentGroup(BookingGroup bookingGroup, List<WrappedBooking> bookings, List<Matcher> contractBlackList) { if (bookings.size() == 0) { return false; } BigDecimal amount = AmountCalculator.calcAmount(bookings); if (amount.compareTo(BigDecimal.ZERO) == 0) { return false; } bookingGroup.setCycle(CycleCalculator.fromDates(bookings.stream() .map(WrappedBooking::getExecutionDate) .collect(Collectors.toList()))); bookingGroup.setContract(ContractValidator.isContract(bookingGroup, bookings, contractBlackList)); bookingGroup.setCancelled(!bookingGroup.isEffective(LocalDate.now(), bookings)); bookingGroup.setMainCategory(bookings.get(0).getMainCategory()); bookingGroup.setSubCategory(bookings.get(0).getSubCategory()); bookingGroup.setSpecification(bookings.get(0).getSpecification()); bookingGroup.setHomepage(bookings.get(0).getHomepage()); bookingGroup.setHotline(bookings.get(0).getHotline()); bookingGroup.setEmail(bookings.get(0).getEmail()); bookingGroup.setLogo(bookings.get(0).getLogo()); bookingGroup.setMandatreference(bookings.get(0).getMandateReference()); if (StringUtils.isNotBlank(bookings.get(0).getOtherAccount())) { bookingGroup.setOtherAccount(bookings.get(0).getOtherAccount()); } else { bookingGroup.setOtherAccount(bookings.get(0).getReferenceName()); } bookingGroup.setAmount(amount); return true; }
static BookingCategory mapToBookingcategory(WrappedBooking wrappedBooking) { BookingCategory bookingCategory = new BookingCategory(); bookingCategory.setReceiver(wrappedBooking.getOtherAccount()); bookingCategory.setMainCategory(wrappedBooking.getMainCategory()); bookingCategory.setSubCategory(wrappedBooking.getSubCategory()); bookingCategory.setSpecification(wrappedBooking.getSpecification()); bookingCategory.setCustom(wrappedBooking.getCustom()); bookingCategory.setEmail(wrappedBooking.getEmail()); bookingCategory.setHomepage(wrappedBooking.getHomepage()); bookingCategory.setHotline(wrappedBooking.getHotline()); bookingCategory.setLogo(wrappedBooking.getLogo()); if (wrappedBooking.getCycle() != null) { bookingCategory.setInterval(Cycle.valueOf(wrappedBooking.getCycle().toString())); } bookingCategory.setRules(wrappedBooking.getRuleIds()); return bookingCategory; }
static BookingCategory mapToBookingcategory(WrappedBooking wrappedBooking) { BookingCategory bookingCategory = new BookingCategory(); bookingCategory.setReceiver(wrappedBooking.getOtherAccount()); bookingCategory.setMainCategory(wrappedBooking.getMainCategory()); bookingCategory.setSubCategory(wrappedBooking.getSubCategory()); bookingCategory.setSpecification(wrappedBooking.getSpecification()); bookingCategory.setCustom(wrappedBooking.getCustom()); bookingCategory.setEmail(wrappedBooking.getEmail()); bookingCategory.setHomepage(wrappedBooking.getHomepage()); bookingCategory.setHotline(wrappedBooking.getHotline()); bookingCategory.setLogo(wrappedBooking.getLogo()); if (wrappedBooking.getCycle() != null) { bookingCategory.setInterval(Cycle.valueOf(wrappedBooking.getCycle().toString())); } bookingCategory.setRules(wrappedBooking.getRuleIds()); return bookingCategory; }