Release 0.4
CodeStyle
This commit is contained in:
parent
3873aa35c3
commit
f68e6b57d7
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,4 +25,5 @@ public class CommentSubscriber implements EventSubscribe<JsonObject> {
|
||||
WallComment wallComment = gson.fromJson(object, WallComment.class);
|
||||
log.info(wallComment);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,4 +42,5 @@ public class EventDistributorVK implements EventDistributable, Runnable {
|
||||
public void run() {
|
||||
distribute();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,4 +26,5 @@ public class MailChatSubscriber implements EventSubscribe<Message> {
|
||||
public void update(Message message) {
|
||||
mailService.add(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -62,4 +62,5 @@ public class MailSend {
|
||||
", stickerId=" + stickerId +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,4 +78,5 @@ public class Person {
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, firstName, lastName, sex, city);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
package org.sadtech.vkbot.core.insert;
|
||||
|
||||
public interface Insert {
|
||||
|
||||
String insertWords();
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,5 @@ public class EventListenerVk implements EventListener, Runnable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ public interface PersonService {
|
||||
boolean checkPerson(Integer idPerson);
|
||||
|
||||
Person createPerson(Integer userId);
|
||||
|
||||
}
|
||||
|
@ -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> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,4 +33,5 @@ public class CommentServiceImpl implements CommentService {
|
||||
public List<Comment> getLastMailByTime(Integer timeFrom, Integer timeTo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,4 +72,5 @@ public class PersonServiceImpl implements PersonService {
|
||||
person.setFirstName(userMin.getFirstName());
|
||||
return person;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,4 +43,5 @@ public class RawEventServiceImpl implements RawEventService {
|
||||
public void replacementEventRepository(EventRepository eventRepository) {
|
||||
this.eventRepository = eventRepository;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user