Создал ORM основу для основного модуля
This commit is contained in:
parent
8be8c6f1fa
commit
6c6a4338c6
15
core/pom.xml
15
core/pom.xml
@ -14,6 +14,9 @@
|
||||
<properties>
|
||||
<persistence.ver>1.0.2</persistence.ver>
|
||||
<lombok.ver>1.18.4</lombok.ver>
|
||||
<log4j>1.2.17</log4j>
|
||||
|
||||
<spring.data>2.1.3.RELEASE</spring.data>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -28,6 +31,18 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.ver}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>${spring.data}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
@ -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<NextUnit, Long> {
|
||||
|
||||
|
||||
|
||||
}
|
@ -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<SaveUnit, Long> {
|
||||
}
|
@ -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<SocialNetworks, Long> {
|
||||
}
|
@ -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<Unit, Long> {
|
||||
}
|
@ -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<User, Long> {
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package org.sadtech.consultant.service;
|
||||
|
||||
public interface NextUnitService {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package org.sadtech.consultant.service;
|
||||
|
||||
public interface SaveUnitService {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package org.sadtech.consultant.service;
|
||||
|
||||
public interface SocialNetworksService {
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
@ -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: Написать удаление профиля из бд
|
||||
}
|
||||
}
|
15
facebook-bot/pom.xml
Normal file
15
facebook-bot/pom.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>consultant</artifactId>
|
||||
<groupId>org.sadtech</groupId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>facebook-bot</artifactId>
|
||||
|
||||
|
||||
</project>
|
1
pom.xml
1
pom.xml
@ -11,6 +11,7 @@
|
||||
<modules>
|
||||
<module>vk-bot</module>
|
||||
<module>core</module>
|
||||
<module>facebook-bot</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<artifactId>time-table</artifactId>
|
||||
<groupId>org.sadtech</groupId>
|
||||
@ -35,10 +36,46 @@
|
||||
|
||||
<properties>
|
||||
<vk.api.ver>0.5.12</vk.api.ver>
|
||||
<spring.ver>5.1.3.RELEASE</spring.ver>
|
||||
|
||||
<spring.core>5.1.3.RELEASE</spring.core>
|
||||
<spring.context>5.1.3.RELEASE</spring.context>
|
||||
<spring.web>5.1.3.RELEASE</spring.web>
|
||||
<spring.webmvc>5.1.3.RELEASE</spring.webmvc>
|
||||
<spring.context>5.1.3.RELEASE</spring.context>
|
||||
<spring.context>5.1.3.RELEASE</spring.context>
|
||||
<spring.data>2.1.3.RELEASE</spring.data>
|
||||
|
||||
<javax.servlet>3.1.0</javax.servlet>
|
||||
<javax.persistance>1.0.2</javax.persistance>
|
||||
|
||||
<hibernate.entitymanager>5.4.0.Final</hibernate.entitymanager>
|
||||
<hibernate.core>5.2.10.Final</hibernate.core>
|
||||
|
||||
<mysql.connector>8.0.13</mysql.connector>
|
||||
|
||||
<lombok>1.18.4</lombok>
|
||||
|
||||
<log4j>1.2.17</log4j>
|
||||
|
||||
<json>20180813</json>
|
||||
|
||||
<jetty.util>6.1.25</jetty.util>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vk.api</groupId>
|
||||
<artifactId>sdk</artifactId>
|
||||
@ -48,99 +85,73 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.ver}</version>
|
||||
<version>${spring.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.ver}</version>
|
||||
<version>${spring.context}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.ver}</version>
|
||||
<version>${spring.context}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.ver}</version>
|
||||
<version>${spring.web}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>5.1.3.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>5.1.3.RELEASE</version>
|
||||
<version>${spring.webmvc}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>2.1.3.RELEASE</version>
|
||||
<version>${spring.data}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>${javax.servlet}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>6.1.25</version>
|
||||
<version>${jetty.util}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20180813</version>
|
||||
<version>${json}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>${javax.persistance}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.13</version>
|
||||
<version>${mysql.connector}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>5.4.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<version>${hibernate.entitymanager}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>5.2.10.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>5.2.10.Final</version>
|
||||
<version>${hibernate.core}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
@ -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}")
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<User, Long> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.sadtech.vkbot.service;
|
||||
|
||||
import org.sadtech.vkbot.dao.User;
|
||||
import org.sadtech.vkbot.entity.User;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user