Рефакторинг

This commit is contained in:
Mark Struchkov 2019-07-12 17:16:50 +03:00
parent e2ed76abbe
commit 2f33c2ac2c
2 changed files with 3 additions and 3 deletions

View File

@ -37,9 +37,9 @@ public class BoardCommentSenderVk implements Sent {
public void send(Integer contentId, Integer personId, BoxAnswer boxAnswer) { public void send(Integer contentId, Integer personId, BoxAnswer boxAnswer) {
try { try {
StringBuilder insertAnswer = new StringBuilder(vkInsertData.insertWords(boxAnswer.getMessage(), personId)); StringBuilder insertAnswer = new StringBuilder(vkInsertData.insertWords(boxAnswer.getMessage(), personId));
if (boxAnswer.getKeyboard() != null) { if (boxAnswer.getKeyBoard() != null) {
insertAnswer.append("\n\nМеню:\n"); insertAnswer.append("\n\nМеню:\n");
for (KeyBoardLine keyBoardLine : boxAnswer.getKeyboard().getKeyBoardLines()) { for (KeyBoardLine keyBoardLine : boxAnswer.getKeyBoard().getKeyBoardLines()) {
for (KeyBoardButton keyBoardButton : keyBoardLine.getKeyBoardButtons()) { for (KeyBoardButton keyBoardButton : keyBoardLine.getKeyBoardButtons()) {
switch (keyBoardButton.getType()) { switch (keyBoardButton.getType()) {
case TEXT: case TEXT:

View File

@ -43,7 +43,7 @@ public class MailSenderVk implements Sent {
MessagesSendQuery messages = vkApiClient.messages().send(groupActor).peerId(peerId) MessagesSendQuery messages = vkApiClient.messages().send(groupActor).peerId(peerId)
.message(vkInsertData.insertWords(boxAnswer.getMessage(), peerId)) .message(vkInsertData.insertWords(boxAnswer.getMessage(), peerId))
.randomId(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE)); .randomId(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE));
messages.keyboard(convertKeyBoard(boxAnswer.getKeyboard())); messages.keyboard(convertKeyBoard(boxAnswer.getKeyBoard()));
if (boxAnswer.getCoordinates() != null) { if (boxAnswer.getCoordinates() != null) {
messages.lat(boxAnswer.getCoordinates().getLatitude()).lng(boxAnswer.getCoordinates().getLongitude()); messages.lat(boxAnswer.getCoordinates().getLatitude()).lng(boxAnswer.getCoordinates().getLongitude());