From 06818e6656045f3410dfa270aac2a2fe853dee06 Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Mon, 21 Jan 2019 13:12:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=8C=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BE=D1=82?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sadtech/autoresponder/Autoresponder.java | 7 ++++++- .../autoresponder/service/impl/PersonServiceImpl.java | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) 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