-
Notifications
You must be signed in to change notification settings - Fork 0
Hw12 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ArchieSW
wants to merge
3
commits into
hw11
Choose a base branch
from
hw12
base: hw11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hw12 #15
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| - [X] Сервис после получения запроса на создание работы, должен сохранить его в таблице. | ||
| - [X] Сервис должен найти копателей для всех заказов, которые имеют статус created. Копатели должны иметь подходящие навыки для выполнения заказа (навыки, указанные в запросе от копателей, должны совпадать с теми, что указал огородник). | ||
| - [X] Если копатели с похожими навыками найдены, то необходимо отсортировать самых ближайших к огороду и выделить первых трех копателей и создать запрос к системе HandymanService, указав необходимых копателей. | ||
| - [X] Иначе - уведомляем сервис RancherService: "По данному запросу копателей не нашлось. Измените объем работ". | ||
| - [X] Новый запрос на изменение объема работ должен обновить данные ранее созданого запроса | ||
|
|
||
| - [X] В сервисе при получении запроса на работу, копатель может либо принять, либо отклонить заказ. (Для тестирования можете захардкодить ответ. Например, если приходит запрос с копанием огорода, ъ копатель отклоняет его, а если с поливанием - принимает) | ||
| - [X] Если заказ принят, в сервисе LandscapeService должны обновить статус заказа. | ||
| - [X] Если заказ отклонен - ничего не делаем. | ||
| - [X] После того, как копатель принял заказа, необходимо через рандомное время отправить запрос в LandscapeService о том, что работа проделана. Статус заказа должен измениться. | ||
| - [X] LandscapeService информирует RancherService об изменении статуса заказа. | ||
| - [X] Через рандомное время огородник отправляет запрос в LandscapeService о подтверждении заказа и выставляет оценку работы. | ||
|
|
||
| - [ ] При отправке запроса из сервиса RancherService в LandscapeService возникнет ситуация, когда LandscapeService не обработал запрос. (сетевые проблемы, приложение упало и тд). Необходимо повторно выслать запроса из сервиса RancherService и записать данные в таблицу сервиса LandscapeService. | ||
| - [ ] Создав запрос из сервиса LandscapeService в HandymanService, у копателя может возникнуть проблема с соединением. Тогда попробовать заново отправить запрос, если запрос не был обработан то, следует создать новый запрос другому копателю. | ||
| - [ ] При отправке запроса из сервиса HandymanService в LandscapeService необходимо убедиться в том, что данные записались корретно. Если LandscapeService в момент получения запроса упадет, то необходимо инициировать новый запрос. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,9 @@ | |
|
|
||
| import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
|
||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
|
|
||
| public interface HandymanRepository extends MongoRepository<Handyman, String> { | ||
| boolean existsByInnerId(UUID innerId); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше добавить чуть больше контекста в наименования |
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
handyman-service/src/main/java/dev/archie/handymanservice/landscape/Order.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package dev.archie.handymanservice.landscape; | ||
|
|
||
|
|
||
| import dev.archie.handymanservice.handyman.skill.Skill; | ||
| import dev.archie.handymanservice.landscape.dto.Field; | ||
| import lombok.Data; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.Set; | ||
|
|
||
| @Data | ||
| public class Order { | ||
| private Long id; | ||
|
|
||
| private WorkType workType; | ||
|
|
||
| private WorkStatus status; | ||
|
|
||
| private LocalDateTime createdAt; | ||
|
|
||
| private Field field; | ||
|
|
||
| private Set<Skill> skills; | ||
|
|
||
| } |
28 changes: 28 additions & 0 deletions
28
handyman-service/src/main/java/dev/archie/handymanservice/landscape/OrderClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package dev.archie.handymanservice.landscape; | ||
|
|
||
| import dev.archie.handymanservice.landscape.dto.CreatingOrderDto; | ||
| import dev.archie.handymanservice.landscape.dto.OrderDto; | ||
| import org.springframework.cloud.openfeign.FeignClient; | ||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.PutMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
|
|
||
| @FeignClient(name = "order-client", path = "/orders", url = "${application.landscape.rest.url}") | ||
| public interface OrderClient { | ||
|
|
||
| @PostMapping | ||
| OrderDto create(@RequestBody CreatingOrderDto orderDto); | ||
|
|
||
| @GetMapping("/{id}") | ||
| OrderDto getById(@PathVariable Long id); | ||
| @PutMapping("/{id}") | ||
| OrderDto update(@PathVariable Long id, @RequestBody CreatingOrderDto orderDto); | ||
|
|
||
| @DeleteMapping("/{id}") | ||
| void delete(@PathVariable Long id); | ||
|
|
||
| } | ||
|
|
8 changes: 8 additions & 0 deletions
8
handyman-service/src/main/java/dev/archie/handymanservice/landscape/WorkStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package dev.archie.handymanservice.landscape; | ||
|
|
||
| public enum WorkStatus { | ||
| CREATED, | ||
| IN_PROGRESS, | ||
| DONE, | ||
| APPROVED | ||
| } |
8 changes: 8 additions & 0 deletions
8
handyman-service/src/main/java/dev/archie/handymanservice/landscape/WorkType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package dev.archie.handymanservice.landscape; | ||
|
|
||
| public enum WorkType { | ||
| SHOVEL, | ||
| PLANT, | ||
| WATER, | ||
| SOW | ||
| } |
24 changes: 24 additions & 0 deletions
24
...yman-service/src/main/java/dev/archie/handymanservice/landscape/dto/CreatingOrderDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package dev.archie.handymanservice.landscape.dto; | ||
|
|
||
| import dev.archie.handymanservice.landscape.WorkStatus; | ||
| import dev.archie.handymanservice.landscape.WorkType; | ||
| import lombok.Builder; | ||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| @Data | ||
| @Builder | ||
| public class CreatingOrderDto { | ||
|
|
||
| private WorkType workType; | ||
|
|
||
| private WorkStatus status; | ||
|
|
||
| private Long fieldId; | ||
|
|
||
| private UUID userId; | ||
|
|
||
| private List<String> skills; | ||
| } |
17 changes: 17 additions & 0 deletions
17
handyman-service/src/main/java/dev/archie/handymanservice/landscape/dto/Field.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package dev.archie.handymanservice.landscape.dto; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class Field { | ||
|
|
||
| private Long id; | ||
|
|
||
| private String address; | ||
|
|
||
| private Double latitude; | ||
|
|
||
| private Double longitude; | ||
|
|
||
| } | ||
|
|
16 changes: 16 additions & 0 deletions
16
handyman-service/src/main/java/dev/archie/handymanservice/landscape/dto/FieldDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package dev.archie.handymanservice.landscape.dto; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| public class FieldDto { | ||
|
|
||
| private Long id; | ||
|
|
||
| private String address; | ||
|
|
||
| private Double latitude; | ||
|
|
||
| private Double longitude; | ||
|
|
||
| } |
27 changes: 27 additions & 0 deletions
27
handyman-service/src/main/java/dev/archie/handymanservice/landscape/dto/OrderDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package dev.archie.handymanservice.landscape.dto; | ||
|
|
||
|
|
||
| import dev.archie.handymanservice.landscape.User; | ||
| import dev.archie.handymanservice.landscape.WorkStatus; | ||
| import dev.archie.handymanservice.landscape.WorkType; | ||
| import lombok.Data; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class OrderDto { | ||
| private Long id; | ||
|
|
||
| private WorkType workType; | ||
|
|
||
| private WorkStatus status; | ||
|
|
||
| private LocalDateTime createdAt; | ||
|
|
||
| private FieldDto field; | ||
|
|
||
| private User user; | ||
|
|
||
| private List<SkillDto> skills; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
landscape-service/src/main/java/dev/archie/landscapeservice/gardener/GardenerClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package dev.archie.landscapeservice.gardener; | ||
|
|
||
| import dev.archie.landscapeservice.order.Order; | ||
| import org.springframework.cloud.openfeign.FeignClient; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
|
|
||
| @FeignClient(name = "gardener-client", url = "${application.rancher.rest.url}", path = "/gardeners") | ||
| public interface GardenerClient { | ||
|
|
||
| @PostMapping("/notify/missingWorkers") | ||
| void notifyAboutMissingWorkers(@RequestBody Order order); | ||
|
|
||
| @PostMapping("/notify/orderUpdate") | ||
| void notifyAboutOrderUpdate(@RequestBody Order orderDto); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не соотносится с методологией REST