Refactoring: Code Style and Optimize import

This commit is contained in:
Mark Struchkov 2019-01-09 11:09:00 +03:00
parent e88563b94e
commit 273356cd83
12 changed files with 11 additions and 31 deletions

View File

@ -3,7 +3,8 @@ package org.sadtech.consultant.database.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
@Entity
@Data
@ -25,11 +26,8 @@ public class Person {
private String token;
@ElementCollection
@CollectionTable(name="PersonSocialNetworks")
@MapKeyColumn(name="KeysSocialNetworks", length = 20)
@CollectionTable(name = "PersonSocialNetworks")
@MapKeyColumn(name = "KeysSocialNetworks", length = 20)
private Map<String, Integer> socialNetworks = new HashMap<>();
// @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="idMess")
// private List<Message> messages;
}

View File

@ -4,7 +4,6 @@ import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Data

View File

@ -4,7 +4,6 @@ import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Data

View File

@ -7,8 +7,12 @@ import java.util.Map;
public interface PersonService {
void addUser(Person user);
void removeUser(Long id);
Person getUserByID(Long id);
Map<String, Integer> getSocialNetwork(Long id);
Person getUserBySocialNetworksId(String type, Integer socialNetworksId);
}

View File

@ -5,6 +5,7 @@ import org.sadtech.consultant.database.entity.Unit;
public interface UnitService {
void addUnit(Unit unit);
void removeUnit(Long id);
}

View File

@ -5,7 +5,6 @@ import org.sadtech.consultant.database.repository.MessageRepository;
import org.sadtech.consultant.database.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

View File

@ -1,7 +1,6 @@
package org.sadtech.consultant.processing;
import org.sadtech.consultant.database.entity.Message;
import org.sadtech.consultant.database.entity.Person;
import org.sadtech.consultant.database.service.MessageService;
import org.springframework.stereotype.Component;

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
public class Main {
public static void main(String[] args) throws Exception {
Main main = new Main();
main.run();
Main main = new Main();
main.run();
}
public void run() throws Exception {

View File

@ -1,21 +1,14 @@
package org.sadtech.vkbot;
import com.google.gson.Gson;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.GroupActor;
import com.vk.api.sdk.exceptions.ApiException;
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.queries.users.UserField;
import lombok.extern.log4j.Log4j;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Log4j
@Component

View File

@ -3,7 +3,6 @@ package org.sadtech.vkbot.handlers.impl;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.vk.api.sdk.objects.users.UserXtrCounters;
import com.vk.api.sdk.queries.users.UserField;
import lombok.extern.log4j.Log4j;
import org.sadtech.consultant.database.entity.Message;
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.springframework.stereotype.Component;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Log4j
@Component
public class MessageHandlerVk implements Observer {

View File

@ -2,8 +2,6 @@ package org.sadtech.vkbot.listener;
import com.google.gson.JsonObject;
import java.util.List;
public interface Observer {
void update(JsonObject object);
}

View File

@ -9,14 +9,11 @@ import com.vk.api.sdk.exceptions.ApiException;
import com.vk.api.sdk.exceptions.ClientException;
import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse;
import lombok.extern.log4j.Log4j;
import org.sadtech.vkbot.VkApi;
import org.sadtech.vkbot.listener.EventListenable;
import org.sadtech.vkbot.listener.data.ResponsibleData;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Date;
@Log4j
@Component
public class EventListenerVk implements EventListenable {
@ -61,5 +58,4 @@ public class EventListenerVk implements EventListenable {
}
}