shp파일 생성 수정, 미사용 소스 제거
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.common.api;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.api.HelloDto.Res;
|
||||
import com.kamco.cd.kamcoback.common.service.ExternalJarRunner;
|
||||
import com.kamco.cd.kamcoback.common.service.HelloService;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/api/hello")
|
||||
public class HelloApiController {
|
||||
|
||||
private final HelloService helloService;
|
||||
private final ExternalJarRunner externalJarRunner;
|
||||
private final ExternalHttpClient externalHttpClient;
|
||||
|
||||
@GetMapping
|
||||
public HelloDto.Res hello(HelloDto.Req req) {
|
||||
req.valid();
|
||||
|
||||
Res res = helloService.sayHello(req);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/shp")
|
||||
public void shp(
|
||||
@Parameter(description = "jar 경로", example = "jar/makeshp-1.0.0.jar") @RequestParam
|
||||
String jarPath,
|
||||
@Parameter(description = "batchIds", example = "252,253,257") @RequestParam String batchIds,
|
||||
@Parameter(description = "32길이 문자열 값", example = "") @RequestParam(required = false)
|
||||
String inferenceId,
|
||||
@Parameter(description = "5K 도엽번호", example = "") @RequestParam(required = false)
|
||||
String mapIds) {
|
||||
externalJarRunner.run(jarPath, batchIds, inferenceId, mapIds);
|
||||
}
|
||||
|
||||
@GetMapping("/batch/{batchId}")
|
||||
public String batch(@PathVariable String batchId) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||
String url = "http://10.100.0.11:8000/batches" + "/" + batchId;
|
||||
ExternalCallResult<String> result =
|
||||
externalHttpClient.call(url, HttpMethod.GET, null, headers, String.class);
|
||||
|
||||
int status = result.statusCode();
|
||||
if (status == 404) {
|
||||
log.info("Batch not found. batchId={}", batchId);
|
||||
return null;
|
||||
}
|
||||
if (status < 200 || status >= 300) {
|
||||
return null;
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.common.api;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
public class HelloDto {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Req {
|
||||
private String id;
|
||||
|
||||
public void valid() {
|
||||
if (id == null) {
|
||||
throw new IllegalArgumentException(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Res {
|
||||
private String id;
|
||||
private String name;
|
||||
|
||||
@Builder
|
||||
public Res(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user