Release 0.4

CodeStyle
This commit is contained in:
Mark Struchkov 2019-02-07 18:11:44 +03:00
parent 3873aa35c3
commit f68e6b57d7
17 changed files with 23 additions and 20 deletions

View File

@ -6,7 +6,7 @@
<groupId>org.sadtech.vkbot</groupId>
<artifactId>core</artifactId>
<version>0.4-SNAPSHOT</version>
<version>0.4-RELEASE</version>
<build>
<plugins>
<plugin>

View File

@ -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;
}
}

View File

@ -25,4 +25,5 @@ public class CommentSubscriber implements EventSubscribe<JsonObject> {
WallComment wallComment = gson.fromJson(object, WallComment.class);
log.info(wallComment);
}
}

View File

@ -42,4 +42,5 @@ public class EventDistributorVK implements EventDistributable, Runnable {
public void run() {
distribute();
}
}

View File

@ -26,4 +26,5 @@ public class MailChatSubscriber implements EventSubscribe<Message> {
public void update(Message message) {
mailService.add(message);
}
}

View File

@ -47,7 +47,7 @@ public class MailSubscriber implements EventSubscribe<JsonObject>, 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);
}

View File

@ -62,4 +62,5 @@ public class MailSend {
", stickerId=" + stickerId +
'}';
}
}

View File

@ -78,4 +78,5 @@ public class Person {
public int hashCode() {
return Objects.hash(id, firstName, lastName, sex, city);
}
}

View File

@ -1,7 +0,0 @@
package org.sadtech.vkbot.core.insert;
public interface Insert {
String insertWords();
}

View File

@ -10,17 +10,17 @@ public class InsertWords {
private String outText;
public void insert(List<String> 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();
}

View File

@ -80,4 +80,5 @@ public class EventListenerVk implements EventListener, Runnable {
e.printStackTrace();
}
}
}

View File

@ -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();
}
}
}

View File

@ -17,4 +17,5 @@ public interface PersonService {
boolean checkPerson(Integer idPerson);
Person createPerson(Integer userId);
}

View File

@ -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<Comment> {
}

View File

@ -33,4 +33,5 @@ public class CommentServiceImpl implements CommentService {
public List<Comment> getLastMailByTime(Integer timeFrom, Integer timeTo) {
return null;
}
}

View File

@ -72,4 +72,5 @@ public class PersonServiceImpl implements PersonService {
person.setFirstName(userMin.getFirstName());
return person;
}
}

View File

@ -43,4 +43,5 @@ public class RawEventServiceImpl implements RawEventService {
public void replacementEventRepository(EventRepository eventRepository) {
this.eventRepository = eventRepository;
}
}