From 6c6a4338c60b0236845f0cacd6ffc05713959c5f Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Sun, 23 Dec 2018 03:34:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20ORM=20?= =?UTF-8?q?=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D1=83=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=D1=83=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/pom.xml | 15 +++ .../org/sadtech/consultant/dao/NextStage.java | 14 --- .../sadtech/consultant/entity/NextUnit.java | 14 +++ .../sadtech/consultant/entity/SaveUnit.java | 16 ++++ .../{dao => entity}/SocialNetworks.java | 9 +- .../{dao/Stage.java => entity/Unit.java} | 6 +- .../consultant/{dao => entity}/User.java | 5 +- .../repository/NextUnitRepositoriy.java | 10 ++ .../repository/SaveUnitRepositoriy.java | 7 ++ .../repository/SocialNetworksRepositoriy.java | 7 ++ .../repository/UnitRepositoriy.java | 7 ++ .../repository/UserRepositoriy.java | 8 ++ .../consultant/service/NextUnitService.java | 4 + .../consultant/service/SaveUnitService.java | 4 + .../service/SocialNetworksService.java | 4 + .../consultant/service/UnitService.java | 10 ++ .../consultant/service/UserService.java | 10 ++ .../service/impl/NextUnitServiceImpl.java | 14 +++ .../service/impl/SaveUnitServiceImpl.java | 14 +++ .../impl/SocialNetworksServiceImpl.java | 14 +++ .../service/impl/UnitServiceImpl.java | 22 +++++ .../service/impl/UserServiceImpl.java | 22 +++++ facebook-bot/pom.xml | 15 +++ pom.xml | 1 + vk-bot/pom.xml | 93 +++++++++++-------- .../org/sadtech/vkbot/config/DataConfig.java | 2 +- .../org/sadtech/vkbot/controller/Test.java | 14 +-- .../main/java/org/sadtech/vkbot/dao/User.java | 19 ---- .../java/org/sadtech/vkbot/entity/User.java | 6 +- .../sadtech/vkbot/repo/UserRepository.java | 2 +- .../sadtech/vkbot/service/UserService.java | 2 +- .../vkbot/service/impl/UserServiceImpl.java | 2 +- 32 files changed, 291 insertions(+), 101 deletions(-) delete mode 100644 core/src/main/java/org/sadtech/consultant/dao/NextStage.java create mode 100644 core/src/main/java/org/sadtech/consultant/entity/NextUnit.java create mode 100644 core/src/main/java/org/sadtech/consultant/entity/SaveUnit.java rename core/src/main/java/org/sadtech/consultant/{dao => entity}/SocialNetworks.java (51%) rename core/src/main/java/org/sadtech/consultant/{dao/Stage.java => entity/Unit.java} (67%) rename core/src/main/java/org/sadtech/consultant/{dao => entity}/User.java (81%) create mode 100644 core/src/main/java/org/sadtech/consultant/repository/NextUnitRepositoriy.java create mode 100644 core/src/main/java/org/sadtech/consultant/repository/SaveUnitRepositoriy.java create mode 100644 core/src/main/java/org/sadtech/consultant/repository/SocialNetworksRepositoriy.java create mode 100644 core/src/main/java/org/sadtech/consultant/repository/UnitRepositoriy.java create mode 100644 core/src/main/java/org/sadtech/consultant/repository/UserRepositoriy.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/NextUnitService.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/SaveUnitService.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/SocialNetworksService.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/UnitService.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/UserService.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/impl/NextUnitServiceImpl.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/impl/SaveUnitServiceImpl.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/impl/SocialNetworksServiceImpl.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/impl/UnitServiceImpl.java create mode 100644 core/src/main/java/org/sadtech/consultant/service/impl/UserServiceImpl.java create mode 100644 facebook-bot/pom.xml delete mode 100644 vk-bot/src/main/java/org/sadtech/vkbot/dao/User.java rename core/src/main/java/org/sadtech/consultant/dao/SaveStage.java => vk-bot/src/main/java/org/sadtech/vkbot/entity/User.java (60%) diff --git a/core/pom.xml b/core/pom.xml index b500633..5e55758 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -14,6 +14,9 @@ 1.0.2 1.18.4 + 1.2.17 + + 2.1.3.RELEASE @@ -28,6 +31,18 @@ lombok ${lombok.ver} + + + log4j + log4j + ${log4j} + + + + org.springframework.data + spring-data-jpa + ${spring.data} + \ No newline at end of file diff --git a/core/src/main/java/org/sadtech/consultant/dao/NextStage.java b/core/src/main/java/org/sadtech/consultant/dao/NextStage.java deleted file mode 100644 index 9a7947d..0000000 --- a/core/src/main/java/org/sadtech/consultant/dao/NextStage.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sadtech.consultant.dao; - -import lombok.Data; - -import javax.persistence.Entity; - -@Entity -@Data -public class NextStage { - - private long id; - private long idNext; - -} diff --git a/core/src/main/java/org/sadtech/consultant/entity/NextUnit.java b/core/src/main/java/org/sadtech/consultant/entity/NextUnit.java new file mode 100644 index 0000000..922cd20 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/entity/NextUnit.java @@ -0,0 +1,14 @@ +package org.sadtech.consultant.entity; + +import lombok.Data; + +import javax.persistence.Entity; + +@Entity +@Data +public class NextUnit { + + private Long id; + private Long idNext; + +} diff --git a/core/src/main/java/org/sadtech/consultant/entity/SaveUnit.java b/core/src/main/java/org/sadtech/consultant/entity/SaveUnit.java new file mode 100644 index 0000000..8e7a447 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/entity/SaveUnit.java @@ -0,0 +1,16 @@ +package org.sadtech.consultant.entity; + +import lombok.Data; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +@Data +public class SaveUnit { + + @Id + private Long id; + private Long idStage; + +} diff --git a/core/src/main/java/org/sadtech/consultant/dao/SocialNetworks.java b/core/src/main/java/org/sadtech/consultant/entity/SocialNetworks.java similarity index 51% rename from core/src/main/java/org/sadtech/consultant/dao/SocialNetworks.java rename to core/src/main/java/org/sadtech/consultant/entity/SocialNetworks.java index 7dd831a..d167608 100644 --- a/core/src/main/java/org/sadtech/consultant/dao/SocialNetworks.java +++ b/core/src/main/java/org/sadtech/consultant/entity/SocialNetworks.java @@ -1,4 +1,4 @@ -package org.sadtech.consultant.dao; +package org.sadtech.consultant.entity; import lombok.Data; @@ -10,9 +10,8 @@ import javax.persistence.Id; public class SocialNetworks { @Id - private long id; - private long idVk; - private long idFacebook; - private long phone; + private Long id; + private Long idVk; + private Long idFacebook; } diff --git a/core/src/main/java/org/sadtech/consultant/dao/Stage.java b/core/src/main/java/org/sadtech/consultant/entity/Unit.java similarity index 67% rename from core/src/main/java/org/sadtech/consultant/dao/Stage.java rename to core/src/main/java/org/sadtech/consultant/entity/Unit.java index 59aa1d7..0f13505 100644 --- a/core/src/main/java/org/sadtech/consultant/dao/Stage.java +++ b/core/src/main/java/org/sadtech/consultant/entity/Unit.java @@ -1,4 +1,4 @@ -package org.sadtech.consultant.dao; +package org.sadtech.consultant.entity; import lombok.Data; @@ -7,10 +7,10 @@ import javax.persistence.Id; @Entity @Data -public class Stage { +public class Unit { @Id - private long id; + private Long id; private String text; private String wordKeys; diff --git a/core/src/main/java/org/sadtech/consultant/dao/User.java b/core/src/main/java/org/sadtech/consultant/entity/User.java similarity index 81% rename from core/src/main/java/org/sadtech/consultant/dao/User.java rename to core/src/main/java/org/sadtech/consultant/entity/User.java index cf14046..c58617b 100644 --- a/core/src/main/java/org/sadtech/consultant/dao/User.java +++ b/core/src/main/java/org/sadtech/consultant/entity/User.java @@ -1,4 +1,4 @@ -package org.sadtech.consultant.dao; +package org.sadtech.consultant.entity; import lombok.Data; @@ -12,8 +12,7 @@ import java.util.List; public class User { @Id - @GeneratedValue - private long id; + private Long id; private String name; private String token; private String lastName; diff --git a/core/src/main/java/org/sadtech/consultant/repository/NextUnitRepositoriy.java b/core/src/main/java/org/sadtech/consultant/repository/NextUnitRepositoriy.java new file mode 100644 index 0000000..6cc97d5 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/repository/NextUnitRepositoriy.java @@ -0,0 +1,10 @@ +package org.sadtech.consultant.repository; + +import org.sadtech.consultant.entity.NextUnit; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface NextUnitRepositoriy extends JpaRepository { + + + +} diff --git a/core/src/main/java/org/sadtech/consultant/repository/SaveUnitRepositoriy.java b/core/src/main/java/org/sadtech/consultant/repository/SaveUnitRepositoriy.java new file mode 100644 index 0000000..d1cd49a --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/repository/SaveUnitRepositoriy.java @@ -0,0 +1,7 @@ +package org.sadtech.consultant.repository; + +import org.sadtech.consultant.entity.SaveUnit; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface SaveUnitRepositoriy extends JpaRepository { +} diff --git a/core/src/main/java/org/sadtech/consultant/repository/SocialNetworksRepositoriy.java b/core/src/main/java/org/sadtech/consultant/repository/SocialNetworksRepositoriy.java new file mode 100644 index 0000000..1e9e84a --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/repository/SocialNetworksRepositoriy.java @@ -0,0 +1,7 @@ +package org.sadtech.consultant.repository; + +import org.sadtech.consultant.entity.SocialNetworks; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface SocialNetworksRepositoriy extends JpaRepository { +} diff --git a/core/src/main/java/org/sadtech/consultant/repository/UnitRepositoriy.java b/core/src/main/java/org/sadtech/consultant/repository/UnitRepositoriy.java new file mode 100644 index 0000000..f804f65 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/repository/UnitRepositoriy.java @@ -0,0 +1,7 @@ +package org.sadtech.consultant.repository; + +import org.sadtech.consultant.entity.Unit; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UnitRepositoriy extends JpaRepository { +} diff --git a/core/src/main/java/org/sadtech/consultant/repository/UserRepositoriy.java b/core/src/main/java/org/sadtech/consultant/repository/UserRepositoriy.java new file mode 100644 index 0000000..25e5e05 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/repository/UserRepositoriy.java @@ -0,0 +1,8 @@ +package org.sadtech.consultant.repository; + +import org.sadtech.consultant.entity.User; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserRepositoriy extends JpaRepository { + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/NextUnitService.java b/core/src/main/java/org/sadtech/consultant/service/NextUnitService.java new file mode 100644 index 0000000..9ff5ac8 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/NextUnitService.java @@ -0,0 +1,4 @@ +package org.sadtech.consultant.service; + +public interface NextUnitService { +} diff --git a/core/src/main/java/org/sadtech/consultant/service/SaveUnitService.java b/core/src/main/java/org/sadtech/consultant/service/SaveUnitService.java new file mode 100644 index 0000000..39e76cc --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/SaveUnitService.java @@ -0,0 +1,4 @@ +package org.sadtech.consultant.service; + +public interface SaveUnitService { +} diff --git a/core/src/main/java/org/sadtech/consultant/service/SocialNetworksService.java b/core/src/main/java/org/sadtech/consultant/service/SocialNetworksService.java new file mode 100644 index 0000000..54dab6d --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/SocialNetworksService.java @@ -0,0 +1,4 @@ +package org.sadtech.consultant.service; + +public interface SocialNetworksService { +} diff --git a/core/src/main/java/org/sadtech/consultant/service/UnitService.java b/core/src/main/java/org/sadtech/consultant/service/UnitService.java new file mode 100644 index 0000000..c8e77e9 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/UnitService.java @@ -0,0 +1,10 @@ +package org.sadtech.consultant.service; + +import org.sadtech.consultant.entity.Unit; + +public interface UnitService { + + void addUnit(Unit unit); + void removeUnit(Long id); + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/UserService.java b/core/src/main/java/org/sadtech/consultant/service/UserService.java new file mode 100644 index 0000000..5018e68 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/UserService.java @@ -0,0 +1,10 @@ +package org.sadtech.consultant.service; + +import org.sadtech.consultant.entity.User; + +public interface UserService { + + void addUser(User user); + void removeUser(Long id); + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/impl/NextUnitServiceImpl.java b/core/src/main/java/org/sadtech/consultant/service/impl/NextUnitServiceImpl.java new file mode 100644 index 0000000..d06b195 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/impl/NextUnitServiceImpl.java @@ -0,0 +1,14 @@ +package org.sadtech.consultant.service.impl; + +import org.sadtech.consultant.repository.NextUnitRepositoriy; +import org.sadtech.consultant.service.NextUnitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class NextUnitServiceImpl implements NextUnitService { + + @Autowired + private NextUnitRepositoriy repositoriy; + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/impl/SaveUnitServiceImpl.java b/core/src/main/java/org/sadtech/consultant/service/impl/SaveUnitServiceImpl.java new file mode 100644 index 0000000..51ef4b6 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/impl/SaveUnitServiceImpl.java @@ -0,0 +1,14 @@ +package org.sadtech.consultant.service.impl; + +import org.sadtech.consultant.repository.SaveUnitRepositoriy; +import org.sadtech.consultant.service.SaveUnitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SaveUnitServiceImpl implements SaveUnitService { + + @Autowired + private SaveUnitRepositoriy repositoriy; + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/impl/SocialNetworksServiceImpl.java b/core/src/main/java/org/sadtech/consultant/service/impl/SocialNetworksServiceImpl.java new file mode 100644 index 0000000..06d5f78 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/impl/SocialNetworksServiceImpl.java @@ -0,0 +1,14 @@ +package org.sadtech.consultant.service.impl; + +import org.sadtech.consultant.repository.SocialNetworksRepositoriy; +import org.sadtech.consultant.service.SocialNetworksService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SocialNetworksServiceImpl implements SocialNetworksService { + + @Autowired + private SocialNetworksRepositoriy repositoriy; + +} diff --git a/core/src/main/java/org/sadtech/consultant/service/impl/UnitServiceImpl.java b/core/src/main/java/org/sadtech/consultant/service/impl/UnitServiceImpl.java new file mode 100644 index 0000000..14706d9 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/impl/UnitServiceImpl.java @@ -0,0 +1,22 @@ +package org.sadtech.consultant.service.impl; + +import org.sadtech.consultant.entity.Unit; +import org.sadtech.consultant.repository.UnitRepositoriy; +import org.sadtech.consultant.service.UnitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UnitServiceImpl implements UnitService { + + @Autowired + private UnitRepositoriy repositoriy; + + public void addUnit(Unit unit) { + repositoriy.saveAndFlush(unit); + } + + public void removeUnit(Long id) { + + } +} diff --git a/core/src/main/java/org/sadtech/consultant/service/impl/UserServiceImpl.java b/core/src/main/java/org/sadtech/consultant/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..3535b00 --- /dev/null +++ b/core/src/main/java/org/sadtech/consultant/service/impl/UserServiceImpl.java @@ -0,0 +1,22 @@ +package org.sadtech.consultant.service.impl; + +import org.sadtech.consultant.entity.User; +import org.sadtech.consultant.repository.UserRepositoriy; +import org.sadtech.consultant.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserRepositoriy repositoriy; + + public void addUser(User user) { + //@TODO: Написть добавление профиля в бд + } + + public void removeUser(Long id) { + //@TODO: Написать удаление профиля из бд + } +} diff --git a/facebook-bot/pom.xml b/facebook-bot/pom.xml new file mode 100644 index 0000000..dca92c0 --- /dev/null +++ b/facebook-bot/pom.xml @@ -0,0 +1,15 @@ + + + + consultant + org.sadtech + 0.1-SNAPSHOT + + 4.0.0 + + facebook-bot + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 494110a..d7ad9d4 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ vk-bot core + facebook-bot diff --git a/vk-bot/pom.xml b/vk-bot/pom.xml index 09af7bc..8139c8a 100644 --- a/vk-bot/pom.xml +++ b/vk-bot/pom.xml @@ -2,6 +2,7 @@ + time-table org.sadtech @@ -35,10 +36,46 @@ 0.5.12 - 5.1.3.RELEASE + + 5.1.3.RELEASE + 5.1.3.RELEASE + 5.1.3.RELEASE + 5.1.3.RELEASE + 5.1.3.RELEASE + 5.1.3.RELEASE + 2.1.3.RELEASE + + 3.1.0 + 1.0.2 + + 5.4.0.Final + 5.2.10.Final + + 8.0.13 + + 1.18.4 + + 1.2.17 + + 20180813 + + 6.1.25 + + + org.projectlombok + lombok + ${lombok} + + + + log4j + log4j + ${log4j} + + com.vk.api sdk @@ -48,99 +85,73 @@ org.springframework spring-core - ${spring.ver} + ${spring.core} org.springframework spring-context - ${spring.ver} + ${spring.context} org.springframework spring-context-support - ${spring.ver} + ${spring.context} org.springframework spring-web - ${spring.ver} + ${spring.web} org.springframework spring-webmvc - 5.1.3.RELEASE - - - org.springframework - spring-core - 5.1.3.RELEASE + ${spring.webmvc} org.springframework.data spring-data-jpa - 2.1.3.RELEASE + ${spring.data} javax.servlet javax.servlet-api - 3.1.0 + ${javax.servlet} - org.mortbay.jetty jetty-util - 6.1.25 + ${jetty.util} org.json json - 20180813 + ${json} javax.persistence persistence-api - 1.0.2 + ${javax.persistance} mysql mysql-connector-java - 8.0.13 + ${mysql.connector} org.hibernate hibernate-entitymanager - 5.4.0.Final - - - - org.projectlombok - lombok - 1.18.4 - - - - log4j - log4j - 1.2.17 + ${hibernate.entitymanager} org.hibernate hibernate-core - 5.2.10.Final - - - org.hibernate - hibernate-core - 5.2.10.Final + ${hibernate.core} + - - - - \ No newline at end of file diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/config/DataConfig.java b/vk-bot/src/main/java/org/sadtech/vkbot/config/DataConfig.java index e529826..ebca4c1 100644 --- a/vk-bot/src/main/java/org/sadtech/vkbot/config/DataConfig.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/config/DataConfig.java @@ -19,7 +19,7 @@ import java.util.Properties; @EnableTransactionManagement @ComponentScan("org.sadtech.vkbot") @EnableJpaRepositories("org.sadtech.vkbot.repo") -@PropertySource("classpath:app.properties") +@PropertySource("classpath:config.properties") public class DataConfig { @Value("${db.driver}") diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/controller/Test.java b/vk-bot/src/main/java/org/sadtech/vkbot/controller/Test.java index 23b8b78..2ccf655 100644 --- a/vk-bot/src/main/java/org/sadtech/vkbot/controller/Test.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/controller/Test.java @@ -11,17 +11,14 @@ import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse; import lombok.extern.log4j.Log4j; import org.json.JSONObject; import org.sadtech.vkbot.ResponseData; -import org.sadtech.vkbot.dao.User; +import org.sadtech.vkbot.entity.User; import org.sadtech.vkbot.service.UserService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.stereotype.Repository; import javax.annotation.Resource; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; @Log4j + public class Test extends Thread { @Autowired @@ -47,14 +44,13 @@ public class Test extends Thread { } catch (ClientException e) { e.printStackTrace(); } - log.info("Test"); JSONObject jObject = new JSONObject(getResponse); // json // System.out.println(getResponse); String key = jObject.getString("key"); // get the name from data. String server = jObject.getString("server"); Integer ts = jObject.getInt("ts"); LongPoll longPoll = new LongPoll(vk); - GetLongPollEventsQuery getLongPollEventsQuery = longPoll.getEvents(server, key, ts).waitTime(5); + GetLongPollEventsQuery getLongPollEventsQuery = longPoll.getEvents(server, key, ts).waitTime(20); // Gson gson = new Gson(); User user = new User(); @@ -70,14 +66,14 @@ public class Test extends Thread { } catch (ClientException e) { e.printStackTrace(); } - System.out.println(getLongPollEventsResponse); + log.info(getLongPollEventsResponse); if (getLongPollEventsResponse.getUpdates().toArray().length != 0) { responseData.setJsonObjects(getLongPollEventsResponse.getUpdates()); // JsonObject updates = getLongPollEventsResponse.getUpdates().get(0); // JsonObject object = updates.getAsJsonObject("object"); // Message messages = gson.fromJson(object, Message.class); } - getLongPollEventsQuery = longPoll.getEvents(server, key, getLongPollEventsResponse.getTs()).waitTime(5); + getLongPollEventsQuery = longPoll.getEvents(server, key, getLongPollEventsResponse.getTs()).waitTime(20); } } diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/dao/User.java b/vk-bot/src/main/java/org/sadtech/vkbot/dao/User.java deleted file mode 100644 index 3009957..0000000 --- a/vk-bot/src/main/java/org/sadtech/vkbot/dao/User.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.sadtech.vkbot.dao; - -import lombok.Data; -import org.hibernate.annotations.GenericGenerator; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -@Data -public class User { - - @Id - private long id; - private String name; - -} diff --git a/core/src/main/java/org/sadtech/consultant/dao/SaveStage.java b/vk-bot/src/main/java/org/sadtech/vkbot/entity/User.java similarity index 60% rename from core/src/main/java/org/sadtech/consultant/dao/SaveStage.java rename to vk-bot/src/main/java/org/sadtech/vkbot/entity/User.java index c80e35e..1601df8 100644 --- a/core/src/main/java/org/sadtech/consultant/dao/SaveStage.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/entity/User.java @@ -1,4 +1,4 @@ -package org.sadtech.consultant.dao; +package org.sadtech.vkbot.entity; import lombok.Data; @@ -7,10 +7,10 @@ import javax.persistence.Id; @Entity @Data -public class SaveStage { +public class User { @Id private long id; - private long idStage; + private String name; } diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/repo/UserRepository.java b/vk-bot/src/main/java/org/sadtech/vkbot/repo/UserRepository.java index f1629f3..f3cfd50 100644 --- a/vk-bot/src/main/java/org/sadtech/vkbot/repo/UserRepository.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/repo/UserRepository.java @@ -1,6 +1,6 @@ package org.sadtech.vkbot.repo; -import org.sadtech.vkbot.dao.User; +import org.sadtech.vkbot.entity.User; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository { diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/service/UserService.java b/vk-bot/src/main/java/org/sadtech/vkbot/service/UserService.java index 9657604..88cba65 100644 --- a/vk-bot/src/main/java/org/sadtech/vkbot/service/UserService.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/service/UserService.java @@ -1,6 +1,6 @@ package org.sadtech.vkbot.service; -import org.sadtech.vkbot.dao.User; +import org.sadtech.vkbot.entity.User; public interface UserService { diff --git a/vk-bot/src/main/java/org/sadtech/vkbot/service/impl/UserServiceImpl.java b/vk-bot/src/main/java/org/sadtech/vkbot/service/impl/UserServiceImpl.java index 1484ff6..e7e1d2a 100644 --- a/vk-bot/src/main/java/org/sadtech/vkbot/service/impl/UserServiceImpl.java +++ b/vk-bot/src/main/java/org/sadtech/vkbot/service/impl/UserServiceImpl.java @@ -1,6 +1,6 @@ package org.sadtech.vkbot.service.impl; -import org.sadtech.vkbot.dao.User; +import org.sadtech.vkbot.entity.User; import org.sadtech.vkbot.repo.UserRepository; import org.sadtech.vkbot.service.UserService; import org.springframework.beans.factory.annotation.Autowired;