이노펨 mockup api 수정

This commit is contained in:
2026-01-05 16:09:56 +09:00
parent a86c0b5c4a
commit 27d33dac3b
2 changed files with 35 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
import com.kamco.cd.kamcoback.Innopam.service.DetectMastService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -14,6 +15,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -123,32 +125,42 @@ public class InnopamApiController {
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Basic.class))),
schema = @Schema(implementation = FeaturePnuDto.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
public List<FeaturePnuDto> selectPnuList(
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable String dtctSno) {
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable Integer dtctSno) {
DetectMastSearch detectMastSearch = new DetectMastSearch();
detectMastSearch.setCprsAdYr(cprsAfYr);
detectMastSearch.setCprsBfYr(cprsBfYr);
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
detectMastSearch.setDtctSno(dtctSno);
return detectMastService.findPnuData(detectMastSearch);
}
@Operation(summary = "탐지객체 랜덤 PNU 상세 조회", description = "탐지객체 PNU 랜덤값을 생성해서 보여준다")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "목록 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = FeaturePnuDto.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}/{featureId}")
public FeaturePnuDto selectPnuDetail(
@PathVariable String cprsBfYr,
@PathVariable String cprsAfYr,
@PathVariable String dtctSno,
@PathVariable String featureId) {
DetectMastSearch detectMastSearch = new DetectMastSearch();
detectMastSearch.setCprsAdYr(cprsAfYr);
detectMastSearch.setCprsBfYr(cprsBfYr);
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
detectMastSearch.setFeatureId(featureId);
return new FeaturePnuDto();
@Parameter(description = "이전년도", example = "2022") @PathVariable String cprsBfYr,
@Parameter(description = "기준년도", example = "2024") @PathVariable String cprsAfYr,
@Parameter(description = "회차", example = "4") @PathVariable Integer dtctSno,
@Parameter(description = "featureId", example = "000e161b-1955-4c89-ad87-0b3b4a91d00f")
@PathVariable
UUID featureId) {
return detectMastService.selectPnuDetail(featureId);
}
@Operation(
@@ -168,11 +180,11 @@ public class InnopamApiController {
})
@PutMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
public Integer updatePnuList(
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable String dtctSno) {
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable Integer dtctSno) {
DetectMastSearch detectMastSearch = new DetectMastSearch();
detectMastSearch.setCprsAdYr(cprsAfYr);
detectMastSearch.setCprsBfYr(cprsBfYr);
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
detectMastSearch.setDtctSno(dtctSno);
return detectMastService.updatePnuData(detectMastSearch);
}
}

View File

@@ -14,6 +14,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
@@ -68,6 +69,13 @@ public class DetectMastService {
return extractFeaturePnusRandom(dirPath);
}
public FeaturePnuDto selectPnuDetail(UUID uuid) {
FeaturePnuDto dto = new FeaturePnuDto();
dto.setPnu(randomPnu());
dto.setFeatureId(uuid.toString());
return dto;
}
@Transactional
public Integer updatePnuData(DetectMastSearch detectMast) {