|
|
|
@ -156,61 +156,4 @@ public class ExternalAuthService {
|
|
|
|
throw new RuntimeException("외부 Edge API 호출 중 오류가 발생했습니다.");
|
|
|
|
throw new RuntimeException("외부 Edge API 호출 중 오류가 발생했습니다.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// public Map<String, Object> addEdgePackage(String token, EdgeSWVO edgeSWVO) throws IOException {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
|
|
|
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
|
|
|
|
|
|
|
// headers.setBearerAuth(token);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 문자열 필드들
|
|
|
|
|
|
|
|
// body.add("sw_id", edgeSWVO.getSw_id());
|
|
|
|
|
|
|
|
// body.add("sw_name", edgeSWVO.getSw_name());
|
|
|
|
|
|
|
|
// body.add("sw_version", edgeSWVO.getSw_version());
|
|
|
|
|
|
|
|
// body.add("creation_datetime", edgeSWVO.getCreation_datetime());
|
|
|
|
|
|
|
|
// body.add("auth_id", edgeSWVO.getAuth_id());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 파일 필드
|
|
|
|
|
|
|
|
// if (edgeSWVO.getFile() != null && !edgeSWVO.getFile().isEmpty()) {
|
|
|
|
|
|
|
|
// MultipartFile file = edgeSWVO.getFile();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // Content-Type 지정 + 파일명 유지
|
|
|
|
|
|
|
|
// ByteArrayResource fileResource = new ByteArrayResource(file.getBytes()) {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public String getFilename() {
|
|
|
|
|
|
|
|
// return file.getOriginalFilename();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public long contentLength() {
|
|
|
|
|
|
|
|
// return file.getSize();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// HttpHeaders fileHeaders = new HttpHeaders();
|
|
|
|
|
|
|
|
// fileHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// HttpEntity<ByteArrayResource> fileEntity = new HttpEntity<>(fileResource, fileHeaders);
|
|
|
|
|
|
|
|
// body.add("files", fileEntity); // ✅ 반드시 "files"
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// ResponseEntity<Map> response = restTemplate.postForEntity(edgeAddUrl, requestEntity, Map.class);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (response.getStatusCode().is2xxSuccessful() && response.getBody() != null) {
|
|
|
|
|
|
|
|
// return response.getBody();
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// throw new RuntimeException("외부 Edge 패키지 등록 실패 (응답 코드: " + response.getStatusCode() + ")");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// } catch (HttpClientErrorException | HttpServerErrorException e) {
|
|
|
|
|
|
|
|
// throw new RuntimeException(
|
|
|
|
|
|
|
|
// e.getStatusCode().value() + " on POST request for \"" + edgeAddUrl + "\": \"" + e.getResponseBodyAsString() + "\""
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|