Refactoring: Code Style and Optimize import
This commit is contained in:
parent
e88563b94e
commit
273356cd83
@ -3,7 +3,8 @@ package org.sadtech.consultant.database.entity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
@ -25,11 +26,8 @@ public class Person {
|
|||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@CollectionTable(name="PersonSocialNetworks")
|
@CollectionTable(name = "PersonSocialNetworks")
|
||||||
@MapKeyColumn(name="KeysSocialNetworks", length = 20)
|
@MapKeyColumn(name = "KeysSocialNetworks", length = 20)
|
||||||
private Map<String, Integer> socialNetworks = new HashMap<>();
|
private Map<String, Integer> socialNetworks = new HashMap<>();
|
||||||
|
|
||||||
// @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="idMess")
|
|
||||||
// private List<Message> messages;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
|
@ -4,7 +4,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
|
@ -7,8 +7,12 @@ import java.util.Map;
|
|||||||
public interface PersonService {
|
public interface PersonService {
|
||||||
|
|
||||||
void addUser(Person user);
|
void addUser(Person user);
|
||||||
|
|
||||||
void removeUser(Long id);
|
void removeUser(Long id);
|
||||||
|
|
||||||
Person getUserByID(Long id);
|
Person getUserByID(Long id);
|
||||||
|
|
||||||
Map<String, Integer> getSocialNetwork(Long id);
|
Map<String, Integer> getSocialNetwork(Long id);
|
||||||
|
|
||||||
Person getUserBySocialNetworksId(String type, Integer socialNetworksId);
|
Person getUserBySocialNetworksId(String type, Integer socialNetworksId);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.sadtech.consultant.database.entity.Unit;
|
|||||||
public interface UnitService {
|
public interface UnitService {
|
||||||
|
|
||||||
void addUnit(Unit unit);
|
void addUnit(Unit unit);
|
||||||
|
|
||||||
void removeUnit(Long id);
|
void removeUnit(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import org.sadtech.consultant.database.repository.MessageRepository;
|
|||||||
import org.sadtech.consultant.database.service.MessageService;
|
import org.sadtech.consultant.database.service.MessageService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.sadtech.consultant.processing;
|
package org.sadtech.consultant.processing;
|
||||||
|
|
||||||
import org.sadtech.consultant.database.entity.Message;
|
import org.sadtech.consultant.database.entity.Message;
|
||||||
import org.sadtech.consultant.database.entity.Person;
|
|
||||||
import org.sadtech.consultant.database.service.MessageService;
|
import org.sadtech.consultant.database.service.MessageService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
|||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Main main = new Main();
|
Main main = new Main();
|
||||||
main.run();
|
main.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
package org.sadtech.vkbot;
|
package org.sadtech.vkbot;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.vk.api.sdk.client.VkApiClient;
|
import com.vk.api.sdk.client.VkApiClient;
|
||||||
import com.vk.api.sdk.client.actors.GroupActor;
|
import com.vk.api.sdk.client.actors.GroupActor;
|
||||||
import com.vk.api.sdk.exceptions.ApiException;
|
import com.vk.api.sdk.exceptions.ApiException;
|
||||||
import com.vk.api.sdk.exceptions.ClientException;
|
import com.vk.api.sdk.exceptions.ClientException;
|
||||||
import com.vk.api.sdk.objects.users.User;
|
|
||||||
import com.vk.api.sdk.objects.users.UserMin;
|
|
||||||
import com.vk.api.sdk.objects.users.UserXtrCounters;
|
import com.vk.api.sdk.objects.users.UserXtrCounters;
|
||||||
import com.vk.api.sdk.queries.users.UserField;
|
|
||||||
import lombok.extern.log4j.Log4j;
|
import lombok.extern.log4j.Log4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Log4j
|
@Log4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -3,7 +3,6 @@ package org.sadtech.vkbot.handlers.impl;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.vk.api.sdk.objects.users.UserXtrCounters;
|
import com.vk.api.sdk.objects.users.UserXtrCounters;
|
||||||
import com.vk.api.sdk.queries.users.UserField;
|
|
||||||
import lombok.extern.log4j.Log4j;
|
import lombok.extern.log4j.Log4j;
|
||||||
import org.sadtech.consultant.database.entity.Message;
|
import org.sadtech.consultant.database.entity.Message;
|
||||||
import org.sadtech.consultant.database.entity.Person;
|
import org.sadtech.consultant.database.entity.Person;
|
||||||
@ -15,11 +14,6 @@ import org.sadtech.vkbot.listener.Observable;
|
|||||||
import org.sadtech.vkbot.listener.Observer;
|
import org.sadtech.vkbot.listener.Observer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Log4j
|
@Log4j
|
||||||
@Component
|
@Component
|
||||||
public class MessageHandlerVk implements Observer {
|
public class MessageHandlerVk implements Observer {
|
||||||
|
@ -2,8 +2,6 @@ package org.sadtech.vkbot.listener;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface Observer {
|
public interface Observer {
|
||||||
void update(JsonObject object);
|
void update(JsonObject object);
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,11 @@ import com.vk.api.sdk.exceptions.ApiException;
|
|||||||
import com.vk.api.sdk.exceptions.ClientException;
|
import com.vk.api.sdk.exceptions.ClientException;
|
||||||
import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse;
|
import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse;
|
||||||
import lombok.extern.log4j.Log4j;
|
import lombok.extern.log4j.Log4j;
|
||||||
import org.sadtech.vkbot.VkApi;
|
|
||||||
import org.sadtech.vkbot.listener.EventListenable;
|
import org.sadtech.vkbot.listener.EventListenable;
|
||||||
import org.sadtech.vkbot.listener.data.ResponsibleData;
|
import org.sadtech.vkbot.listener.data.ResponsibleData;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Log4j
|
@Log4j
|
||||||
@Component
|
@Component
|
||||||
public class EventListenerVk implements EventListenable {
|
public class EventListenerVk implements EventListenable {
|
||||||
@ -61,5 +58,4 @@ public class EventListenerVk implements EventListenable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user