Продолжаем переработку
This commit is contained in:
parent
9c97344bf5
commit
418b7c9f80
@ -1,123 +0,0 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.core;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.context.domain.IdAndStatusPr;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.domain.filter.PullRequestFilter;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.core.utils.Pair;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.PullRequestJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.sheet.PullRequestSheetJson;
|
||||
import org.sadtech.bot.vsc.context.domain.PullRequestStatus;
|
||||
import org.sadtech.bot.vsc.context.service.PullRequestParser;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Абстрактный парсер ПРов, для использования в мульти и локал версиях приложения.
|
||||
*
|
||||
* @author upagge 25.10.2020
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class AbstractPullRequestBitbucketParser implements PullRequestParser {
|
||||
|
||||
private static final Set<PullRequestStatus> OLD_STATUSES = Stream.of(PullRequestStatus.MERGED, PullRequestStatus.OPEN, PullRequestStatus.DECLINED).collect(Collectors.toSet());
|
||||
|
||||
protected final PullRequestsService pullRequestsService;
|
||||
protected final ConversionService conversionService;
|
||||
|
||||
protected AbstractPullRequestBitbucketParser(
|
||||
PullRequestsService pullRequestsService,
|
||||
ConversionService conversionService
|
||||
) {
|
||||
this.pullRequestsService = pullRequestsService;
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
public void processingOldPullRequests(@NonNull String urlPullRequestOpen, @NonNull String urlPullRequestClose) {
|
||||
final Set<Long> existsId = pullRequestsService.getAllId(OLD_STATUSES).stream()
|
||||
.map(IdAndStatusPr::getId)
|
||||
.collect(Collectors.toSet());
|
||||
final Set<Long> openId = getExistsPullRequestIds(urlPullRequestOpen);
|
||||
final Set<Long> closeId = getExistsPullRequestIds(urlPullRequestClose);
|
||||
final Set<Long> newNotExistsId = existsId.stream()
|
||||
.filter(id -> !openId.contains(id) && !closeId.contains(id))
|
||||
.collect(Collectors.toSet());
|
||||
log.info("Открыты: " + Arrays.toString(openId.toArray()));
|
||||
log.info("Закрыты: " + Arrays.toString(closeId.toArray()));
|
||||
log.info("Не найдены: " + Arrays.toString(newNotExistsId.toArray()));
|
||||
if (!newNotExistsId.isEmpty() && !openId.isEmpty()) {
|
||||
pullRequestsService.deleteAllById(newNotExistsId);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Set<Long> getExistsPullRequestIds(@NonNull String bitbucketUrl);
|
||||
|
||||
protected void createNewPullRequest(@NonNull String urlPullRequestOpen, @NonNull String bitbucketToken) {
|
||||
Optional<PullRequestSheetJson> sheetJson = Utils.urlToJson(urlPullRequestOpen, bitbucketToken, PullRequestSheetJson.class);
|
||||
while (sheetJson.isPresent() && sheetJson.get().hasContent()) {
|
||||
final PullRequestSheetJson pullRequestBitbucketSheet = sheetJson.get();
|
||||
final List<PullRequest> newPullRequest = pullRequestBitbucketSheet.getValues().stream()
|
||||
.collect(Collectors.toMap(pullRequestJson -> new Pair<>(pullRequestJson.getId(), pullRequestJson.getFromRef().getRepository().getId()), pullRequestJson -> pullRequestJson))
|
||||
.values()
|
||||
.stream()
|
||||
.filter(pullRequestJson -> !pullRequestsService.exists(bitbucketIdAndPullRequestId(pullRequestJson)))
|
||||
.map(pullRequestJson -> conversionService.convert(pullRequestJson, PullRequest.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
pullRequestsService.createAll(newPullRequest);
|
||||
|
||||
if (pullRequestBitbucketSheet.getNextPageStart() != null) {
|
||||
sheetJson = Utils.urlToJson(urlPullRequestOpen + pullRequestBitbucketSheet.getNextPageStart(), bitbucketToken, PullRequestSheetJson.class);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Set<Long> updateOldPullRequests(@NonNull String url, @NonNull String token) {
|
||||
Optional<PullRequestSheetJson> sheetJson = Utils.urlToJson(url, token, PullRequestSheetJson.class);
|
||||
Set<Long> ids = new HashSet<>();
|
||||
while (sheetJson.isPresent() && sheetJson.get().hasContent()) {
|
||||
final PullRequestSheetJson jsonSheet = sheetJson.get();
|
||||
final List<PullRequest> existsPr = getExistsPr(jsonSheet.getValues());
|
||||
|
||||
ids.addAll(
|
||||
pullRequestsService.updateAll(existsPr).stream()
|
||||
.map(PullRequest::getId)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
|
||||
if (jsonSheet.getNextPageStart() != null) {
|
||||
sheetJson = Utils.urlToJson(url + jsonSheet.getNextPageStart(), token, PullRequestSheetJson.class);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
private List<PullRequest> getExistsPr(@NonNull List<PullRequestJson> pullRequestJsons) {
|
||||
return pullRequestJsons.stream()
|
||||
.filter(json -> pullRequestsService.exists(bitbucketIdAndPullRequestId(json)))
|
||||
.map(json -> conversionService.convert(json, PullRequest.class))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private PullRequestFilter bitbucketIdAndPullRequestId(PullRequestJson json) {
|
||||
return PullRequestFilter.builder()
|
||||
.bitbucketId(json.getId())
|
||||
.bitbucketRepositoryId(json.getFromRef().getRepository().getId())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -75,6 +75,11 @@
|
||||
<artifactId>gitlab-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.sadtech.haiti</groupId>
|
||||
<artifactId>haiti-utils</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
@ -98,7 +103,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>bitbucketbot</finalName>
|
||||
<finalName>gitlab-notification</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app;
|
||||
package org.sadtech.bot.gitlab.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
@EnableJpaRepositories(basePackages = {"org.sadtech.bot.vcs.bitbucketbot.data.jpa", "org.sadtech.bot.vcs.teamcity.core.repository.jpa"})
|
||||
@SpringBootApplication(scanBasePackages = "org.sadtech.bot.vcs")
|
||||
@EntityScan(basePackages = {"org.sadtech.bot.vsc.bitbucketbot.context.domain.entity", "org.sadtech.bot.vcs.teamcity.core.domain.entity"})
|
||||
@EnableJpaRepositories(basePackages = {"org.sadtech.bot.gitlab.data.jpa", "org.sadtech.bot.gitlab.teamcity.core.repository.jpa"})
|
||||
@SpringBootApplication(scanBasePackages = "org.sadtech.bot.gitlab")
|
||||
@EntityScan(basePackages = {"org.sadtech.bot.gitlab.context.domain.entity", "org.sadtech.bot.gitlab.teamcity.core.domain.entity"})
|
||||
public class BitbucketbotApplication {
|
||||
|
||||
public static void main(String[] args) {
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.config;
|
||||
package org.sadtech.bot.gitlab.app.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.config.property;
|
||||
package org.sadtech.bot.gitlab.app.config.property;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,7 +1,7 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.scheduler;
|
||||
package org.sadtech.bot.gitlab.app.scheduler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.CommentAndTaskParser;
|
||||
import org.sadtech.bot.gitlab.app.service.CommentAndTaskParser;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.scheduler;
|
||||
package org.sadtech.bot.gitlab.app.scheduler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
@ -1,6 +1,8 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service;
|
||||
package org.sadtech.bot.gitlab.app.service;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.app.config.property.CommentSchedulerProperty;
|
||||
import org.sadtech.bot.gitlab.app.service.executor.DataScan;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Comment;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequestMini;
|
||||
@ -9,13 +11,10 @@ import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.CommentService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.service.TaskService;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.BitbucketProperty;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.GitlabProperty;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.InitProperty;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.CommentJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.Severity;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.config.property.CommentSchedulerProperty;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.executor.DataScan;
|
||||
import org.sadtech.haiti.context.page.Sheet;
|
||||
import org.sadtech.haiti.core.page.PaginationImpl;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
@ -41,7 +40,7 @@ public class CommentAndTaskParser {
|
||||
private final TaskService taskService;
|
||||
private final ConversionService conversionService;
|
||||
|
||||
private final BitbucketProperty bitbucketProperty;
|
||||
private final GitlabProperty gitlabProperty;
|
||||
private final CommentSchedulerProperty commentSchedulerProperty;
|
||||
private final InitProperty initProperty;
|
||||
|
||||
@ -53,7 +52,7 @@ public class CommentAndTaskParser {
|
||||
ExecutorScanner executorScanner,
|
||||
TaskService taskService,
|
||||
ConversionService conversionService,
|
||||
BitbucketProperty bitbucketProperty,
|
||||
GitlabProperty gitlabProperty,
|
||||
CommentSchedulerProperty commentSchedulerProperty,
|
||||
InitProperty initProperty
|
||||
) {
|
||||
@ -62,7 +61,7 @@ public class CommentAndTaskParser {
|
||||
this.executorScanner = executorScanner;
|
||||
this.taskService = taskService;
|
||||
this.conversionService = conversionService;
|
||||
this.bitbucketProperty = bitbucketProperty;
|
||||
this.gitlabProperty = gitlabProperty;
|
||||
this.commentSchedulerProperty = commentSchedulerProperty;
|
||||
this.initProperty = initProperty;
|
||||
}
|
||||
@ -157,7 +156,7 @@ public class CommentAndTaskParser {
|
||||
}
|
||||
|
||||
private String getCommentUrl(long commentId, PullRequest pullRequest) {
|
||||
return bitbucketProperty.getUrlPullRequestComment()
|
||||
return gitlabProperty.getUrlPullRequestComment()
|
||||
.replace("{projectKey}", pullRequest.getProjectKey())
|
||||
.replace("{repositorySlug}", pullRequest.getRepositorySlug())
|
||||
.replace("{pullRequestId}", pullRequest.getBitbucketId().toString())
|
||||
@ -171,7 +170,7 @@ public class CommentAndTaskParser {
|
||||
for (Comment oldComment : comments) {
|
||||
final Optional<CommentJson> optCommentJson = Utils.urlToJson(
|
||||
oldComment.getUrlApi(),
|
||||
bitbucketProperty.getToken(),
|
||||
gitlabProperty.getToken(),
|
||||
CommentJson.class
|
||||
);
|
||||
if (optCommentJson.isPresent()) {
|
||||
@ -195,7 +194,7 @@ public class CommentAndTaskParser {
|
||||
for (Task oldTask : tasks) {
|
||||
final Optional<CommentJson> optCommentJson = Utils.urlToJson(
|
||||
oldTask.getUrlApi(),
|
||||
bitbucketProperty.getToken(),
|
||||
gitlabProperty.getToken(),
|
||||
CommentJson.class
|
||||
);
|
||||
if (optCommentJson.isPresent()) {
|
@ -1,13 +1,13 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service;
|
||||
package org.sadtech.bot.gitlab.app.service;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.BitbucketProperty;
|
||||
import org.sadtech.bot.gitlab.app.service.executor.DataScan;
|
||||
import org.sadtech.bot.gitlab.app.service.executor.Executor;
|
||||
import org.sadtech.bot.gitlab.app.service.executor.Seeker;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.GitlabProperty;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.CommentJson;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.executor.DataScan;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.executor.Executor;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.executor.Seeker;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -25,13 +25,13 @@ public class ExecutorScanner implements Executor<DataScan, CommentJson> {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private List<Future<Optional<CommentJson>>> resultList = new ArrayList<>();
|
||||
private final BitbucketProperty bitbucketProperty;
|
||||
private final GitlabProperty gitlabProperty;
|
||||
|
||||
@Override
|
||||
public boolean registration(@NonNull List<DataScan> dataScans) {
|
||||
resultList.addAll(
|
||||
dataScans.stream()
|
||||
.map(dataScan -> new Seeker(dataScan, bitbucketProperty.getToken()))
|
||||
.map(dataScan -> new Seeker(dataScan, gitlabProperty.getToken()))
|
||||
.map(executorService::submit)
|
||||
.collect(Collectors.toList())
|
||||
);
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.executor;
|
||||
package org.sadtech.bot.gitlab.app.service.executor;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.executor;
|
||||
package org.sadtech.bot.gitlab.app.service.executor;
|
||||
|
||||
import lombok.NonNull;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.executor;
|
||||
package org.sadtech.bot.gitlab.app.service.executor;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
@ -1,7 +1,6 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.executor;
|
||||
package org.sadtech.bot.gitlab.app.service.executor;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.CommentJson;
|
||||
|
||||
import java.util.Optional;
|
@ -0,0 +1,116 @@
|
||||
package org.sadtech.bot.gitlab.app.service.parser;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.GitlabProperty;
|
||||
import org.sadtech.bot.gitlab.core.utils.Pair;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.PullRequestJson;
|
||||
import org.sadtech.bot.vsc.context.domain.PullRequestStatus;
|
||||
import org.sadtech.bot.vsc.context.service.PullRequestParser;
|
||||
import org.sadtech.haiti.utils.network.HttpHeader;
|
||||
import org.sadtech.haiti.utils.network.HttpParse;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.sadtech.haiti.utils.network.HttpParse.ACCEPT;
|
||||
import static org.sadtech.haiti.utils.network.HttpParse.AUTHORIZATION;
|
||||
import static org.sadtech.haiti.utils.network.HttpParse.BEARER;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PullRequestBitbucketParser implements PullRequestParser {
|
||||
|
||||
private static final Set<PullRequestStatus> OLD_STATUSES = Stream.of(PullRequestStatus.MERGED, PullRequestStatus.OPEN, PullRequestStatus.DECLINED).collect(Collectors.toSet());
|
||||
|
||||
private final GitlabProperty gitlabProperty;
|
||||
private final PullRequestsService pullRequestsService;
|
||||
private final ConversionService conversionService;
|
||||
|
||||
@Override
|
||||
public void parsingOldPullRequest() {
|
||||
// processingOldPullRequests(gitlabProperty.getUrlPullRequestOpen(), gitlabProperty.getUrlPullRequestClose());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parsingNewPullRequest() {
|
||||
|
||||
final List<PullRequestJson> pullRequestJsons = HttpParse.request(gitlabProperty.getUrlPullRequestOpen())
|
||||
.header(HttpHeader.of(AUTHORIZATION, BEARER + gitlabProperty.getToken()))
|
||||
.header(ACCEPT)
|
||||
.executeList(PullRequestJson.class);
|
||||
|
||||
while (pullRequestJsons != null && !pullRequestJsons.isEmpty()) {
|
||||
final List<PullRequest> newPullRequest = pullRequestJsons.stream()
|
||||
.collect(Collectors.toMap(pullRequestJson -> new Pair<>(pullRequestJson.getId(), pullRequestJson.getFromRef().getRepository().getId()), pullRequestJson -> pullRequestJson))
|
||||
.values()
|
||||
.stream()
|
||||
// .filter(pullRequestJson -> !pullRequestsService.exists(bitbucketIdAndPullRequestId(pullRequestJson)))
|
||||
.map(pullRequestJson -> conversionService.convert(pullRequestJson, PullRequest.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
pullRequestsService.createAll(newPullRequest);
|
||||
}
|
||||
}
|
||||
|
||||
// private Set<Long> getExistsPullRequestIds(String bitbucketUrl) {
|
||||
// Optional<PullRequestSheetJson> sheetJson = Utils.urlToJson(url, token, PullRequestSheetJson.class);
|
||||
// Set<Long> ids = new HashSet<>();
|
||||
// while (sheetJson.isPresent() && sheetJson.get().hasContent()) {
|
||||
// final PullRequestSheetJson jsonSheet = sheetJson.get();
|
||||
// final List<PullRequest> existsPr = getExistsPr(jsonSheet.getValues());
|
||||
//
|
||||
// ids.addAll(
|
||||
// pullRequestsService.updateAll(existsPr).stream()
|
||||
// .map(PullRequest::getId)
|
||||
// .collect(Collectors.toSet())
|
||||
// );
|
||||
//
|
||||
// if (jsonSheet.getNextPageStart() != null) {
|
||||
// sheetJson = Utils.urlToJson(url + jsonSheet.getNextPageStart(), token, PullRequestSheetJson.class);
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return ids;
|
||||
// }
|
||||
//
|
||||
// public void processingOldPullRequests(@NonNull String urlPullRequestOpen, @NonNull String urlPullRequestClose) {
|
||||
// final Set<Long> existsId = pullRequestsService.getAllId(OLD_STATUSES).stream()
|
||||
// .map(IdAndStatusPr::getId)
|
||||
// .collect(Collectors.toSet());
|
||||
// final Set<Long> openId = getExistsPullRequestIds(urlPullRequestOpen);
|
||||
// final Set<Long> closeId = getExistsPullRequestIds(urlPullRequestClose);
|
||||
// final Set<Long> newNotExistsId = existsId.stream()
|
||||
// .filter(id -> !openId.contains(id) && !closeId.contains(id))
|
||||
// .collect(Collectors.toSet());
|
||||
// log.info("Открыты: " + Arrays.toString(openId.toArray()));
|
||||
// log.info("Закрыты: " + Arrays.toString(closeId.toArray()));
|
||||
// log.info("Не найдены: " + Arrays.toString(newNotExistsId.toArray()));
|
||||
// if (!newNotExistsId.isEmpty() && !openId.isEmpty()) {
|
||||
// pullRequestsService.deleteAllById(newNotExistsId);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private List<PullRequest> getExistsPr(@NonNull List<PullRequestJson> pullRequestJsons) {
|
||||
// return pullRequestJsons.stream()
|
||||
// .filter(json -> pullRequestsService.exists(bitbucketIdAndPullRequestId(json)))
|
||||
// .map(json -> conversionService.convert(json, PullRequest.class))
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// private PullRequestFilter bitbucketIdAndPullRequestId(PullRequestJson json) {
|
||||
// return PullRequestFilter.builder()
|
||||
// .bitbucketId(json.getId())
|
||||
// .bitbucketRepositoryId(json.getFromRef().getRepository().getId())
|
||||
// .build();
|
||||
// }
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.scheduler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.vcs.bitbucket.app.service.parser.PersonBitbucketParser;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class PersonScheduler {
|
||||
|
||||
private final PersonBitbucketParser personParser;
|
||||
|
||||
@Scheduled(cron = "${bitbucketbot.scheduler.person:0 0 0 */1 * *}")
|
||||
public void scanPersons() {
|
||||
personParser.scanNewPerson();
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.scheduler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.EntityType;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.notify.SimpleTextNotify;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RatingScheduler {
|
||||
|
||||
private final RatingService ratingService;
|
||||
private final PersonService personService;
|
||||
private final NotifyService notifyService;
|
||||
|
||||
@Scheduled(cron = "0 */50 * * * *")
|
||||
private void ratingRecalculation() {
|
||||
ratingService.ratingRecalculation();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 20 8 * * MON-FRI")
|
||||
private void goodMorningRating() {
|
||||
List<Person> allRegister = personService.getAllRegister();
|
||||
for (Person person : allRegister) {
|
||||
final String message = ratingService.getRatingTop(person.getLogin());
|
||||
notifyService.send(
|
||||
SimpleTextNotify.builder()
|
||||
.entityType(EntityType.PERSON)
|
||||
.message(message)
|
||||
.recipients(Collections.singleton(person.getLogin()))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.parser;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.parser.PersonParser;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.BitbucketProperty;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.UserJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.sheet.UserSheetJson;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PersonBitbucketParser implements PersonParser {
|
||||
|
||||
private final PersonService personService;
|
||||
private final ConversionService conversionService;
|
||||
|
||||
private final BitbucketProperty bitbucketProperty;
|
||||
|
||||
@Override
|
||||
public void scanNewPerson() {
|
||||
Optional<UserSheetJson> sheetJson = Utils.urlToJson(bitbucketProperty.getUrlUsers(), bitbucketProperty.getToken(), UserSheetJson.class);
|
||||
while (sheetJson.isPresent() && sheetJson.get().hasContent()) {
|
||||
final UserSheetJson sheetUsers = sheetJson.get();
|
||||
final List<UserJson> users = sheetUsers.getValues();
|
||||
final Set<String> logins = users.stream().map(UserJson::getName).collect(Collectors.toSet());
|
||||
final Set<String> existsLogins = personService.existsByLogin(logins);
|
||||
final Set<Person> newUsers = users.stream()
|
||||
.filter(userJson -> !existsLogins.contains(userJson.getName()))
|
||||
.map(userJson -> conversionService.convert(userJson, Person.class))
|
||||
.collect(Collectors.toSet());
|
||||
if (!newUsers.isEmpty()) {
|
||||
personService.createAll(newUsers);
|
||||
}
|
||||
if (sheetUsers.getNextPageStart() != null) {
|
||||
sheetJson = Utils.urlToJson(bitbucketProperty.getUrlUsers() + sheetUsers.getNextPageStart(), bitbucketProperty.getToken(), UserSheetJson.class);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.app.service.parser;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.BitbucketProperty;
|
||||
import org.sadtech.bot.vcs.bitbucket.core.AbstractPullRequestBitbucketParser;
|
||||
import org.sadtech.bot.vsc.context.service.PullRequestParser;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PullRequestBitbucketParser extends AbstractPullRequestBitbucketParser implements PullRequestParser {
|
||||
|
||||
private final PersonService personService;
|
||||
private final BitbucketProperty bitbucketProperty;
|
||||
|
||||
protected PullRequestBitbucketParser(
|
||||
PullRequestsService pullRequestsService,
|
||||
PersonService personService,
|
||||
ConversionService conversionService,
|
||||
BitbucketProperty bitbucketProperty
|
||||
) {
|
||||
super(pullRequestsService, conversionService);
|
||||
this.personService = personService;
|
||||
this.bitbucketProperty = bitbucketProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parsingOldPullRequest() {
|
||||
processingOldPullRequests(bitbucketProperty.getUrlPullRequestOpen(), bitbucketProperty.getUrlPullRequestClose());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parsingNewPullRequest() {
|
||||
final List<Person> users = personService.getAllRegister();
|
||||
for (Person user : users) {
|
||||
createNewPullRequest(bitbucketProperty.getUrlPullRequestOpen(), user.getToken());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Long> getExistsPullRequestIds(String bitbucketUrl) {
|
||||
final List<Person> persons = personService.getAllRegister();
|
||||
final Set<Long> ids = new HashSet<>();
|
||||
for (Person person : persons) {
|
||||
ids.addAll(updateOldPullRequests(bitbucketUrl, person.getToken()));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: ${DATASOURCE_URL}
|
||||
username: ${DATASOURCE_USERNAME}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
password: ${DATASOURCE_PASSWORD}
|
||||
liquibase:
|
||||
change-log: classpath:liquibase/change-log.xml
|
||||
jpa:
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||
properties:
|
||||
hibernate:
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
logging:
|
||||
config: classpath:logback-dev.xml
|
||||
bitbucketbot:
|
||||
scheduler:
|
||||
person: 0 */1 * * * *
|
||||
comment:
|
||||
settings:
|
||||
no-comment-count: 20
|
||||
comment-count: 100
|
||||
init:
|
||||
start-comment-id: 8301
|
||||
use: false
|
||||
rating:
|
||||
enable: true
|
||||
bitbucket:
|
||||
token: ${BITBUCKET_ADMIN_TOKEN}
|
||||
url-pull-request-open: ${BITBUCKET_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&state=OPEN
|
||||
url-pull-request-close: ${BITBUCKET_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&closedSince=86400
|
||||
url-pull-request-comment: ${BITBUCKET_URL}/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
|
||||
url-pull-request: ${BITBUCKET_URL}/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/overview
|
||||
url-users: ${BITBUCKET_URL}/rest/api/1.0/admin/users
|
||||
teamcity:
|
||||
token: ${TEAMCITY_ADMIN_TOKEN}
|
||||
project-url: ${TEAMCITY_URL}/app/rest/projects
|
||||
build-url: ${TEAMCITY_URL}/app/rest/builds/?locator=project:(id:{0}),branch:(default:any)
|
@ -1,41 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: ${DATASOURCE_URL}
|
||||
username: ${DATASOURCE_USERNAME}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
password: ${DATASOURCE_PASSWORD}
|
||||
liquibase:
|
||||
change-log: classpath:liquibase/change-log.xml
|
||||
jpa:
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||
properties:
|
||||
hibernate:
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
logging:
|
||||
config: classpath:logback-prod.xml
|
||||
bitbucketbot:
|
||||
scheduler:
|
||||
person: 0 0 0 */1 * *
|
||||
comment:
|
||||
settings:
|
||||
no-comment-count: 20
|
||||
comment-count: 100
|
||||
init:
|
||||
start-comment-id: 7807
|
||||
use: false
|
||||
bitbucket:
|
||||
token: ${BITBUCKET_ADMIN_TOKEN}
|
||||
url-pull-request-open: ${BITBUCKET_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&state=OPEN
|
||||
url-pull-request-close: ${BITBUCKET_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&closedSince=86400
|
||||
url-pull-request-comment: ${BITBUCKET_URL}/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
|
||||
url-pull-request: ${BITBUCKET_URL}/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/overview
|
||||
url-users: ${BITBUCKET_URL}/rest/api/1.0/admin/users
|
||||
teamcity:
|
||||
token: ${TEAMCITY_ADMIN_TOKEN}
|
||||
project-url: ${TEAMCITY_URL}/app/rest/projects
|
||||
build-url: ${TEAMCITY_URL}/app/rest/builds/?locator=project:(id:{0}),branch:(default:any)
|
@ -1,7 +1,43 @@
|
||||
server:
|
||||
port: 8018
|
||||
spring:
|
||||
datasource:
|
||||
url: ${DATASOURCE_URL}
|
||||
username: ${DATASOURCE_USERNAME}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
password: ${DATASOURCE_PASSWORD}
|
||||
liquibase:
|
||||
change-log: classpath:liquibase/change-log.xml
|
||||
jpa:
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||
properties:
|
||||
hibernate:
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
telegram-config:
|
||||
bot-username: ${TELEGRAM_BOT_USERNAME}
|
||||
bot-token: ${TELEGRAM_BOT_TOKEN}
|
||||
bitbucketbot:
|
||||
version: 2.15.3
|
||||
gitlab-bot:
|
||||
version: 2.15.3
|
||||
scheduler:
|
||||
comment:
|
||||
settings:
|
||||
no-comment-count: 20
|
||||
comment-count: 100
|
||||
gitlab:
|
||||
token: ${GITLAB_PERSONAL_TOKEN}
|
||||
username: ${GITLAB_USERNAME}
|
||||
full-name: ${GITLAB_FULLNAME}
|
||||
url-pull-request-open: ${GITLAB_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&state=OPEN
|
||||
url-pull-request-close: ${GITLAB_URL}/rest/api/1.0/dashboard/pull-requests?limit=150&closedSince=86400
|
||||
url-pull-request-comment: ${GITLAB_URL}/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
|
||||
url-pull-request: ${GITLAB_URL}/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/overview
|
||||
url-users: ${GITLAB_URL}/rest/api/1.0/admin/users
|
||||
teamcity:
|
||||
token: ${TEAMCITY_ADMIN_TOKEN}
|
||||
project-url: ${TEAMCITY_URL}/app/rest/projects
|
||||
build-url: ${TEAMCITY_URL}/app/rest/builds/?locator=project:(id:{0}),branch:(default:any)
|
@ -1,24 +0,0 @@
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>bitbucketbot-logs.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>bitbucket.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
<totalSizeCap>50MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
@ -1,24 +0,0 @@
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>bitbucketbot-logs.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>bitbucket.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
<totalSizeCap>50MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
@ -1,50 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.domain.entity;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* Пользователь битбакета.
|
||||
*
|
||||
* @author upagge [30.01.2020]
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "person")
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
||||
public class Person {
|
||||
|
||||
/**
|
||||
* Логин
|
||||
*/
|
||||
@Id
|
||||
@EqualsAndHashCode.Include
|
||||
@Column(name = "login")
|
||||
private String login;
|
||||
|
||||
/**
|
||||
* Персональный токен из битбакета
|
||||
*/
|
||||
@Column(name = "bitbucket_token")
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* Идентификатор телеграма
|
||||
*/
|
||||
@Column(name = "telegram_id")
|
||||
private Long telegramId;
|
||||
|
||||
/**
|
||||
* ФИО
|
||||
*/
|
||||
@Column(name = "full_name")
|
||||
private String fullName;
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.domain.entity;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.sadtech.bot.gitlab.context.domain.PointType;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "rating_history")
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
||||
public class RatingHistory {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@EqualsAndHashCode.Include
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "login")
|
||||
private String login;
|
||||
|
||||
@Column(name = "points")
|
||||
private Integer points;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type")
|
||||
private PointType type;
|
||||
|
||||
@Column(name = "date_add")
|
||||
private LocalDateTime dateAdd;
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.domain.entity;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "rating_list")
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
||||
public class RatingList implements Comparable<RatingList> {
|
||||
|
||||
@Id
|
||||
@Column(name = "login")
|
||||
@EqualsAndHashCode.Include
|
||||
private String login;
|
||||
|
||||
@Column(name = "points")
|
||||
private Integer points;
|
||||
|
||||
@Column(name = "number")
|
||||
private Integer number;
|
||||
|
||||
@Override
|
||||
public int compareTo(@NonNull RatingList ratingList) {
|
||||
return Integer.compare(ratingList.getPoints(), points);
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.repository;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* // TODO: 06.09.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 06.09.2020
|
||||
*/
|
||||
public interface PersonRepository {
|
||||
|
||||
Person save(@NonNull Person person);
|
||||
|
||||
boolean existsByTelegramId(Long chatId);
|
||||
|
||||
boolean existsByLogin(String login);
|
||||
|
||||
List<Person> findAllByTelegramIdNotNullAndTokenNotNull();
|
||||
|
||||
Set<Long> findAllTelegramIdByLogin(Set<String> logins);
|
||||
|
||||
Optional<Person> findByLogin(@NonNull String login);
|
||||
|
||||
Optional<Person> findByTelegramId(@NonNull Long telegramId);
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.repository;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingHistory;
|
||||
import org.sadtech.haiti.context.repository.SimpleManagerRepository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
public interface RatingHistoryRepository extends SimpleManagerRepository<RatingHistory, Long> {
|
||||
|
||||
List<RatingHistory> findAllByDateAddBetween(@NonNull LocalDateTime from, @NonNull LocalDateTime to);
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.repository;
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingList;
|
||||
import org.sadtech.haiti.context.repository.SimpleManagerRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
public interface RatingListRepository extends SimpleManagerRepository<RatingList, String> {
|
||||
|
||||
Optional<RatingList> getByLogin(String login);
|
||||
|
||||
List<RatingList> findFirstThree();
|
||||
|
||||
List<RatingList> findLastThree();
|
||||
|
||||
long count();
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.service;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public interface PersonService {
|
||||
|
||||
Set<String> existsByLogin(@NonNull Set<String> logins);
|
||||
|
||||
Person reg(@NonNull Person user);
|
||||
|
||||
List<Person> getAllRegister();
|
||||
|
||||
Set<Long> getAllTelegramIdByLogin(Set<String> logins);
|
||||
|
||||
Person create(@NonNull Person person);
|
||||
|
||||
List<Person> createAll(Collection<Person> newUsers);
|
||||
|
||||
boolean existsByTelegram(Long telegramId);
|
||||
|
||||
Optional<Person> getByTelegramId(@NonNull Long telegramId);
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.service;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.context.domain.PointType;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
public interface RatingService {
|
||||
|
||||
void addRating(@NonNull String login, @NonNull PointType type, @NonNull Integer points);
|
||||
|
||||
void ratingRecalculation();
|
||||
|
||||
String getRatingTop(@NonNull String login);
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.context.service.parser;
|
||||
|
||||
/**
|
||||
* // TODO: 06.09.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 06.09.2020
|
||||
*/
|
||||
public interface PersonParser {
|
||||
|
||||
/**
|
||||
* Извлечение новых пользователей SCV.
|
||||
*/
|
||||
void scanNewPerson();
|
||||
|
||||
}
|
@ -13,12 +13,13 @@ import org.springframework.stereotype.Component;
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties("bitbucketbot.bitbucket")
|
||||
public class BitbucketProperty {
|
||||
@ConfigurationProperties("gitlab-bot.gitlab")
|
||||
public class GitlabProperty {
|
||||
|
||||
private String username;
|
||||
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* Токен администратора
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
@ -41,9 +42,4 @@ public class BitbucketProperty {
|
||||
*/
|
||||
private String urlPullRequest;
|
||||
|
||||
/**
|
||||
* Адрес на получение пользователей битбакет
|
||||
*/
|
||||
private String urlUsers;
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.core.config.properties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* // TODO: 25.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 25.10.2020
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "bitbucketbot.rating")
|
||||
public class RatingProperty {
|
||||
|
||||
boolean enabled = false;
|
||||
|
||||
}
|
@ -2,12 +2,10 @@ package org.sadtech.bot.gitlab.core.scheduler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.EntityType;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.domain.notify.GoodMorningNotify;
|
||||
import org.sadtech.bot.gitlab.context.domain.notify.SimpleTextNotify;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.utils.Smile;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.AppProperty;
|
||||
@ -31,7 +29,6 @@ public class NotificationScheduler {
|
||||
"mstruchkov", "emukhin", "imescheryakov", "kkeglev"
|
||||
));
|
||||
|
||||
private final PersonService personService;
|
||||
private final PullRequestsService pullRequestsService;
|
||||
|
||||
private final NotifyService notifyService;
|
||||
|
@ -11,7 +11,6 @@ import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.repository.CommentRepository;
|
||||
import org.sadtech.bot.gitlab.context.service.CommentService;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.sadtech.bot.gitlab.context.service.TaskService;
|
||||
import org.sadtech.haiti.core.service.AbstractSimpleManagerService;
|
||||
import org.sadtech.haiti.core.util.Assert;
|
||||
|
@ -1,111 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.core.service.impl;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.NotifySetting;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.exception.RegException;
|
||||
import org.sadtech.bot.gitlab.context.repository.PersonRepository;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.BitbucketProperty;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.haiti.core.util.Assert;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PersonServiceImpl implements PersonService {
|
||||
|
||||
private final PersonRepository personRepository;
|
||||
private final BitbucketProperty bitbucketProperty;
|
||||
|
||||
private final NotifyService notifyService;
|
||||
|
||||
public PersonServiceImpl(
|
||||
PersonRepository personRepository,
|
||||
BitbucketProperty bitbucketProperty,
|
||||
@Lazy NotifyService notifyService
|
||||
) {
|
||||
this.personRepository = personRepository;
|
||||
this.bitbucketProperty = bitbucketProperty;
|
||||
this.notifyService = notifyService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> existsByLogin(@NonNull Set<String> logins) {
|
||||
return logins.stream()
|
||||
.filter(personRepository::existsByLogin)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Person reg(@NonNull Person user) {
|
||||
final Optional<Person> optUser = personRepository.findByLogin(user.getLogin());
|
||||
if (optUser.isPresent()) {
|
||||
final Person oldUser = optUser.get();
|
||||
if (oldUser.getTelegramId() == null) {
|
||||
Optional<Object> sheetJson = Utils.urlToJson(bitbucketProperty.getUrlPullRequestClose(), user.getToken(), Object.class);
|
||||
if (sheetJson.isPresent()) {
|
||||
oldUser.setTelegramId(user.getTelegramId());
|
||||
|
||||
defaultSettings(oldUser);
|
||||
|
||||
return personRepository.save(oldUser);
|
||||
} else {
|
||||
throw new RegException("Ваш токен не валиден");
|
||||
}
|
||||
} else {
|
||||
throw new RegException("Вы уже авторизованы в системе");
|
||||
}
|
||||
}
|
||||
throw new RegException("Пользователь не найден, подождите обновление базы пользователей!");
|
||||
}
|
||||
|
||||
private void defaultSettings(Person person) {
|
||||
final NotifySetting notifySetting = new NotifySetting();
|
||||
notifySetting.setLogin(person.getLogin());
|
||||
notifySetting.setStartReceiving(LocalDateTime.now());
|
||||
notifyService.saveSettings(notifySetting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Person> getAllRegister() {
|
||||
return personRepository.findAllByTelegramIdNotNullAndTokenNotNull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getAllTelegramIdByLogin(Set<String> logins) {
|
||||
return personRepository.findAllTelegramIdByLogin(logins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Person create(@NonNull Person person) {
|
||||
Assert.isNotNull(person.getLogin(), "При создании пользователя должен присутствовать логин");
|
||||
return personRepository.save(person);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Person> createAll(Collection<Person> newPersons) {
|
||||
return newPersons.stream().map(this::create).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByTelegram(Long telegramId) {
|
||||
return personRepository.existsByTelegramId(telegramId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Person> getByTelegramId(@NonNull Long telegramId) {
|
||||
return personRepository.findByTelegramId(telegramId);
|
||||
}
|
||||
|
||||
}
|
@ -19,8 +19,6 @@ import org.sadtech.bot.gitlab.context.exception.UpdateException;
|
||||
import org.sadtech.bot.gitlab.context.repository.PullRequestsRepository;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.sadtech.bot.gitlab.core.config.properties.RatingProperty;
|
||||
import org.sadtech.bot.vsc.context.domain.PullRequestStatus;
|
||||
import org.sadtech.bot.vsc.context.domain.ReviewerStatus;
|
||||
import org.sadtech.haiti.context.page.Pagination;
|
||||
|
@ -1,140 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.core.service.impl;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.PointType;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingHistory;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingList;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.repository.RatingHistoryRepository;
|
||||
import org.sadtech.bot.gitlab.context.repository.RatingListRepository;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.sadtech.bot.gitlab.context.utils.Smile;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RatingServiceImpl implements RatingService {
|
||||
|
||||
private final RatingHistoryRepository ratingHistoryRepository;
|
||||
private final RatingListRepository ratingListRepository;
|
||||
private final PersonService personService;
|
||||
|
||||
@Override
|
||||
public void addRating(@NonNull String login, @NonNull PointType type, @NonNull Integer points) {
|
||||
final RatingHistory ratingHistory = new RatingHistory();
|
||||
ratingHistory.setLogin(login);
|
||||
ratingHistory.setPoints(points);
|
||||
ratingHistory.setType(type);
|
||||
ratingHistory.setDateAdd(LocalDateTime.now());
|
||||
ratingHistoryRepository.save(ratingHistory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ratingRecalculation() {
|
||||
AtomicInteger i = new AtomicInteger();
|
||||
final List<RatingList> newRatingList = ratingHistoryRepository.findAllByDateAddBetween(LocalDateTime.now().minusDays(30L), LocalDateTime.now()).stream()
|
||||
.collect(Collectors.groupingBy(RatingHistory::getLogin, Collectors.summingInt(RatingHistory::getPoints)))
|
||||
.entrySet().stream()
|
||||
.map(this::createRatingList)
|
||||
.collect(Collectors.toList());
|
||||
final Set<String> ratingListLogins = newRatingList.stream()
|
||||
.map(RatingList::getLogin)
|
||||
.collect(Collectors.toSet());
|
||||
final Set<String> regLogins = personService.getAllRegister().stream()
|
||||
.map(Person::getLogin)
|
||||
.collect(Collectors.toSet());
|
||||
newRatingList.addAll(
|
||||
regLogins.stream()
|
||||
.filter(s -> !ratingListLogins.contains(s))
|
||||
.map(this::createEmptyRatingList)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
ratingListRepository.saveAll(
|
||||
newRatingList.stream()
|
||||
.sorted()
|
||||
.peek(ratingList -> ratingList.setNumber(i.getAndIncrement()))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
private RatingList createEmptyRatingList(String s) {
|
||||
final RatingList ratingList = new RatingList();
|
||||
ratingList.setLogin(s);
|
||||
ratingList.setPoints(0);
|
||||
return ratingList;
|
||||
}
|
||||
|
||||
private RatingList createRatingList(Map.Entry<String, Integer> entry) {
|
||||
final RatingList ratingList = new RatingList();
|
||||
ratingList.setLogin(entry.getKey());
|
||||
ratingList.setPoints(entry.getValue());
|
||||
return ratingList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRatingTop(@NonNull String login) {
|
||||
final RatingList personRating = ratingListRepository.getByLogin(login)
|
||||
.orElseThrow(() -> new NotFoundException("Пользователь не найден"));
|
||||
|
||||
final long countPerson = ratingListRepository.count();
|
||||
final String threeMessage = ratingListRepository.findFirstThree().stream()
|
||||
.map(this::createString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
final String lastMessage = ratingListRepository.findLastThree().stream()
|
||||
.limit(countPerson - 3 < 0 ? 0 : countPerson - 3)
|
||||
.map(this::createString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
String message;
|
||||
|
||||
if (personRating.getPoints() == 0) {
|
||||
message = Smile.SADLY + " У вас не обнаружена активность в битбакете, поэтому вы не учавствуйте в рейтинге" +
|
||||
"\n\n" + Smile.TOP + " Рейтинговая таблица " + Smile.TOP + Smile.HR + threeMessage + "\n... ... ... ... ...\n";
|
||||
} else {
|
||||
message = Smile.TOP + " Рейтинговая таблица " + Smile.TOP + Smile.HR + threeMessage;
|
||||
final Integer numberRatingList = personRating.getNumber();
|
||||
if (numberRatingList <= 2) {
|
||||
if (countPerson > 3) {
|
||||
message += "\n... ... ... ... ...\n";
|
||||
}
|
||||
} else if (numberRatingList > 3 && numberRatingList <= (countPerson - 3)) {
|
||||
message += "\n... ... ... ... ...\n" + personRating.getNumber() + ": " + personRating.getLogin() + "\n... ... ... ... ...\n";
|
||||
} else {
|
||||
message += "\n... ... ... ... ...\n";
|
||||
}
|
||||
}
|
||||
message += lastMessage;
|
||||
return message;
|
||||
}
|
||||
|
||||
private String createString(RatingList ratingList) {
|
||||
String message = "";
|
||||
final Integer number = ratingList.getNumber();
|
||||
if (number == 0) {
|
||||
message += Smile.TOP_ONE.getValue() + " " + ratingList.getLogin() + " " + Smile.TOP_ONE.getValue();
|
||||
} else if (number == 1) {
|
||||
message += Smile.TOP_TWO.getValue() + " " + ratingList.getLogin() + " " + Smile.TOP_TWO.getValue();
|
||||
} else if (number == 2) {
|
||||
message += Smile.TOP_THREE.getValue() + " " + ratingList.getLogin() + " " + Smile.TOP_THREE.getValue();
|
||||
} else {
|
||||
message += Smile.KAKASHKA.getValue() + " " + ratingList.getLogin();
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,6 @@ import org.sadtech.bot.gitlab.context.repository.TaskRepository;
|
||||
import org.sadtech.bot.gitlab.context.service.CommentService;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.sadtech.bot.gitlab.context.service.TaskService;
|
||||
import org.sadtech.haiti.core.service.AbstractSimpleManagerService;
|
||||
import org.sadtech.haiti.core.util.Assert;
|
||||
|
@ -1,54 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.core.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author upagge [30.01.2020]
|
||||
*/
|
||||
@Slf4j
|
||||
public class Utils {
|
||||
|
||||
private static final ObjectMapper objectMapper;
|
||||
|
||||
static {
|
||||
objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
private Utils() {
|
||||
throw new IllegalStateException("Утилитарный класс");
|
||||
}
|
||||
|
||||
public static <T> Optional<T> urlToJson(@NonNull String urlValue, @NonNull String token, @NonNull Class<T> classOfT) {
|
||||
Request request = new Request.Builder()
|
||||
.url(urlValue)
|
||||
.header("Authorization", "Bearer " + token)
|
||||
.header("Accept", "text/html,application/xhtml+xml,application/json")
|
||||
.build();
|
||||
try (final Response execute = client.newCall(request).execute()) {
|
||||
if (execute.isSuccessful() && execute.body() != null) {
|
||||
return Optional.ofNullable(objectMapper.readValue(execute.body().string(), classOfT));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.impl;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.repository.PersonRepository;
|
||||
import org.sadtech.bot.gitlab.data.jpa.PersonJpaRepository;
|
||||
import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* // TODO: 06.09.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 06.09.2020
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PersonRepositoryImpl implements PersonRepository {
|
||||
|
||||
private final PersonJpaRepository jpaRepository;
|
||||
|
||||
@Override
|
||||
public Person save(@NonNull Person person) {
|
||||
return jpaRepository.save(person);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByTelegramId(Long chatId) {
|
||||
return jpaRepository.existsByTelegramId(chatId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByLogin(String login) {
|
||||
try {
|
||||
return jpaRepository.existsByLogin(login);
|
||||
} catch (InvalidDataAccessResourceUsageException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Person> findAllByTelegramIdNotNullAndTokenNotNull() {
|
||||
try {
|
||||
return jpaRepository.findAllByTelegramIdNotNullAndTokenNotNull();
|
||||
} catch (InvalidDataAccessResourceUsageException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> findAllTelegramIdByLogin(Set<String> logins) {
|
||||
return jpaRepository.findAllTelegramIdByLogin(logins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Person> findByLogin(@NonNull String login) {
|
||||
return jpaRepository.findById(login);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Person> findByTelegramId(@NonNull Long telegramId) {
|
||||
return jpaRepository.findByTelegramId(telegramId);
|
||||
}
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.impl;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingHistory;
|
||||
import org.sadtech.bot.gitlab.context.repository.RatingHistoryRepository;
|
||||
import org.sadtech.bot.gitlab.data.jpa.RatingHistoryJpaRepository;
|
||||
import org.sadtech.haiti.database.repository.manager.AbstractSimpleManagerRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Repository
|
||||
public class RatingHistoryRepositoryImpl extends AbstractSimpleManagerRepository<RatingHistory, Long> implements RatingHistoryRepository {
|
||||
|
||||
private final RatingHistoryJpaRepository jpaRepository;
|
||||
|
||||
public RatingHistoryRepositoryImpl(RatingHistoryJpaRepository jpaRepository) {
|
||||
super(jpaRepository);
|
||||
this.jpaRepository = jpaRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RatingHistory> findAllByDateAddBetween(@NonNull LocalDateTime from, @NonNull LocalDateTime to) {
|
||||
return jpaRepository.findAllByDateAddBetween(from, to);
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.impl;
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingList;
|
||||
import org.sadtech.bot.gitlab.context.repository.RatingListRepository;
|
||||
import org.sadtech.bot.gitlab.data.jpa.RatingListJpaRepository;
|
||||
import org.sadtech.haiti.database.repository.manager.AbstractSimpleManagerRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Repository
|
||||
public class RatingListRepositoryImpl extends AbstractSimpleManagerRepository<RatingList, String> implements RatingListRepository {
|
||||
|
||||
private final RatingListJpaRepository jpaRepository;
|
||||
|
||||
public RatingListRepositoryImpl(RatingListJpaRepository jpaRepository) {
|
||||
super(jpaRepository);
|
||||
this.jpaRepository = jpaRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<RatingList> getByLogin(String login) {
|
||||
return jpaRepository.findById(login);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RatingList> findFirstThree() {
|
||||
return jpaRepository.findTop3ByPointsGreaterThanOrderByNumberAsc(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RatingList> findLastThree() {
|
||||
return jpaRepository.findTop3ByPointsGreaterThanOrderByNumberDesc(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return jpaRepository.countByNumberGreaterThan(0);
|
||||
}
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.jpa;
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
*
|
||||
* @author upagge [30.01.2020]
|
||||
*/
|
||||
@Repository
|
||||
public interface PersonJpaRepository extends JpaRepository<Person, String> {
|
||||
|
||||
boolean existsByTelegramId(Long chatId);
|
||||
|
||||
boolean existsByLogin(String login);
|
||||
|
||||
List<Person> findAllByTelegramIdNotNullAndTokenNotNull();
|
||||
|
||||
@Query("SELECT u.telegramId FROM Person u WHERE u.login=:login")
|
||||
Long findTelegramIdByLogin(String login);
|
||||
|
||||
@Query("SELECT u.telegramId FROM Person u WHERE u.login IN :logins AND u.telegramId IS NOT NULL")
|
||||
Set<Long> findAllTelegramIdByLogin(Set<String> logins);
|
||||
|
||||
Optional<Person> findByTelegramId(Long telegramId);
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.jpa;
|
||||
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingHistory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
public interface RatingHistoryJpaRepository extends JpaRepository<RatingHistory, Long> {
|
||||
|
||||
List<RatingHistory> findAllByDateAddBetween(LocalDateTime from, LocalDateTime to);
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.data.jpa;
|
||||
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.RatingList;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
public interface RatingListJpaRepository extends JpaRepository<RatingList, String> {
|
||||
|
||||
List<RatingList> findTop3ByPointsGreaterThanOrderByNumberAsc(Integer points);
|
||||
|
||||
List<RatingList> findTop3ByPointsGreaterThanOrderByNumberDesc(Integer points);
|
||||
|
||||
Long countByNumberGreaterThan(Integer points);
|
||||
|
||||
}
|
@ -4,11 +4,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Reviewer;
|
||||
import org.sadtech.bot.gitlab.core.utils.StringUtils;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.AuthorJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.Outcome;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.Properties;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.PullRequestJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.PullRequestState;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.UserDecisionJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.UserPullRequestStatus;
|
||||
import org.sadtech.bot.vsc.context.domain.PullRequestStatus;
|
||||
import org.sadtech.bot.vsc.context.domain.ReviewerStatus;
|
||||
@ -23,6 +23,32 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class PullRequestJsonConverter implements Converter<PullRequestJson, PullRequest> {
|
||||
|
||||
public static PullRequestStatus convertPullRequestStatus(PullRequestState state) {
|
||||
switch (state) {
|
||||
case OPENED:
|
||||
return PullRequestStatus.OPEN;
|
||||
case MERGED:
|
||||
return PullRequestStatus.MERGED;
|
||||
case DECLINED:
|
||||
return PullRequestStatus.DECLINED;
|
||||
default:
|
||||
throw new ConvertException("Неподдерживаемый тип ПР");
|
||||
}
|
||||
}
|
||||
|
||||
private static ReviewerStatus convertStatusReviewer(UserPullRequestStatus status) {
|
||||
switch (status) {
|
||||
case APPROVED:
|
||||
return ReviewerStatus.APPROVED;
|
||||
case NEEDS_WORK:
|
||||
return ReviewerStatus.UNAPPROVED;
|
||||
case UNAPPROVED:
|
||||
return ReviewerStatus.NEEDS_WORK;
|
||||
default:
|
||||
throw new ConvertException("Неподдерживаемый статус ревьювера");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PullRequest convert(PullRequestJson json) {
|
||||
|
||||
@ -54,20 +80,7 @@ public class PullRequestJsonConverter implements Converter<PullRequestJson, Pull
|
||||
&& Outcome.CONFLICTED.equals(properties.getMergeResult().getOutcome());
|
||||
}
|
||||
|
||||
public static PullRequestStatus convertPullRequestStatus(PullRequestState state) {
|
||||
switch (state) {
|
||||
case OPEN:
|
||||
return PullRequestStatus.OPEN;
|
||||
case MERGED:
|
||||
return PullRequestStatus.MERGED;
|
||||
case DECLINED:
|
||||
return PullRequestStatus.DECLINED;
|
||||
default:
|
||||
throw new ConvertException("Неподдерживаемый тип ПР");
|
||||
}
|
||||
}
|
||||
|
||||
private List<Reviewer> convertReviewers(List<UserDecisionJson> jsonReviewers) {
|
||||
private List<Reviewer> convertReviewers(List<AuthorJson> jsonReviewers) {
|
||||
return jsonReviewers.stream()
|
||||
.map(
|
||||
jsonReviewer -> {
|
||||
@ -80,17 +93,4 @@ public class PullRequestJsonConverter implements Converter<PullRequestJson, Pull
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static ReviewerStatus convertStatusReviewer(UserPullRequestStatus status) {
|
||||
switch (status) {
|
||||
case APPROVED:
|
||||
return ReviewerStatus.APPROVED;
|
||||
case NEEDS_WORK:
|
||||
return ReviewerStatus.UNAPPROVED;
|
||||
case UNAPPROVED:
|
||||
return ReviewerStatus.NEEDS_WORK;
|
||||
default:
|
||||
throw new ConvertException("Неподдерживаемый статус ревьювера");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package org.sadtech.bot.vcs.bitbucket.core.service.converter;
|
||||
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.UserJson;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.stereotype.Component;
|
@ -0,0 +1,21 @@
|
||||
package org.sadtech.bot.gitlab.sdk.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
*
|
||||
* @author upagge [31.01.2020]
|
||||
*/
|
||||
@Data
|
||||
public class AuthorJson {
|
||||
|
||||
private Long id;
|
||||
private String name;
|
||||
private String userName;
|
||||
|
||||
@JsonProperty("web_url")
|
||||
private String webUrl;
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package org.sadtech.bot.gitlab.sdk.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Data;
|
||||
import org.sadtech.bot.gitlab.sdk.utils.LocalDateTimeFromEpochDeserializer;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
@ -16,21 +16,30 @@ import java.util.List;
|
||||
public class PullRequestJson {
|
||||
|
||||
private Long id;
|
||||
private Integer version;
|
||||
|
||||
@JsonProperty("iid")
|
||||
private Long twoId;
|
||||
|
||||
@JsonProperty("project_id")
|
||||
private Long projectId;
|
||||
private String title;
|
||||
private String description;
|
||||
private PullRequestState state;
|
||||
|
||||
@JsonProperty("created_at")
|
||||
@JsonDeserialize(using = LocalDateTimeFromEpochDeserializer.class)
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
@JsonProperty("updated_at")
|
||||
@JsonDeserialize(using = LocalDateTimeFromEpochDeserializer.class)
|
||||
private LocalDateTime updatedDate;
|
||||
|
||||
private String title;
|
||||
private String description;
|
||||
private LinkJson links;
|
||||
private UserDecisionJson author;
|
||||
private List<UserDecisionJson> reviewers;
|
||||
private FromRefJson fromRef;
|
||||
private Properties properties;
|
||||
private AuthorJson author;
|
||||
|
||||
@JsonProperty("web_url")
|
||||
private String webUrl;
|
||||
|
||||
@JsonProperty("has_conflicts")
|
||||
private String conflicts;
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ package org.sadtech.bot.gitlab.sdk.domain;
|
||||
*/
|
||||
public enum PullRequestState {
|
||||
|
||||
OPEN, MERGED, DECLINED
|
||||
OPENED, MERGED, DECLINED
|
||||
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.sdk.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
*
|
||||
* @author upagge [31.01.2020]
|
||||
*/
|
||||
@Data
|
||||
public class UserDecisionJson {
|
||||
|
||||
private UserJson user;
|
||||
private BitbucketUserRole role;
|
||||
private Boolean approved;
|
||||
private UserPullRequestStatus status;
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.sdk.domain.sheet;
|
||||
|
||||
import org.sadtech.bot.gitlab.sdk.domain.PullRequestJson;
|
||||
import org.sadtech.bot.gitlab.sdk.domain.Sheet;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
*
|
||||
* @author upagge [02.02.2020]
|
||||
*/
|
||||
public class PullRequestSheetJson extends Sheet<PullRequestJson> {
|
||||
|
||||
}
|
8
pom.xml
8
pom.xml
@ -15,7 +15,7 @@
|
||||
<module>bot-core</module>
|
||||
<module>bot-app</module>
|
||||
<module>teamcity</module>
|
||||
<module>bitbucketbot-core</module>
|
||||
<module>gitlab-core</module>
|
||||
<module>bot-data</module>
|
||||
</modules>
|
||||
|
||||
@ -171,6 +171,12 @@
|
||||
<version>${haiti.database.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.sadtech.haiti</groupId>
|
||||
<artifactId>haiti-utils</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.sadtech.bot.godfather</groupId>
|
||||
<artifactId>telegram-bot</artifactId>
|
||||
|
@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "bitbucketbot.teamcity")
|
||||
@ConfigurationProperties(prefix = "gitlab-bot.teamcity")
|
||||
public class TeamcityProperty {
|
||||
|
||||
private String token;
|
||||
|
@ -7,7 +7,6 @@ package org.sadtech.bot.gitlab.teamcity.core.service.parser;
|
||||
*/
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.config.property.TeamcityProperty;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.sadtech.bot.gitlab.teamcity.core.service.parser;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.core.utils.Utils;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.config.property.TeamcityProperty;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcityProjectService;
|
||||
|
@ -6,7 +6,6 @@ import org.sadtech.bot.gitlab.context.domain.notify.Notify;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.ChatService;
|
||||
import org.sadtech.bot.gitlab.context.service.MessageSendService;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.social.core.domain.BoxAnswer;
|
||||
import org.sadtech.social.core.service.sender.Sending;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -1,34 +0,0 @@
|
||||
package org.sadtech.bot.gitlab.telegram.service.unit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.RatingService;
|
||||
import org.sadtech.social.bot.service.usercode.ProcessingData;
|
||||
import org.sadtech.social.core.domain.BoxAnswer;
|
||||
import org.sadtech.social.core.domain.content.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* // TODO: 01.10.2020 Добавить описание.
|
||||
*
|
||||
* @author upagge 01.10.2020
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RatingTopProcessing implements ProcessingData<Message> {
|
||||
|
||||
private final RatingService ratingService;
|
||||
private final PersonService personService;
|
||||
|
||||
@Override
|
||||
public BoxAnswer processing(Message content) {
|
||||
final Person person = personService.getByTelegramId(content.getPersonId())
|
||||
.orElseThrow(() -> new NotFoundException("Пользователь не найден"));
|
||||
return BoxAnswer.builder()
|
||||
.message(ratingService.getRatingTop(person.getLogin()))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -2,10 +2,8 @@ package org.sadtech.bot.gitlab.telegram.service.unit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.TaskStatus;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Task;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.TaskService;
|
||||
import org.sadtech.social.bot.service.usercode.ProcessingData;
|
||||
import org.sadtech.social.core.domain.BoxAnswer;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package org.sadtech.bot.gitlab.telegram.service.unit.pullrequest;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.utils.MessageUtils;
|
||||
import org.sadtech.bot.vsc.context.domain.ReviewerStatus;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package org.sadtech.bot.gitlab.telegram.service.unit.pullrequest;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.PullRequest;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.context.service.PullRequestsService;
|
||||
import org.sadtech.bot.gitlab.context.utils.MessageUtils;
|
||||
import org.sadtech.bot.vsc.context.domain.PullRequestStatus;
|
||||
|
@ -4,10 +4,8 @@ import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.NotifySetting;
|
||||
import org.sadtech.bot.gitlab.context.domain.entity.Person;
|
||||
import org.sadtech.bot.gitlab.context.exception.NotFoundException;
|
||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.social.bot.domain.unit.AnswerProcessing;
|
||||
import org.sadtech.social.bot.domain.unit.AnswerText;
|
||||
import org.sadtech.social.core.domain.BoxAnswer;
|
||||
|
@ -1,8 +1,6 @@
|
||||
package org.sadtech.bot.gitlab.telegram.unit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.sadtech.bot.gitlab.context.service.PersonService;
|
||||
import org.sadtech.bot.gitlab.telegram.service.unit.RatingTopProcessing;
|
||||
import org.sadtech.bot.gitlab.telegram.service.unit.TaskProcessing;
|
||||
import org.sadtech.bot.gitlab.telegram.utils.GeneratorKeyBoards;
|
||||
import org.sadtech.social.bot.domain.unit.AnswerCheck;
|
||||
|
Loading…
Reference in New Issue
Block a user