국유인 연동 API validation 체크 주석 해제

This commit is contained in:
2026-02-02 10:10:52 +09:00
parent d8d35c3462
commit 5015a2a437

View File

@@ -20,11 +20,14 @@ import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
import com.kamco.cd.kamcoback.log.dto.EventStatus;
import com.kamco.cd.kamcoback.log.dto.EventType;
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;
@@ -60,7 +63,7 @@ public class GukYuinApiService {
@Transactional
public ChngDetectMastDto.RegistResDto regist(
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
String url = gukyuinCdiUrl + "/chn/mast/regist";
@@ -69,12 +72,12 @@ public class GukYuinApiService {
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
ExternalCallResult<ChngDetectMastDto.RegistResDto> result =
externalHttpClient.call(
url,
HttpMethod.POST,
chnDetectMastReq,
netUtils.jsonHeaders(),
ChngDetectMastDto.RegistResDto.class);
externalHttpClient.call(
url,
HttpMethod.POST,
chnDetectMastReq,
netUtils.jsonHeaders(),
ChngDetectMastDto.RegistResDto.class);
ChngDetectMastDto.RegistResDto resultBody = result.body();
Boolean success = false;
@@ -89,12 +92,12 @@ public class GukYuinApiService {
}
this.insertGukyuinAuditLog(
EventType.ADDED.getId(),
myip,
userUtil.getId(),
url.replace(gukyuinUrl, ""),
chnDetectMastReq,
success);
EventType.ADDED.getId(),
myip,
userUtil.getId(),
url.replace(gukyuinUrl, ""),
chnDetectMastReq,
success);
return resultBody;
}
@@ -107,23 +110,23 @@ public class GukYuinApiService {
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
ExternalCallResult<ChngDetectMastDto.Basic> result =
externalHttpClient.call(
url,
HttpMethod.POST,
chnDetectMastReq,
netUtils.jsonHeaders(),
ChngDetectMastDto.Basic.class);
externalHttpClient.call(
url,
HttpMethod.POST,
chnDetectMastReq,
netUtils.jsonHeaders(),
ChngDetectMastDto.Basic.class);
ChngDetectMastDto.Basic resultBody = result.body();
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
this.insertGukyuinAuditLog(
EventType.REMOVE.getId(),
myip,
userUtil.getId(),
url.replace(gukyuinUrl, ""),
chnDetectMastReq,
true); // TODO : successFail 여부
EventType.REMOVE.getId(),
myip,
userUtil.getId(),
url.replace(gukyuinUrl, ""),
chnDetectMastReq,
true); // TODO : successFail 여부
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
}
@@ -133,37 +136,37 @@ public class GukYuinApiService {
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
this.insertGukyuinAuditLog(
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
public ChngDetectMastDto.ResultDto listYearStage(
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
String queryString = netUtils.dtoToQueryString(searchDto, null);
String url = gukyuinCdiUrl + "/chn/mast" + queryString;
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
this.insertGukyuinAuditLog(
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
@@ -209,21 +212,21 @@ public class GukYuinApiService {
public ResultContDto findChnContList(String chnDtctId, Integer pageIndex, Integer pageSize) {
String url =
gukyuinCdiUrl
+ "/chn/cont/"
+ chnDtctId
+ "?pageIndex="
+ pageIndex
+ "&pageSize="
+ pageSize;
gukyuinCdiUrl
+ "/chn/cont/"
+ chnDtctId
+ "?pageIndex="
+ pageIndex
+ "&pageSize="
+ pageSize;
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultContDto.class);
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultContDto.class);
List<ContBasic> contList = result.body().getResult();
if (contList == null || contList.isEmpty()) {
@@ -238,19 +241,19 @@ public class GukYuinApiService {
if (pnuCnt > 0) {
Long geoUid =
gukyuinCoreService.findMapSheetAnalDataInferenceGeomUid(cont.getChnDtctObjtId());
gukyuinCoreService.findMapSheetAnalDataInferenceGeomUid(cont.getChnDtctObjtId());
gukyuinCoreService.insertGeoUidPnuData(geoUid, pnuList);
}
}
}
this.insertGukyuinAuditLog(
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
@@ -259,20 +262,20 @@ public class GukYuinApiService {
String url = gukyuinCdiUrl + "/chn/pnu/" + chnDtctId + "/objt/" + chnDtctObjtId;
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultPnuDto.class);
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultPnuDto.class);
this.insertGukyuinAuditLog(
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
@@ -281,22 +284,22 @@ public class GukYuinApiService {
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
externalHttpClient.call(
url,
HttpMethod.POST,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultPnuDto.class);
externalHttpClient.call(
url,
HttpMethod.POST,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultPnuDto.class);
ChngDetectContDto.ResultPnuDto dto = result.body();
this.insertGukyuinAuditLog(
EventType.MODIFIED.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.MODIFIED.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
}
@@ -305,20 +308,20 @@ public class GukYuinApiService {
String url = gukyuinCdiUrl + "/chn/cont/" + chnDtctId + "/pnu/" + pnu;
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultContDto.class);
externalHttpClient.call(
url,
HttpMethod.GET,
null,
netUtils.jsonHeaders(),
ChngDetectContDto.ResultContDto.class);
this.insertGukyuinAuditLog(
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.LIST.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
@@ -326,41 +329,41 @@ public class GukYuinApiService {
String url = gukyuinCdiUrl + "/chn/mast/" + chnDtctId;
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
externalHttpClient.call(
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
this.insertGukyuinAuditLog(
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
EventType.DETAIL.getId(),
netUtils.getLocalIP(),
userUtil.getId(),
url.replace(gukyuinUrl, ""),
null,
result.body().getSuccess());
return result.body();
}
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
public void insertGukyuinAuditLog(
String actionType,
String myIp,
Long userUid,
String requestUri,
Object requestBody,
boolean successFail) {
String actionType,
String myIp,
Long userUid,
String requestUri,
Object requestBody,
boolean successFail) {
try {
AuditLogEntity log =
new AuditLogEntity(
userUid,
EventType.fromName(actionType),
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
myIp,
requestUri,
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
null,
null,
null);
new AuditLogEntity(
userUid,
EventType.fromName(actionType),
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
myIp,
requestUri,
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
null,
null,
null);
auditLogRepository.save(log);
} catch (Exception e) {
@@ -372,15 +375,14 @@ public class GukYuinApiService {
public ResponseObj connectChnMastRegist(UUID uuid) {
// uuid로 추론 회차 조회
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
// if (info.getApplyStatus() != null &&
// !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId()))
// {
// return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 추론 회차입니다.");
// }
if (info.getApplyStatus() != null
&& !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId())) {
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
}
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
Integer maxStage =
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
// reqDto 셋팅
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
@@ -390,6 +392,10 @@ public class GukYuinApiService {
reqDto.setChnDtctId(info.getUid());
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
if (Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
return new ResponseObj(ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
}
// 국유인 /chn/mast/regist 전송
this.regist(reqDto);