diff --git a/src/main/java/org/sadtech/autoresponder/Autoresponder.java b/src/main/java/org/sadtech/autoresponder/Autoresponder.java index a3154f5..8044482 100644 --- a/src/main/java/org/sadtech/autoresponder/Autoresponder.java +++ b/src/main/java/org/sadtech/autoresponder/Autoresponder.java @@ -28,10 +28,15 @@ public class Autoresponder { Unit unit; if (person.getUnit() == null) { unit = nextUnit(unitService.menuUnit(), message); + person.setUnit(unit); } else { unit = nextUnit(person.getUnit().getNextUnits(), message); + if (unit == null) { + return null; + } else { + person.setUnit(unit); + } } - person.setUnit(unit); return unit; } diff --git a/src/main/java/org/sadtech/autoresponder/service/impl/PersonServiceImpl.java b/src/main/java/org/sadtech/autoresponder/service/impl/PersonServiceImpl.java index d7933f2..f958c01 100644 --- a/src/main/java/org/sadtech/autoresponder/service/impl/PersonServiceImpl.java +++ b/src/main/java/org/sadtech/autoresponder/service/impl/PersonServiceImpl.java @@ -1,9 +1,11 @@ package org.sadtech.autoresponder.service.impl; +import lombok.extern.log4j.Log4j; import org.sadtech.autoresponder.entity.Person; import org.sadtech.autoresponder.repository.PersonRepository; import org.sadtech.autoresponder.service.PersonService; +@Log4j public class PersonServiceImpl implements PersonService { private PersonRepository personRepository; @@ -20,6 +22,7 @@ public class PersonServiceImpl implements PersonService { @Override public void addPerson(Person person) { personRepository.addPerson(person); + log.info("Пользователь отправлен в репозиторий"); } @Override