diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/task/TaskCloseChange.java b/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/task/TaskCloseChange.java index 14120eb..33732a7 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/task/TaskCloseChange.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/task/TaskCloseChange.java @@ -27,7 +27,7 @@ public class TaskCloseChange extends TaskChange { @Override public String generateMessage() { return MessageFormat.format( - "{0} Задача выполнена* | [ПР]({1}){2}" + + "{0} *Задача выполнена* | [ПР]({1}){2}" + "{3}: {4}", Smile.TASK, url, Smile.HR, authorName, messageTask ); diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/SchedulerPushMessageSend.java b/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/SchedulerPushMessageSend.java index 05f720a..a6c7a1c 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/SchedulerPushMessageSend.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/SchedulerPushMessageSend.java @@ -61,9 +61,7 @@ public class SchedulerPushMessageSend { if (!pushMessage.isEmpty()) { try { final String json = objectMapper.writeValueAsString(pushMessage); -// sendMessage(json); - System.out.println(json); - System.out.println("\n\n"); + sendMessage(json); } catch (JsonProcessingException e) { log.error(e.getMessage()); } diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/parser/PersonScheduler.java b/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/parser/PersonScheduler.java index dc1421b..ff3cc41 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/parser/PersonScheduler.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/scheduler/parser/PersonScheduler.java @@ -11,8 +11,7 @@ public class PersonScheduler { private final PersonBitbucketParser personParser; - // @Scheduled(cron = "0 0 0 */1 * *") - @Scheduled(cron = "0 */1 * * * *") + @Scheduled(cron = "${bitbucketbot.scheduler.person:0 0 0 */1 * *}") public void scanPersons() { personParser.scanNewPerson(); } diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java index a9ff997..6cb9f42 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java @@ -96,10 +96,10 @@ public class TaskServiceImpl extends AbstractSimpleManagerService im changeService.save( TaskNewChange.builder() .messageTask(task.getDescription()) - .authorName(task.getAuthor()) - .url(task.getUrl()) + .authorName(oldTask.getAuthor()) + .url(oldTask.getUrl()) .telegramIds( - personService.getAllTelegramIdByLogin(Collections.singleton(task.getResponsible())) + personService.getAllTelegramIdByLogin(Collections.singleton(oldTask.getResponsible())) ) .build() ); @@ -107,11 +107,11 @@ public class TaskServiceImpl extends AbstractSimpleManagerService im case RESOLVED: changeService.save( TaskCloseChange.builder() - .messageTask(task.getDescription()) - .authorName(task.getAuthor()) - .url(task.getUrl()) + .messageTask(oldTask.getDescription()) + .authorName(oldTask.getAuthor()) + .url(oldTask.getUrl()) .telegramIds( - personService.getAllTelegramIdByLogin(Collections.singleton(task.getAuthor())) + personService.getAllTelegramIdByLogin(Collections.singleton(oldTask.getAuthor())) ) .build() ); diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/service/parser/CommentAndTaskParser.java b/src/main/java/org/sadtech/bot/bitbucketbot/service/parser/CommentAndTaskParser.java index e012bd1..b5994f3 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/service/parser/CommentAndTaskParser.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/service/parser/CommentAndTaskParser.java @@ -136,7 +136,7 @@ public class CommentAndTaskParser { } private String generateUrl(@NonNull Long id, @NonNull String pullRequestUrl) { - return MessageFormat.format("{0}/overview?commentId={1}", pullRequestUrl, id).replaceAll(" ", ""); + return MessageFormat.format("{0}/overview?commentId={1}", pullRequestUrl, Long.toString(id)); } private String getCommentUrl(long commentId, PullRequest pullRequest) { diff --git a/src/main/resources/application-dev.yaml b/src/main/resources/application-dev.yaml index cf64301..242ebbe 100644 --- a/src/main/resources/application-dev.yaml +++ b/src/main/resources/application-dev.yaml @@ -18,13 +18,14 @@ spring: non_contextual_creation: true bitbucketbot: scheduler: + person: 0 */1 * * * * comment: settings: no-comment-count: 20 comment-count: 100 init: start-comment-id: 7807 - use: false + use: true server-send: url: http://188.225.35.149:8080/api/send bitbucket: diff --git a/src/main/resources/application-prod.yaml b/src/main/resources/application-prod.yaml index 1f5c841..3e87a56 100644 --- a/src/main/resources/application-prod.yaml +++ b/src/main/resources/application-prod.yaml @@ -17,8 +17,15 @@ spring: lob: non_contextual_creation: true bitbucketbot: + scheduler: + person: 0 */1 * * * * + comment: + settings: + no-comment-count: 20 + comment-count: 100 init: - start-comment-id: + start-comment-id: 7807 + use: true server-send: url: http://188.225.35.149:8080/api/send bitbucket: diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index e106cf3..0335154 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -18,7 +18,7 @@ - + \ No newline at end of file