Commit c532b55a authored by Jürgen Hannus's avatar Jürgen Hannus
Browse files

TEIS-2018: functionality to create read proceeding inspection document

parent cf47e98c
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReadProceedingInspectionDocumentDto {
private UUID id;
private UUID objectId;
private ClassifierItemLightDto objectType;
private LocalDateTime readAt;
private UUID officialUserId;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
import static ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.CreateReadInspectionDocumentRequest.Parameters;
public class CreateReadInspectionDocumentRequest extends AbstractDTO<Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateReadInspectionDocumentRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
@NotNull
private UUID objectId;
@NotNull
private ClassifierItemLightDto objectType;
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto.ReadProceedingInspectionDocumentDto;
public class CreateReadInspectionDocumentResponse extends AbstractDTO<ReadProceedingInspectionDocumentDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateReadInspectionDocumentResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
......@@ -4,6 +4,7 @@ import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.CommentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.CreateReadInspectionDocumentRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,4 +45,10 @@ class ProceedingInspectionDocumentControllerTest extends OfficeApiGatewayTestBas
new CommentDto(), new RequestMetaDTO()));
}
@Test
void createReadProceedingInspectionDocument() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.createReadProceedingInspectionDocument(
new CreateReadInspectionDocumentRequest.Parameters(), new RequestMetaDTO()));
}
}
......@@ -5,13 +5,10 @@ import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.CommentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.ProceedingInspectionDocumentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.CreateProceedingInspectionDocumentRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.PatchProceedingInspectionDocumentCommentRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.ProceedingInspectionDocumentsRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.UpdateProceedingInspectionDocumentsRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto.ReadProceedingInspectionDocumentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.*;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.CreateReadInspectionDocumentRequest.Parameters;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
......@@ -19,8 +16,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.UUID;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@RestController
@RequiredArgsConstructor
public class ProceedingInspectionDocumentController extends TeisBaseController {
......@@ -29,8 +24,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.get-proceeding-inspection-item-id}"))
@GetMapping(value = "proceedings/{id}/inspection-documents", produces = APPLICATION_JSON_VALUE)
@GetMapping("proceedings/{id}/inspection-documents")
public List<ProceedingInspectionDocumentDto> getDocuments(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ProceedingInspectionDocumentsRequest request = new ProceedingInspectionDocumentsRequest();
request.setPayload(id, requestMetaDTO);
......@@ -40,8 +34,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.proceeding.put-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.put-proceeding-inspection-item-id}"))
@PutMapping(value = "proceedings/{id}/inspection-documents", produces = APPLICATION_JSON_VALUE)
@PutMapping("proceedings/{id}/inspection-documents")
public List<ProceedingInspectionDocumentDto> updateDocuments(@PathVariable UUID id,
@RequestBody List<ClassifierItemLightDto> inspectionDocumentCodes,
RequestMetaDTO requestMetaDTO) {
......@@ -53,8 +46,9 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.proceeding.create-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
@PostMapping(value = "proceedings/{id}/inspection-documents", produces = APPLICATION_JSON_VALUE)
public ProceedingInspectionDocumentDto createDocument(@PathVariable UUID id, @RequestBody ClassifierItemLightDto document, RequestMetaDTO requestMetaDTO) {
@PostMapping("proceedings/{id}/inspection-documents")
public ProceedingInspectionDocumentDto createDocument(@PathVariable UUID id,
@RequestBody ClassifierItemLightDto document, RequestMetaDTO requestMetaDTO) {
CreateProceedingInspectionDocumentRequest request = new CreateProceedingInspectionDocumentRequest();
CreateProceedingInspectionDocumentRequest.Parameters payload = new CreateProceedingInspectionDocumentRequest.Parameters();
payload.setDocumentId(document.getCode());
......@@ -66,10 +60,9 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding.comment}",
response = ProceedingInspectionDocumentDto.class)
@PatchMapping(value = "proceeding-inspection-documents/{documentId}/comment", produces = APPLICATION_JSON_VALUE)
public ProceedingInspectionDocumentDto patchDocumentComment(@PathVariable UUID documentId,
@RequestBody CommentDto comment,
RequestMetaDTO requestMetaDTO) {
@PatchMapping("proceeding-inspection-documents/{documentId}/comment")
public ProceedingInspectionDocumentDto patchDocumentComment(@PathVariable UUID documentId, @RequestBody CommentDto comment,
RequestMetaDTO requestMetaDTO) {
PatchProceedingInspectionDocumentCommentRequest request = new PatchProceedingInspectionDocumentCommentRequest();
comment.setId(documentId);
request.setPayload(comment, requestMetaDTO);
......@@ -77,4 +70,15 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
return (ProceedingInspectionDocumentDto) service.sendAndReceive(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.inspection-document.create-inspection-document-read}",
response = ReadProceedingInspectionDocumentDto.class)
@PostMapping("read-proceeding-inspection-documents")
public ReadProceedingInspectionDocumentDto createReadProceedingInspectionDocument(@RequestBody Parameters dto,
RequestMetaDTO requestMetaDTO) {
CreateReadInspectionDocumentRequest request = new CreateReadInspectionDocumentRequest();
request.setPayload(dto, requestMetaDTO);
return (ReadProceedingInspectionDocumentDto) service.sendAndReceive(request);
}
}
......@@ -43,14 +43,14 @@ teis.api.messages.proceeding.put-proceeding: Teenus võimaldab muuta järelevalv
teis.api.messages.proceeding.patch-proceeding: Teenus muudab menetluse staatust
teis.api.messages.proceeding.put-proceeding-companies: Teenust kasutakase aktiivsete menetluste objektis ettevõtte andmete uuendamiseks või lisamiseks.
teis.api.messages.proceeding.get-proceeding-inspection-documents: Teenus väljastab menetlusega seotud kontrollitavate dokumentide nimekirja.
teis.api.messages.proceeding.get-proceeding-inspection-item-id: objectStatus = CURRENT<br>cd8d9fce-881a-4d31-b0d0-7fae124ba3de<br>objectStatus = DELETED<br>effbf2ac-e2bc-439f-bd5e-a458363646d1
teis.api.messages.proceeding.put-proceeding-inspection-documents: Teenus muudab (lisab või kustutab) menetlusega seotud kontrollitavate dokumentide nimekirja
teis.api.messages.proceeding.put-proceeding-inspection-item-id: objectStatus = CURRENT<br>cd8d9fce-881a-4d31-b0d0-7fae124ba3de<br>objectStatus = DELETED<br>effbf2ac-e2bc-439f-bd5e-a458363646d1
teis.api.messages.proceeding.put-proceeding-inspection-topics: Teenus muudab (lisab või kustutab) menetlusega seotud kontrolli teemade nimekirja.
teis.api.messages.proceeding.get-proceeding-inspection-topics: Teenus väljastab menetlusega seotud kontrolli teemade nimekirja.
teis.api.messages.proceeding.get-proceeding.overview: API väljastab menetluste nimistu koos statistiliste andmetega.
teis.api.messages.proceeding.get-proceeding.comment: API lisab või muudab dokumendi kommentaari.
teis.api.messages.proceeding.inspection-document.create-inspection-document-read: Teenuse abil on võimalik salvestada menetluse dokumendi lugemise fakti. Salvestatakse ainult ametniku menetluse dokumendi lugemise faktid.
teis.api.messages.proceeding.get-procedural-acts: API väljastab kontrollide nimistu. Mõeldud menetlusega seotud kontrollide nimistu kuvamiseks.
teis.api.messages.proceeding.get-procedural-act: API väljastab soovitud kontrolli andmed.
teis.api.messages.proceeding.post-procedural-act: API abil on võimalik luua uus kontrolli objekt ja sellega seotud objektid. Mõeldud kontrolli andmete loomiseks.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment