diff --git a/pom.xml b/pom.xml index 89e23b0..a006875 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.sadtech.vkbot core - 0.4-SNAPSHOT + 0.4-RELEASE diff --git a/src/main/java/org/sadtech/vkbot/core/VkApi.java b/src/main/java/org/sadtech/vkbot/core/VkApi.java index d868ff0..b6eb483 100644 --- a/src/main/java/org/sadtech/vkbot/core/VkApi.java +++ b/src/main/java/org/sadtech/vkbot/core/VkApi.java @@ -59,8 +59,8 @@ public class VkApi { } catch (ApiException | ClientException e) { e.printStackTrace(); } - if (temp!=null) { - if (temp.get(0).getCity()!=null) { + if (temp != null) { + if (temp.get(0).getCity() != null) { log.info("Запрошен город пользователя: " + temp.get(0).getCity().getTitle()); return temp.get(0).getCity().getTitle(); } @@ -68,5 +68,4 @@ public class VkApi { return null; } - } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java index 729fd8a..c03fc7a 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/CommentSubscriber.java @@ -25,4 +25,5 @@ public class CommentSubscriber implements EventSubscribe { WallComment wallComment = gson.fromJson(object, WallComment.class); log.info(wallComment); } + } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java index e32291c..d43b9b3 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/EventDistributorVK.java @@ -42,4 +42,5 @@ public class EventDistributorVK implements EventDistributable, Runnable { public void run() { distribute(); } + } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java index 9ed0c9d..fe7a586 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailChatSubscriber.java @@ -26,4 +26,5 @@ public class MailChatSubscriber implements EventSubscribe { public void update(Message message) { mailService.add(message); } + } diff --git a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java index a9675a1..7ec7d66 100644 --- a/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java +++ b/src/main/java/org/sadtech/vkbot/core/distribution/impl/MailSubscriber.java @@ -47,7 +47,7 @@ public class MailSubscriber implements EventSubscribe, EventDistribu log.info("Дистрибьютор получил событие - сообщение"); Gson gson = new Gson(); Message userMessage = gson.fromJson(object, Message.class); - if (userMessage.getPeerId()>2000000000) { + if (userMessage.getPeerId() > 2000000000) { if (eventDistributionMap.containsKey("chat")) { eventDistributionMap.get("chat").update(userMessage); } diff --git a/src/main/java/org/sadtech/vkbot/core/entity/MailSend.java b/src/main/java/org/sadtech/vkbot/core/entity/MailSend.java index 999f9b0..db19bd4 100644 --- a/src/main/java/org/sadtech/vkbot/core/entity/MailSend.java +++ b/src/main/java/org/sadtech/vkbot/core/entity/MailSend.java @@ -62,4 +62,5 @@ public class MailSend { ", stickerId=" + stickerId + '}'; } + } diff --git a/src/main/java/org/sadtech/vkbot/core/entity/Person.java b/src/main/java/org/sadtech/vkbot/core/entity/Person.java index 9040b63..4a6e4d3 100644 --- a/src/main/java/org/sadtech/vkbot/core/entity/Person.java +++ b/src/main/java/org/sadtech/vkbot/core/entity/Person.java @@ -78,4 +78,5 @@ public class Person { public int hashCode() { return Objects.hash(id, firstName, lastName, sex, city); } + } diff --git a/src/main/java/org/sadtech/vkbot/core/insert/Insert.java b/src/main/java/org/sadtech/vkbot/core/insert/Insert.java deleted file mode 100644 index 173541c..0000000 --- a/src/main/java/org/sadtech/vkbot/core/insert/Insert.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.sadtech.vkbot.core.insert; - -public interface Insert { - - String insertWords(); - -} diff --git a/src/main/java/org/sadtech/vkbot/core/insert/InsertWords.java b/src/main/java/org/sadtech/vkbot/core/insert/InsertWords.java index f8c23e7..ba2588e 100644 --- a/src/main/java/org/sadtech/vkbot/core/insert/InsertWords.java +++ b/src/main/java/org/sadtech/vkbot/core/insert/InsertWords.java @@ -10,17 +10,17 @@ public class InsertWords { private String outText; public void insert(List words) { - Pattern pattern = Pattern.compile("\\{(\\d+)}"); // Задаем шаблон - Matcher m = pattern.matcher(inText); // Инициализация Matcher - StringBuffer result = new StringBuffer(); // Буфер для конечного значения - while (m.find()) { // Проверка на совпадение + Pattern pattern = Pattern.compile("\\{(\\d+)}"); + Matcher m = pattern.matcher(inText); + StringBuffer result = new StringBuffer(); + while (m.find()) { if (Integer.parseInt(m.group(1)) < words.size()) { - m.appendReplacement(result, words.get(Integer.parseInt(m.group(1)))); // Подставляем значение из HashMap + m.appendReplacement(result, words.get(Integer.parseInt(m.group(1)))); } else { m.appendReplacement(result, m.group(0)); } } - m.appendTail(result); // Добавить остаток строки + m.appendTail(result); outText = result.toString(); } diff --git a/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java b/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java index 18df94c..6092007 100644 --- a/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java +++ b/src/main/java/org/sadtech/vkbot/core/listener/EventListenerVk.java @@ -80,4 +80,5 @@ public class EventListenerVk implements EventListener, Runnable { e.printStackTrace(); } } + } diff --git a/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java index 08873e6..a88ded9 100644 --- a/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java +++ b/src/main/java/org/sadtech/vkbot/core/sender/MailSenderVk.java @@ -28,7 +28,7 @@ public class MailSenderVk implements MailSent { this.vkInsertData = new VkInsertData(vkConnect); } - private MessagesSendQuery createMessage (MailSend mailSend, Integer peerId) { + private MessagesSendQuery createMessage(MailSend mailSend, Integer peerId) { MessagesSendQuery messages = vkApiClient.messages().send(groupActor).peerId(peerId); if (mailSend.getKeyboard() != null) { messages.keyboard(mailSend.getKeyboard()); @@ -76,4 +76,5 @@ public class MailSenderVk implements MailSent { e.printStackTrace(); } } + } diff --git a/src/main/java/org/sadtech/vkbot/core/service/PersonService.java b/src/main/java/org/sadtech/vkbot/core/service/PersonService.java index 7769688..af2fe2b 100644 --- a/src/main/java/org/sadtech/vkbot/core/service/PersonService.java +++ b/src/main/java/org/sadtech/vkbot/core/service/PersonService.java @@ -17,4 +17,5 @@ public interface PersonService { boolean checkPerson(Integer idPerson); Person createPerson(Integer userId); + } diff --git a/src/main/java/org/sadtech/vkbot/core/service/distribution/CommentService.java b/src/main/java/org/sadtech/vkbot/core/service/distribution/CommentService.java index 8aaafc3..e62efd5 100644 --- a/src/main/java/org/sadtech/vkbot/core/service/distribution/CommentService.java +++ b/src/main/java/org/sadtech/vkbot/core/service/distribution/CommentService.java @@ -3,8 +3,8 @@ package org.sadtech.vkbot.core.service.distribution; import org.sadtech.vkbot.core.entity.Comment; import org.sadtech.vkbot.core.service.distribution.impl.EventService; +//@TODO: Дописать класс public interface CommentService extends EventService { - } diff --git a/src/main/java/org/sadtech/vkbot/core/service/distribution/impl/CommentServiceImpl.java b/src/main/java/org/sadtech/vkbot/core/service/distribution/impl/CommentServiceImpl.java index a22c868..074325b 100644 --- a/src/main/java/org/sadtech/vkbot/core/service/distribution/impl/CommentServiceImpl.java +++ b/src/main/java/org/sadtech/vkbot/core/service/distribution/impl/CommentServiceImpl.java @@ -33,4 +33,5 @@ public class CommentServiceImpl implements CommentService { public List getLastMailByTime(Integer timeFrom, Integer timeTo) { return null; } + } diff --git a/src/main/java/org/sadtech/vkbot/core/service/impl/PersonServiceImpl.java b/src/main/java/org/sadtech/vkbot/core/service/impl/PersonServiceImpl.java index 10a5af3..e4240c1 100644 --- a/src/main/java/org/sadtech/vkbot/core/service/impl/PersonServiceImpl.java +++ b/src/main/java/org/sadtech/vkbot/core/service/impl/PersonServiceImpl.java @@ -72,4 +72,5 @@ public class PersonServiceImpl implements PersonService { person.setFirstName(userMin.getFirstName()); return person; } + } diff --git a/src/main/java/org/sadtech/vkbot/core/service/impl/RawEventServiceImpl.java b/src/main/java/org/sadtech/vkbot/core/service/impl/RawEventServiceImpl.java index 7464f08..f150c47 100644 --- a/src/main/java/org/sadtech/vkbot/core/service/impl/RawEventServiceImpl.java +++ b/src/main/java/org/sadtech/vkbot/core/service/impl/RawEventServiceImpl.java @@ -43,4 +43,5 @@ public class RawEventServiceImpl implements RawEventService { public void replacementEventRepository(EventRepository eventRepository) { this.eventRepository = eventRepository; } + }