diff --git a/src/main/java/com/kamco/cd/kamcoback/gukyuin/service/GukYuinApiService.java b/src/main/java/com/kamco/cd/kamcoback/gukyuin/service/GukYuinApiService.java index 4778f363..46ace37b 100644 --- a/src/main/java/com/kamco/cd/kamcoback/gukyuin/service/GukYuinApiService.java +++ b/src/main/java/com/kamco/cd/kamcoback/gukyuin/service/GukYuinApiService.java @@ -63,7 +63,7 @@ public class GukYuinApiService { @Transactional public ChngDetectMastDto.RegistResDto regist( - ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) { + ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) { String url = gukyuinCdiUrl + "/chn/mast/regist"; @@ -72,12 +72,12 @@ public class GukYuinApiService { chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo()); ExternalCallResult 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; @@ -92,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; } @@ -110,23 +110,23 @@ public class GukYuinApiService { chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo()); ExternalCallResult 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", "탐지결과 삭제 되었습니다."); } @@ -136,37 +136,37 @@ public class GukYuinApiService { String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId; ExternalCallResult 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 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(); } @@ -212,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 result = - externalHttpClient.call( - url, - HttpMethod.GET, - null, - netUtils.jsonHeaders(), - ChngDetectContDto.ResultContDto.class); + externalHttpClient.call( + url, + HttpMethod.GET, + null, + netUtils.jsonHeaders(), + ChngDetectContDto.ResultContDto.class); List contList = result.body().getResult(); if (contList == null || contList.isEmpty()) { @@ -241,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(); } @@ -262,20 +262,20 @@ public class GukYuinApiService { String url = gukyuinCdiUrl + "/chn/pnu/" + chnDtctId + "/objt/" + chnDtctObjtId; ExternalCallResult 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(); } @@ -284,22 +284,22 @@ public class GukYuinApiService { String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn; ExternalCallResult 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()); } @@ -308,20 +308,20 @@ public class GukYuinApiService { String url = gukyuinCdiUrl + "/chn/cont/" + chnDtctId + "/pnu/" + pnu; ExternalCallResult 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(); } @@ -329,41 +329,41 @@ public class GukYuinApiService { String url = gukyuinCdiUrl + "/chn/mast/" + chnDtctId; ExternalCallResult 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) { @@ -376,13 +376,13 @@ public class GukYuinApiService { // uuid로 추론 회차 조회 LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid); if (info.getApplyStatus() != null - && !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId())) { + && !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(); @@ -393,9 +393,10 @@ public class GukYuinApiService { 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, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다."); + return new ResponseObj( + ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다."); } - + // 국유인 /chn/mast/regist 전송 this.regist(reqDto);