Merge branch 'jenkins_with_weblogic' into devs/sso
# Conflicts: # readme.md # src/main/java/com/eactive/ext/kjb/util/KjbPropertyInjector.java
This commit is contained in:
@@ -657,7 +657,8 @@ public class TransactionBAPServiceImpl extends BaseService implements Transactio
|
||||
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
|
||||
|
||||
String json = mapper.writeValueAsString(interfaceDeploy);
|
||||
System.out.println(json);
|
||||
// System.out.println(json);
|
||||
logger.debug(json);
|
||||
|
||||
FileWriteUtil.FileWrite(path , fileName+".txt", json, "UTF-8");
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ public class BapSystemInstService extends BapBaseService {
|
||||
List<Map<String, Object>> sysConnList = dao.selectDetailSysconn(param);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
System.out.println( "list-->" + list.size());
|
||||
// System.out.println( "list-->" + list.size());
|
||||
logger.debug( "list-->" + list.size());
|
||||
map.put("detail", detail);
|
||||
map.put("rows", list);
|
||||
map.put("sysConnList", sysConnList);
|
||||
|
||||
-1
@@ -156,7 +156,6 @@ public class BapMessageProcController extends BapBaseAnnotationController {
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/bap/admin/work/messageProcMan.json",params = "cmd=LIST_PROP")
|
||||
public ModelAndView getProps( HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.rms.common.advice;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* .json 요청에 대해 빈 응답 본문을 {}로 변환하는 ResponseBodyAdvice.
|
||||
*
|
||||
* 웹서버를 거치면서 Content-Type이 application/json으로 설정되는데,
|
||||
* 빈 응답이면 JavaScript(jQuery)가 JSON 파싱 시 에러가 발생하는 문제를 해결합니다.
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class EmptyJsonResponseAdviceController implements ResponseBodyAdvice<Object> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmptyJsonResponseAdviceController.class);
|
||||
private static final Map<String, Object> EMPTY_JSON = Collections.emptyMap();
|
||||
private static final String EMPTY_JSON_STRING = "{}";
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
logger.debug("========== EmptyJsonResponseAdviceController 로딩됨 ==========");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
// 모든 응답에 대해 적용 (beforeBodyWrite에서 .json 요청만 필터링)
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
|
||||
ServerHttpResponse response) {
|
||||
|
||||
String path = request.getURI().getPath();
|
||||
|
||||
// .json 요청이 아니면 원본 그대로 반환
|
||||
if (path == null || !path.endsWith(".json")) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// 정상적인 응답이 있는 경우, String 타입의 빈 응답 처리
|
||||
if (body != null && !(body instanceof String && ((String) body).isEmpty())) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// Controller 리턴타입이 String 일 때 cannot be cast 에러 대응
|
||||
logger.debug("빈 응답 감지, {} 로 변환 시도. 선택된 컨버터: {}", path, selectedConverterType.getSimpleName());
|
||||
|
||||
if (StringHttpMessageConverter.class.isAssignableFrom(selectedConverterType)) {
|
||||
return EMPTY_JSON_STRING; // 문자열 "{}" 반환
|
||||
}
|
||||
|
||||
return EMPTY_JSON; // Map 객체 반환
|
||||
}
|
||||
}
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.eactive.eai.rms.common.interceptor.InterceptorSkipController;
|
||||
import com.eactive.eai.rms.common.login.LoginVo;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.dbconsole.dto.ColumnInfoDto;
|
||||
import com.eactive.eai.rms.common.dbconsole.dto.DatasourceInfoDto;
|
||||
import com.eactive.eai.rms.common.dbconsole.dto.SqlRequestDto;
|
||||
import com.eactive.eai.rms.common.dbconsole.dto.SqlResultDto;
|
||||
import com.eactive.eai.rms.common.dbconsole.dto.TableInfoDto;
|
||||
import com.eactive.eai.rms.common.dbconsole.service.DbConsoleDecryptService;
|
||||
import com.eactive.eai.rms.common.dbconsole.service.DbConsoleService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* DB Console Controller
|
||||
* - admin 그룹 사용자만 접근 가능
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/dbconsole")
|
||||
public class DbConsoleController implements InterceptorSkipController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DbConsoleController.class);
|
||||
|
||||
private final DbConsoleService dbConsoleService;
|
||||
private final DbConsoleDecryptService decryptService;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public DbConsoleController(DbConsoleService dbConsoleService, DbConsoleDecryptService decryptService) {
|
||||
this.dbConsoleService = dbConsoleService;
|
||||
this.decryptService = decryptService;
|
||||
this.objectMapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Role 권한 체크
|
||||
*/
|
||||
private void checkAdminAccess(HttpServletRequest request) {
|
||||
LoginVo loginVo = SessionManager.getLoginVo(request);
|
||||
if (loginVo == null) {
|
||||
throw new AccessDeniedException("로그인이 필요합니다.");
|
||||
}
|
||||
|
||||
List<String> roleList = loginVo.getRoleList();
|
||||
if (roleList == null || roleList.isEmpty()) {
|
||||
log.warn("DB Console 접근 거부 (역할 없음): userId={}", loginVo.getUserId());
|
||||
throw new AccessDeniedException("DB Console 접근 권한이 없습니다.");
|
||||
}
|
||||
|
||||
// admin 역할 체크
|
||||
boolean hasAdminRole = roleList.stream()
|
||||
.anyMatch(role -> role != null &&
|
||||
("ADMIN".equalsIgnoreCase(role) || role.toUpperCase().contains("ADMIN")));
|
||||
|
||||
if (!hasAdminRole) {
|
||||
log.warn("DB Console 접근 거부 (Admin 권한 없음): userId={}, roles={}",
|
||||
loginVo.getUserId(), roleList);
|
||||
throw new AccessDeniedException("DB Console 접근 권한이 없습니다. (Admin 권한 필요)");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DB Console 페이지
|
||||
*/
|
||||
@GetMapping("/console.do")
|
||||
public String dbConsolePage(HttpServletRequest request, Model model) {
|
||||
checkAdminAccess(request);
|
||||
|
||||
try {
|
||||
List<DatasourceInfoDto> datasources = dbConsoleService.getAvailableDatasources();
|
||||
String sessionId = dbConsoleService.createSession();
|
||||
|
||||
model.addAttribute("datasources", datasources);
|
||||
model.addAttribute("datasourcesJson", objectMapper.writeValueAsString(datasources));
|
||||
model.addAttribute("sessionId", sessionId);
|
||||
} catch (Exception e) {
|
||||
log.error("DB Console 페이지 로드 오류", e);
|
||||
model.addAttribute("datasourcesJson", "[]");
|
||||
model.addAttribute("sessionId", "");
|
||||
}
|
||||
|
||||
return "/common/dbconsole/dbConsoleMan";
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용 가능한 데이터소스 목록 조회
|
||||
*/
|
||||
@PostMapping("/datasources.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<DatasourceInfoDto>> getDatasources(HttpServletRequest request) {
|
||||
checkAdminAccess(request);
|
||||
return ResponseEntity.ok(dbConsoleService.getAvailableDatasources());
|
||||
}
|
||||
|
||||
/**
|
||||
* 새 세션 생성
|
||||
*/
|
||||
@PostMapping("/session.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, String>> createSession(HttpServletRequest request) {
|
||||
checkAdminAccess(request);
|
||||
String sessionId = dbConsoleService.createSession();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("sessionId", sessionId);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL 실행
|
||||
*/
|
||||
@PostMapping("/execute.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<SqlResultDto> executeSql(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
log.debug("SQL 실행 요청: session={}, action={}", sqlRequest.getSessionId(), sqlRequest.getAction());
|
||||
SqlResultDto result = dbConsoleService.executeSql(sqlRequest);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* COMMIT
|
||||
*/
|
||||
@PostMapping("/commit.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<SqlResultDto> commit(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
sqlRequest.setAction("COMMIT");
|
||||
SqlResultDto result = dbConsoleService.executeSql(sqlRequest);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* ROLLBACK
|
||||
*/
|
||||
@PostMapping("/rollback.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<SqlResultDto> rollback(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
sqlRequest.setAction("ROLLBACK");
|
||||
SqlResultDto result = dbConsoleService.executeSql(sqlRequest);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 세션 종료
|
||||
*/
|
||||
@PostMapping("/disconnect.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<SqlResultDto> disconnect(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
sqlRequest.setAction("DISCONNECT");
|
||||
SqlResultDto result = dbConsoleService.executeSql(sqlRequest);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 스키마 목록 조회
|
||||
*/
|
||||
@PostMapping("/schemas.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<String>> getSchemas(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
List<String> schemas = dbConsoleService.getSchemas(sqlRequest);
|
||||
return ResponseEntity.ok(schemas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 목록 조회
|
||||
*/
|
||||
@PostMapping("/tables.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<TableInfoDto>> getTables(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
List<TableInfoDto> tables = dbConsoleService.getTables(sqlRequest);
|
||||
return ResponseEntity.ok(tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 컬럼 정보 조회
|
||||
*/
|
||||
@PostMapping("/columns.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<ColumnInfoDto>> getColumns(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
List<ColumnInfoDto> columns = dbConsoleService.getColumns(sqlRequest);
|
||||
return ResponseEntity.ok(columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 DDL 조회
|
||||
*/
|
||||
@PostMapping("/ddl.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, String>> getTableDdl(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
String ddl = dbConsoleService.getTableDdl(sqlRequest);
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("ddl", ddl);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 세션 하트비트 (커넥션 유지용)
|
||||
*/
|
||||
@PostMapping("/heartbeat.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<SqlResultDto> heartbeat(HttpServletRequest request, @RequestBody SqlRequestDto sqlRequest) {
|
||||
checkAdminAccess(request);
|
||||
SqlResultDto result = dbConsoleService.heartbeat(sqlRequest.getSessionId());
|
||||
// 남은 시간도 함께 반환
|
||||
long remainingSeconds = dbConsoleService.getSessionRemainingTime(sqlRequest.getSessionId());
|
||||
result.setMessage(result.getMessage() + " (남은시간: " + remainingSeconds + "초)");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* SafeDB 암호화 데이터 복호화 (단일 값)
|
||||
*/
|
||||
@PostMapping("/decrypt.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, Object>> decryptValue(HttpServletRequest request, @RequestBody Map<String, String> params) {
|
||||
checkAdminAccess(request);
|
||||
|
||||
String encryptedValue = params.get("value");
|
||||
if (encryptedValue == null || encryptedValue.isEmpty()) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", false);
|
||||
result.put("message", "복호화할 값이 없습니다.");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
try {
|
||||
String decryptedValue = decryptService.decryptValue(encryptedValue);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", true);
|
||||
result.put("originalValue", encryptedValue);
|
||||
result.put("decryptedValue", decryptedValue);
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("복호화 오류", e);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", false);
|
||||
result.put("message", "복호화 오류: " + e.getMessage());
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SafeDB 암호화 데이터 복호화 (여러 값)
|
||||
*/
|
||||
@PostMapping("/decryptBatch.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, Object>> decryptBatch(HttpServletRequest request, @RequestBody Map<String, List<String>> params) {
|
||||
checkAdminAccess(request);
|
||||
|
||||
List<String> encryptedValues = params.get("values");
|
||||
if (encryptedValues == null || encryptedValues.isEmpty()) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", false);
|
||||
result.put("message", "복호화할 값이 없습니다.");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
try {
|
||||
Map<String, String> decryptedMap = decryptService.decryptValues(encryptedValues);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", true);
|
||||
result.put("decrypted", decryptedMap);
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("복호화 오류", e);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", false);
|
||||
result.put("message", "복호화 오류: " + e.getMessage());
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 값이 암호화되었는지 확인
|
||||
*/
|
||||
@PostMapping("/checkEncrypted.do")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, Object>> checkEncrypted(HttpServletRequest request, @RequestBody Map<String, String> params) {
|
||||
checkAdminAccess(request);
|
||||
|
||||
String value = params.get("value");
|
||||
boolean isEncrypted = decryptService.isEncrypted(value);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", true);
|
||||
result.put("value", value);
|
||||
result.put("isEncrypted", isEncrypted);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 컬럼 정보 DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ColumnInfoDto {
|
||||
|
||||
/**
|
||||
* 컬럼명
|
||||
*/
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 데이터 타입
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 데이터 길이
|
||||
*/
|
||||
private Integer dataLength;
|
||||
|
||||
/**
|
||||
* NULL 허용 여부 (Y/N)
|
||||
*/
|
||||
private String nullable;
|
||||
|
||||
/**
|
||||
* 기본값
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* 코멘트
|
||||
*/
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 컬럼 순서
|
||||
*/
|
||||
private Integer columnId;
|
||||
|
||||
/**
|
||||
* PK 여부
|
||||
*/
|
||||
private boolean primaryKey;
|
||||
|
||||
/**
|
||||
* UK 여부
|
||||
*/
|
||||
private boolean uniqueKey;
|
||||
|
||||
/**
|
||||
* FK 여부
|
||||
*/
|
||||
private boolean foreignKey;
|
||||
|
||||
/**
|
||||
* 인덱스 여부
|
||||
*/
|
||||
private boolean indexed;
|
||||
|
||||
/**
|
||||
* 인덱스명 (콤마로 구분)
|
||||
*/
|
||||
private String indexName;
|
||||
|
||||
/**
|
||||
* LOB 타입 여부
|
||||
*/
|
||||
private boolean lobType;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 데이터소스 정보 DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class DatasourceInfoDto {
|
||||
|
||||
/**
|
||||
* 표시 이름
|
||||
*/
|
||||
private String displayName;
|
||||
|
||||
/**
|
||||
* 타입 (JNDI, DIRECT)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 설명
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* JNDI 이름
|
||||
*/
|
||||
private String jndiName;
|
||||
|
||||
/**
|
||||
* JDBC URL
|
||||
*/
|
||||
private String jdbcUrl;
|
||||
|
||||
/**
|
||||
* 사용자명
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 드라이버 클래스명
|
||||
*/
|
||||
private String driverClassName;
|
||||
|
||||
/**
|
||||
* 스키마명
|
||||
*/
|
||||
private String schema;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* SQL 실행 요청 DTO
|
||||
*/
|
||||
@Data
|
||||
public class SqlRequestDto {
|
||||
|
||||
/**
|
||||
* 세션 ID
|
||||
*/
|
||||
private String sessionId;
|
||||
|
||||
/**
|
||||
* 실행할 SQL
|
||||
*/
|
||||
private String sql;
|
||||
|
||||
/**
|
||||
* 액션 (EXECUTE, COMMIT, ROLLBACK, DISCONNECT)
|
||||
*/
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* 최대 조회 행 수
|
||||
*/
|
||||
private Integer maxRows;
|
||||
|
||||
/**
|
||||
* 데이터소스 타입 (JNDI, DIRECT)
|
||||
*/
|
||||
private String datasourceType;
|
||||
|
||||
/**
|
||||
* JNDI 이름
|
||||
*/
|
||||
private String jndiName;
|
||||
|
||||
/**
|
||||
* JDBC URL (DIRECT 연결 시)
|
||||
*/
|
||||
private String jdbcUrl;
|
||||
|
||||
/**
|
||||
* 사용자명 (DIRECT 연결 시)
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 비밀번호 (DIRECT 연결 시 또는 COMMIT 확인용)
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 드라이버 클래스명
|
||||
*/
|
||||
private String driverClassName;
|
||||
|
||||
/**
|
||||
* 스키마명 (테이블/컬럼 조회 시)
|
||||
*/
|
||||
private String schemaName;
|
||||
|
||||
/**
|
||||
* 테이블명 (컬럼/DDL 조회 시)
|
||||
*/
|
||||
private String tableName;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.dto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* SQL 실행 결과 DTO
|
||||
*/
|
||||
@Data
|
||||
public class SqlResultDto {
|
||||
|
||||
/**
|
||||
* 성공 여부
|
||||
*/
|
||||
private boolean success;
|
||||
|
||||
/**
|
||||
* 메시지
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 세션 ID
|
||||
*/
|
||||
private String sessionId;
|
||||
|
||||
/**
|
||||
* 쿼리 타입 (SELECT, INSERT, UPDATE, DELETE, DDL, ERROR, MULTI)
|
||||
*/
|
||||
private String queryType;
|
||||
|
||||
/**
|
||||
* 컬럼 목록 (SELECT 결과)
|
||||
*/
|
||||
private List<String> columns;
|
||||
|
||||
/**
|
||||
* 컬럼 메타정보 (SELECT 결과)
|
||||
*/
|
||||
private List<ColumnInfoDto> columnMetas;
|
||||
|
||||
/**
|
||||
* 데이터 행 (SELECT 결과)
|
||||
*/
|
||||
private List<Map<String, Object>> rows;
|
||||
|
||||
/**
|
||||
* 영향받은 행 수 (INSERT, UPDATE, DELETE)
|
||||
*/
|
||||
private Integer affectedRows;
|
||||
|
||||
/**
|
||||
* 실행 시간 (ms)
|
||||
*/
|
||||
private Long executionTime;
|
||||
|
||||
/**
|
||||
* 트랜잭션 활성 상태
|
||||
*/
|
||||
private boolean transactionActive;
|
||||
|
||||
/**
|
||||
* 성공 결과 생성
|
||||
*/
|
||||
public static SqlResultDto success(String message) {
|
||||
SqlResultDto result = new SqlResultDto();
|
||||
result.setSuccess(true);
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 오류 결과 생성
|
||||
*/
|
||||
public static SqlResultDto error(String message) {
|
||||
SqlResultDto result = new SqlResultDto();
|
||||
result.setSuccess(false);
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 테이블 정보 DTO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class TableInfoDto {
|
||||
|
||||
/**
|
||||
* 테이블명
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 테이블 타입 (TABLE, VIEW)
|
||||
*/
|
||||
private String tableType;
|
||||
|
||||
/**
|
||||
* 코멘트
|
||||
*/
|
||||
private String comments;
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package com.eactive.eai.rms.common.dbconsole.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
||||
|
||||
/**
|
||||
* DB Console 복호화 서비스
|
||||
* - SafeDB 암호화 데이터 복호화 기능 제공
|
||||
*/
|
||||
@Service
|
||||
public class DbConsoleDecryptService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DbConsoleDecryptService.class);
|
||||
|
||||
/**
|
||||
* SafeDB 암호화 패턴 (16진수 문자열, 최소 32자 이상)
|
||||
* - 암호화된 데이터는 대체로 긴 16진수 문자열 형태
|
||||
*/
|
||||
private static final Pattern ENCRYPTED_PATTERN = Pattern.compile("^[0-9A-Fa-f]{32,}$");
|
||||
|
||||
/**
|
||||
* 단일 값 복호화
|
||||
*/
|
||||
public String decryptValue(String encryptedValue) {
|
||||
if (encryptedValue == null || encryptedValue.isEmpty()) {
|
||||
return encryptedValue;
|
||||
}
|
||||
|
||||
try {
|
||||
KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance();
|
||||
String decrypted = safedb.decryptNotRnno(encryptedValue);
|
||||
log.debug("복호화 성공: {} -> {}",
|
||||
encryptedValue.length() > 20 ? encryptedValue.substring(0, 20) + "..." : encryptedValue,
|
||||
decrypted);
|
||||
return decrypted;
|
||||
} catch (Exception e) {
|
||||
log.warn("복호화 실패: {}", e.getMessage());
|
||||
return "[복호화 실패: " + e.getMessage() + "]";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 값 일괄 복호화
|
||||
*/
|
||||
public Map<String, String> decryptValues(List<String> encryptedValues) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
if (encryptedValues == null || encryptedValues.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (String encrypted : encryptedValues) {
|
||||
if (encrypted != null && !encrypted.isEmpty()) {
|
||||
result.put(encrypted, decryptValue(encrypted));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 행 데이터에서 암호화 컬럼 복호화
|
||||
* @param rows 원본 행 데이터
|
||||
* @param columns 복호화할 컬럼명 목록
|
||||
* @return 복호화된 행 데이터
|
||||
*/
|
||||
public List<Map<String, Object>> decryptRows(List<Map<String, Object>> rows, List<String> columns) {
|
||||
if (rows == null || rows.isEmpty() || columns == null || columns.isEmpty()) {
|
||||
return rows;
|
||||
}
|
||||
|
||||
List<Map<String, Object>> decryptedRows = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> row : rows) {
|
||||
Map<String, Object> decryptedRow = new HashMap<>(row);
|
||||
|
||||
for (String column : columns) {
|
||||
Object value = row.get(column);
|
||||
if (value != null && value instanceof String) {
|
||||
String strValue = (String) value;
|
||||
if (isEncrypted(strValue)) {
|
||||
decryptedRow.put(column, decryptValue(strValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decryptedRows.add(decryptedRow);
|
||||
}
|
||||
|
||||
return decryptedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 값이 암호화된 것인지 확인 (휴리스틱)
|
||||
* - 16진수 문자열 패턴 (32자 이상)
|
||||
*/
|
||||
public boolean isEncrypted(String value) {
|
||||
if (value == null || value.length() < 32) {
|
||||
return false;
|
||||
}
|
||||
return ENCRYPTED_PATTERN.matcher(value).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 컬럼별로 암호화 여부 자동 감지
|
||||
* @param rows 조회 결과 행
|
||||
* @return 암호화된 것으로 추정되는 컬럼명 목록
|
||||
*/
|
||||
public List<String> detectEncryptedColumns(List<Map<String, Object>> rows) {
|
||||
List<String> encryptedColumns = new ArrayList<>();
|
||||
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
return encryptedColumns;
|
||||
}
|
||||
|
||||
// 첫 번째 행 기준으로 검사 (모든 행을 검사하면 비용이 높음)
|
||||
Map<String, Object> firstRow = rows.get(0);
|
||||
|
||||
for (Map.Entry<String, Object> entry : firstRow.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
if (value != null && value instanceof String) {
|
||||
if (isEncrypted((String) value)) {
|
||||
encryptedColumns.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return encryptedColumns;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,12 +15,9 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
// GS인증 크로스사이트스크립트 보안성 문제로 XSS 공격을 방지하기 위한 악성 스크립트 패턴 정의.
|
||||
// 2025.05.27 패턴 추가
|
||||
// 2025.12.30 src 패턴 수정 - 화이트리스트 방식 (http, https, data:image/ 만 허용)
|
||||
private static final Pattern[] PATTERNS = new Pattern[] {
|
||||
Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
|
||||
Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
|
||||
Pattern.compile("</script>", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("<script(.*?)>",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
|
||||
@@ -46,6 +43,22 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL)
|
||||
};
|
||||
|
||||
// src 속성 화이트리스트 패턴 - data:image/만 허용
|
||||
private static final Pattern SRC_ATTR_PATTERN = Pattern.compile(
|
||||
"(src\\s*=\\s*)([\"'])([^\"']*?)\\2",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
// 허용되는 src 값 패턴 (화이트리스트) - data:image/만 허용
|
||||
private static final Pattern ALLOWED_SRC_PATTERN = Pattern.compile(
|
||||
"^data:image/.*",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
// XSS 문자 변환을 건너뛸 파라미터 목록 (리치 텍스트 에디터 콘텐츠 등)
|
||||
// XSS 패턴 필터링은 적용하지만 <, > 등으로 변환하지 않음
|
||||
private static final String[] SKIP_CHAR_CONVERT_PARAMS = {"contents", "content", "description"};
|
||||
|
||||
// 현재 처리 중인 파라미터명 (cleanXSS에서 문자 변환 여부 결정에 사용)
|
||||
private ThreadLocal<String> currentParameter = new ThreadLocal<>();
|
||||
|
||||
public RequestWrapper(HttpServletRequest servletRequest) {
|
||||
super(servletRequest);
|
||||
@@ -60,8 +73,13 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
int count = values.length;
|
||||
String[] encodedValues = new String[count];
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
encodedValues[i] = cleanXSS(values[i]);
|
||||
currentParameter.set(parameter);
|
||||
try {
|
||||
for (int i = 0; i < count; i++) {
|
||||
encodedValues[i] = cleanXSS(values[i]);
|
||||
}
|
||||
} finally {
|
||||
currentParameter.remove();
|
||||
}
|
||||
|
||||
return encodedValues;
|
||||
@@ -74,13 +92,19 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
for (Entry<String, String[]> entry : map.entrySet()) {
|
||||
String[] values = entry.getValue();
|
||||
String paramName = entry.getKey();
|
||||
|
||||
if (values != null && values.length > 0) {
|
||||
String[] cloneValues = new String[values.length];
|
||||
for (int idx = 0; idx < values.length; idx++) {
|
||||
cloneValues[idx] = cleanXSS(values[idx]);
|
||||
currentParameter.set(paramName);
|
||||
try {
|
||||
for (int idx = 0; idx < values.length; idx++) {
|
||||
cloneValues[idx] = cleanXSS(values[idx]);
|
||||
}
|
||||
} finally {
|
||||
currentParameter.remove();
|
||||
}
|
||||
clonedMap.put(entry.getKey(), cloneValues);
|
||||
clonedMap.put(paramName, cloneValues);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +119,12 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
return value;
|
||||
}
|
||||
|
||||
return cleanXSS(value);
|
||||
currentParameter.set(parameter);
|
||||
try {
|
||||
return cleanXSS(value);
|
||||
} finally {
|
||||
currentParameter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,9 +152,15 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
// script 문자열을 완전히 제거
|
||||
value = value.replaceAll("(?i)\\bscript\\b", "");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
value = convertChars(value, sb);
|
||||
// src 속성 화이트리스트 필터링 - 허용된 프로토콜만 통과
|
||||
value = filterSrcAttribute(value);
|
||||
|
||||
// 리치 텍스트 파라미터는 문자 변환을 건너뛰고 XSS 패턴 필터링만 적용
|
||||
if (!shouldSkipCharConvert()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
value = convertChars(value, sb);
|
||||
}
|
||||
|
||||
// eval, javascript 등 스크립트 관련 문자열 제거
|
||||
value = value.replaceAll("(?i)eval\\((.*?)\\)", "");
|
||||
@@ -133,6 +168,54 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 파라미터가 문자 변환을 건너뛸지 여부 확인
|
||||
* 리치 텍스트 에디터 콘텐츠 등은 HTML 태그가 필요하므로 < > 변환을 하지 않음
|
||||
*/
|
||||
private boolean shouldSkipCharConvert() {
|
||||
String param = currentParameter.get();
|
||||
if (param == null) {
|
||||
return false;
|
||||
}
|
||||
for (String skipParam : SKIP_CHAR_CONVERT_PARAMS) {
|
||||
if (StringUtils.equalsIgnoreCase(param, skipParam)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* src 속성을 화이트리스트 방식으로 필터링
|
||||
* 허용: data:image/ (Base64 이미지)
|
||||
* 비허용: 그 외 모든 프로토콜
|
||||
*/
|
||||
private String filterSrcAttribute(String value) {
|
||||
if (value == null || !value.toLowerCase().contains("src")) {
|
||||
return value;
|
||||
}
|
||||
|
||||
Matcher matcher = SRC_ATTR_PATTERN.matcher(value);
|
||||
StringBuffer result = new StringBuffer();
|
||||
|
||||
while (matcher.find()) {
|
||||
String srcPrefix = matcher.group(1); // src=
|
||||
String quote = matcher.group(2); // " 또는 '
|
||||
String srcValue = matcher.group(3); // src 값
|
||||
|
||||
// 빈 값이거나 화이트리스트에 매칭되면 유지
|
||||
if (srcValue.isEmpty() || ALLOWED_SRC_PATTERN.matcher(srcValue).matches()) {
|
||||
matcher.appendReplacement(result, Matcher.quoteReplacement(srcPrefix + quote + srcValue + quote));
|
||||
} else {
|
||||
// 허용되지 않는 프로토콜은 src="" 로 대체
|
||||
matcher.appendReplacement(result, Matcher.quoteReplacement(srcPrefix + quote + quote));
|
||||
}
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
// '(', ')', '"' 문자는 getMethod()가 "get"일 때만 변환됨.
|
||||
// 이는 gridData에서 사용되는 큰따옴표(")와 변환 함수에서 사용하는 괄호('(', ')')의 처리를 위함.
|
||||
private String convertChars(String value, StringBuilder sb) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
@@ -32,6 +33,14 @@ public class AuthorizeInterceptor implements HandlerInterceptor {
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
// InterceptorSkipController 구현 컨트롤러는 권한 체크 스킵
|
||||
if (handler instanceof HandlerMethod) {
|
||||
Class<?> clazz = ((HandlerMethod) handler).getBeanType();
|
||||
if (ClassUtils.isAssignable(clazz, InterceptorSkipController.class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 요청 URI, 사용자 ID, 서비스 타입, cmd 추출
|
||||
String uri = request.getRequestURI();
|
||||
String userId = SessionManager.getUserId(request);
|
||||
|
||||
@@ -67,9 +67,9 @@ public class SessionCheckInterceptor extends HandlerInterceptorAdapter {
|
||||
} else {
|
||||
//request.getRequestDispatcher("/monitoring/loginForm.do").forward(request, response);
|
||||
//request.getSession().setAttribute("redirectInProgress", true);
|
||||
response.sendRedirect("/monitoring/rms/logout.do");
|
||||
response.sendRedirect(request.getContextPath() + "/rms/logout.do");
|
||||
//response.sendRedirect("/monitoring/loginForm.do");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.rms.common.login;
|
||||
|
||||
import javax.servlet.annotation.WebListener;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
import javax.servlet.http.HttpSessionListener;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@WebListener
|
||||
public class SessionDestructionListener implements HttpSessionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SessionDestructionListener.class);
|
||||
|
||||
@Override
|
||||
public void sessionCreated(HttpSessionEvent se) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 세션 타임아웃 등으로 소멸 시 세션정보 삭제
|
||||
*/
|
||||
@Override
|
||||
public void sessionDestroyed(HttpSessionEvent se) {
|
||||
|
||||
try {
|
||||
HttpSession session = se.getSession();
|
||||
|
||||
String userId = (String) session.getAttribute("userId");
|
||||
|
||||
// 로그인 한 사용자의 세션정보 정리
|
||||
if (userId != null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[SessionListener] 세션만료 감지. 사용자 제거: " + userId);
|
||||
}
|
||||
|
||||
SessionManager.removeUserSession(userId);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
|
||||
logger.error("[SessionListener] 세션 정리 중 오류 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.rms.common.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 서버 시작 시 등록된 HTTP 엔드포인트 목록을 로그로 출력
|
||||
*/
|
||||
@Component
|
||||
public class EndpointLogger implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EndpointLogger.class);
|
||||
|
||||
private boolean logged = false;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
// 중복 출력 방지 (parent/child context)
|
||||
if (logged) {
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationContext ctx = event.getApplicationContext();
|
||||
|
||||
try {
|
||||
RequestMappingHandlerMapping mapping = ctx.getBean(RequestMappingHandlerMapping.class);
|
||||
Map<RequestMappingInfo, HandlerMethod> methods = mapping.getHandlerMethods();
|
||||
|
||||
log.debug("========== Registered HTTP Endpoints ({}) ==========", methods.size());
|
||||
|
||||
methods.entrySet().stream()
|
||||
.sorted((e1, e2) -> e1.getKey().toString().compareTo(e2.getKey().toString()))
|
||||
.forEach(entry -> {
|
||||
RequestMappingInfo info = entry.getKey();
|
||||
HandlerMethod method = entry.getValue();
|
||||
log.debug("{} -> {}.{}",
|
||||
info.getPatternsCondition(),
|
||||
method.getBeanType().getSimpleName(),
|
||||
method.getMethod().getName());
|
||||
});
|
||||
|
||||
log.debug("========== End of Endpoints ==========");
|
||||
logged = true;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log endpoints: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class MenuService extends AbstractEMSDataSerivce<Menu, String, MenuReposi
|
||||
.where( qUserRole.id.userId.eq(userId),
|
||||
qMenu.menuUrl.like(url.concat("%")), qRole.useYn.eq("Y"),
|
||||
qRoleMenuAuth.auth.in("R", "W"),
|
||||
qRoleMenuAuth.id.serviceType.eq(serviceType)
|
||||
serviceType != null ? qRoleMenuAuth.id.serviceType.eq(serviceType) : qRoleMenuAuth.id.serviceType.isNull()
|
||||
)
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetchOne();
|
||||
|
||||
+11
-5
@@ -2,6 +2,7 @@ package com.eactive.eai.rms.data.entity.man.monitoringProperty.service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -14,13 +15,14 @@ import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@Slf4j
|
||||
public class MonitoringPropertyService
|
||||
extends AbstractDataService<MonitoringProperty, MonitoringPropertyId, MonitoringPropertyRepository> {
|
||||
|
||||
public String findPrpty2ValById(String prptyGroupName, String key) {
|
||||
MonitoringPropertyId id = new MonitoringPropertyId();
|
||||
id.setPrptyGroupName(prptyGroupName);
|
||||
id.setPrptyGroupName(key);
|
||||
id.setPrptyName(key);
|
||||
|
||||
Optional<MonitoringProperty> property = repository.findById(id);
|
||||
return property.map(MonitoringProperty::getPrpty2Val).orElse(null);
|
||||
@@ -41,12 +43,16 @@ public class MonitoringPropertyService
|
||||
id.setPrptyName(prptyName);
|
||||
|
||||
Optional<MonitoringProperty> property = repository.findById(id);
|
||||
if (property.isPresent() && !property.get().getPrpty2Val().isEmpty()) {
|
||||
return property.get().getPrpty2Val();
|
||||
} else {
|
||||
return defaultValue;
|
||||
if (property.isPresent()) {
|
||||
String value = property.get().getPrpty2Val();
|
||||
if (value != null && !value.isEmpty()) {
|
||||
log.debug("getPropertyValue - {} : {}", prptyName, value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("getPropertyValue - {} : {} (defaultValue)", prptyName, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public Iterable<MonitoringProperty> findAllByIdPrptyName(String prptyName) {
|
||||
|
||||
+13
-3
@@ -8,6 +8,7 @@ import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -58,11 +59,20 @@ public class ApiGroupService extends AbstractDataService<ApiGroup, String, ApiGr
|
||||
QApiGroup qApiGroup = QApiGroup.apiGroup;
|
||||
QApiGroupApi qApiGroupApi = QApiGroupApi.apiGroupApi;
|
||||
|
||||
return getJPAQueryFactory().selectFrom(qApiGroup)
|
||||
.leftJoin(qApiGroup.apiGroupApiList, qApiGroupApi)
|
||||
// Oracle에서 CLOB 필드(contentDetail 등)가 있으면 DISTINCT를 사용할 수 없으므로
|
||||
// api_group_api 테이블에서 api_group_id만 조회한 후 엔티티를 조회
|
||||
List<String> apiGroupIds = getJPAQueryFactory()
|
||||
.select(qApiGroupApi.id.apiGroupId)
|
||||
.from(qApiGroupApi)
|
||||
.where(qApiGroupApi.id.apiId.eq(apiId))
|
||||
.distinct()
|
||||
.fetch();
|
||||
|
||||
if (apiGroupIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return getJPAQueryFactory().selectFrom(qApiGroup)
|
||||
.where(qApiGroup.id.in(apiGroupIds))
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.apprequest.entity.AppRequest;
|
||||
import com.eactive.apim.portal.apprequest.entity.QAppRequest;
|
||||
import com.eactive.eai.data.entity.onl.message.EAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.unifbwk.QUnifBwkTp;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ObpGwMetric JPA DAO - JPA/QueryDSL을 사용한 로그 테이블 집계
|
||||
*
|
||||
* <p>Multi-tenancy 지원: 호출 전 DataSourceContextHolder 설정 필요</p>
|
||||
*/
|
||||
@Repository
|
||||
public class ObpGwMetricJpaDAO {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ObpGwMetricJpaDAO.class);
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
private JPAQueryFactory getQueryFactory() {
|
||||
return new JPAQueryFactory(entityManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* EAIBZWKDSTCD 코드 목록 조회 (TSEAICM01)
|
||||
*
|
||||
* @return 업무구분코드 목록
|
||||
*/
|
||||
public List<String> selectAllBzwkCodes() {
|
||||
QUnifBwkTp cm01 = QUnifBwkTp.unifBwkTp;
|
||||
|
||||
return getQueryFactory()
|
||||
.select(cm01.eaibzwkdstcd)
|
||||
.from(cm01)
|
||||
.orderBy(cm01.eaibzwkdstcd.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* EAIBZWKDSTCD별 시간대 로그 집계 (Native Query)
|
||||
*
|
||||
* <p>동적 테이블명(TSEAILG1X)을 사용하므로 Native Query 필요</p>
|
||||
*
|
||||
* @param tableName 동적 테이블명 (예: TSEAILG14)
|
||||
* @param bzwkCode 업무구분코드
|
||||
* @param startTime 시작시간 (yyyyMMddHHmmssSSS)
|
||||
* @param endTime 종료시간 (yyyyMMddHHmmssSSS)
|
||||
* @param timeslice 타임슬라이스 (yyyyMMddHH0000000)
|
||||
* @return 집계 결과 목록
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ObpGwMetricVO> selectHourlyMetricsByBzwkCode(
|
||||
String tableName, String bzwkCode, String startTime, String endTime, String timeslice) {
|
||||
|
||||
String sql = "SELECT " +
|
||||
"EAISVCNAME AS API_ID, " +
|
||||
"CLIENTID AS CLIENT_ID, " +
|
||||
"EAISEVRINSTNCNAME AS HOSTNAME, " +
|
||||
"ORGID AS ORG_ID, " +
|
||||
":timeslice AS TIMESLICE, " +
|
||||
"SUM(CASE WHEN LOGPRCSSSERNO = '100' THEN 1 ELSE 0 END) AS ATTEMPTED_COUNT, " +
|
||||
"SUM(CASE WHEN LOGPRCSSSERNO = '400' " +
|
||||
" AND (RSPNSERRCDNAME IS NULL OR RSPNSERRCDNAME LIKE 'ESB%') " +
|
||||
" THEN 1 ELSE 0 END) AS COMPLETED_COUNT, " +
|
||||
"MAX(TRIM(EAISVCSERNO)) AS EAI_SVC_SERNO " +
|
||||
"FROM " + tableName + " " +
|
||||
"WHERE EAIBZWKDSTCD = :bzwkCode " +
|
||||
" AND MSGDPSTYMS BETWEEN :startTime AND :endTime " +
|
||||
"GROUP BY EAISVCNAME, CLIENTID, EAISEVRINSTNCNAME, ORGID " +
|
||||
"HAVING SUM(CASE WHEN LOGPRCSSSERNO = '100' THEN 1 ELSE 0 END) > 0 " +
|
||||
" OR SUM(CASE WHEN LOGPRCSSSERNO = '400' THEN 1 ELSE 0 END) > 0";
|
||||
|
||||
Query query = entityManager.createNativeQuery(sql);
|
||||
query.setParameter("timeslice", timeslice);
|
||||
query.setParameter("bzwkCode", bzwkCode);
|
||||
query.setParameter("startTime", startTime);
|
||||
query.setParameter("endTime", endTime);
|
||||
|
||||
List<Object[]> results = query.getResultList();
|
||||
|
||||
return results.stream()
|
||||
.map(this::mapToObpGwMetricVO)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Native Query 결과를 ObpGwMetricVO로 변환
|
||||
*/
|
||||
private ObpGwMetricVO mapToObpGwMetricVO(Object[] row) {
|
||||
ObpGwMetricVO vo = new ObpGwMetricVO();
|
||||
vo.setApiId((String) row[0]);
|
||||
vo.setClientId((String) row[1]);
|
||||
vo.setHostname((String) row[2]);
|
||||
vo.setOrgId((String) row[3]);
|
||||
vo.setTimeslice((String) row[4]);
|
||||
vo.setAttemptedCount(toLong(row[5]));
|
||||
vo.setCompletedCount(toLong(row[6]));
|
||||
vo.setEaiSvcSerno((String) row[7]);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number 타입을 Long으로 변환 (Oracle은 BigDecimal 반환)
|
||||
*/
|
||||
private Long toLong(Object value) {
|
||||
if (value == null) return 0L;
|
||||
if (value instanceof BigDecimal) {
|
||||
return ((BigDecimal) value).longValue();
|
||||
}
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).longValue();
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* API 이름 조회 (TSEAIHE01)
|
||||
*
|
||||
* @param apiIds API ID 목록 (EAISVCNAME)
|
||||
* @return API ID → API 이름 맵
|
||||
*/
|
||||
public Map<String, String> selectApiNames(Set<String> apiIds) {
|
||||
if (apiIds == null || apiIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
QEAIMessageEntity he01 = QEAIMessageEntity.eAIMessageEntity;
|
||||
|
||||
List<Tuple> results = getQueryFactory()
|
||||
.select(he01.eaisvcname, he01.eaisvcdesc)
|
||||
.from(he01)
|
||||
.where(he01.eaisvcname.in(apiIds))
|
||||
.fetch();
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Tuple tuple : results) {
|
||||
String apiId = tuple.get(he01.eaisvcname);
|
||||
String apiName = tuple.get(he01.eaisvcdesc);
|
||||
if (apiId != null && apiName != null) {
|
||||
result.put(apiId, apiName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* URI 및 HTTP Method 조회 결과
|
||||
*/
|
||||
public static class UriMethodResult {
|
||||
private final Map<String, String> uriMap;
|
||||
private final Map<String, String> methodMap;
|
||||
|
||||
public UriMethodResult(Map<String, String> uriMap, Map<String, String> methodMap) {
|
||||
this.uriMap = uriMap;
|
||||
this.methodMap = methodMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getUriMap() {
|
||||
return uriMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getMethodMap() {
|
||||
return methodMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URI 및 HTTP Method 조회 (HTTP_ADAPTER_EXTRA_LOG)
|
||||
*
|
||||
* <p>SERVICE_PROCESS_NUMBER = 100 (인바운드 요청) 조건으로 조회</p>
|
||||
*
|
||||
* @param eaiSvcSernos EAI 서비스 일련번호 목록 (GUID)
|
||||
* @return UriMethodResult (eaiSvcSerno → URI 맵, eaiSvcSerno → METHOD 맵)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public UriMethodResult selectUrisAndMethods(Set<String> eaiSvcSernos) {
|
||||
if (eaiSvcSernos == null || eaiSvcSernos.isEmpty()) {
|
||||
return new UriMethodResult(new HashMap<>(), new HashMap<>());
|
||||
}
|
||||
|
||||
// IN절 파라미터 바인딩을 위한 처리
|
||||
String sql = "SELECT GUID AS EAI_SVC_SERNO, URL AS URI, HTTP_METHOD AS METHOD " +
|
||||
"FROM HTTP_ADAPTER_EXTRA_LOG " +
|
||||
"WHERE SERVICE_PROCESS_NUMBER = 100 " +
|
||||
" AND GUID IN (:eaiSvcSernos)";
|
||||
|
||||
Query query = entityManager.createNativeQuery(sql);
|
||||
query.setParameter("eaiSvcSernos", new ArrayList<>(eaiSvcSernos));
|
||||
|
||||
List<Object[]> results = query.getResultList();
|
||||
|
||||
Map<String, String> uriMap = new HashMap<>();
|
||||
Map<String, String> methodMap = new HashMap<>();
|
||||
|
||||
for (Object[] row : results) {
|
||||
String eaiSvcSerno = (String) row[0];
|
||||
String uri = (String) row[1];
|
||||
String method = (String) row[2];
|
||||
if (eaiSvcSerno != null) {
|
||||
if (uri != null) {
|
||||
uriMap.put(eaiSvcSerno, uri);
|
||||
}
|
||||
if (method != null) {
|
||||
methodMap.put(eaiSvcSerno, method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new UriMethodResult(uriMap, methodMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* AppId 조회 (PTL_APP_REQUEST) - org_id로 조회
|
||||
*
|
||||
* @param orgIds 기관 ID 목록
|
||||
* @return 기관 ID → 앱 ID 맵
|
||||
*/
|
||||
public Map<String, String> selectAppIdsByOrgIds(Set<String> orgIds) {
|
||||
if (orgIds == null || orgIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
QAppRequest appRequest = QAppRequest.appRequest;
|
||||
|
||||
List<Tuple> results = getQueryFactory()
|
||||
.select(appRequest.org.id, appRequest.id)
|
||||
.from(appRequest)
|
||||
.where(appRequest.org.id.in(orgIds))
|
||||
.fetch();
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Tuple tuple : results) {
|
||||
String orgId = tuple.get(appRequest.org.id);
|
||||
String appId = tuple.get(appRequest.id);
|
||||
if (orgId != null && appId != null) {
|
||||
result.put(orgId, appId);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.eactive.apim.portal.obp.repository.ObpGwMetricRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* ObpGwMetric Service - 엔티티 CRUD 서비스
|
||||
*/
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class ObpGwMetricService {
|
||||
|
||||
private final ObpGwMetricRepository repository;
|
||||
|
||||
public ObpGwMetricService(ObpGwMetricRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* UPSERT 판단을 위한 기존 데이터 조회 (NULL 안전)
|
||||
*/
|
||||
public Optional<ObpGwMetric> findByUniqueKey(LocalDateTime timeslice, String apiId, String clientId, String hostname, String orgId) {
|
||||
return repository.findByUniqueKeyNullSafe(timeslice, apiId, clientId, hostname, orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대의 모든 GwMetric 데이터 조회
|
||||
*/
|
||||
public List<ObpGwMetric> findByTimeslice(LocalDateTime timeslice) {
|
||||
return repository.findByTimeslice(timeslice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간 범위의 GwMetric 데이터 조회
|
||||
*/
|
||||
public List<ObpGwMetric> findByTimesliceBetween(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
return repository.findByTimesliceBetween(startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대 이후의 모든 GwMetric 데이터 조회
|
||||
*/
|
||||
public List<ObpGwMetric> findByTimesliceGreaterThanEqual(LocalDateTime timeslice) {
|
||||
return repository.findByTimesliceGreaterThanEqual(timeslice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엔티티 저장 (INSERT 또는 UPDATE)
|
||||
*/
|
||||
public ObpGwMetric save(ObpGwMetric entity) {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엔티티 목록 저장
|
||||
*/
|
||||
public List<ObpGwMetric> saveAll(List<ObpGwMetric> entities) {
|
||||
return repository.saveAll(entities);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.obp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* ObpGwMetric VO - 로그 집계 결과 매핑용
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ObpGwMetricVO {
|
||||
|
||||
private static final DateTimeFormatter TIMESLICE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHH0000000");
|
||||
|
||||
/** API ID (EAISVCNAME) */
|
||||
private String apiId;
|
||||
|
||||
/** 클라이언트 ID (CLIENTID) */
|
||||
private String clientId;
|
||||
|
||||
/** 호스트 이름 (EAISEVRINSTNCNAME) */
|
||||
private String hostname;
|
||||
|
||||
/** 기관 ID (ORGID) */
|
||||
private String orgId;
|
||||
|
||||
/** 타임슬라이스 문자열 (yyyyMMddHH0000000) */
|
||||
private String timeslice;
|
||||
|
||||
/** 시도 횟수 (LOGPRCSSSERNO='100' 건수) */
|
||||
private Long attemptedCount;
|
||||
|
||||
/** 완료 횟수 (LOGPRCSSSERNO='400' AND 성공 조건 건수) */
|
||||
private Long completedCount;
|
||||
|
||||
/** EAI 서비스 일련번호 (URI 조회용 - HTTP_ADAPTER_EXTRA_LOG.GUID와 매핑) */
|
||||
private String eaiSvcSerno;
|
||||
|
||||
/**
|
||||
* timeslice 문자열을 LocalDateTime으로 변환
|
||||
*/
|
||||
public LocalDateTime getTimesliceAsLocalDateTime() {
|
||||
if (timeslice == null || timeslice.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// "yyyyMMddHH0000000" 형식에서 앞 10자리(yyyyMMddHH)만 사용
|
||||
String dateTimeStr = timeslice.substring(0, 10) + "0000";
|
||||
return LocalDateTime.parse(dateTimeStr, DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 집계 키 생성 (apiId + clientId + hostname + orgId)
|
||||
*/
|
||||
public String getAggregationKey() {
|
||||
return String.join("|",
|
||||
nullSafe(apiId),
|
||||
nullSafe(clientId),
|
||||
nullSafe(hostname),
|
||||
nullSafe(orgId)
|
||||
);
|
||||
}
|
||||
|
||||
private String nullSafe(String value) {
|
||||
return value != null ? value : "";
|
||||
}
|
||||
}
|
||||
+13
-3
@@ -1,21 +1,31 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.authserver;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.authserver.QScopeEntity;
|
||||
import com.eactive.eai.data.entity.onl.authserver.ScopeEntity;
|
||||
import com.eactive.eai.data.entity.onl.authserver.ScopeEntityId;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ScopeEntityService extends AbstractDataService<ScopeEntity, ScopeEntityId, ScopeEntityEMSRepository> {
|
||||
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager; // AbstractDataService 의 entityManager가 private이라 접근 불가하여 별도 주입
|
||||
|
||||
public void deleteByIdScopeId(String scopeId) {
|
||||
getJPAQueryFactory().delete(QScopeEntity.scopeEntity)
|
||||
.where(QScopeEntity.scopeEntity.id.scopeid.eq(scopeId))
|
||||
.execute();
|
||||
|
||||
// 동일 트랜잭션 내에서 같은 ID로 재저장 시 충돌(EntityExistsException)을 방지
|
||||
entityManager.flush();
|
||||
entityManager.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import lombok.Data;
|
||||
@AllArgsConstructor
|
||||
public class ApiScopeDto {
|
||||
|
||||
@JsonProperty("EAISVCNAME")
|
||||
private String eaiSvcName;
|
||||
|
||||
@JsonProperty("EAISVCDESC")
|
||||
private String eaiSvcDesc;
|
||||
|
||||
@@ -20,5 +23,8 @@ public class ApiScopeDto {
|
||||
|
||||
@JsonProperty("SCOPENAME")
|
||||
private String scopeName;
|
||||
|
||||
@JsonProperty("APIFULLPATH")
|
||||
private String apiFullPath;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
QServiceMessageEntity qServiceMessageEntity = QServiceMessageEntity.serviceMessageEntity;
|
||||
QRouting qRouting = QRouting.routing;
|
||||
QStandardMessageInfo qStdInfo = QStandardMessageInfo.standardMessageInfo;
|
||||
|
||||
JPAQuery<Tuple> jpaQuery = createBaseQuery(eaiMessageUISearch);
|
||||
|
||||
@@ -53,7 +54,14 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
OrderSpecifier<?> orderSpecifier = getOrderSpecifier(qeaiMessageEntity, sortname, sortorder);
|
||||
|
||||
List<Tuple> eaiMessages = jpaQuery
|
||||
.select(qeaiMessageEntity, qServiceMessageEntity.psvintfacdsticname, qServiceMessageEntity.psvsysadptrbzwkgroupname, qRouting.nonmotivrouturiname)
|
||||
.select(qeaiMessageEntity
|
||||
, qServiceMessageEntity.psvintfacdsticname
|
||||
, qServiceMessageEntity.psvsysadptrbzwkgroupname
|
||||
, qRouting.nonmotivrouturiname
|
||||
, qStdInfo.apifullpath
|
||||
, qStdInfo.bzwksvckeyname
|
||||
|
||||
)
|
||||
.limit(pageable.getPageSize())
|
||||
.offset(pageable.getOffset())
|
||||
.orderBy(orderSpecifier)
|
||||
@@ -96,16 +104,24 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
QServiceMessageEntity qServiceMessageEntity = QServiceMessageEntity.serviceMessageEntity;
|
||||
QRouting qRouting = QRouting.routing;
|
||||
QStandardMessageInfo qStdInfo = QStandardMessageInfo.standardMessageInfo;
|
||||
|
||||
BooleanBuilder predicate = createSelectListPredicate(eaiMessageUISearch);
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qeaiMessageEntity, qServiceMessageEntity.psvintfacdsticname, qRouting.nonmotivrouturiname)
|
||||
.select(qeaiMessageEntity
|
||||
, qServiceMessageEntity.psvintfacdsticname
|
||||
, qRouting.nonmotivrouturiname
|
||||
, qStdInfo.apifullpath
|
||||
, qStdInfo.bzwksvckeyname
|
||||
)
|
||||
.from(qeaiMessageEntity)
|
||||
.join(qRouting)
|
||||
.on(qeaiMessageEntity.flowctrlroutname.eq(qRouting.routname))
|
||||
.leftJoin(qeaiMessageEntity.serviceMessages, qServiceMessageEntity)
|
||||
.on(qServiceMessageEntity.id.svcprcssno.eq(1))
|
||||
.leftJoin(qStdInfo)
|
||||
.on(qeaiMessageEntity.eaisvcname.eq(qStdInfo.eaisvcname))
|
||||
.where(predicate);
|
||||
}
|
||||
|
||||
@@ -114,6 +130,7 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
QEAIMessageEntity qeaiMessageEntity = QEAIMessageEntity.eAIMessageEntity;
|
||||
QServiceMessageEntity qServiceMessageEntity = QServiceMessageEntity.serviceMessageEntity;
|
||||
QRouting qRouting = QRouting.routing;
|
||||
QStandardMessageInfo qStdInfo = QStandardMessageInfo.standardMessageInfo;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
@@ -167,6 +184,12 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
.and(qServiceMessageEntity.psvintfacdsticname
|
||||
.containsIgnoreCase(eaiMessageUISearch.getSearchPsvintfacdsticName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(eaiMessageUISearch.getSearchApiFullPath())) {
|
||||
predicate
|
||||
.and(qStdInfo.apifullpath.contains(eaiMessageUISearch.getSearchApiFullPath()));
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
@@ -270,10 +293,14 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
|
||||
List<ApiScopeDto> result = getJPAQueryFactory()
|
||||
.select(Projections.constructor(ApiScopeDto.class ,
|
||||
qEaiMessageEntity.eaisvcname ,
|
||||
qEaiMessageEntity.eaisvcdesc ,
|
||||
qScopeEntity.id.scopeid ,
|
||||
qScopeEntity.id.bzwksvckeyname ,
|
||||
qScopeInfo.scopeName ))
|
||||
qScopeInfo.scopeName ,
|
||||
qStandardMessageInfo.apifullpath
|
||||
)
|
||||
)
|
||||
.from(qEaiMessageEntity)
|
||||
.join(qStandardMessageInfo)
|
||||
.on(qEaiMessageEntity.eaisvcname.eq(qStandardMessageInfo.eaisvcname))
|
||||
@@ -283,8 +310,6 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
.on(qScopeEntity.id.scopeid.eq(qScopeInfo.scopeId))
|
||||
.where(predicate)
|
||||
.orderBy(qScopeEntity.id.bzwksvckeyname.asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(result, pageable, result.size());
|
||||
@@ -293,19 +318,20 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
private BooleanExpression booleanPredicate(QEAIMessageEntity qEaiMessageEntity, QScopeEntity qScopeEntity,
|
||||
QScopeInfo qScopeInfo, ApiScopeSearch apiScopeSearch) {
|
||||
|
||||
BooleanExpression predicate = qEaiMessageEntity.eaisvcdesc.containsIgnoreCase(apiScopeSearch.getSearchEaiSvcDesc());
|
||||
BooleanExpression predicate = qScopeEntity.id.scopeid.equalsIgnoreCase(apiScopeSearch.getSearchScopeId());
|
||||
// BooleanExpression predicate = qEaiMessageEntity.eaisvcdesc.containsIgnoreCase(apiScopeSearch.getSearchEaiSvcDesc());
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchBzwkSvcKeyName())) {
|
||||
predicate = predicate.and(qScopeEntity.id.bzwksvckeyname.containsIgnoreCase(apiScopeSearch.getSearchBzwkSvcKeyName()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeId())) {
|
||||
predicate = predicate.and(qScopeEntity.id.scopeid.containsIgnoreCase(apiScopeSearch.getSearchScopeId()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeName())) {
|
||||
predicate = predicate.and(qScopeInfo.scopeName.containsIgnoreCase(apiScopeSearch.getSearchScopeName()));
|
||||
}
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchBzwkSvcKeyName())) {
|
||||
// predicate = predicate.and(qScopeEntity.id.bzwksvckeyname.containsIgnoreCase(apiScopeSearch.getSearchBzwkSvcKeyName()));
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeId())) {
|
||||
// predicate = predicate.and(qScopeEntity.id.scopeid.containsIgnoreCase(apiScopeSearch.getSearchScopeId()));
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeName())) {
|
||||
// predicate = predicate.and(qScopeInfo.scopeName.containsIgnoreCase(apiScopeSearch.getSearchScopeName()));
|
||||
// }
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,6 @@ public class EAIMessageUISearch {
|
||||
private String tranChangeSim;
|
||||
private String searchRefKey;
|
||||
|
||||
private String searchApiFullPath;
|
||||
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.inflow;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface InflowControlGroupMappingRepository extends BaseRepository<InflowControlGroupMapping, String> {
|
||||
|
||||
List<InflowControlGroupMapping> findByGroupId(String groupId);
|
||||
|
||||
@Modifying
|
||||
@Query("DELETE FROM InflowControlGroupMapping m WHERE m.groupId = :groupId")
|
||||
void deleteByGroupId(@Param("groupId") String groupId);
|
||||
|
||||
/**
|
||||
* 인터페이스 ID로 매핑 조회 (중복 체크용)
|
||||
*/
|
||||
Optional<InflowControlGroupMapping> findByInterfaceId(String interfaceId);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.inflow;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroup;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface InflowControlGroupRepository extends BaseRepository<InflowControlGroup, String> {
|
||||
|
||||
}
|
||||
@@ -1,19 +1,33 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.inflow;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlLog;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlLogId;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlLog;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManMapper;
|
||||
import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUI;
|
||||
import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUISearch;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
|
||||
@Service
|
||||
public class InflowControlLogService
|
||||
extends AbstractDataService<InflowControlLog, InflowControlLogId, InflowControlLogRepository> {
|
||||
|
||||
private final InflowControlService inflowControlService;
|
||||
private final InflowControlHistoryManMapper inflowControlHistoryManMapper;
|
||||
|
||||
@Autowired
|
||||
public InflowControlLogService(InflowControlService inflowControlService, InflowControlHistoryManMapper inflowControlHistoryManMapper) {
|
||||
this.inflowControlService = inflowControlService;
|
||||
this.inflowControlHistoryManMapper = inflowControlHistoryManMapper;
|
||||
}
|
||||
|
||||
public Page<InflowControlLog> findAll(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog;
|
||||
@@ -25,6 +39,28 @@ public class InflowControlLogService
|
||||
return super.repository.findAll(booleanBuilder, pageable);
|
||||
}
|
||||
|
||||
public Page<InflowControlHistoryManUI> selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
|
||||
Page<Tuple> tuples = inflowControlService.selectLogList(pageable, uiSearch);
|
||||
|
||||
return tuples.map(tuple -> {
|
||||
InflowControlLog inflowControlLog = tuple.get(QInflowControlLog.inflowControlLog);
|
||||
|
||||
String groupName = tuple.get(QInflowControlGroup.inflowControlGroup.groupName);
|
||||
|
||||
InflowControlHistoryManUI inflowControlHistoryManUI;
|
||||
|
||||
inflowControlHistoryManUI = inflowControlHistoryManMapper.toVo(inflowControlLog);
|
||||
|
||||
inflowControlHistoryManUI.setGroupname(groupName);
|
||||
|
||||
return inflowControlHistoryManUI;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Iterable<InflowControlLog> findAll(InflowControlHistoryManUISearch uiSearch) {
|
||||
QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog;
|
||||
BooleanBuilder booleanBuilder = new BooleanBuilder();
|
||||
|
||||
@@ -17,11 +17,16 @@ import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControl;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlId;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControl;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlLog;
|
||||
import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUISearch;
|
||||
import com.eactive.eai.rms.onl.manage.inflow.inflow.InflowControlManMapper;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
|
||||
@Service
|
||||
@@ -168,5 +173,45 @@ public class InflowControlService extends AbstractDataService<InflowControl, Inf
|
||||
|
||||
return toDto(qEAIMessageEntity, qInflowControl, tuple);
|
||||
}
|
||||
|
||||
public Page<Tuple> selectLogList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
QInflowControlLog qlog = QInflowControlLog.inflowControlLog;
|
||||
QInflowControlGroup qgroup = QInflowControlGroup.inflowControlGroup;
|
||||
|
||||
JPAQuery<Tuple> jpaQuery = createBaseQuery(uiSearch);
|
||||
|
||||
long totalCount = jpaQuery.select(QInflowControlLog.inflowControlLog.count()).fetchOne();
|
||||
|
||||
List<Tuple> inflowControlLog = jpaQuery
|
||||
.select(qlog, qgroup.groupName)
|
||||
.limit(pageable.getPageSize())
|
||||
.offset(pageable.getOffset())
|
||||
.orderBy(qlog.id.msgdpstyms.desc())
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(inflowControlLog, pageable, totalCount);
|
||||
}
|
||||
|
||||
private JPAQuery<Tuple> createBaseQuery(InflowControlHistoryManUISearch uiSearch) {
|
||||
QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog;
|
||||
QInflowControlGroup qinflowControlGroup = QInflowControlGroup.inflowControlGroup;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
predicate
|
||||
.and(qInflowConfrolLog.id.msgdpstyms
|
||||
.between(uiSearch.getSearchStartDate() + "000000000",
|
||||
uiSearch.getSearchEndDate() + "235959999"));
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(
|
||||
qInflowConfrolLog,
|
||||
qinflowControlGroup.groupName
|
||||
)
|
||||
.from(qInflowConfrolLog)
|
||||
.leftJoin(qinflowControlGroup)
|
||||
.on(qInflowConfrolLog.adptrbzwkgroupname.eq(qinflowControlGroup.groupId))
|
||||
.where(predicate);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiLogDTO {
|
||||
|
||||
private String apiServiceNumber;
|
||||
|
||||
private String txDate;
|
||||
|
||||
private List<ApiMessageLogDTO> logs;
|
||||
|
||||
private Long totalProcessingTime;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiMessageLogDTO {
|
||||
|
||||
private String apiServiceNumber;
|
||||
|
||||
private int processNumber;
|
||||
|
||||
private String txDate;
|
||||
|
||||
private String url;
|
||||
|
||||
private String queryString;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String method;
|
||||
|
||||
private Integer HttpStatus;
|
||||
|
||||
private String header;
|
||||
|
||||
private String body;
|
||||
|
||||
private String exdata;
|
||||
|
||||
private Long processingTime;
|
||||
|
||||
private String keymgtmsgctnt;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import org.springframework.data.domain.Pageable;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILog;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILogId;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface EAILogRepository {
|
||||
@@ -16,4 +17,6 @@ public interface EAILogRepository {
|
||||
|
||||
Map<String, Long> countDetailedTransactions(Class<? extends EAILog> clazz, EAILogSearch eaiLogSearch);
|
||||
|
||||
List<EAILog> getApiLog(Class<? extends EAILog> class1, String apiServiceNumber);
|
||||
|
||||
}
|
||||
|
||||
+24
-12
@@ -1,5 +1,19 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILog;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILogId;
|
||||
import com.eactive.eai.data.entity.onl.logger.QEAILog;
|
||||
@@ -11,18 +25,6 @@ import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.EntityPathBase;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Repository
|
||||
public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
@@ -217,4 +219,14 @@ public class EAILogRepositoryImpl implements EAILogRepository {
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EAILog> getApiLog(Class<? extends EAILog> clazz, String apiServiceNumber) {
|
||||
QEAILog qeaiLog = QEAILog.eAILog;
|
||||
EntityPathBase<?> entityPathBase = new EntityPathBase<>(clazz, qeaiLog.getMetadata().getName());
|
||||
|
||||
return new JPAQueryFactory(em).select(qeaiLog).from(entityPathBase)
|
||||
.where(qeaiLog.id.eaisvcserno.trim().eq(apiServiceNumber)).orderBy(qeaiLog.id.logprcssserno.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface EAILogService {
|
||||
List<PortalStatisticsVO> selectLogList(HashMap<String, Object> paramMap);
|
||||
|
||||
Map<String, Long> getTransactionCounts(EAILogSearch eaiLogSearch);
|
||||
|
||||
ApiLogDTO getApiLog(String txDate, String apiServiceNumber);
|
||||
}
|
||||
|
||||
@@ -1,55 +1,132 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.logger;
|
||||
|
||||
import com.eactive.eai.data.RollingTable;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILog;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILogId;
|
||||
import com.eactive.eai.rms.common.util.CommonUtil;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.portalstatistics.PortalStatisticsVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.eactive.eai.data.RollingTable;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILog;
|
||||
import com.eactive.eai.data.entity.onl.logger.EAILogId;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraLog;
|
||||
import com.eactive.eai.rms.common.util.CommonUtil;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.portalstatistics.PortalStatisticsVO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
@RequiredArgsConstructor
|
||||
public class EAILogServiceImpl implements EAILogService {
|
||||
|
||||
private final EAILogRepository eaiLogRepository;
|
||||
private final ApplicationContext applicationContext;
|
||||
private final EAILogDAOForEMS eaiLogDAOForEMS;
|
||||
private final EAILogRepository eaiLogRepository;
|
||||
private final ApplicationContext applicationContext;
|
||||
private final EAILogDAOForEMS eaiLogDAOForEMS;
|
||||
private final HttpAdapterExtraLogService httpAdapterExtraLogService;
|
||||
|
||||
@Override
|
||||
public Page<EAILogDto> findAll(Pageable pageable, EAILogSearch eaiLogSearch) {
|
||||
long time = CommonUtil.getCalendar(eaiLogSearch.getSearchStartTime()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
Page<EAILogDto> eaiLogDtos = eaiLogRepository.findAll(eaiLog.getClass(), pageable, eaiLogSearch);
|
||||
return eaiLogDtos;
|
||||
}
|
||||
@Override
|
||||
public Page<EAILogDto> findAll(Pageable pageable, EAILogSearch eaiLogSearch) {
|
||||
long time = CommonUtil.getCalendar(eaiLogSearch.getSearchStartTime()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
Page<EAILogDto> eaiLogDtos = eaiLogRepository.findAll(eaiLog.getClass(), pageable, eaiLogSearch);
|
||||
return eaiLogDtos;
|
||||
}
|
||||
|
||||
public Map<String, Long> getTransactionCounts(EAILogSearch eaiLogSearch){
|
||||
long time = CommonUtil.getCalendar(eaiLogSearch.getSearchStartTime()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
Map<String, Long> detailedCounts = eaiLogRepository.countDetailedTransactions(eaiLog.getClass(), eaiLogSearch);
|
||||
return detailedCounts;
|
||||
}
|
||||
public Map<String, Long> getTransactionCounts(EAILogSearch eaiLogSearch) {
|
||||
long time = CommonUtil.getCalendar(eaiLogSearch.getSearchStartTime()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
Map<String, Long> detailedCounts = eaiLogRepository.countDetailedTransactions(eaiLog.getClass(), eaiLogSearch);
|
||||
return detailedCounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAILogDto getById(EAILogId eaiLogId) {
|
||||
long time = CommonUtil.getCalendar(eaiLogId.getMsgdpstyms()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
return eaiLogRepository.getById(eaiLog.getClass(), eaiLogId);
|
||||
}
|
||||
@Override
|
||||
public EAILogDto getById(EAILogId eaiLogId) {
|
||||
long time = CommonUtil.getCalendar(eaiLogId.getMsgdpstyms()).getTimeInMillis();
|
||||
EAILog eaiLog = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
return eaiLogRepository.getById(eaiLog.getClass(), eaiLogId);
|
||||
}
|
||||
|
||||
public List<PortalStatisticsVO> selectLogList(HashMap<String, Object> paramMap) {
|
||||
return eaiLogDAOForEMS.selectLogList(paramMap);
|
||||
}
|
||||
|
||||
public List<PortalStatisticsVO> selectLogList(HashMap<String, Object> paramMap) {
|
||||
return eaiLogDAOForEMS.selectLogList(paramMap);
|
||||
}
|
||||
@Override
|
||||
public ApiLogDTO getApiLog(String txDate, String apiServiceNumber) {
|
||||
|
||||
long time = CommonUtil.getCalendar(txDate).getTimeInMillis();
|
||||
EAILog eaiLogTargetObject = (EAILog) applicationContext.getBean(RollingTable.class, EAILog.class, time);
|
||||
List<EAILog> eaiLogs = eaiLogRepository.getApiLog(eaiLogTargetObject.getClass(), apiServiceNumber);
|
||||
eaiLogs.sort((l1, l2) -> l1.getId().getEaisvcserno().compareTo(l2.getId().getEaisvcserno()));
|
||||
|
||||
ApiLogDTO apiLogDTO = new ApiLogDTO();
|
||||
apiLogDTO.setApiServiceNumber(apiServiceNumber);
|
||||
eaiLogs.stream().findFirst().ifPresent(log -> apiLogDTO.setTxDate(log.getId().getMsgdpstyms()));
|
||||
|
||||
List<ApiMessageLogDTO> apiMessageLogDTOs = new LinkedList<>();
|
||||
|
||||
for (EAILog eaiLog : eaiLogs) {
|
||||
ApiMessageLogDTO apiMessageLogDTO = new ApiMessageLogDTO();
|
||||
|
||||
apiMessageLogDTO.setApiServiceNumber(apiServiceNumber);
|
||||
apiMessageLogDTO.setTxDate(eaiLog.getMsgprcssyms());
|
||||
apiMessageLogDTO.setProcessNumber(Integer.parseInt(eaiLog.getId().getLogprcssserno()));
|
||||
apiMessageLogDTO.setQueryString("");
|
||||
apiMessageLogDTO.setClientId(eaiLog.getClientid());
|
||||
apiMessageLogDTO.setKeymgtmsgctnt(eaiLog.getKeymgtmsgctnt());
|
||||
|
||||
String body = StringUtils.substringAfter(eaiLog.getBzwkdatactnt(), '|');
|
||||
body = StringUtils.substringBeforeLast(body, "|");
|
||||
|
||||
apiMessageLogDTO.setBody(body);
|
||||
apiMessageLogDTOs.add(apiMessageLogDTO);
|
||||
}
|
||||
|
||||
Map<Integer, HttpAdapterExtraLog> extraLogs = httpAdapterExtraLogService.findByGuid(apiServiceNumber);
|
||||
for (ApiMessageLogDTO apiMessageLogDTO : apiMessageLogDTOs) {
|
||||
HttpAdapterExtraLog httpAdapterExtraLog = extraLogs.get(apiMessageLogDTO.getProcessNumber());
|
||||
|
||||
if (httpAdapterExtraLog != null) {
|
||||
apiMessageLogDTO.setHeader(httpAdapterExtraLog.getHeaderContent());
|
||||
apiMessageLogDTO.setMethod(httpAdapterExtraLog.getHttpMethod());
|
||||
apiMessageLogDTO.setHttpStatus(httpAdapterExtraLog.getHttpStatus());
|
||||
apiMessageLogDTO.setUrl(httpAdapterExtraLog.getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
// 처리 시간 계산
|
||||
for (int i = 0; i < apiMessageLogDTOs.size(); i++) {
|
||||
ApiMessageLogDTO dto = apiMessageLogDTOs.get(i);
|
||||
EAILog eaiLog = eaiLogs.get(i);
|
||||
|
||||
// msgprcssyms - msgdpstyms
|
||||
long receivedTime = CommonUtil.getCalendar(eaiLog.getId().getMsgdpstyms()).getTimeInMillis();
|
||||
long processedTime = CommonUtil.getCalendar(eaiLog.getMsgprcssyms()).getTimeInMillis();
|
||||
long processingTime = processedTime - receivedTime;
|
||||
dto.setProcessingTime(processingTime);
|
||||
}
|
||||
|
||||
// 전체 처리 시간 계산 (첫 수신 시각 ~ 마지막 처리 시각)
|
||||
if (!eaiLogs.isEmpty()) {
|
||||
long firstReceivedTime = CommonUtil.getCalendar(eaiLogs.get(0).getId().getMsgdpstyms()).getTimeInMillis();
|
||||
long lastProcessedTime = CommonUtil.getCalendar(eaiLogs.get(eaiLogs.size() - 1).getMsgprcssyms()).getTimeInMillis();
|
||||
long totalProcessingTime = lastProcessedTime - firstReceivedTime;
|
||||
apiLogDTO.setTotalProcessingTime(totalProcessingTime);
|
||||
}
|
||||
|
||||
apiLogDTO.setLogs(apiMessageLogDTOs);
|
||||
return apiLogDTO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
@@ -1,16 +1,28 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.logger;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraLog;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraLogId;
|
||||
import com.eactive.eai.data.entity.onl.logger.QHttpAdapterExtraLog;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class HttpAdapterExtraLogService
|
||||
extends AbstractDataService<HttpAdapterExtraLog, HttpAdapterExtraLogId, HttpAdapterExtraLogRepository> {
|
||||
|
||||
public Map<Integer, HttpAdapterExtraLog> findByGuid(String guid) {
|
||||
BooleanExpression predicate = QHttpAdapterExtraLog.httpAdapterExtraLog.id.guid.eq(guid);
|
||||
return StreamSupport.stream(repository.findAll(predicate).spliterator(), false)
|
||||
.collect(Collectors.toMap(log -> log.getId().getServiceProcessNumber(), log -> log));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class TempController implements InterceptorSkipController {
|
||||
result = "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
// System.out.println(e);
|
||||
result = e.getMessage();
|
||||
}
|
||||
|
||||
|
||||
@@ -191,13 +191,13 @@ public class AdapterInfosManager {
|
||||
|
||||
public String toString() {
|
||||
|
||||
System.out.println("---------------- Display START -------------------");
|
||||
// System.out.println("---------------- Display START -------------------");
|
||||
Collection<AdapterInfosVO> coll = AdapterInfosManager.adaptersMap.values();
|
||||
Iterator<AdapterInfosVO> iter = coll.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
AdapterInfosVO tempVO = iter.next();
|
||||
System.out.println(tempVO.toString());
|
||||
// System.out.println(tempVO.toString());
|
||||
}
|
||||
|
||||
return new String("---------------- Display END -------------------" );
|
||||
@@ -254,7 +254,7 @@ public class AdapterInfosManager {
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB5.PRPTYGROUPNAME "
|
||||
+ "\n ORDER BY 1, 3, 4 "
|
||||
+ "\n WITH UR";
|
||||
System.out.println(SqlString);
|
||||
// System.out.println(SqlString);
|
||||
return SqlString;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,4 +7,5 @@ public class ApiGroupUISearch {
|
||||
private String searchGroupName;
|
||||
private String searchGroupDesc;
|
||||
private String searchDisplayYn;
|
||||
private String searchApiFullPath;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class PortalApprovalManService extends BaseService {
|
||||
|
||||
public Page<PortalApprovalUI> selectList(Pageable pageable, PortalApprovalUISearch portalApprovalUISearch) {
|
||||
Page<Approval> approval = approvalService.findAll(pageable, portalApprovalUISearch);
|
||||
return approval.map(entity -> getDetailWithMaskOption(entity.getId(), true));
|
||||
return approval.map(entity -> getDetailWithMaskOption(entity.getId(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 마스킹된 상세 정보 조회
|
||||
*/
|
||||
public PortalApprovalUI selectDetail(String id) {
|
||||
return getDetailWithMaskOption(id, true);
|
||||
return getDetailWithMaskOption(id, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public abstract class CredentialUIMapper implements GenericMapper<CredentialUI,
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
@Mapping(target = "apiList", expression = "java(apiSpecUIMapper.mapList(credentialUI.getApiList()))")
|
||||
@Mapping(target = "apiList", source = "apiList")
|
||||
public abstract void updateToEntity(CredentialUI credentialUI, @MappingTarget Credential credential);
|
||||
|
||||
@Mapping(source = "clientid", target = "clientId")
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.eactive.eai.rms.onl.apim.common;
|
||||
|
||||
import com.eactive.eai.rms.common.interceptor.InterceptorSkipController;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* REST API Controller 기본 클래스
|
||||
*
|
||||
* <p>기능:</p>
|
||||
* <ul>
|
||||
* <li>세션 체크 우회 (InterceptorSkipController)</li>
|
||||
* <li>JSON 변환 유틸리티 (pretty print 지원)</li>
|
||||
* <li>응답 크기 포맷팅</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>사용 예:</p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* @Controller
|
||||
* public class MyApiController extends BaseRestController {
|
||||
* @RequestMapping(value = "/api/something.json", produces = JSON_CONTENT_TYPE)
|
||||
* @ResponseBody
|
||||
* public String getSomething(@RequestParam(value = "pretty", required = false) Boolean pretty) {
|
||||
* List<MyDTO> data = service.getData();
|
||||
* return toJson(data, pretty);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public abstract class BaseRestController implements InterceptorSkipController {
|
||||
|
||||
/**
|
||||
* JSON 응답 Content-Type
|
||||
*/
|
||||
protected static final String JSON_CONTENT_TYPE = "application/json;charset=utf-8";
|
||||
|
||||
/**
|
||||
* 객체를 JSON 문자열로 변환
|
||||
*
|
||||
* @param object 변환할 객체
|
||||
* @param pretty true면 들여쓰기 적용 (null이면 false로 처리)
|
||||
* @return JSON 문자열
|
||||
*/
|
||||
protected String toJson(Object object, Boolean pretty) {
|
||||
GsonBuilder builder = new GsonBuilder().serializeNulls();
|
||||
if (Boolean.TRUE.equals(pretty)) {
|
||||
builder.setPrettyPrinting();
|
||||
}
|
||||
return builder.create().toJson(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체를 JSON 문자열로 변환 (기본: 한 줄 출력)
|
||||
*
|
||||
* @param object 변환할 객체
|
||||
* @return JSON 문자열
|
||||
*/
|
||||
protected String toJson(Object object) {
|
||||
return toJson(object, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 바이트 크기를 읽기 쉬운 형식으로 변환
|
||||
* 예: 1024 -> "1.0 KB", 1048576 -> "1.0 MB"
|
||||
*
|
||||
* @param bytes 바이트 수
|
||||
* @return 포맷된 문자열
|
||||
*/
|
||||
protected String formatByteSize(long bytes) {
|
||||
if (bytes < 1024) {
|
||||
return bytes + " B";
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
return String.format("%.1f KB", bytes / 1024.0);
|
||||
} else {
|
||||
return String.format("%.1f MB", bytes / (1024.0 * 1024.0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 문자열의 바이트 크기 계산 (UTF-8 기준)
|
||||
*
|
||||
* @param json JSON 문자열
|
||||
* @return 바이트 수
|
||||
*/
|
||||
protected int getJsonByteSize(String json) {
|
||||
return json.getBytes(StandardCharsets.UTF_8).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 문자열의 포맷된 바이트 크기 반환
|
||||
*
|
||||
* @param json JSON 문자열
|
||||
* @return 포맷된 크기 문자열
|
||||
*/
|
||||
protected String getFormattedJsonSize(String json) {
|
||||
return formatByteSize(getJsonByteSize(json));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.onl.apim.common.BaseRestController;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OBP API 목록 조회 REST Controller
|
||||
*
|
||||
* <p>TSEAIHE01과 TSEAIHS04를 조인하여 API 정보를 JSON으로 제공</p>
|
||||
*
|
||||
* @see BaseRestController 세션 체크 우회 및 JSON 유틸리티 제공
|
||||
*/
|
||||
@Controller
|
||||
public class ObpApiController extends BaseRestController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ObpApiController.class);
|
||||
|
||||
private final ObpApiService obpApiService;
|
||||
|
||||
public ObpApiController(ObpApiService obpApiService) {
|
||||
this.obpApiService = obpApiService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 API 목록 조회
|
||||
*
|
||||
* @param pretty true면 JSON 들여쓰기 적용
|
||||
* @return JSON Array
|
||||
*/
|
||||
@RequestMapping(
|
||||
value = "/kjb/apis.json",
|
||||
produces = JSON_CONTENT_TYPE
|
||||
)
|
||||
@ResponseBody
|
||||
public String getApis(
|
||||
@RequestParam(value = "pretty", required = false) Boolean pretty) {
|
||||
log.debug("OBP API 목록 조회 요청: pretty={}", pretty);
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// APIGW 데이터소스 강제 설정
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW));
|
||||
|
||||
try {
|
||||
List<ObpApiDTO> apis = obpApiService.findAllApis();
|
||||
|
||||
String json = toJson(apis, pretty);
|
||||
|
||||
long elapsed = System.currentTimeMillis() - startTime;
|
||||
log.info("OBP API 목록 조회 완료: count={}, size={}, elapsed={}ms",
|
||||
apis.size(), getFormattedJsonSize(json), elapsed);
|
||||
|
||||
return json;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("OBP API 목록 조회 실패", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* OBP API 목록 조회 DTO
|
||||
*
|
||||
* <p>TSEAIHE01과 TSEAIHS04 테이블을 조인하여 API 정보를 제공</p>
|
||||
*/
|
||||
@Getter
|
||||
@Builder
|
||||
public class ObpApiDTO {
|
||||
|
||||
/**
|
||||
* API ID (TSEAIHE01.EAISVCNAME)
|
||||
*/
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
* API 이름 (TSEAIHE01.EAISVCDESC)
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* 활성화 여부 (TSEAIHE01.USEYN = '1' -> true)
|
||||
*/
|
||||
private final boolean enabled;
|
||||
|
||||
/**
|
||||
* API URL (TSEAIHS04.APIFULLPATH에서 '|' 이후 부분)
|
||||
*/
|
||||
private final String url;
|
||||
|
||||
/**
|
||||
* HTTP Method (TSEAIHS04.APIFULLPATH에서 '|' 이전 부분)
|
||||
*/
|
||||
private final String method;
|
||||
|
||||
/**
|
||||
* 인증 타입 (TSEAIHE01.AUTHTYPE)
|
||||
*/
|
||||
private final String authType;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.stdmessage.QStandardMessageInfo;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* OBP API 목록 조회 Service
|
||||
*
|
||||
* <p>APIGW 데이터소스의 TSEAIHE01, TSEAIHS04 테이블에서 API 정보 조회</p>
|
||||
*/
|
||||
@Service
|
||||
public class ObpApiService {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
private JPAQueryFactory getQueryFactory() {
|
||||
return new JPAQueryFactory(entityManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 API 목록 조회
|
||||
*
|
||||
* @return API 목록
|
||||
*/
|
||||
public List<ObpApiDTO> findAllApis() {
|
||||
QEAIMessageEntity he01 = QEAIMessageEntity.eAIMessageEntity;
|
||||
QStandardMessageInfo hs04 = QStandardMessageInfo.standardMessageInfo;
|
||||
|
||||
List<Tuple> results = getQueryFactory()
|
||||
.select(
|
||||
he01.eaisvcname,
|
||||
he01.eaisvcdesc,
|
||||
he01.useyn,
|
||||
he01.authtype,
|
||||
hs04.apifullpath
|
||||
)
|
||||
.from(he01)
|
||||
.leftJoin(hs04).on(he01.eaisvcname.eq(hs04.eaisvcname))
|
||||
.orderBy(he01.eaisvcname.asc())
|
||||
.fetch();
|
||||
|
||||
return results.stream()
|
||||
.map(this::toDto)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tuple을 DTO로 변환
|
||||
*/
|
||||
private ObpApiDTO toDto(Tuple tuple) {
|
||||
QEAIMessageEntity he01 = QEAIMessageEntity.eAIMessageEntity;
|
||||
QStandardMessageInfo hs04 = QStandardMessageInfo.standardMessageInfo;
|
||||
|
||||
String eaisvcname = tuple.get(he01.eaisvcname);
|
||||
String eaisvcdesc = tuple.get(he01.eaisvcdesc);
|
||||
String useyn = tuple.get(he01.useyn);
|
||||
String authtype = tuple.get(he01.authtype);
|
||||
String apifullpath = tuple.get(hs04.apifullpath);
|
||||
|
||||
// APIFULLPATH 파싱: "POST|/mapi/kjbank/..." -> method="POST", url="/mapi/kjbank/..."
|
||||
String method = null;
|
||||
String url = null;
|
||||
if (StringUtils.isNotBlank(apifullpath) && apifullpath.contains("|")) {
|
||||
int pipeIndex = apifullpath.indexOf('|');
|
||||
method = apifullpath.substring(0, pipeIndex);
|
||||
url = apifullpath.substring(pipeIndex + 1);
|
||||
}
|
||||
|
||||
// USEYN이 "1"이면 enabled = true
|
||||
boolean enabled = "1".equals(useyn);
|
||||
|
||||
return ObpApiDTO.builder()
|
||||
.id(eaisvcname)
|
||||
.name(eaisvcdesc)
|
||||
.enabled(enabled)
|
||||
.url(url)
|
||||
.method(method)
|
||||
.authType(authtype)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* ObpGwMetric JSON 응답 DTO (after-timeslice 엔드포인트용)
|
||||
*
|
||||
* <p>예시 출력 형식에 맞춤:</p>
|
||||
* <pre>
|
||||
* {
|
||||
* "apiId": "1ba56b82-a9c9-41e2-b3ab-ff9377667d56",
|
||||
* "apiName": "[해외송금] 가상계좌 입금실패 정보조회",
|
||||
* "apiRoutingUri": "/api/obs/remittance/remittancefail*",
|
||||
* "httpMethod": "POST",
|
||||
* "orgId": "ORG001",
|
||||
* "partnerCode": "000008-01",
|
||||
* "appId": "APP001",
|
||||
* "appKey": "l7xx2fd7efc523794be5a1b126873a5de613",
|
||||
* "requestUri": "-1",
|
||||
* "timeslice": "2025-12-02T03:00:00.000+0000",
|
||||
* "attemptedCount": 3,
|
||||
* "completedCount": 3
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
public class ObpGwMetricAfterDTO {
|
||||
|
||||
private static final DateTimeFormatter ISO8601_MILLIS_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'+0000'");
|
||||
|
||||
@SerializedName("apiId")
|
||||
private String apiId;
|
||||
|
||||
@SerializedName("apiName")
|
||||
private String apiName;
|
||||
|
||||
@SerializedName("apiRoutingUri")
|
||||
private String apiRoutingUri;
|
||||
|
||||
@SerializedName("httpMethod")
|
||||
private String httpMethod;
|
||||
|
||||
@SerializedName("orgId")
|
||||
private String orgId;
|
||||
|
||||
@SerializedName("partnerCode")
|
||||
private String partnerCode;
|
||||
|
||||
@SerializedName("appId")
|
||||
private String appId;
|
||||
|
||||
@SerializedName("appKey")
|
||||
private String appKey;
|
||||
|
||||
@SerializedName("requestUri")
|
||||
private String requestUri;
|
||||
|
||||
@SerializedName("timeslice")
|
||||
private String timeslice;
|
||||
|
||||
@SerializedName("attemptedCount")
|
||||
private Long attemptedCount;
|
||||
|
||||
@SerializedName("completedCount")
|
||||
private Long completedCount;
|
||||
|
||||
/**
|
||||
* Entity → DTO 변환
|
||||
*/
|
||||
public static ObpGwMetricAfterDTO from(ObpGwMetric entity) {
|
||||
ObpGwMetricAfterDTO dto = new ObpGwMetricAfterDTO();
|
||||
dto.setApiId(entity.getApiId());
|
||||
dto.setApiName(entity.getApiName());
|
||||
dto.setApiRoutingUri(entity.getUri());
|
||||
dto.setHttpMethod(entity.getMethod());
|
||||
dto.setOrgId(entity.getOrgId());
|
||||
dto.setPartnerCode(entity.getPartnerCode());
|
||||
dto.setAppId(entity.getAppId());
|
||||
dto.setAppKey(entity.getClientId());
|
||||
dto.setRequestUri(entity.getRequestUri());
|
||||
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
|
||||
dto.setAttemptedCount(entity.getAttemptedCount());
|
||||
dto.setCompletedCount(entity.getCompletedCount());
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* timeslice를 ISO8601 형식 (밀리초 포함) + UTC 시간대로 변환
|
||||
* 예: 2025-12-02T03:00:00.000+0000
|
||||
*/
|
||||
private static String formatTimeslice(LocalDateTime timeslice) {
|
||||
if (timeslice == null) return null;
|
||||
return timeslice.format(ISO8601_MILLIS_FORMATTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.eai.rms.onl.apim.common.BaseRestController;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.ResponseBody;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ObpGwMetric REST Controller
|
||||
* API Gateway 시간별 거래량 지표 조회 API
|
||||
*
|
||||
* @see BaseRestController 세션 체크 우회 및 JSON 유틸리티 제공
|
||||
*/
|
||||
@Controller
|
||||
public class ObpGwMetricController extends BaseRestController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ObpGwMetricController.class);
|
||||
|
||||
private static final DateTimeFormatter PATH_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd_HH:mm:ss");
|
||||
|
||||
private final ObpGwMetricManService obpGwMetricManService;
|
||||
|
||||
public ObpGwMetricController(ObpGwMetricManService obpGwMetricManService) {
|
||||
this.obpGwMetricManService = obpGwMetricManService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대의 GwMetric 데이터 조회
|
||||
*
|
||||
* @param datetime 조회 시간대 (형식: yyyy-MM-dd_HH:mm:ss)
|
||||
* @param pretty true면 JSON 들여쓰기 적용
|
||||
* @return JSON Array
|
||||
*/
|
||||
@RequestMapping(
|
||||
value = "/kjb/gw-metrics/{datetime}.json",
|
||||
produces = JSON_CONTENT_TYPE
|
||||
)
|
||||
@ResponseBody
|
||||
public String getGwMetrics(
|
||||
@PathVariable("datetime") String datetime,
|
||||
@RequestParam(value = "pretty", required = false) Boolean pretty) {
|
||||
log.debug("GwMetric 조회 요청: datetime={}, pretty={}", datetime, pretty);
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
// Path 파라미터 파싱
|
||||
LocalDateTime targetTime = LocalDateTime.parse(datetime, PATH_FORMATTER);
|
||||
LocalDateTime timeslice = targetTime.withMinute(0).withSecond(0).withNano(0);
|
||||
|
||||
// 조회
|
||||
List<ObpGwMetricDTO> metrics = obpGwMetricManService.findByTimeslice(timeslice);
|
||||
|
||||
// JSON 변환 (GSON)
|
||||
String json = toJson(metrics, pretty);
|
||||
|
||||
long elapsed = System.currentTimeMillis() - startTime;
|
||||
log.info("GwMetric 조회 완료: datetime={}, count={}, size={}, elapsed={}ms",
|
||||
datetime, metrics.size(), getFormattedJsonSize(json), elapsed);
|
||||
|
||||
return json;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("GwMetric 조회 실패: datetime={}", datetime, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대 이후의 GwMetric 데이터 조회
|
||||
*
|
||||
* @param datetime 조회 시작 시간대 (형식: yyyy-MM-dd_HH:mm:ss)
|
||||
* @param pretty true면 JSON 들여쓰기 적용
|
||||
* @return JSON Array (해당 시간대 이후의 모든 지표)
|
||||
*/
|
||||
@RequestMapping(
|
||||
value = "/kjb/gw-metrics/after-timeslice/{datetime}.json",
|
||||
produces = JSON_CONTENT_TYPE
|
||||
)
|
||||
@ResponseBody
|
||||
public String getGwMetricsAfterTimeslice(
|
||||
@PathVariable("datetime") String datetime,
|
||||
@RequestParam(value = "pretty", required = false) Boolean pretty) {
|
||||
log.debug("GwMetric after-timeslice 조회 요청: datetime={}, pretty={}", datetime, pretty);
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
// Path 파라미터 파싱
|
||||
LocalDateTime targetTime = LocalDateTime.parse(datetime, PATH_FORMATTER);
|
||||
LocalDateTime timeslice = targetTime.withMinute(0).withSecond(0).withNano(0);
|
||||
|
||||
// 조회
|
||||
List<ObpGwMetricAfterDTO> metrics = obpGwMetricManService.findByTimesliceAfter(timeslice);
|
||||
|
||||
// JSON 변환 (GSON)
|
||||
String json = toJson(metrics, pretty);
|
||||
|
||||
long elapsed = System.currentTimeMillis() - startTime;
|
||||
log.info("GwMetric after-timeslice 조회 완료: datetime={}, count={}, size={}, elapsed={}ms",
|
||||
datetime, metrics.size(), getFormattedJsonSize(json), elapsed);
|
||||
|
||||
return json;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("GwMetric after-timeslice 조회 실패: datetime={}", datetime, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* ObpGwMetric JSON 응답 DTO
|
||||
* Entity 주석에 명시된 JSON Key 사용
|
||||
*/
|
||||
@Data
|
||||
public class ObpGwMetricDTO {
|
||||
|
||||
private static final DateTimeFormatter ISO8601_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'+0000'");
|
||||
|
||||
@SerializedName("appKey")
|
||||
private String clientId;
|
||||
|
||||
@SerializedName("clusterHostname")
|
||||
private String hostname;
|
||||
|
||||
@SerializedName("timeslice")
|
||||
private String timeslice;
|
||||
|
||||
@SerializedName("apiName")
|
||||
private String apiName;
|
||||
|
||||
@SerializedName("apiRoutingUri")
|
||||
private String uri;
|
||||
|
||||
@SerializedName("httpMethod")
|
||||
private String method;
|
||||
|
||||
@SerializedName("attemptedCount")
|
||||
private Long attemptedCount;
|
||||
|
||||
@SerializedName("completedCount")
|
||||
private Long completedCount;
|
||||
|
||||
// EAPIM ID
|
||||
@SerializedName("apiIdByEapim")
|
||||
private String apiId;
|
||||
|
||||
@SerializedName("appIdByEapim")
|
||||
private String appId;
|
||||
|
||||
@SerializedName("orgIdByEapim")
|
||||
private String orgId;
|
||||
|
||||
// AS-IS 호환용 필드
|
||||
@SerializedName("appId")
|
||||
private String appIdByCaPortal;
|
||||
|
||||
@SerializedName("portalOrgId")
|
||||
private String orgIdByCaPortal;
|
||||
|
||||
@SerializedName("portalApiId")
|
||||
private String apiIdByCaPortal;
|
||||
|
||||
@SerializedName("partnerCode")
|
||||
private String partnerCode;
|
||||
|
||||
@SerializedName("apiId")
|
||||
private String apiIdByCa;
|
||||
|
||||
/**
|
||||
* Entity → DTO 변환
|
||||
*/
|
||||
public static ObpGwMetricDTO from(ObpGwMetric entity) {
|
||||
ObpGwMetricDTO dto = new ObpGwMetricDTO();
|
||||
dto.setClientId(entity.getClientId());
|
||||
dto.setHostname(entity.getHostname());
|
||||
dto.setTimeslice(formatTimeslice(entity.getTimeslice()));
|
||||
dto.setApiName(entity.getApiName());
|
||||
dto.setUri(entity.getUri());
|
||||
dto.setMethod(entity.getMethod());
|
||||
dto.setAttemptedCount(entity.getAttemptedCount());
|
||||
dto.setCompletedCount(entity.getCompletedCount());
|
||||
dto.setApiId(entity.getApiId());
|
||||
dto.setAppId(entity.getAppId());
|
||||
dto.setOrgId(entity.getOrgId());
|
||||
dto.setAppIdByCaPortal(entity.getAppIdByCaPortal());
|
||||
dto.setOrgIdByCaPortal(entity.getOrgIdByCaPortal());
|
||||
dto.setApiIdByCaPortal(entity.getApiIdByCaPortal());
|
||||
dto.setPartnerCode(entity.getPartnerCode());
|
||||
dto.setApiIdByCa(entity.getApiIdByCa());
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* timeslice를 ISO8601 형식 + UTC 시간대로 변환
|
||||
* 예: 2025-12-02T01:00:00+0000
|
||||
*/
|
||||
private static String formatTimeslice(LocalDateTime timeslice) {
|
||||
if (timeslice == null) return null;
|
||||
return timeslice.format(ISO8601_FORMATTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
package com.eactive.eai.rms.onl.apim.obp;
|
||||
|
||||
import com.eactive.apim.portal.obp.entity.ObpGwMetric;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.util.CommonUtil;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricJpaDAO;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricService;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.obp.ObpGwMetricVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ObpGwMetric Man Service - 비즈니스 로직
|
||||
* API Gateway 로그 데이터를 집계하여 ObpGwMetric 엔티티로 저장
|
||||
*/
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class ObpGwMetricManService extends BaseService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ObpGwMetricManService.class);
|
||||
|
||||
/**
|
||||
* 기본 집계 범위 시간 (단위: 시간)
|
||||
* - 1: 직전 1시간만 집계
|
||||
* - 5: 직전 5시간까지 각각 1시간 단위로 집계
|
||||
*
|
||||
* <p>Job 파라미터로 오버라이드 가능 (aggregation.hour.range)</p>
|
||||
*/
|
||||
public static final int DEFAULT_AGGREGATION_HOUR_RANGE = 1;
|
||||
|
||||
private static final DateTimeFormatter TIMESLICE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHH0000000");
|
||||
private static final DateTimeFormatter TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
||||
private static final DateTimeFormatter YYYYMMDD_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
|
||||
private final ObpGwMetricJpaDAO obpGwMetricJpaDAO;
|
||||
private final ObpGwMetricService obpGwMetricService;
|
||||
|
||||
public ObpGwMetricManService(ObpGwMetricJpaDAO obpGwMetricJpaDAO, ObpGwMetricService obpGwMetricService) {
|
||||
this.obpGwMetricJpaDAO = obpGwMetricJpaDAO;
|
||||
this.obpGwMetricService = obpGwMetricService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 다중 시간대 집계 실행 (Job에서 호출) - 기본 집계 범위 사용
|
||||
*/
|
||||
public void executeHourlyAggregation() {
|
||||
executeHourlyAggregation(DEFAULT_AGGREGATION_HOUR_RANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 다중 시간대 집계 실행 (Job에서 호출)
|
||||
*
|
||||
* @param aggregationHourRange 집계 범위 시간 (단위: 시간)
|
||||
* 예: 1=직전 1시간, 3=직전 3시간 각각 집계
|
||||
*/
|
||||
public void executeHourlyAggregation(int aggregationHourRange) {
|
||||
long totalStartTime = System.currentTimeMillis();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime baseHour = now.truncatedTo(ChronoUnit.HOURS); // 현재 시간의 정각
|
||||
|
||||
log.info("========== ObpGwMetric 집계 시작 ==========");
|
||||
log.info("실행 시간: {}, aggregationHourRange: {}", now, aggregationHourRange);
|
||||
|
||||
for (int i = 1; i <= aggregationHourRange; i++) {
|
||||
LocalDateTime targetHour = baseHour.minusHours(i);
|
||||
log.info("집계 대상 시간대: {}", targetHour);
|
||||
createHourlyData(targetHour);
|
||||
}
|
||||
|
||||
long totalElapsed = System.currentTimeMillis() - totalStartTime;
|
||||
log.info("========== ObpGwMetric 집계 완료 ==========");
|
||||
log.info("전체 집계 소요시간: {}ms ({}초)", totalElapsed, String.format("%.2f", totalElapsed / 1000.0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 1시간 단위 ObpGwMetric 데이터 생성 (UPSERT)
|
||||
*/
|
||||
public void createHourlyData(LocalDateTime targetHour) {
|
||||
long jobStartTime = System.currentTimeMillis();
|
||||
log.info("ObpGwMetric 집계 시작: targetHour={}", targetHour);
|
||||
|
||||
try {
|
||||
String timeslice = targetHour.format(TIMESLICE_FORMATTER);
|
||||
String yyyymmdd = targetHour.format(YYYYMMDD_FORMATTER);
|
||||
String tableName = CommonUtil.getLogTable(yyyymmdd, true);
|
||||
String startTime = targetHour.format(TIMESTAMP_FORMATTER);
|
||||
String endTime = targetHour.plusHours(1).minusNanos(1).format(TIMESTAMP_FORMATTER);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// 1단계: GW DB에서 EAIBZWKDSTCD 코드 목록 조회
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
long step1Start = System.currentTimeMillis();
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW));
|
||||
|
||||
List<String> bzwkCodes = obpGwMetricJpaDAO.selectAllBzwkCodes();
|
||||
log.info("[1단계] EAIBZWKDSTCD 코드 조회 완료: count={}, elapsed={}ms",
|
||||
bzwkCodes.size(), System.currentTimeMillis() - step1Start);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// 2단계: 코드별 개별 쿼리 실행 후 결과 병합
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
long step2Start = System.currentTimeMillis();
|
||||
Map<String, ObpGwMetricVO> aggregatedMap = new HashMap<>();
|
||||
int totalLogCount = 0;
|
||||
|
||||
for (String bzwkCode : bzwkCodes) {
|
||||
long codeStart = System.currentTimeMillis();
|
||||
|
||||
List<ObpGwMetricVO> partialResult = obpGwMetricJpaDAO.selectHourlyMetricsByBzwkCode(
|
||||
tableName, bzwkCode, startTime, endTime, timeslice);
|
||||
|
||||
for (ObpGwMetricVO vo : partialResult) {
|
||||
String key = vo.getAggregationKey();
|
||||
aggregatedMap.merge(key, vo, this::mergeMetricVO);
|
||||
}
|
||||
|
||||
if (!partialResult.isEmpty()) {
|
||||
log.debug("[2단계] bzwkCode={}, 집계건수={}, elapsed={}ms",
|
||||
bzwkCode, partialResult.size(), System.currentTimeMillis() - codeStart);
|
||||
}
|
||||
totalLogCount += partialResult.size();
|
||||
}
|
||||
|
||||
List<ObpGwMetricVO> aggregatedList = new ArrayList<>(aggregatedMap.values());
|
||||
log.info("[2단계] 로그 집계 완료: 원본건수={}, 병합후건수={}, elapsed={}ms",
|
||||
totalLogCount, aggregatedList.size(), System.currentTimeMillis() - step2Start);
|
||||
|
||||
if (aggregatedList.isEmpty()) {
|
||||
log.warn("집계 대상 데이터 없음: targetHour={}", targetHour);
|
||||
return;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// 3단계: 부가 정보 조회 (apiName, uri) - GW DB
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
long step3Start = System.currentTimeMillis();
|
||||
Set<String> apiIds = aggregatedList.stream()
|
||||
.map(ObpGwMetricVO::getApiId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// URI 조회용 EAI 서비스 일련번호 (HTTP_ADAPTER_EXTRA_LOG.GUID와 매핑)
|
||||
Set<String> eaiSvcSernos = aggregatedList.stream()
|
||||
.map(ObpGwMetricVO::getEaiSvcSerno)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, String> apiNameMap = obpGwMetricJpaDAO.selectApiNames(apiIds);
|
||||
ObpGwMetricJpaDAO.UriMethodResult uriMethodResult = obpGwMetricJpaDAO.selectUrisAndMethods(eaiSvcSernos);
|
||||
Map<String, String> uriMap = uriMethodResult.getUriMap();
|
||||
Map<String, String> methodMap = uriMethodResult.getMethodMap();
|
||||
log.info("[3단계] 부가정보 조회 완료: apiCount={}, eaiSvcSernoCount={}, elapsed={}ms",
|
||||
apiIds.size(), eaiSvcSernos.size(), System.currentTimeMillis() - step3Start);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// 4단계: 지표 DB로 전환 후 appId 조회 및 UPSERT
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
long step4Start = System.currentTimeMillis();
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
|
||||
|
||||
Set<String> orgIds = aggregatedList.stream()
|
||||
.map(ObpGwMetricVO::getOrgId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, String> appIdMap = obpGwMetricJpaDAO.selectAppIdsByOrgIds(orgIds);
|
||||
|
||||
int insertCount = 0;
|
||||
int updateCount = 0;
|
||||
|
||||
for (ObpGwMetricVO vo : aggregatedList) {
|
||||
LocalDateTime timesliceDateTime = vo.getTimesliceAsLocalDateTime();
|
||||
|
||||
Optional<ObpGwMetric> existing = obpGwMetricService.findByUniqueKey(
|
||||
timesliceDateTime,
|
||||
vo.getApiId(),
|
||||
vo.getClientId(),
|
||||
vo.getHostname(),
|
||||
vo.getOrgId()
|
||||
);
|
||||
|
||||
if (existing.isPresent()) {
|
||||
// UPDATE: 기존 데이터 갱신
|
||||
ObpGwMetric entity = existing.get();
|
||||
entity.setAttemptedCount(vo.getAttemptedCount());
|
||||
entity.setCompletedCount(vo.getCompletedCount());
|
||||
entity.setApiName(apiNameMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 URI 조회
|
||||
entity.setMethod(methodMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 HTTP Method 조회
|
||||
entity.setAppId(appIdMap.get(vo.getOrgId()));
|
||||
entity.setUpdateCount(entity.getUpdateCount() + 1); // 보정 횟수 증가
|
||||
entity.setUpdatedAt(LocalDateTime.now());
|
||||
entity.setUpdatedBy("GwMetricHourJob");
|
||||
obpGwMetricService.save(entity);
|
||||
updateCount++;
|
||||
} else {
|
||||
// INSERT: 신규 데이터 생성
|
||||
ObpGwMetric entity = convertToEntity(vo, apiNameMap, uriMap, methodMap, appIdMap);
|
||||
obpGwMetricService.save(entity);
|
||||
insertCount++;
|
||||
}
|
||||
}
|
||||
|
||||
log.info("[4단계] UPSERT 완료: INSERT={}, UPDATE={}, elapsed={}ms",
|
||||
insertCount, updateCount, System.currentTimeMillis() - step4Start);
|
||||
|
||||
long totalElapsed = System.currentTimeMillis() - jobStartTime;
|
||||
log.info("ObpGwMetric 집계 완료: targetHour={}, 총 소요시간={}ms ({}초)",
|
||||
targetHour, totalElapsed, totalElapsed / 1000.0);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("ObpGwMetric 집계 실패: targetHour={}", targetHour, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ObpGwMetricVO 병합 (count 누적)
|
||||
*/
|
||||
private ObpGwMetricVO mergeMetricVO(ObpGwMetricVO existing, ObpGwMetricVO incoming) {
|
||||
existing.setAttemptedCount(
|
||||
(existing.getAttemptedCount() != null ? existing.getAttemptedCount() : 0L) +
|
||||
(incoming.getAttemptedCount() != null ? incoming.getAttemptedCount() : 0L)
|
||||
);
|
||||
existing.setCompletedCount(
|
||||
(existing.getCompletedCount() != null ? existing.getCompletedCount() : 0L) +
|
||||
(incoming.getCompletedCount() != null ? incoming.getCompletedCount() : 0L)
|
||||
);
|
||||
return existing;
|
||||
}
|
||||
|
||||
/**
|
||||
* VO → Entity 변환
|
||||
*/
|
||||
private ObpGwMetric convertToEntity(ObpGwMetricVO vo, Map<String, String> apiNameMap,
|
||||
Map<String, String> uriMap, Map<String, String> methodMap,
|
||||
Map<String, String> appIdMap) {
|
||||
ObpGwMetric entity = new ObpGwMetric();
|
||||
entity.setClientId(vo.getClientId());
|
||||
entity.setHostname(vo.getHostname());
|
||||
entity.setTimeslice(vo.getTimesliceAsLocalDateTime());
|
||||
entity.setApiId(vo.getApiId());
|
||||
entity.setOrgId(vo.getOrgId());
|
||||
entity.setAttemptedCount(vo.getAttemptedCount());
|
||||
entity.setCompletedCount(vo.getCompletedCount());
|
||||
entity.setApiName(apiNameMap.get(vo.getApiId()));
|
||||
entity.setUri(uriMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 URI 조회
|
||||
entity.setMethod(methodMap.get(vo.getEaiSvcSerno())); // eaiSvcSerno로 HTTP Method 조회
|
||||
entity.setAppId(appIdMap.get(vo.getOrgId()));
|
||||
entity.setUpdateCount(0);
|
||||
entity.setCreatedAt(LocalDateTime.now());
|
||||
entity.setCreatedBy("GwMetricHourJob");
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대의 GwMetric 데이터 조회 (REST API용)
|
||||
*/
|
||||
public List<ObpGwMetricDTO> findByTimeslice(LocalDateTime timeslice) {
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
|
||||
|
||||
List<ObpGwMetric> entities = obpGwMetricService.findByTimeslice(timeslice);
|
||||
return entities.stream()
|
||||
.map(ObpGwMetricDTO::from)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 시간대 이후의 GwMetric 데이터 조회 (REST API용)
|
||||
* after-timeslice 엔드포인트에서 사용
|
||||
*/
|
||||
public List<ObpGwMetricAfterDTO> findByTimesliceAfter(LocalDateTime timeslice) {
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
|
||||
|
||||
List<ObpGwMetric> entities = obpGwMetricService.findByTimesliceGreaterThanEqual(timeslice);
|
||||
return entities.stream()
|
||||
.map(ObpGwMetricAfterDTO::from)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.eactive.eai.rms.onl.apim.portalorg;
|
||||
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
|
||||
import com.eactive.ext.kjb.common.KjbObpException;
|
||||
import com.eactive.ext.kjb.common.KjbProperty;
|
||||
import com.eactive.ext.kjb.obp.KjbObpModule;
|
||||
import com.eactive.ext.kjb.util.KjbPropertyInjector;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OBP 파트너코드 조회 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ObpPartnerCodeService {
|
||||
private static final String PROP_GROUP_ID = "Monitoring";
|
||||
|
||||
private final KjbPropertyInjector kjbPropertyInjector;
|
||||
|
||||
@Autowired
|
||||
public ObpPartnerCodeService(MonitoringPropertyService monitoringPropertyService) {
|
||||
this.kjbPropertyInjector = new KjbPropertyInjector(monitoringPropertyService, PROP_GROUP_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자등록번호로 OBP 파트너코드 조회
|
||||
* @param compRegNo 사업자등록번호
|
||||
* @return 조회 결과 (success, partnerCode 또는 message)
|
||||
*/
|
||||
public Map<String, Object> queryPartnerCode(String compRegNo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
KjbProperty prop = kjbPropertyInjector.inject(new KjbProperty());
|
||||
KjbObpModule obpModule = KjbObpModule.getInstance(prop);
|
||||
|
||||
String partnerCode = obpModule.queryPartnerCode(compRegNo);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("partnerCode", partnerCode);
|
||||
log.info("[OBP] 파트너코드 조회 성공 - compRegNo: {}, partnerCode: {}", compRegNo, partnerCode);
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("[OBP] 파트너코드 조회 실패 - 잘못된 입력: {}", e.getMessage());
|
||||
result.put("success", false);
|
||||
result.put("message", e.getMessage());
|
||||
|
||||
} catch (KjbObpException e) {
|
||||
log.warn("[OBP] 파트너코드 조회 실패 - OBP 오류: {}", e.getMessage());
|
||||
result.put("success", false);
|
||||
result.put("message", "OBP 조회 실패: " + e.getMessage());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("[OBP] 파트너코드 조회 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "시스템 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -25,13 +26,16 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class PortalOrgManController extends BaseAnnotationController {
|
||||
|
||||
private final PortalOrgManService portalOrgManService;
|
||||
private final ComboService comboService;
|
||||
private final ObpPartnerCodeService obpPartnerCodeService;
|
||||
|
||||
@GetMapping(value = "/onl/apim/portalorg/portalOrgMan.view")
|
||||
public void view() {
|
||||
@@ -86,7 +90,7 @@ public class PortalOrgManController extends BaseAnnotationController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(PortalOrgUI portalOrgUI) throws IOException {
|
||||
public ResponseEntity<Void> update(PortalOrgUI portalOrgUI) throws IOException {
|
||||
portalOrgManService.update(portalOrgUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
@@ -104,4 +108,15 @@ public class PortalOrgManController extends BaseAnnotationController {
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
/**
|
||||
* OBP 파트너코드 조회
|
||||
* @param compRegNo 사업자등록번호
|
||||
* @return partnerCode
|
||||
*/
|
||||
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=QUERY_OBP_PARTNER_CODE")
|
||||
public ResponseEntity<Map<String, Object>> queryObpPartnerCode(@RequestParam("compRegNo") String compRegNo) {
|
||||
Map<String, Object> result = obpPartnerCodeService.queryPartnerCode(compRegNo);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.eactive.eai.rms.onl.apim.portalterms;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.interceptor.InterceptorSkipController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 에디터 이미지 컨트롤러
|
||||
* - summernote 에디터에서 사용하는 이미지 업로드/서빙 API
|
||||
* - InterceptorSkipController: 인터셉터의 상세 검증 우회 (필터에서 기본 로그인 체크는 수행됨)
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/onl/apim/editor/image")
|
||||
public class EditorImageController extends BaseAnnotationController implements InterceptorSkipController {
|
||||
|
||||
private final EditorImageService editorImageService;
|
||||
|
||||
@Autowired
|
||||
public EditorImageController(EditorImageService editorImageService) {
|
||||
this.editorImageService = editorImageService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 업로드 API
|
||||
* - summernote에서 이미지 선택/붙여넣기 시 호출
|
||||
* - 즉시 DB에 저장하고 플레이스홀더 정보 반환
|
||||
*
|
||||
* @param file MultipartFile 이미지 파일
|
||||
* @return { success: true, fileId: "uuid", fileSn: 1, placeholder: "{{IMG:uuid:1}}" }
|
||||
*/
|
||||
@PostMapping("/upload.json")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, Object>> uploadImage(@RequestParam("file") MultipartFile file) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
// 파일 검증
|
||||
if (file.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("error", "파일이 비어있습니다.");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
// 이미지 타입 검증
|
||||
String contentType = file.getContentType();
|
||||
if (contentType == null || !contentType.startsWith("image/")) {
|
||||
result.put("success", false);
|
||||
result.put("error", "이미지 파일만 업로드 가능합니다.");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
// 파일 크기 검증 (10MB)
|
||||
long maxSize = 10 * 1024 * 1024;
|
||||
if (file.getSize() > maxSize) {
|
||||
result.put("success", false);
|
||||
result.put("error", "파일 크기는 10MB를 초과할 수 없습니다.");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
// 이미지 저장
|
||||
EditorImageDTO saved = editorImageService.saveImage(file);
|
||||
|
||||
// 성공 응답
|
||||
result.put("success", true);
|
||||
result.put("fileId", saved.getFileId());
|
||||
result.put("fileSn", saved.getFileSn());
|
||||
result.put("placeholder", "{{IMG:" + saved.getFileId() + ":" + saved.getFileSn() + "}}");
|
||||
|
||||
return ResponseEntity.ok(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("이미지 업로드 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("error", "이미지 업로드 중 오류가 발생했습니다: " + e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 서빙 API
|
||||
* - 브라우저에서 이미지 표시용 (관리자포탈)
|
||||
* - 캐시 설정으로 성능 최적화
|
||||
*
|
||||
* @param fileId 파일 ID (PTL_FILE.FILE_ID)
|
||||
* @param fileSn 파일 순번 (PTL_FILE_DETAIL.FILE_SN)
|
||||
* @return 이미지 바이너리 데이터
|
||||
*/
|
||||
@GetMapping("/view.do")
|
||||
public ResponseEntity<byte[]> viewImage(
|
||||
@RequestParam String fileId,
|
||||
@RequestParam(defaultValue = "1") int fileSn) {
|
||||
try {
|
||||
EditorImageDTO image = editorImageService.getImage(fileId, fileSn);
|
||||
|
||||
if (image == null || image.getImageData() == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.parseMediaType(image.getContentType()));
|
||||
headers.setContentLength(image.getFileSize());
|
||||
headers.setCacheControl("public, max-age=86400"); // 1일 캐시
|
||||
headers.set("Content-Disposition", "inline");
|
||||
|
||||
return new ResponseEntity<>(image.getImageData(), headers, HttpStatus.OK);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("이미지 조회 중 오류 발생: fileId=" + fileId + ", fileSn=" + fileSn, e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 삭제 API
|
||||
* - 에디터에서 이미지 삭제 시 호출
|
||||
* - DB에서 파일 삭제
|
||||
*
|
||||
* @param fileId 파일 ID (PTL_FILE.FILE_ID)
|
||||
* @return { success: true }
|
||||
*/
|
||||
@PostMapping("/delete.json")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Map<String, Object>> deleteImage(@RequestParam String fileId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
if (fileId == null || fileId.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("error", "파일 ID가 필요합니다.");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
editorImageService.deleteImage(fileId);
|
||||
|
||||
result.put("success", true);
|
||||
return ResponseEntity.ok(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("이미지 삭제 중 오류 발생: fileId=" + fileId, e);
|
||||
result.put("success", false);
|
||||
result.put("error", "이미지 삭제 중 오류가 발생했습니다: " + e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.rms.onl.apim.portalterms;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 에디터 이미지 DTO
|
||||
* - summernote 에디터에서 업로드된 이미지 정보를 담는 DTO
|
||||
*/
|
||||
@Data
|
||||
public class EditorImageDTO {
|
||||
|
||||
/**
|
||||
* 파일 ID (PTL_FILE.FILE_ID)
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 파일 순번 (PTL_FILE_DETAIL.FILE_SN)
|
||||
*/
|
||||
private int fileSn;
|
||||
|
||||
/**
|
||||
* 원본 파일명
|
||||
*/
|
||||
private String originalFileName;
|
||||
|
||||
/**
|
||||
* 파일 확장자
|
||||
*/
|
||||
private String fileExtension;
|
||||
|
||||
/**
|
||||
* 파일 크기 (bytes)
|
||||
*/
|
||||
private int fileSize;
|
||||
|
||||
/**
|
||||
* Content-Type (MIME 타입)
|
||||
*/
|
||||
private String contentType;
|
||||
|
||||
/**
|
||||
* 이미지 바이너리 데이터 (조회 시에만 사용)
|
||||
*/
|
||||
private byte[] imageData;
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.eactive.eai.rms.onl.apim.portalterms;
|
||||
|
||||
import com.eactive.apim.portal.file.entity.FileDetail;
|
||||
import com.eactive.apim.portal.file.entity.FileInfo;
|
||||
import com.eactive.apim.portal.file.service.FileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 에디터 이미지 서비스
|
||||
* - summernote 에디터에서 사용하는 이미지 업로드/조회/삭제 서비스
|
||||
* - FileService를 래핑하여 이미지 전용 기능 제공
|
||||
*/
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@Slf4j
|
||||
public class EditorImageService {
|
||||
|
||||
/**
|
||||
* 플레이스홀더 패턴: {{IMG:fileId:fileSn}} 또는 {{IMG:fileId:fileSn|속성}}
|
||||
* - fileId: UUID 형식 (예: 550e8400-e29b-41d4-a716-446655440000)
|
||||
* - fileSn: 정수 (예: 1)
|
||||
* - 속성: 선택적 (예: |width=300|height=200|style=max-width:100%)
|
||||
*/
|
||||
private static final Pattern PLACEHOLDER_PATTERN =
|
||||
Pattern.compile("\\{\\{IMG:([a-f0-9\\-]+):(\\d+)(\\|[^}]+)?\\}\\}");
|
||||
|
||||
private final FileService fileService;
|
||||
|
||||
@Autowired
|
||||
public EditorImageService(FileService fileService) {
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 저장
|
||||
*
|
||||
* @param file MultipartFile 이미지 파일
|
||||
* @return EditorImageDTO (fileId, fileSn 포함)
|
||||
* @throws IOException 파일 처리 중 오류 발생 시
|
||||
*/
|
||||
public EditorImageDTO saveImage(MultipartFile file) throws IOException {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String contentType = file.getContentType();
|
||||
byte[] data = file.getBytes();
|
||||
|
||||
// FileService를 통해 저장
|
||||
FileInfo fileInfo = fileService.createSingleFileFromBytes(fileName, contentType, data);
|
||||
FileDetail detail = fileInfo.getFileDetails().get(0);
|
||||
|
||||
// DTO로 변환하여 반환
|
||||
EditorImageDTO dto = new EditorImageDTO();
|
||||
dto.setFileId(fileInfo.getFileId());
|
||||
dto.setFileSn(detail.getFileSn());
|
||||
dto.setOriginalFileName(detail.getOriginalFileName());
|
||||
dto.setFileExtension(detail.getFileExtension());
|
||||
dto.setFileSize(detail.getFileSize());
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 조회
|
||||
*
|
||||
* @param fileId 파일 ID
|
||||
* @param fileSn 파일 순번
|
||||
* @return EditorImageDTO (imageData 포함)
|
||||
* @throws IOException 파일 조회 중 오류 발생 시
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public EditorImageDTO getImage(String fileId, int fileSn) throws IOException {
|
||||
FileDetail detail = fileService.getFileDetailByIds(fileId, fileSn);
|
||||
byte[] data = fileService.retrieveFileContent(detail);
|
||||
|
||||
EditorImageDTO dto = new EditorImageDTO();
|
||||
dto.setFileId(fileId);
|
||||
dto.setFileSn(fileSn);
|
||||
dto.setOriginalFileName(detail.getOriginalFileName());
|
||||
dto.setFileExtension(detail.getFileExtension());
|
||||
dto.setFileSize(detail.getFileSize());
|
||||
dto.setContentType(getContentType(detail.getFileExtension()));
|
||||
dto.setImageData(data);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 본문에서 사용 중인 파일 ID 추출
|
||||
*
|
||||
* @param contents 본문 내용 (플레이스홀더 포함)
|
||||
* @return 사용 중인 파일 ID Set
|
||||
*/
|
||||
public Set<String> extractFileIds(String contents) {
|
||||
Set<String> fileIds = new HashSet<>();
|
||||
if (contents == null || contents.isEmpty()) {
|
||||
return fileIds;
|
||||
}
|
||||
|
||||
Matcher matcher = PLACEHOLDER_PATTERN.matcher(contents);
|
||||
while (matcher.find()) {
|
||||
fileIds.add(matcher.group(1)); // fileId
|
||||
}
|
||||
return fileIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 삭제
|
||||
*
|
||||
* @param fileId 삭제할 파일 ID
|
||||
*/
|
||||
public void deleteImage(String fileId) {
|
||||
try {
|
||||
fileService.deleteFile(fileId);
|
||||
log.info("Deleted image: {}", fileId);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to delete image: {}", fileId, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 미사용 이미지 정리
|
||||
* - 원래 저장된 이미지 중 현재 본문에서 사용되지 않는 이미지 삭제
|
||||
*
|
||||
* @param usedFileIds 본문에서 사용 중인 파일 ID 목록
|
||||
* @param originalFileIds 원래 저장된 모든 파일 ID 목록
|
||||
*/
|
||||
public void cleanupUnusedImages(Set<String> usedFileIds, Set<String> originalFileIds) {
|
||||
if (originalFileIds == null || originalFileIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String fileId : originalFileIds) {
|
||||
if (!usedFileIds.contains(fileId)) {
|
||||
try {
|
||||
fileService.deleteFile(fileId);
|
||||
log.info("Deleted unused image: {}", fileId);
|
||||
} catch (Exception e) {
|
||||
// 삭제 실패 시 로그만 남기고 계속 진행
|
||||
log.warn("Failed to delete unused image: {}", fileId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 플레이스홀더를 실제 이미지 태그로 변환
|
||||
*
|
||||
* @param contents 본문 내용 (플레이스홀더 포함)
|
||||
* @param baseUrl 이미지 서빙 베이스 URL (예: /onl/apim/editor/image/view/)
|
||||
* @return 이미지 태그가 포함된 HTML
|
||||
*/
|
||||
public String convertPlaceholdersToHtml(String contents, String baseUrl) {
|
||||
if (contents == null || contents.isEmpty()) {
|
||||
return contents;
|
||||
}
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
Matcher matcher = PLACEHOLDER_PATTERN.matcher(contents);
|
||||
|
||||
while (matcher.find()) {
|
||||
String fileId = matcher.group(1);
|
||||
String fileSn = matcher.group(2);
|
||||
String attrs = matcher.group(3); // |width=300|height=200 형태
|
||||
|
||||
StringBuilder img = new StringBuilder();
|
||||
img.append("<img src=\"").append(baseUrl).append(fileId).append("/").append(fileSn).append("\"");
|
||||
|
||||
// 속성 파싱 및 추가
|
||||
if (attrs != null && !attrs.isEmpty()) {
|
||||
String[] parts = attrs.substring(1).split("\\|"); // 앞의 | 제거 후 분리
|
||||
for (String part : parts) {
|
||||
String[] kv = part.split("=", 2);
|
||||
if (kv.length == 2) {
|
||||
img.append(" ").append(kv[0]).append("=\"").append(kv[1]).append("\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 기본 스타일 (style 속성이 없으면 추가)
|
||||
if (attrs == null || !attrs.contains("style=")) {
|
||||
img.append(" style=\"max-width:100%;height:auto;\"");
|
||||
}
|
||||
|
||||
img.append(" />");
|
||||
matcher.appendReplacement(result, Matcher.quoteReplacement(img.toString()));
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 확장자를 Content-Type으로 변환
|
||||
*
|
||||
* @param extension 파일 확장자
|
||||
* @return MIME 타입
|
||||
*/
|
||||
private String getContentType(String extension) {
|
||||
if (extension == null) {
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
switch (extension.toLowerCase()) {
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return "image/jpeg";
|
||||
case "png":
|
||||
return "image/png";
|
||||
case "gif":
|
||||
return "image/gif";
|
||||
case "bmp":
|
||||
return "image/bmp";
|
||||
case "webp":
|
||||
return "image/webp";
|
||||
case "svg":
|
||||
return "image/svg+xml";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-4
@@ -13,12 +13,16 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@@ -72,14 +76,22 @@ public class PortalTermsManController extends BaseAnnotationController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalterms/portalTermsMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(PortalTermsUI portalTermsUI) throws IOException {
|
||||
portalTermsManService.insert(portalTermsUI);
|
||||
public ResponseEntity<String> insert(PortalTermsUI portalTermsUI,
|
||||
@RequestParam(value = "attachedFile", required = false) MultipartFile attachedFile) throws IOException {
|
||||
portalTermsManService.insert(portalTermsUI, attachedFile);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalterms/portalTermsMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(PortalTermsUI portalTermsUI) throws IOException {
|
||||
portalTermsManService.update(portalTermsUI);
|
||||
public ResponseEntity<String> update(PortalTermsUI portalTermsUI, String usedFileIds,
|
||||
@RequestParam(value = "attachedFile", required = false) MultipartFile attachedFile,
|
||||
@RequestParam(value = "deleteAttachment", defaultValue = "false") boolean deleteAttachment) throws IOException {
|
||||
// 사용 중인 파일 ID 목록 파싱
|
||||
Set<String> usedFileIdSet = new HashSet<>();
|
||||
if (usedFileIds != null && !usedFileIds.isEmpty()) {
|
||||
usedFileIdSet.addAll(Arrays.asList(usedFileIds.split(",")));
|
||||
}
|
||||
portalTermsManService.update(portalTermsUI, usedFileIdSet, attachedFile, deleteAttachment);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,24 @@ import com.eactive.apim.portal.agreements.entity.AgreementType;
|
||||
import com.eactive.apim.portal.agreements.entity.Agreements;
|
||||
import com.eactive.apim.portal.agreements.entity.AgreementsId;
|
||||
import com.eactive.apim.portal.agreements.service.AgreementsService;
|
||||
import com.eactive.apim.portal.file.entity.FileDetail;
|
||||
import com.eactive.apim.portal.file.entity.FileInfo;
|
||||
import com.eactive.apim.portal.file.service.FileService;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserInfoService;
|
||||
import com.eactive.eai.rms.data.entity.onl.apim.portalterms.PortalTermsService;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@@ -21,16 +30,22 @@ public class PortalTermsManService extends BaseService {
|
||||
private final PortalTermsUIMapper portalTermsUIMapper;
|
||||
private final AgreementsService agreementsService;
|
||||
private final UserInfoService userInfoService;
|
||||
private final EditorImageService editorImageService;
|
||||
private final FileService fileService;
|
||||
|
||||
@Autowired
|
||||
public PortalTermsManService(PortalTermsService portalTermsService,
|
||||
PortalTermsUIMapper portalTermsUIMapper,
|
||||
AgreementsService agreementsService,
|
||||
UserInfoService userInfoService){
|
||||
UserInfoService userInfoService,
|
||||
EditorImageService editorImageService,
|
||||
FileService fileService){
|
||||
this.portalTermsService = portalTermsService;
|
||||
this.portalTermsUIMapper = portalTermsUIMapper;
|
||||
this.agreementsService = agreementsService;
|
||||
this.userInfoService = userInfoService;
|
||||
this.editorImageService = editorImageService;
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
private String findName(String userId) {
|
||||
@@ -55,25 +70,90 @@ public class PortalTermsManService extends BaseService {
|
||||
portalTermsUI.setCreatedByName(findName(agreements.getCreatedBy()));
|
||||
portalTermsUI.setLastModifiedByName(findName(agreements.getLastModifiedBy()));
|
||||
portalTermsUI.setName(agreements.getAgreementsType().getDescription());
|
||||
|
||||
// 첨부파일 정보 조회
|
||||
if (StringUtils.isNotBlank(agreements.getAttachedFileId())) {
|
||||
try {
|
||||
FileInfo fileInfo = fileService.findById(agreements.getAttachedFileId());
|
||||
if (fileInfo != null && !fileInfo.getFileDetails().isEmpty()) {
|
||||
FileDetail fileDetail = fileInfo.getFileDetails().get(0);
|
||||
portalTermsUI.setAttachedFileName(fileDetail.getOriginalFileName() + "." + fileDetail.getFileExtension());
|
||||
portalTermsUI.setAttachedFileSize((long) fileDetail.getFileSize());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 파일 조회 실패 시 무시
|
||||
logger.warn("첨부파일 조회 실패: {}", agreements.getAttachedFileId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
return portalTermsUI;
|
||||
}
|
||||
|
||||
public void insert(PortalTermsUI portalTermsUI) {
|
||||
public void insert(PortalTermsUI portalTermsUI, MultipartFile attachedFile) throws IOException {
|
||||
portalTermsUI.setName(AgreementType.fromCode(portalTermsUI.getAgreementsType()).getDescription());
|
||||
portalTermsUI.setContents(StringEscapeUtils.unescapeHtml(portalTermsUI.getContents()));
|
||||
Agreements agreements = portalTermsUIMapper.toEntity(portalTermsUI);
|
||||
|
||||
// 첨부파일 저장
|
||||
if (attachedFile != null && !attachedFile.isEmpty()) {
|
||||
FileInfo fileInfo = fileService.createOrUpdateSingleFile(null, attachedFile, attachedFile.getOriginalFilename());
|
||||
agreements.setAttachedFileId(fileInfo.getFileId());
|
||||
}
|
||||
|
||||
agreementsService.save(agreements);
|
||||
}
|
||||
|
||||
public void update(PortalTermsUI portalTermsUI) {
|
||||
public void update(PortalTermsUI portalTermsUI, Set<String> usedFileIds,
|
||||
MultipartFile attachedFile, boolean deleteAttachment) throws IOException {
|
||||
Agreements agreements = agreementsService.findById(portalTermsUI.getAgreementsType(), portalTermsUI.getRevision());
|
||||
|
||||
// 원래 내용에서 사용 중이던 파일 ID 추출
|
||||
Set<String> originalFileIds = editorImageService.extractFileIds(agreements.getContents());
|
||||
|
||||
// 내용 업데이트
|
||||
agreements.setName(AgreementType.fromCode(portalTermsUI.getAgreementsType()).getDescription());
|
||||
agreements.setContents(StringEscapeUtils.unescapeHtml(portalTermsUI.getContents()));
|
||||
agreements.setPublishedOn(portalTermsUI.getPublishedOn());
|
||||
|
||||
// 첨부파일 처리
|
||||
String oldAttachedFileId = agreements.getAttachedFileId();
|
||||
|
||||
if (deleteAttachment && StringUtils.isNotBlank(oldAttachedFileId)) {
|
||||
// 첨부파일 삭제 요청
|
||||
fileService.deleteFile(oldAttachedFileId);
|
||||
agreements.setAttachedFileId(null);
|
||||
} else if (attachedFile != null && !attachedFile.isEmpty()) {
|
||||
// 새 첨부파일 업로드
|
||||
FileInfo fileInfo = fileService.createOrUpdateSingleFile(
|
||||
oldAttachedFileId, attachedFile, attachedFile.getOriginalFilename());
|
||||
agreements.setAttachedFileId(fileInfo.getFileId());
|
||||
}
|
||||
|
||||
agreementsService.save(agreements);
|
||||
|
||||
// 미사용 이미지 정리 (저장 후 비동기적으로 처리)
|
||||
editorImageService.cleanupUnusedImages(usedFileIds, originalFileIds);
|
||||
}
|
||||
|
||||
public void delete(String agreementsType, Integer revision) {
|
||||
// 삭제 전 사용 중인 파일 ID 추출
|
||||
Agreements agreements = agreementsService.findById(agreementsType, revision);
|
||||
Set<String> fileIdsToDelete = editorImageService.extractFileIds(agreements.getContents());
|
||||
String attachedFileId = agreements.getAttachedFileId();
|
||||
|
||||
// 약관 삭제
|
||||
agreementsService.delete(agreementsType, revision);
|
||||
|
||||
// 관련 이미지 모두 삭제
|
||||
editorImageService.cleanupUnusedImages(new HashSet<>(), fileIdsToDelete);
|
||||
|
||||
// 첨부파일 삭제
|
||||
if (StringUtils.isNotBlank(attachedFileId)) {
|
||||
try {
|
||||
fileService.deleteFile(attachedFileId);
|
||||
} catch (Exception e) {
|
||||
logger.warn("첨부파일 삭제 실패: {}", attachedFileId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,13 @@ public class PortalTermsUI {
|
||||
|
||||
private String searchAgreementsType;
|
||||
|
||||
/* 첨부파일 ID */
|
||||
private String attachedFileId;
|
||||
|
||||
/* 첨부파일명 (조회용) */
|
||||
private String attachedFileName;
|
||||
|
||||
/* 첨부파일 크기 (조회용) */
|
||||
private Long attachedFileSize;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.eactive.eai.rms.onl.audit.adapter.ui.AuditUI;
|
||||
@Mapper(config = BaseMapperConfig.class, uses = {})
|
||||
public interface AuditUIMapper {
|
||||
|
||||
@Mapping(target = "revTstmp", expression = "java(mapLongToString(entity.getRevTstmp()))")
|
||||
@Mapping(target = "revTstmp", source = "revTstmp")
|
||||
@Mapping(target = "revNo", source = "rev")
|
||||
@Mapping(target = "revUserId", source = "userId")
|
||||
void map(CustomRevisionEntity entity, @MappingTarget AuditUI auditUI);
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.eactive.eai.rms.onl.common.service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.util.CommonUtil;
|
||||
import com.eactive.eai.rms.onl.apim.obp.ObpGwMetricManService;
|
||||
import com.eactive.eai.rms.onl.common.util.DateUtil;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* ObpGwMetric Hour Job - Quartz Job
|
||||
* API Gateway 로그 데이터를 1시간 단위로 집계하여 ObpGwMetric 테이블에 저장
|
||||
*
|
||||
* <p>Cron Schedule 권장:</p>
|
||||
* <ul>
|
||||
* <li>기본: 0 5 * * * ? (매시 05분 1회 실행)</li>
|
||||
* <li>보정 (15분): 0 5,20,35,50 * * * ? (15분 간격 4회 실행)</li>
|
||||
* <li>보정 (10분): 0 5,15,25,35,45,55 * * * ? (10분 간격 6회 실행)</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Job 파라미터 (JobDataMap):</p>
|
||||
* <ul>
|
||||
* <li><b>aggregation.hour.range</b>: 집계 범위 시간 (단위: 시간, 기본값: 1)
|
||||
* <ul>
|
||||
* <li>1: 직전 1시간만 집계</li>
|
||||
* <li>3: 직전 3시간 각각 집계</li>
|
||||
* <li>5: 직전 5시간 각각 집계</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>예시 (Quartz 스케줄 등록 시):</p>
|
||||
* <pre>
|
||||
* JobDataMap jobDataMap = new JobDataMap();
|
||||
* jobDataMap.put("aggregation.hour.range", "3");
|
||||
* </pre>
|
||||
*/
|
||||
public class ObpGwMetricHourJob implements Job {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ObpGwMetricHourJob.class);
|
||||
|
||||
/** Job 파라미터 키: 집계 범위 시간 */
|
||||
public static final String PARAM_AGGREGATION_HOUR_RANGE = "aggregation.hour.range";
|
||||
|
||||
/** 기본 집계 범위 시간 (시간 단위) */
|
||||
public static final int DEFAULT_AGGREGATION_HOUR_RANGE = 1;
|
||||
|
||||
private transient MonitoringContext monitoringContext;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
log.info("*** START ObpGwMetricHourJob run({})", CommonUtil.getToday("yyyy-MM-dd HH:mm"));
|
||||
|
||||
// Job 파라미터 로깅
|
||||
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
|
||||
logJobParameters(jobDataMap);
|
||||
|
||||
ApplicationContext appContext;
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
} catch (SchedulerException e) {
|
||||
log.error("applicationContext get module error", e);
|
||||
return;
|
||||
}
|
||||
|
||||
monitoringContext = (MonitoringContext) appContext.getBean("monitoringContext");
|
||||
ObpGwMetricManService obpGwMetricManService = appContext.getBean(ObpGwMetricManService.class);
|
||||
|
||||
// 집계 범위 시간 파라미터 파싱
|
||||
int aggregationHourRange = parseAggregationHourRange(jobDataMap);
|
||||
|
||||
try {
|
||||
obpGwMetricManService.executeHourlyAggregation(aggregationHourRange);
|
||||
} catch (Exception e) {
|
||||
log.error("ObpGwMetricHourJob execution failed", e);
|
||||
throw new JobExecutionException(e);
|
||||
}
|
||||
|
||||
log.info("*** END ObpGwMetricHourJob run({})", DateUtil.getDateTime("yyyy-MM-dd HH:mm"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 파라미터 로깅
|
||||
*/
|
||||
private void logJobParameters(JobDataMap jobDataMap) {
|
||||
if (jobDataMap == null || jobDataMap.isEmpty()) {
|
||||
log.debug("Job 파라미터 없음 (기본값 사용)");
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder("Job 파라미터: ");
|
||||
for (String key : jobDataMap.getKeys()) {
|
||||
sb.append(key).append("=").append(jobDataMap.getString(key)).append(", ");
|
||||
}
|
||||
log.info(sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 집계 범위 시간 파라미터 파싱
|
||||
*
|
||||
* @param jobDataMap Job 파라미터 맵
|
||||
* @return 집계 범위 시간 (파싱 실패 시 기본값 반환)
|
||||
*/
|
||||
private int parseAggregationHourRange(JobDataMap jobDataMap) {
|
||||
if (jobDataMap == null) {
|
||||
return DEFAULT_AGGREGATION_HOUR_RANGE;
|
||||
}
|
||||
|
||||
try {
|
||||
String value = jobDataMap.getString(PARAM_AGGREGATION_HOUR_RANGE);
|
||||
if (value != null && !value.trim().isEmpty()) {
|
||||
int parsedValue = Integer.parseInt(value.trim());
|
||||
if (parsedValue < 1) {
|
||||
log.warn("aggregation.hour.range 값이 1 미만입니다. 기본값({}) 사용: input={}",
|
||||
DEFAULT_AGGREGATION_HOUR_RANGE, parsedValue);
|
||||
return DEFAULT_AGGREGATION_HOUR_RANGE;
|
||||
}
|
||||
// 개발 모드(D)가 아닌 경우에만 24시간 제한 적용
|
||||
if (parsedValue > 24 && !isDevMode()) {
|
||||
log.warn("aggregation.hour.range 값이 24 초과입니다. 24로 제한: input={}", parsedValue);
|
||||
return 24;
|
||||
}
|
||||
return parsedValue;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("aggregation.hour.range 파싱 실패, 기본값({}) 사용: {}",
|
||||
DEFAULT_AGGREGATION_HOUR_RANGE, e.getMessage());
|
||||
}
|
||||
|
||||
return DEFAULT_AGGREGATION_HOUR_RANGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 개발 모드 여부 확인
|
||||
* @return eai.systemmode=D 이면 true
|
||||
*/
|
||||
private boolean isDevMode() {
|
||||
String systemMode = System.getProperty("eai.systemmode", "");
|
||||
return "D".equalsIgnoreCase(systemMode);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.util.FileSystemUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
@@ -75,7 +76,7 @@ public class TransactionReportHourJob implements Job {
|
||||
}
|
||||
|
||||
String trTime = monitoringContext.getStringProperty(MonitoringContext.RMS_TRANSACTION_LOG_TIME, "");
|
||||
if( trTime.indexOf("EVERY_HOUR") > -1 ) {
|
||||
if (trTime.contains("EVERY_HOUR")) {
|
||||
// go on
|
||||
} else if (!StringUtils.contains(trTime, hour)) {
|
||||
return;
|
||||
@@ -93,9 +94,11 @@ public class TransactionReportHourJob implements Job {
|
||||
+ CommonUtil.getToday("yyyy-MM-dd HH:mm") + ")");
|
||||
}
|
||||
|
||||
String pathDir = monitoringContext.getStringProperty( MonitoringContext.RMS_TRANSACTION_LOG_PATH,"/fslog/eai/")
|
||||
+ monitoringContext.getStringProperty( Keys.SERVER_KEY)
|
||||
+ "/trlog";
|
||||
String pathDir = FileSystemUtil.pathNormalize(
|
||||
monitoringContext.getStringProperty( MonitoringContext.RMS_TRANSACTION_LOG_PATH,"/fslog/eai/")
|
||||
, monitoringContext.getStringProperty( Keys.SERVER_KEY)
|
||||
, "trlog"
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// 로컬테스트용
|
||||
|
||||
@@ -17,13 +17,14 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -43,9 +44,10 @@ public class UmsDispatchService {
|
||||
private EntityManager entityManager;
|
||||
|
||||
private final MessageRequestRepository messageRequestRepository;
|
||||
private final KjbUmsService kjbUmsService;
|
||||
private final KjbEmailSendModule kjbEmailSendModule;
|
||||
private KjbUmsService kjbUmsService;
|
||||
private KjbEmailSendModule kjbEmailSendModule;
|
||||
private final KjbPropertyInjector kjbPropertyInjector;
|
||||
private KjbProperty kjbProperty;
|
||||
|
||||
|
||||
@Autowired
|
||||
@@ -55,11 +57,7 @@ public class UmsDispatchService {
|
||||
MessageRequestRepository messageRequestRepository
|
||||
) {
|
||||
this.kjbPropertyInjector = new KjbPropertyInjector(monitoringPropertyService, PROP_GORUP_ID);
|
||||
|
||||
this.messageRequestRepository = messageRequestRepository;
|
||||
// this.kjbEmailService = kjbEmailService;
|
||||
// this.kjbSafedbWrapper = kjbSafedbWrapper;
|
||||
// this.monitoringPropertyService = monitoringPropertyService;
|
||||
|
||||
this.executorService = new ThreadPoolExecutor(
|
||||
CORE_POOL_SIZE,
|
||||
@@ -72,20 +70,40 @@ public class UmsDispatchService {
|
||||
this.transactionTemplate = new TransactionTemplate(transactionManager);
|
||||
log.debug("UmsDispatchService initialized with thread pool - core: {}, max: {}, queue: {}",
|
||||
CORE_POOL_SIZE, MAX_POOL_SIZE, QUEUE_CAPACITY);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.kjbProperty = kjbPropertyInjector.inject(new KjbProperty());
|
||||
|
||||
KjbProperty prop = new KjbProperty();
|
||||
// prop.setEaiBatchUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.url"));
|
||||
// prop.setUmsEaiBatchSendDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.send_dir"));
|
||||
// prop.setUmsEaiBatchBackupDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.backup_dir"));
|
||||
// prop.setUmsEaiBatchInterfaceId(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.interface_id"));
|
||||
// prop.setUmsHostUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.host_url"));
|
||||
// prop.setUmsApiKey(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.api_key"));
|
||||
prop = kjbPropertyInjector.inject(prop);
|
||||
try {
|
||||
this.kjbUmsService = new KjbUmsService(kjbProperty);
|
||||
this.kjbEmailSendModule = KjbEmailSendModule.getInstance(kjbProperty, messageRequestRepository);
|
||||
log.info("KjbUmsService and KjbEmailSendModule initialized successfully");
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to initialize KjbUmsService or KjbEmailSendModule: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
this.kjbUmsService = new KjbUmsService(prop);
|
||||
/**
|
||||
* URL 설정값이 비어있을 경우 DB에서 재로딩 후 서비스 재초기화
|
||||
*/
|
||||
private void reloadPropertyIfNeeded() {
|
||||
if (!kjbPropertyInjector.isUrlConfigured(kjbProperty)) {
|
||||
log.info("KjbProperty URL 값이 비어있어 재로딩 시도");
|
||||
KjbProperty reloaded = kjbPropertyInjector.reloadIfUrlEmpty(kjbProperty);
|
||||
|
||||
this.kjbEmailSendModule = KjbEmailSendModule.getInstance(prop, messageRequestRepository);
|
||||
if (reloaded != kjbProperty && kjbPropertyInjector.isUrlConfigured(reloaded)) {
|
||||
this.kjbProperty = reloaded;
|
||||
try {
|
||||
this.kjbUmsService = new KjbUmsService(kjbProperty);
|
||||
this.kjbEmailSendModule = KjbEmailSendModule.getInstance(kjbProperty, messageRequestRepository);
|
||||
log.info("KjbProperty 재로딩 후 서비스 재초기화 완료");
|
||||
} catch (Exception e) {
|
||||
log.error("KjbProperty 재로딩 후 서비스 재초기화 실패: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -93,7 +111,10 @@ public class UmsDispatchService {
|
||||
public void processMessages() {
|
||||
log.info("Starting to process pending messages");
|
||||
|
||||
// 상태가 PENDING인 메시지들을 조회하고 바로 PROCESSING으로 변경
|
||||
// URL 설정값이 비어있을 경우 DB에서 재로딩 시도
|
||||
reloadPropertyIfNeeded();
|
||||
|
||||
// 상태가 PENDING인 메시지들을 조회하고 바로 PROCESSING으로 변경
|
||||
List<MessageRequest> pendingMessages = entityManager.createQuery(
|
||||
"SELECT m FROM MessageRequest m WHERE m.requestStatus = :status " +
|
||||
"ORDER BY m.requestDate ASC")
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.rms.onl.common.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class FileSystemUtil {
|
||||
|
||||
/**
|
||||
* Normalizes a path by joining segments and applying the correct file separator for the current operating system.
|
||||
* It handles redundant separators between segments.
|
||||
*
|
||||
* <p>Examples for Linux/macOS:</p>
|
||||
* <ul>
|
||||
* <li>{@code pathNormalize("/asd1/asd2", "asd3")} returns {@code "/asd1/asd2/asd3"}</li>
|
||||
* <li>{@code pathNormalize("/asd1/asd2/", "/asd3")} returns {@code "/asd1/asd2/asd3"}</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Examples for Windows:</p>
|
||||
* <ul>
|
||||
* <li>{@code pathNormalize("C:/Users/Test", "Documents")} returns {@code "C:\\Users\\Test\\Documents"}</li>
|
||||
* <li>{@code pathNormalize("C:/Users/Test/", "/Documents")} returns {@code "C:\\Users\\Test\\Documents"}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param args A variable number of path segments to join.
|
||||
* @return A normalized path string for the current operating system.
|
||||
*/
|
||||
public static String pathNormalize(String... args) {
|
||||
if (args == null || args.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringJoiner joiner = new StringJoiner(File.separator);
|
||||
for (String arg : args) {
|
||||
if (arg != null && !arg.isEmpty()) {
|
||||
String segment = arg;
|
||||
// Remove leading separators from the segment
|
||||
while (segment.startsWith("/") || segment.startsWith("\\")) {
|
||||
segment = segment.substring(1);
|
||||
}
|
||||
// Remove trailing separators from the segment
|
||||
while (segment.endsWith("/") || segment.endsWith("\\")) {
|
||||
segment = segment.substring(0, segment.length() - 1);
|
||||
}
|
||||
if (!segment.isEmpty()) {
|
||||
joiner.add(segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String joinedPath = joiner.toString();
|
||||
|
||||
// Handle the root path for the first argument
|
||||
String firstArg = args[0];
|
||||
if (firstArg != null && !firstArg.isEmpty()) {
|
||||
if (firstArg.startsWith("/")) {
|
||||
joinedPath = File.separator + joinedPath;
|
||||
} else if (firstArg.matches("^[a-zA-Z]:\\\\") || firstArg.matches("^[a-zA-Z]:/.*")) { // Handle Windows drive letters, e.g., "C:\" or "C:/"
|
||||
String drive = firstArg.substring(0, 2);
|
||||
return drive + File.separator + joinedPath.substring(joinedPath.indexOf(File.separator) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Final normalization for Windows if the path starts with a separator (e.g. from a UNC path)
|
||||
if (System.getProperty("os.name").toLowerCase().contains("win")) {
|
||||
if (args[0] != null && args[0].startsWith("//") || args[0].startsWith("\\\\")) {
|
||||
return "\\\\" + joinedPath;
|
||||
}
|
||||
return joinedPath.replace("/", "\\");
|
||||
}
|
||||
|
||||
return joinedPath.replace("\\", "/");
|
||||
}
|
||||
}
|
||||
+8
-12
@@ -223,10 +223,6 @@ public class ModernDashboardController implements InterceptorSkipController {
|
||||
@RequestMapping(path = "/modern-dashboard-api.do", params = "type=adapter-status")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getAdapterStatus(@RequestParam(required = false) String serverName) {
|
||||
// TODO: 디버그 완료 후 삭제
|
||||
System.out.println("========================================");
|
||||
System.out.println("[Dashboard Debug] getAdapterStatus API CALLED!");
|
||||
System.out.println("========================================");
|
||||
log.error("[Dashboard Debug] getAdapterStatus API CALLED - serverName: " + serverName);
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
@@ -254,26 +250,26 @@ public class ModernDashboardController implements InterceptorSkipController {
|
||||
|
||||
// TODO: 디버그 완료 후 아래 디버그 로그 전체 삭제 (라인 254-299)
|
||||
// [Dashboard Debug] Check server list size
|
||||
System.out.println("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check.");
|
||||
// System.out.println("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check.");
|
||||
log.error("[Dashboard Debug] getAdapterStatus: Found " + (servers == null ? 0 : servers.size()) + " servers to check.");
|
||||
|
||||
List<Map<String, Object>> serverAdapters = new ArrayList<>();
|
||||
|
||||
for (DataSourceType server : servers) {
|
||||
System.out.println("[Dashboard Debug] Loop for server: " + server.getName());
|
||||
// System.out.println("[Dashboard Debug] Loop for server: " + server.getName());
|
||||
log.error("[Dashboard Debug] Loop for server: " + server.getName());
|
||||
// 서버 컨텍스트 설정
|
||||
DataSourceContextHolder.setDataSourceType(server);
|
||||
|
||||
// 서버에 대한 인스턴스 목록 조회
|
||||
System.out.println("[Dashboard Debug] Calling getEaiServerIpListDB...");
|
||||
// System.out.println("[Dashboard Debug] Calling getEaiServerIpListDB...");
|
||||
List<Map<String, String>> ipList = eaiServerInfoService.getEaiServerIpListDB();
|
||||
System.out.println("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size()));
|
||||
// System.out.println("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size()));
|
||||
log.error("[Dashboard Debug] Call to getEaiServerIpListDB finished. IP list size: " + (ipList == null ? 0 : ipList.size()));
|
||||
|
||||
// 어댑터 상태 목록 조회 (개별 인스턴스별 상태)
|
||||
List<AdaptersVO> adaptersList = dashboardService.findAdapterStatusList(ipList);
|
||||
System.out.println("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size()));
|
||||
// System.out.println("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size()));
|
||||
log.error("[Dashboard Debug] adaptersList size: " + (adaptersList == null ? "null" : adaptersList.size()));
|
||||
|
||||
// 어댑터별 상태 코드 로깅
|
||||
@@ -288,7 +284,7 @@ public class ModernDashboardController implements InterceptorSkipController {
|
||||
", Socket counts: [" + vo.getSocket(0) + "," + vo.getSocket(1) + "," + vo.getSocket(2) + "]" +
|
||||
", Socket2 counts: [" + vo.getSocket2(0) + "," + vo.getSocket2(1) + "," + vo.getSocket2(2) + "]" +
|
||||
", Http counts: [" + vo.getHttp(0) + "," + vo.getHttp(1) + "," + vo.getHttp(2) + "]";
|
||||
System.out.println(debugMsg);
|
||||
// System.out.println(debugMsg);
|
||||
log.error(debugMsg);
|
||||
}
|
||||
}
|
||||
@@ -305,8 +301,8 @@ public class ModernDashboardController implements InterceptorSkipController {
|
||||
", normal=" + summaryContainer.getAdapterSummary("HTTP").getNormalCount() +
|
||||
", inactive=" + summaryContainer.getAdapterSummary("HTTP").getInactiveCount() +
|
||||
", overall=" + summaryContainer.getAdapterSummary("HTTP").getOverallStatus();
|
||||
System.out.println(socketSummary);
|
||||
System.out.println(httpSummary);
|
||||
// System.out.println(socketSummary);
|
||||
// System.out.println(httpSummary);
|
||||
log.error(socketSummary);
|
||||
log.error(httpSummary);
|
||||
// TODO: 여기까지 디버그 로그 삭제
|
||||
|
||||
+31
-11
@@ -2,6 +2,8 @@ package com.eactive.eai.rms.onl.dashboard.modern.mapper;
|
||||
|
||||
import com.eactive.eai.rms.onl.dashboard.modern.dto.SmsNotificationDto;
|
||||
import com.eactive.eai.rms.onl.vo.SmsVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -21,6 +23,9 @@ public class SmsNotificationMapper {
|
||||
|
||||
private static final Pattern DATE_TIME_PATTERN = Pattern.compile("(\\d{4}) (\\d{2}:\\d{2}:\\d{2}\\.\\d{3})");
|
||||
private static final Pattern COUNT_PATTERN = Pattern.compile("\\[(\\d+)\\]");
|
||||
|
||||
// Sysout --> logger
|
||||
private static final Logger logger = Logger.getLogger(SmsNotificationMapper.class);
|
||||
|
||||
/**
|
||||
* SmsVO 목록을 SmsNotificationDto 목록으로 변환합니다.
|
||||
@@ -148,22 +153,37 @@ public class SmsNotificationMapper {
|
||||
smsVO.setMessage(messages);
|
||||
List<SmsNotificationDto> results = mapper.mapToSmsNotificationDtoList(Arrays.asList(smsVO));
|
||||
|
||||
System.out.println("=== SMS 메시지 파싱 결과 ===");
|
||||
// System.out.println("=== SMS 메시지 파싱 결과 ===");
|
||||
logger.debug("=== SMS 메시지 파싱 결과 ===");
|
||||
for (SmsNotificationDto dto : results) {
|
||||
System.out.println("\n[메시지 정보]");
|
||||
System.out.println("시간: " + dto.getDateTime());
|
||||
System.out.println("건수: " + dto.getCount());
|
||||
System.out.println("인스턴스: " + dto.getInstanceName());
|
||||
System.out.println("에러내용: " + dto.getErrorContent());
|
||||
System.out.println("에러유형: " + dto.getErrorType());
|
||||
// System.out.println("\n[메시지 정보]");
|
||||
// System.out.println("시간: " + dto.getDateTime());
|
||||
// System.out.println("건수: " + dto.getCount());
|
||||
// System.out.println("인스턴스: " + dto.getInstanceName());
|
||||
// System.out.println("에러내용: " + dto.getErrorContent());
|
||||
// System.out.println("에러유형: " + dto.getErrorType());
|
||||
|
||||
logger.debug("\n[메시지 정보]");
|
||||
logger.debug("시간: " + dto.getDateTime());
|
||||
logger.debug("건수: " + dto.getCount());
|
||||
logger.debug("인스턴스: " + dto.getInstanceName());
|
||||
logger.debug("에러내용: " + dto.getErrorContent());
|
||||
logger.debug("에러유형: " + dto.getErrorType());
|
||||
|
||||
if ("ADAPTER".equals(dto.getErrorType())) {
|
||||
System.out.println("어댑터설명: " + dto.getAdapterDesc());
|
||||
System.out.println("어댑터ID: " + dto.getAdapterId());
|
||||
// System.out.println("어댑터설명: " + dto.getAdapterDesc());
|
||||
// System.out.println("어댑터ID: " + dto.getAdapterId());
|
||||
|
||||
logger.debug("어댑터설명: " + dto.getAdapterDesc());
|
||||
logger.debug("어댑터ID: " + dto.getAdapterId());
|
||||
} else {
|
||||
System.out.println("인터페이스ID: " + dto.getInterfaceId());
|
||||
// System.out.println("인터페이스ID: " + dto.getInterfaceId());
|
||||
|
||||
logger.debug("인터페이스ID: " + dto.getInterfaceId());
|
||||
}
|
||||
System.out.println("------------------------");
|
||||
// System.out.println("------------------------");
|
||||
|
||||
logger.debug("------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -432,7 +433,7 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
@PostMapping(value = "/onl/admin/adapter/adapterMan.file", params = "cmd=LIST_IMPORT_FILE")
|
||||
public ResponseEntity<?> listImportFromFile(
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
@RequestParam("file") MultipartFile file, boolean importDupliCheck) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -445,7 +446,7 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
synchronized (obj) {
|
||||
AdapterGroupUI importedUI = service
|
||||
.importAdapterFromJson(file);
|
||||
.importAdapterFromJson(file, importDupliCheck);
|
||||
|
||||
Map<String, String> resultMap = service
|
||||
.reloadSync(importedUI);
|
||||
@@ -456,6 +457,10 @@ public class AdapterController extends OnlBaseAnnotationController {
|
||||
|
||||
}
|
||||
|
||||
} catch (IllegalStateException dupEx) {
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.CONFLICT)
|
||||
.body(dupEx.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
return ResponseEntity.internalServerError()
|
||||
|
||||
+20
-5
@@ -565,7 +565,7 @@ public class AdapterManService extends OnlBaseService {
|
||||
return adapterPropLoader.findSnaAppcodeProps((String) map.get("searchPrptygroupName"));
|
||||
}
|
||||
|
||||
public AdapterGroupUI importAdapterFromJson(MultipartFile file) throws Exception {
|
||||
public AdapterGroupUI importAdapterFromJson(MultipartFile file, boolean importDupliCheck) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw new IOException("File is empty");
|
||||
}
|
||||
@@ -574,13 +574,28 @@ public class AdapterManService extends OnlBaseService {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.addMixIn(AdapterGroupUI.class, AdapterGroupUIMixIn.class);
|
||||
AdapterGroupUI adapterGroupUI = objectMapper.readValue(inputStream, AdapterGroupUI.class);
|
||||
|
||||
if(!adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname())){
|
||||
|
||||
String adapterGrpupName = adapterGroupUI.getAdptrbzwkgroupname();
|
||||
boolean adapterGroupExists = adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname());
|
||||
|
||||
if (adapterGroupExists) {
|
||||
|
||||
if (importDupliCheck) {
|
||||
throw new IllegalStateException("AdapterGroup already exists [ " + adapterGrpupName + " ]" );
|
||||
} else {
|
||||
update(adapterGroupUI);
|
||||
}
|
||||
|
||||
} else {
|
||||
insert(adapterGroupUI);
|
||||
}else{
|
||||
update(adapterGroupUI);
|
||||
}
|
||||
|
||||
// if(!adapterGroupService.existsById(adapterGroupUI.getAdptrbzwkgroupname())){
|
||||
// insert(adapterGroupUI);
|
||||
// }else{
|
||||
// update(adapterGroupUI);
|
||||
// }
|
||||
|
||||
return adapterGroupUI;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.eaimsg.ApiScopeSearch;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -11,6 +20,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
@@ -53,6 +63,25 @@ public class ApiScopeController extends OnlBaseAnnotationController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authserver/apiScopeMan.json", params = "cmd=INSERT_APILIST")
|
||||
public ResponseEntity<Void> insertApiScopeList(@RequestParam("apiList") String apiListJson, @RequestParam("scopeId") String scopeId) {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<ApiScopeUI> apiScopeList = null;
|
||||
|
||||
try {
|
||||
apiScopeList = mapper.readValue(apiListJson, new TypeReference<List<ApiScopeUI>>(){});
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BizException("데이터 변환 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
apiScopeManService.insertApiScopeRelationList(apiScopeList, scopeId);
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/onl/admin/authserver/apiScopeMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> deleteApiScope(ApiScopeUI apiScopeUI) {
|
||||
apiScopeManService.deleteApiScopeRelation(apiScopeUI);
|
||||
|
||||
+31
-1
@@ -11,6 +11,8 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseService;
|
||||
import com.eactive.eai.rms.common.spring.LocaleMessage;
|
||||
import com.eactive.eai.rms.data.entity.onl.authserver.ScopeEntityService;
|
||||
@@ -56,10 +58,12 @@ public class ApiScopeManService extends OnlBaseService {
|
||||
|
||||
private ApiScopeUI convertToApiScopeUI(ApiScopeDto dto) {
|
||||
ApiScopeUI apiScopeUI = new ApiScopeUI();
|
||||
apiScopeUI.setEaiSvcDesc(dto.getEaiSvcDesc());
|
||||
apiScopeUI.setApiDesc(dto.getEaiSvcDesc());
|
||||
apiScopeUI.setScopeId(dto.getScopeId());
|
||||
apiScopeUI.setBzwkSvcKeyName(dto.getBzwkSvcKeyName());
|
||||
apiScopeUI.setScopeName(dto.getScopeName());
|
||||
apiScopeUI.setApiFullPath(dto.getApiFullPath());
|
||||
apiScopeUI.setApiId(dto.getEaiSvcName());
|
||||
return apiScopeUI;
|
||||
}
|
||||
|
||||
@@ -72,6 +76,32 @@ public class ApiScopeManService extends OnlBaseService {
|
||||
scopeEntityService.save(apiScopeUIMapper.toEntity(apiScopeUI));
|
||||
}
|
||||
|
||||
public void insertApiScopeRelationList(List<ApiScopeUI> apiScopeList, String scopeId) {
|
||||
// ScopeId 기준 전체 삭제 후 LIST 기준으로 저장.
|
||||
if(scopeId == null || scopeId.isEmpty()) {
|
||||
throw new BizException("ScopeId 가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
scopeEntityService.deleteByIdScopeId(scopeId);
|
||||
|
||||
if(apiScopeList == null || apiScopeList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ApiScopeUI ui : apiScopeList) {
|
||||
ui.setScopeId(scopeId);
|
||||
|
||||
scopeEntityService.save(apiScopeUIMapper.toEntity(ui));
|
||||
|
||||
CommonCommand.builder()
|
||||
.name(CommonCommand.RELOAD_API_SCOPE_COMMAND)
|
||||
.args(new String[] {ReloadApiScopeCommand.COMMAND_TYPE_API_SCOPE,
|
||||
ui.getBzwkSvcKeyName(), ui.getScopeId()})
|
||||
.build()
|
||||
.broadcast(agentUtilService);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApiScopeRelation(ApiScopeUI apiScopeUI) {
|
||||
scopeEntityService.deleteById(apiScopeUIMapper.toId(apiScopeUI));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.eactive.eai.rms.onl.manage.authserver.scope;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor // jackson 사용을 위해 추가.
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ApiScopeUI {
|
||||
|
||||
@JsonProperty("SCOPEID")
|
||||
@@ -16,7 +20,13 @@ public class ApiScopeUI {
|
||||
@JsonProperty("SCOPENAME")
|
||||
private String scopeName;
|
||||
|
||||
@JsonProperty("EAISVCDESC")
|
||||
private String eaiSvcDesc;
|
||||
@JsonProperty("apiDesc")
|
||||
private String apiDesc;
|
||||
|
||||
@JsonProperty("APIFULLPATH")
|
||||
private String apiFullPath;
|
||||
|
||||
@JsonProperty("apiId")
|
||||
private String apiId;
|
||||
|
||||
}
|
||||
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.group;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
public class InflowGroupControlManController extends OnlBaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private InflowGroupControlManService service;
|
||||
|
||||
@Autowired
|
||||
private ComboService comboService;
|
||||
|
||||
private ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
// ========== View Mappings ==========
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.view")
|
||||
public String viewList() {
|
||||
return "/onl/admin/inflow/inflowGroupControlMan";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.view", params = "cmd=DETAIL")
|
||||
public String viewDetail() {
|
||||
return "/onl/admin/inflow/inflowGroupControlManDetail";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.view", params = "cmd=INTERFACE_POPUP")
|
||||
public String viewInterfacePopup() {
|
||||
return "/onl/admin/inflow/inflowGroupInterfacePopup";
|
||||
}
|
||||
|
||||
// ========== JSON API Mappings ==========
|
||||
|
||||
/**
|
||||
* 그룹 목록 조회
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<InflowGroupControlManUI>> selectList(HttpServletRequest request,
|
||||
Pageable pageVo, String searchGroupName) {
|
||||
Page<InflowGroupControlManUI> uiPage = service.selectGroupList(pageVo, searchGroupName);
|
||||
return ResponseEntity.ok(new GridResponse<>(uiPage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 상세 조회
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<InflowGroupControlManUI> selectDetail(HttpServletRequest request,
|
||||
HttpServletResponse response, String groupId) {
|
||||
InflowGroupControlManUI ui = service.selectGroupDetail(groupId);
|
||||
return ResponseEntity.ok(ui);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 저장 (INSERT)
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<Void> insert(HttpServletRequest request, HttpServletResponse response, InflowGroupControlManUI ui,
|
||||
@RequestParam(value = "interfaceListJson", required = false) String interfaceListJson) throws Exception {
|
||||
parseInterfaceList(ui, interfaceListJson);
|
||||
String modifiedBy = getSessionUserId(request);
|
||||
service.mergeGroup(ui, modifiedBy);
|
||||
|
||||
// Agent Command 전송
|
||||
CommonCommand command = new CommonCommand("com.eactive.eai.agent.inflow.ReloadInflowGroupControlCommand",
|
||||
ui.getGroupId());
|
||||
agentUtilService.broadcast(command);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 저장 (UPDATE)
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<Void> update(HttpServletRequest request, HttpServletResponse response, InflowGroupControlManUI ui,
|
||||
@RequestParam(value = "interfaceListJson", required = false) String interfaceListJson) throws Exception {
|
||||
parseInterfaceList(ui, interfaceListJson);
|
||||
String modifiedBy = getSessionUserId(request);
|
||||
service.mergeGroup(ui, modifiedBy);
|
||||
|
||||
// Agent Command 전송
|
||||
CommonCommand command = new CommonCommand("com.eactive.eai.agent.inflow.ReloadInflowGroupControlCommand",
|
||||
ui.getGroupId());
|
||||
agentUtilService.broadcast(command);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 삭제
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(HttpServletRequest request, HttpServletResponse response, String groupId) throws Exception {
|
||||
service.deleteGroup(groupId);
|
||||
|
||||
// Agent Command 전송
|
||||
CommonCommand command = new CommonCommand("com.eactive.eai.agent.inflow.RemoveInflowGroupControlCommand",
|
||||
groupId);
|
||||
agentUtilService.broadcast(command);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 콤보박스 초기화 데이터
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<ComboVo> useYnRows = comboService.getFromCode("USE_YN");
|
||||
List<ComboVo> timeUnitRows = comboService.getFromCode("INFLOW_CTRL_TIME_UNIT");
|
||||
|
||||
Map<String, List<ComboVo>> resultMap = new HashMap<>();
|
||||
resultMap.put("useYnRows", useYnRows);
|
||||
resultMap.put("timeUnitRows", timeUnitRows);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 인터페이스 목록 조회 (팝업용)
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=INTERFACE_LIST")
|
||||
public ResponseEntity<GridResponse<InflowGroupMappingUI>> selectInterfaceList(HttpServletRequest request,
|
||||
Pageable pageVo, String searchName) {
|
||||
Page<InflowGroupMappingUI> uiPage = service.selectInterfaceListForPopup(pageVo, searchName);
|
||||
return ResponseEntity.ok(new GridResponse<>(uiPage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 인터페이스 중복 등록 체크
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=LIST_CHECK_DUPLICATE")
|
||||
public ModelAndView checkDuplicate(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam("interfaceId") String interfaceId,
|
||||
@RequestParam(value = "groupId", required = false) String groupId) {
|
||||
String existingGroupName = service.checkInterfaceDuplicate(interfaceId, groupId);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("duplicate", existingGroupName != null);
|
||||
resultMap.put("groupName", existingGroupName);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 버킷 상태 조회 (GW 서버별 현황)
|
||||
*/
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowGroupControlMan.json", params = "cmd=LIST_BUCKET_STATUS")
|
||||
public ModelAndView getBucketStatus(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam("groupId") String groupId) {
|
||||
List<Map<String, Object>> statusList = service.getGroupBucketStatus(groupId);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("servers", statusList);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 문자열을 인터페이스 목록으로 변환
|
||||
*/
|
||||
private void parseInterfaceList(InflowGroupControlManUI ui, String interfaceListJson) throws Exception {
|
||||
if (interfaceListJson != null && !interfaceListJson.isEmpty()) {
|
||||
List<InflowGroupMappingUI> interfaceList = objectMapper.readValue(interfaceListJson,
|
||||
new TypeReference<List<InflowGroupMappingUI>>() {
|
||||
});
|
||||
ui.setInterfaceList(interfaceList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 세션에서 사용자 ID 조회
|
||||
*/
|
||||
private String getSessionUserId(HttpServletRequest request) {
|
||||
Object userId = request.getSession().getAttribute("userId");
|
||||
return userId != null ? userId.toString() : "SYSTEM";
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.group;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface InflowGroupControlManMapper {
|
||||
|
||||
InflowGroupControlManUI toVo(InflowControlGroup entity);
|
||||
|
||||
InflowControlGroup toEntity(InflowGroupControlManUI vo);
|
||||
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(InflowGroupControlManUI vo, @MappingTarget InflowControlGroup entity);
|
||||
|
||||
// Mapping Entity <-> UI
|
||||
InflowGroupMappingUI toMappingVo(InflowControlGroupMapping entity);
|
||||
|
||||
InflowControlGroupMapping toMappingEntity(InflowGroupMappingUI vo);
|
||||
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToMappingEntity(InflowGroupMappingUI vo, @MappingTarget InflowControlGroupMapping entity);
|
||||
}
|
||||
+316
@@ -0,0 +1,316 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.group;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroupMapping;
|
||||
import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.data.entity.onl.inflow.InflowControlGroupMappingRepository;
|
||||
import com.eactive.eai.rms.data.entity.onl.inflow.InflowControlGroupRepository;
|
||||
import com.eactive.eai.rms.onl.common.service.EaiServerInfoService;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
|
||||
@Service
|
||||
public class InflowGroupControlManService extends BaseService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InflowGroupControlManService.class);
|
||||
|
||||
@PersistenceContext
|
||||
EntityManager entityManager;
|
||||
|
||||
@Autowired
|
||||
private InflowControlGroupRepository groupRepository;
|
||||
|
||||
@Autowired
|
||||
private InflowControlGroupMappingRepository mappingRepository;
|
||||
|
||||
@Autowired
|
||||
private InflowGroupControlManMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private EaiServerInfoService eaiServerInfoService;
|
||||
|
||||
private RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
/**
|
||||
* 그룹 목록 조회
|
||||
*/
|
||||
public Page<InflowGroupControlManUI> selectGroupList(Pageable pageable, String searchGroupName) {
|
||||
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
|
||||
QInflowControlGroup qGroup = QInflowControlGroup.inflowControlGroup;
|
||||
|
||||
BooleanBuilder boolBuilder = new BooleanBuilder();
|
||||
if (!StringUtils.isEmpty(searchGroupName)) {
|
||||
boolBuilder.and(qGroup.groupName.contains(searchGroupName));
|
||||
}
|
||||
|
||||
List<InflowControlGroup> groupList = jpaQueryFactory
|
||||
.selectFrom(qGroup)
|
||||
.where(boolBuilder)
|
||||
.orderBy(qGroup.groupId.asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
List<InflowGroupControlManUI> uiList = groupList.stream()
|
||||
.map(mapper::toVo)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
long totalCount = jpaQueryFactory
|
||||
.select(qGroup.groupId.count())
|
||||
.from(qGroup)
|
||||
.where(boolBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(uiList, pageable, totalCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 상세 조회 (매핑된 인터페이스 포함)
|
||||
*/
|
||||
public InflowGroupControlManUI selectGroupDetail(String groupId) {
|
||||
Optional<InflowControlGroup> groupOpt = groupRepository.findById(groupId);
|
||||
if (!groupOpt.isPresent()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
InflowGroupControlManUI ui = mapper.toVo(groupOpt.get());
|
||||
|
||||
// 매핑된 인터페이스 목록 조회 (인터페이스 설명 포함)
|
||||
List<InflowGroupMappingUI> mappingList = selectMappingListWithDesc(groupId);
|
||||
ui.setInterfaceList(mappingList);
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹에 매핑된 인터페이스 목록 조회 (인터페이스 설명 포함)
|
||||
*/
|
||||
private List<InflowGroupMappingUI> selectMappingListWithDesc(String groupId) {
|
||||
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
|
||||
QInflowControlGroupMapping qMapping = QInflowControlGroupMapping.inflowControlGroupMapping;
|
||||
QEAIMessageEntity qMessage = QEAIMessageEntity.eAIMessageEntity;
|
||||
|
||||
List<Tuple> tupleList = jpaQueryFactory
|
||||
.select(qMapping, qMessage.eaisvcdesc)
|
||||
.from(qMapping)
|
||||
.leftJoin(qMessage).on(qMapping.interfaceId.eq(qMessage.eaisvcname))
|
||||
.where(qMapping.groupId.eq(groupId))
|
||||
.orderBy(qMapping.interfaceId.asc())
|
||||
.fetch();
|
||||
|
||||
return tupleList.stream()
|
||||
.map(tuple -> {
|
||||
InflowGroupMappingUI mappingUI = mapper.toMappingVo(tuple.get(qMapping));
|
||||
mappingUI.setInterfaceDesc(tuple.get(qMessage.eaisvcdesc));
|
||||
return mappingUI;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 저장 (INSERT/UPDATE)
|
||||
*/
|
||||
@Transactional
|
||||
public void mergeGroup(InflowGroupControlManUI ui, String modifiedBy) {
|
||||
String groupId = ui.getGroupId();
|
||||
boolean isNew = StringUtils.isEmpty(groupId);
|
||||
|
||||
InflowControlGroup entity;
|
||||
if (!isNew) {
|
||||
Optional<InflowControlGroup> groupOpt = groupRepository.findById(groupId);
|
||||
if (groupOpt.isPresent()) {
|
||||
entity = groupOpt.get();
|
||||
mapper.updateToEntity(ui, entity);
|
||||
} else {
|
||||
entity = mapper.toEntity(ui);
|
||||
}
|
||||
} else {
|
||||
entity = mapper.toEntity(ui);
|
||||
}
|
||||
entity.setModifiedBy(modifiedBy);
|
||||
entity.setModifiedAt(LocalDateTime.now());
|
||||
InflowControlGroup savedEntity = groupRepository.saveAndFlush(entity);
|
||||
|
||||
// 저장된 엔티티의 groupId 사용 (신규 생성 시 시퀀스에서 생성된 ID)
|
||||
String savedGroupId = savedEntity.getGroupId();
|
||||
|
||||
// 매핑 정보 저장
|
||||
saveMappings(savedGroupId, ui.getInterfaceList(), modifiedBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹-인터페이스 매핑 저장
|
||||
*/
|
||||
@Transactional
|
||||
public void saveMappings(String groupId, List<InflowGroupMappingUI> interfaceList, String modifiedBy) {
|
||||
// 기존 매핑 삭제
|
||||
mappingRepository.deleteByGroupId(groupId);
|
||||
|
||||
// 새로운 매핑 저장
|
||||
if (interfaceList != null && !interfaceList.isEmpty()) {
|
||||
for (InflowGroupMappingUI mappingUI : interfaceList) {
|
||||
InflowControlGroupMapping mapping = new InflowControlGroupMapping();
|
||||
mapping.setInterfaceId(mappingUI.getInterfaceId());
|
||||
mapping.setGroupId(groupId);
|
||||
// 화면에서 전달된 useYn 사용, 없으면 기본값 "1"
|
||||
String useYn = StringUtils.isNotEmpty(mappingUI.getUseYn()) ? mappingUI.getUseYn() : "1";
|
||||
mapping.setUseYn(useYn);
|
||||
mapping.setModifiedBy(modifiedBy);
|
||||
mapping.setModifiedAt(LocalDateTime.now());
|
||||
mappingRepository.save(mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 삭제
|
||||
*/
|
||||
@Transactional
|
||||
public void deleteGroup(String groupId) {
|
||||
// 매핑 먼저 삭제
|
||||
mappingRepository.deleteByGroupId(groupId);
|
||||
// 그룹 삭제
|
||||
groupRepository.deleteById(groupId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 인터페이스 중복 등록 체크 (다른 그룹에 등록 여부)
|
||||
* @param interfaceId 체크할 인터페이스 ID
|
||||
* @param currentGroupId 현재 그룹 ID (수정 시 자기 그룹 제외, 신규 시 null)
|
||||
* @return 등록된 그룹명 (미등록 시 null)
|
||||
*/
|
||||
public String checkInterfaceDuplicate(String interfaceId, String currentGroupId) {
|
||||
Optional<InflowControlGroupMapping> mappingOpt = mappingRepository.findByInterfaceId(interfaceId);
|
||||
if (!mappingOpt.isPresent()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
InflowControlGroupMapping mapping = mappingOpt.get();
|
||||
String existingGroupId = mapping.getGroupId();
|
||||
|
||||
// 현재 그룹과 동일하면 중복 아님 (수정 시)
|
||||
if (existingGroupId.equals(currentGroupId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 그룹명 조회
|
||||
Optional<InflowControlGroup> groupOpt = groupRepository.findById(existingGroupId);
|
||||
if (groupOpt.isPresent()) {
|
||||
return groupOpt.get().getGroupName();
|
||||
}
|
||||
return existingGroupId; // 그룹명 없으면 ID 반환
|
||||
}
|
||||
|
||||
/**
|
||||
* 인터페이스 목록 조회 (팝업용)
|
||||
*/
|
||||
public Page<InflowGroupMappingUI> selectInterfaceListForPopup(Pageable pageable, String searchName) {
|
||||
JPAQueryFactory jpaQueryFactory = new JPAQueryFactory(entityManager);
|
||||
QEAIMessageEntity qMessage = QEAIMessageEntity.eAIMessageEntity;
|
||||
|
||||
BooleanBuilder boolBuilder = new BooleanBuilder();
|
||||
if (!StringUtils.isEmpty(searchName)) {
|
||||
boolBuilder.and(qMessage.eaisvcname.containsIgnoreCase(searchName)
|
||||
.or(qMessage.eaisvcdesc.containsIgnoreCase(searchName)));
|
||||
}
|
||||
|
||||
List<Tuple> tupleList = jpaQueryFactory
|
||||
.select(qMessage.eaisvcname, qMessage.eaisvcdesc)
|
||||
.from(qMessage)
|
||||
.where(boolBuilder)
|
||||
.orderBy(qMessage.eaisvcname.asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
List<InflowGroupMappingUI> uiList = tupleList.stream()
|
||||
.map(tuple -> {
|
||||
InflowGroupMappingUI ui = new InflowGroupMappingUI();
|
||||
ui.setInterfaceId(tuple.get(qMessage.eaisvcname));
|
||||
ui.setInterfaceDesc(tuple.get(qMessage.eaisvcdesc));
|
||||
return ui;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
long totalCount = jpaQueryFactory
|
||||
.select(qMessage.eaisvcname.count())
|
||||
.from(qMessage)
|
||||
.where(boolBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(uiList, pageable, totalCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 버킷 상태 조회 (모든 GW 서버에서 수집)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map<String, Object>> getGroupBucketStatus(String groupId) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
List<Map<String, String>> serverList = eaiServerInfoService.getEaiServerIpList();
|
||||
|
||||
for (Map<String, String> server : serverList) {
|
||||
String serverName = server.get("EAISVRINSTNM");
|
||||
String serverIp = server.get("EAISVRIP");
|
||||
String serverPort = server.get("WEBSERVERPORT");
|
||||
|
||||
if (StringUtils.isEmpty(serverPort)) {
|
||||
serverPort = server.get("EAISVRLSNPORT");
|
||||
}
|
||||
|
||||
Map<String, Object> serverStatus = new HashMap<>();
|
||||
serverStatus.put("serverName", serverName);
|
||||
serverStatus.put("serverIp", serverIp);
|
||||
serverStatus.put("serverPort", serverPort);
|
||||
|
||||
try {
|
||||
String url = String.format("http://%s:%s/manage/inflow/group/%s/bucket-status",
|
||||
serverIp, serverPort, groupId);
|
||||
ResponseEntity<Map> response = restTemplate.getForEntity(url, Map.class);
|
||||
|
||||
if (response.getBody() != null && Boolean.TRUE.equals(response.getBody().get("success"))) {
|
||||
serverStatus.put("status", "online");
|
||||
serverStatus.put("data", response.getBody().get("data"));
|
||||
} else {
|
||||
serverStatus.put("status", "no_data");
|
||||
serverStatus.put("message", "그룹이 로드되지 않음");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("버킷 상태 조회 실패 - server: {}, error: {}", serverName, e.getMessage());
|
||||
serverStatus.put("status", "offline");
|
||||
serverStatus.put("message", "서버 연결 실패");
|
||||
}
|
||||
|
||||
result.add(serverStatus);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.group;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InflowGroupControlManUI {
|
||||
/**
|
||||
* 그룹 ID
|
||||
*/
|
||||
@JsonProperty("GROUPID")
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* 그룹명
|
||||
*/
|
||||
@JsonProperty("GROUPNAME")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 임계치
|
||||
*/
|
||||
@JsonProperty("THRESHOLD")
|
||||
private Integer threshold;
|
||||
|
||||
/**
|
||||
* 초당 임계치
|
||||
*/
|
||||
@JsonProperty("THRESHOLDPERSECOND")
|
||||
private Integer thresholdPerSecond;
|
||||
|
||||
/**
|
||||
* 임계치 TimeUnit
|
||||
*/
|
||||
@JsonProperty("THRESHOLDTIMEUNIT")
|
||||
private String thresholdTimeUnit;
|
||||
|
||||
/**
|
||||
* 사용여부
|
||||
*/
|
||||
@JsonProperty("USEYN")
|
||||
private String useYn;
|
||||
|
||||
/**
|
||||
* 수정일시
|
||||
*/
|
||||
@JsonProperty("MODIFIEDAT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
/**
|
||||
* 매핑된 인터페이스 목록 (저장용)
|
||||
*/
|
||||
private List<InflowGroupMappingUI> interfaceList;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.group;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InflowGroupMappingUI {
|
||||
/**
|
||||
* 인터페이스 ID
|
||||
*/
|
||||
@JsonProperty("INTERFACEID")
|
||||
@JsonAlias("interfaceId")
|
||||
private String interfaceId;
|
||||
|
||||
/**
|
||||
* 인터페이스 설명 (조회용)
|
||||
*/
|
||||
@JsonProperty("INTERFACEDESC")
|
||||
@JsonAlias("interfaceDesc")
|
||||
private String interfaceDesc;
|
||||
|
||||
/**
|
||||
* 그룹 ID
|
||||
*/
|
||||
@JsonProperty("GROUPID")
|
||||
@JsonAlias("groupId")
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* 사용여부
|
||||
*/
|
||||
@JsonProperty("USEYN")
|
||||
@JsonAlias("useYn")
|
||||
private String useYn;
|
||||
}
|
||||
+7
@@ -31,6 +31,13 @@ public class InflowControlHistoryManController extends OnlBaseAnnotationControll
|
||||
return "/onl/admin/inflow/inflowControlHistoryMan";
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "/onl/admin/inflow/inflowControlHistoryMan.json", params = "cmd=LIST")
|
||||
// public ResponseEntity<GridResponse<InflowControlHistoryManUI>> selectList(HttpServletRequest request,
|
||||
// Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
// Page<InflowControlHistoryManUI> uiPage = service.selectList(pageable, uiSearch);
|
||||
// return ResponseEntity.ok(new GridResponse<>(uiPage));
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowControlHistoryMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<InflowControlHistoryManUI>> selectList(HttpServletRequest request,
|
||||
Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
|
||||
+6
-1
@@ -23,8 +23,13 @@ public class InflowControlHistoryManService extends BaseService {
|
||||
@Autowired
|
||||
InflowControlHistoryManMapper mapper;
|
||||
|
||||
// public Page<InflowControlHistoryManUI> selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
// return service.findAll(pageable, uiSearch).map(mapper::toVo);
|
||||
// }
|
||||
|
||||
|
||||
public Page<InflowControlHistoryManUI> selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) {
|
||||
return service.findAll(pageable, uiSearch).map(mapper::toVo);
|
||||
return service.selectList(pageable, uiSearch);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectListToExcel(InflowControlHistoryManUISearch uiSearch) {
|
||||
|
||||
+6
@@ -66,6 +66,12 @@ public class InflowControlHistoryManUI {
|
||||
*/
|
||||
@JsonProperty("THRESHOLDTIMEUNIT")
|
||||
private String thresholdtimeunit;
|
||||
|
||||
/**
|
||||
* 그룹명
|
||||
*/
|
||||
@JsonProperty("GROUPNAME")
|
||||
private String groupname;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@@ -171,7 +171,8 @@ public class Transform2Service extends BaseService {
|
||||
|
||||
private String genConversionSourceItems(String srcLayoutName, String cnvsncmdname) {
|
||||
|
||||
Pattern pattern = Pattern.compile(srcLayoutName + "(\\w|\\[|\\]|\\*|\\.|-|:)*");
|
||||
// \uAC00-\uD7A3 : 한글 전체 ('가' ~ '힣')
|
||||
Pattern pattern = Pattern.compile(srcLayoutName + "[\\w\\.\\[\\]\\*\\-:\\uAC00-\\uD7A3]*");
|
||||
Matcher matcher = pattern.matcher(cnvsncmdname);
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -52,7 +53,7 @@ public class StdMessageManController extends BaseController {
|
||||
@PostMapping(value = "/onl/admin/service/stdMessageMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<StdMessageUI>> selectList(Pageable pageable, String searchBzwkSvcKeyName,
|
||||
String searchEaiSvcCode, String searchEaiSendRecv, String searchEaiDirection) {
|
||||
List<StdMessageUI> map = service
|
||||
Page<StdMessageUI> map = service
|
||||
.selectList(pageable, searchBzwkSvcKeyName, searchEaiSvcCode, searchEaiSendRecv, searchEaiDirection);
|
||||
|
||||
return ResponseEntity.ok(new GridResponse<>(map));
|
||||
|
||||
+6
-6
@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -59,14 +60,13 @@ public class StdMessageManService {
|
||||
@Autowired
|
||||
private ExtendedColumnDefinitionUIMapper extendedColumnDefinitionUIMapper;
|
||||
|
||||
public List<StdMessageUI> selectList(Pageable pageable, String searchBzwkSvcKeyName, String searchEaiSvcCode,
|
||||
public Page<StdMessageUI> selectList(Pageable pageable, String searchBzwkSvcKeyName, String searchEaiSvcCode,
|
||||
String searchEaiSendRecv, String searchEaiDirection) {
|
||||
|
||||
return standardMessageInfoService
|
||||
.findAll(pageable, searchBzwkSvcKeyName, searchEaiSvcCode, searchEaiSendRecv, searchEaiDirection)
|
||||
.stream()
|
||||
.map(stdMessageUIMapper::toVo)
|
||||
.collect(Collectors.toList());
|
||||
Page<StandardMessageInfo> pageResult = standardMessageInfoService
|
||||
.findAll(pageable, searchBzwkSvcKeyName, searchEaiSvcCode, searchEaiSendRecv, searchEaiDirection);
|
||||
|
||||
return pageResult.map(stdMessageUIMapper::toVo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -271,10 +271,12 @@ public class ApiInterfaceController extends OnlBaseAnnotationController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=CLONE")
|
||||
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode, String newApiInterfaceId, String newInboundHttpMethod, String newInboundRestPath, boolean importDupliCheck) throws BizException {
|
||||
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode,
|
||||
String newApiInterfaceId, String newInboundHttpMethod,
|
||||
String newInboundRestPath, String newSvcDesc, boolean importDupliCheck) throws BizException {
|
||||
try {
|
||||
ApiInterfaceUI orgApiInterfaceUI = service.selectDetail(orgApiInterfaceId);
|
||||
ApiInterfaceUI apiInterfaceUI = service.cloneApiInterface(orgApiInterfaceUI, newBizCode, newApiInterfaceId, newInboundHttpMethod, newInboundRestPath, importDupliCheck);
|
||||
ApiInterfaceUI apiInterfaceUI = service.cloneApiInterface(orgApiInterfaceUI, newBizCode, newApiInterfaceId, newInboundHttpMethod, newInboundRestPath, newSvcDesc, importDupliCheck);
|
||||
Map<String, Object> resultMap = reloadSync(apiInterfaceUI);
|
||||
return ResponseEntity.ok(resultMap);
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.message.ServiceMessageEntity;
|
||||
import com.eactive.eai.data.entity.onl.message.ServiceMessageEntityId;
|
||||
import com.eactive.eai.data.entity.onl.messagekey.MessageKey;
|
||||
import com.eactive.eai.data.entity.onl.stdmessage.QStandardMessageInfo;
|
||||
import com.eactive.eai.data.entity.onl.stdmessage.StandardMessageInfo;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseService;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
@@ -131,10 +132,14 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
}
|
||||
|
||||
public Page<ApiInterfaceUI> selectList(EAIMessageUISearch eaiMessageUISearch, Pageable pageable,String sortname, String sortorder) {
|
||||
Page<Tuple> tuples = eaiMessageQueryService.selectList(eaiMessageUISearch, pageable, sortname, sortorder );
|
||||
|
||||
Page<Tuple> tuples = eaiMessageQueryService.selectList(eaiMessageUISearch, pageable, sortname, sortorder );
|
||||
|
||||
return tuples.map(tuple -> {
|
||||
EAIMessageEntity eaiMessageEntity = tuple.get(QEAIMessageEntity.eAIMessageEntity);
|
||||
|
||||
String apiFullPath = tuple.get(QStandardMessageInfo.standardMessageInfo.apifullpath);
|
||||
String bzwksvckeyname = tuple.get(QStandardMessageInfo.standardMessageInfo.bzwksvckeyname);
|
||||
|
||||
ApiInterfaceUI apiInterfaceUI;
|
||||
if (eaiMessageEntity.getServiceMessages() != null && eaiMessageEntity.getServiceMessages().size() > 0) {
|
||||
@@ -142,7 +147,10 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
} else {
|
||||
apiInterfaceUI = apiInterfaceUIMapper.toVo(eaiMessageEntity);
|
||||
}
|
||||
|
||||
|
||||
apiInterfaceUI.setApiFullPath(apiFullPath);
|
||||
apiInterfaceUI.setBzwksvckeyname(bzwksvckeyname);
|
||||
|
||||
return apiInterfaceUI;
|
||||
});
|
||||
}
|
||||
@@ -242,6 +250,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
String stdKey = stdMessageUI.getBzwkSvcKeyName();
|
||||
String inboundRestPath = StringUtils.substringAfter(stdKey, STEMSG_SERVICE_URL_DELIMITER);
|
||||
apiInterfaceUI.setInboundRestPath(inboundRestPath);
|
||||
apiInterfaceUI.setApiFullPath(standardMessageInfo.getApifullpath());
|
||||
|
||||
apiInterfaceUI.setStandardMessageItems(stdMessageUI.getStandardMessageItems());
|
||||
|
||||
@@ -420,6 +429,9 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
case "NET":
|
||||
outbndRoutName = "SOCKETOUT";
|
||||
break;
|
||||
case "APP":
|
||||
outbndRoutName = "APPOUT";
|
||||
break;
|
||||
default:
|
||||
outbndRoutName = "RESTOUT";
|
||||
break;
|
||||
@@ -541,7 +553,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
restOption.setMethod(outboundHttpMethod);
|
||||
restOption.setExtraPath(outboundRestPath);
|
||||
|
||||
String pathType = outboundRestPath.matches(".*\\{[a-zA-Z]+\\}.*") ? "variableUrlRequest" : "simpleRequest";
|
||||
String pathType = outboundRestPath.matches(".*\\{[_a-zA-Z]+\\}.*") ? "variableUrlRequest" : "simpleRequest";
|
||||
restOption.setType(pathType);
|
||||
|
||||
if (StringUtils.isNotBlank(contentType)) {
|
||||
@@ -591,6 +603,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
|
||||
// 25.11.25 HS04 APIFULLPATH 추가.
|
||||
List<AdapterUI> adapters = adapterGroup.getAdapters();
|
||||
String inboundHttpMethod = vo.getInboundHttpMethod().toUpperCase();
|
||||
|
||||
for (AdapterUI adapter : adapters) {
|
||||
|
||||
@@ -603,19 +616,21 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
for (AdapterPropUI prop : props) {
|
||||
if("API_PATH".equals(prop.getPrptyname())) {
|
||||
|
||||
String fullPath = prop.getPrpty2val() + "/" + vo.getInboundRestPath();
|
||||
String fullPath = inboundHttpMethod + "|" + prop.getPrpty2val() + "/" + vo.getInboundRestPath();
|
||||
vo.setApiFullPath(fullPath);
|
||||
|
||||
// HS04 AndEaiSvcNameNot : 업데이트일 때 자신의 fullpath 는 제외함
|
||||
standardMessageInfoQueryService.existsByApiFullPathAndEaiSvcNameNot(vo.getApiFullPath(), eaiServiceName);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!"RST".equals(adapterGroup.getAdptrcd())) {
|
||||
throw new RuntimeException("인바운드 어댑터가 타입이 REST가 아닙니다. 타입을 확인하세요");
|
||||
// HTTP 어댑터도 등록 가능하도록 수정.
|
||||
if (!"RST".equals(adapterGroup.getAdptrcd())&&!"HTT".equals(adapterGroup.getAdptrcd())) {
|
||||
throw new RuntimeException("인바운드 어댑터가 타입이 REST/HTTP가 아닙니다. 타입을 확인하세요");
|
||||
}
|
||||
|
||||
StandardMessageInfo standardMessageInfo = apiInterfaceUIMapper.toStandardMessageInfo(vo);
|
||||
@@ -1148,7 +1163,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
|
||||
public ApiInterfaceUI cloneApiInterface(ApiInterfaceUI orgApiInterfaceUI, String newBizCd,
|
||||
String newApiInterfaceId, String newInboundHttpMethod,
|
||||
String newInboundRestPath, boolean importDupliCheck) throws Exception {
|
||||
String newInboundRestPath, String newSvcDesc, boolean importDupliCheck) throws Exception {
|
||||
|
||||
Optional<EAIMessageEntity> optional = eaiMessageQueryService.findById(newApiInterfaceId);
|
||||
if (optional.isPresent()) {
|
||||
@@ -1162,21 +1177,59 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
apiInterfaceUI.setEaiBzwkDstcd(newBizCd);
|
||||
settingInterfaceId(apiInterfaceUI, newApiInterfaceId);
|
||||
apiInterfaceUI.setEaiSvcName(newApiInterfaceId);
|
||||
apiInterfaceUI.setEaiSvcDesc(newSvcDesc);
|
||||
apiInterfaceUI.setInboundHttpMethod(newInboundHttpMethod);
|
||||
apiInterfaceUI.setInboundRestPath(newInboundRestPath);
|
||||
|
||||
if ("Y".equals(apiInterfaceUI.getTransformYn())) {
|
||||
apiInterfaceUI.setInboundRequestLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getInboundRequestLayout()), newBizCd, newApiInterfaceId));
|
||||
apiInterfaceUI.setOutboundRequestLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getOutboundRequestLayout()), newBizCd, newApiInterfaceId));
|
||||
apiInterfaceUI.setOutboundResponseLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getOutboundResponseLayout()), newBizCd, newApiInterfaceId));
|
||||
apiInterfaceUI.setInboundResponseLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getInboundResponseLayout()), newBizCd, newApiInterfaceId));
|
||||
|
||||
apiInterfaceUI.setRequestTransform(changeToTargetTransformUI(transform2Service.getTransformUiToExport(apiInterfaceUI.getRequestTransform()), newBizCd, newApiInterfaceId, apiInterfaceUI.getInboundRequestLayout(), apiInterfaceUI.getOutboundRequestLayout()));
|
||||
apiInterfaceUI.setResponseTransform(changeToTargetTransformUI(transform2Service.getTransformUiToExport(apiInterfaceUI.getResponseTransform()), newBizCd, newApiInterfaceId, apiInterfaceUI.getOutboundResponseLayout(), apiInterfaceUI.getInboundResponseLayout()));
|
||||
|
||||
String newInReq = processLayoutIfExist(apiInterfaceUI.getInboundRequestLayout(), newBizCd, newApiInterfaceId);
|
||||
String newOutReq = processLayoutIfExist(apiInterfaceUI.getOutboundRequestLayout(), newBizCd, newApiInterfaceId);
|
||||
String newOutRes = processLayoutIfExist(apiInterfaceUI.getOutboundResponseLayout(), newBizCd, newApiInterfaceId);
|
||||
String newInRes = processLayoutIfExist(apiInterfaceUI.getInboundResponseLayout(), newBizCd, newApiInterfaceId);
|
||||
|
||||
apiInterfaceUI.setInboundRequestLayout(newInReq);
|
||||
apiInterfaceUI.setOutboundRequestLayout(newOutReq);
|
||||
apiInterfaceUI.setOutboundResponseLayout(newOutRes);
|
||||
apiInterfaceUI.setInboundResponseLayout(newInRes);
|
||||
|
||||
if (newInReq != null && newOutReq != null) {
|
||||
apiInterfaceUI.setRequestTransform(
|
||||
changeToTargetTransformUI(
|
||||
transform2Service.getTransformUiToExport(apiInterfaceUI.getRequestTransform()),
|
||||
newBizCd, newApiInterfaceId, newInReq, newOutReq
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (newOutRes != null && newInRes != null) {
|
||||
apiInterfaceUI.setResponseTransform(
|
||||
changeToTargetTransformUI(
|
||||
transform2Service.getTransformUiToExport(apiInterfaceUI.getResponseTransform()),
|
||||
newBizCd, newApiInterfaceId, newOutRes, newInRes
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
importApiInterfaceUi(apiInterfaceUI, importDupliCheck);
|
||||
|
||||
return apiInterfaceUI;
|
||||
}
|
||||
|
||||
/*
|
||||
* 복제시 레이아웃 정보가 있는 경우에만 변환 로직을 수행
|
||||
*/
|
||||
private String processLayoutIfExist(String layoutId, String newBizCd, String newApiInterfaceId) {
|
||||
|
||||
if (layoutId == null || layoutId.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LayoutUI layoutEntity = layoutManService.getLayoutUiToExport(layoutId);
|
||||
|
||||
return changeToTargetLayoutUI(layoutEntity, newBizCd, newApiInterfaceId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -21,6 +21,15 @@ public class StandardMessageInfoQueryServiceForApi extends AbstractDataService<S
|
||||
public void deleteByEaiSvcName(String eaiSvcName){
|
||||
repository.deleteByEaisvcname(eaiSvcName);
|
||||
}
|
||||
|
||||
public void existsByApiFullPathAndEaiSvcNameNot(String apiFullPath, String eaiServiceName) {
|
||||
|
||||
boolean isExist = repository.existsByApifullpathAndEaisvcnameNot(apiFullPath, eaiServiceName);
|
||||
|
||||
if(isExist) {
|
||||
throw new RuntimeException("API FUll PATH 가 중복되었습니다 : " + apiFullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ public interface ApiInterfaceUIMapper {
|
||||
@Mapping(target = "eaisendrecv", source = "sendRecvType")
|
||||
@Mapping(target = "eaidirection", source = "inOutType")
|
||||
@Mapping(target = "standardMessageItems", source = "standardMessageItems")
|
||||
@Mapping(target = "apiFullPath", source = "apiFullPath")
|
||||
@Mapping(target = "apifullpath", source = "apiFullPath")
|
||||
StandardMessageInfo toStandardMessageInfo(ApiInterfaceUI vo);
|
||||
|
||||
@AfterMapping
|
||||
|
||||
+2
@@ -10,4 +10,6 @@ public interface StandardMessageInfoRepositoryForApi extends BaseRepository<Stan
|
||||
Optional<StandardMessageInfo> findByEaisvcname(String eaiSvcName);
|
||||
|
||||
void deleteByEaisvcname(String eaiSvcName);
|
||||
|
||||
boolean existsByApifullpathAndEaisvcnameNot(String fullPath, String eaiServiceName);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ApiInterfaceUI {
|
||||
private List<StdMessageItemUI> inboundResponseStandardMessageItems ;
|
||||
|
||||
private String apiFullPath;
|
||||
private String bzwksvckeyname;
|
||||
|
||||
//ASYNC-SYNC 용
|
||||
private String inboundResponseHttpMethod;
|
||||
|
||||
+2
-2
@@ -454,11 +454,11 @@ public class DbTrackingController {
|
||||
|
||||
@RequestMapping(value = "/onl/transaction/tracking/trackingMan.json", params = "cmd=DETAIL_HTTP_LOG")
|
||||
public ResponseEntity<HttpAdapterExtraLogVo> selectHttpAdapterExtraLog(
|
||||
@RequestParam int dayOfWeekNumber,
|
||||
@RequestParam String prcsDate,
|
||||
@RequestParam String guid,
|
||||
@RequestParam int serviceProcessNumber) {
|
||||
return ResponseEntity.ok(service.selectHttpAdapterExtraLog(
|
||||
dayOfWeekNumber, guid, serviceProcessNumber));
|
||||
prcsDate, guid, serviceProcessNumber));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/transaction/tracking/trackingMan.json", params = "cmd=DETAIL_8583")
|
||||
|
||||
@@ -439,18 +439,23 @@ public class DbTrackingService extends BaseService {
|
||||
return map;
|
||||
}
|
||||
|
||||
public HttpAdapterExtraLogVo selectHttpAdapterExtraLog(int dayOfWeekNumber,
|
||||
public HttpAdapterExtraLogVo selectHttpAdapterExtraLog(String prcsDate,
|
||||
String guid, int serviceProcessNumber) {
|
||||
Optional<HttpAdapterExtraLog> optional = httpAdapterExtraLogService
|
||||
.findById(new HttpAdapterExtraLogId(
|
||||
dayOfWeekNumber, guid,
|
||||
serviceProcessNumber));
|
||||
HttpAdapterExtraLogId httpAdapterExtraLogId = new HttpAdapterExtraLogId();
|
||||
httpAdapterExtraLogId.setPrcsDate(prcsDate);
|
||||
httpAdapterExtraLogId.setGuid(guid);
|
||||
httpAdapterExtraLogId.setServiceProcessNumber(serviceProcessNumber);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
return httpAdapterExtraLogMapper.toVo(optional.get());
|
||||
}
|
||||
HttpAdapterExtraLog httpAdapterExtraLog = httpAdapterExtraLogService.getById(httpAdapterExtraLogId);
|
||||
// Optional<HttpAdapterExtraLog> optional = httpAdapterExtraLogService
|
||||
// .findById(new HttpAdapterExtraLogId(
|
||||
// prcsDate, guid, serviceProcessNumber));
|
||||
//
|
||||
// if (optional.isPresent()) {
|
||||
// return httpAdapterExtraLogMapper.toVo(optional.get());
|
||||
// }
|
||||
|
||||
return null;
|
||||
return httpAdapterExtraLogMapper.toVo(httpAdapterExtraLog);
|
||||
}
|
||||
|
||||
public String resultByMessage(EAILogDetailSearch paramVo,
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# API Gateway 통계 테이블 설계
|
||||
|
||||
## 요구사항 정리
|
||||
|
||||
### 수집 차원
|
||||
- **시간 단위**: 분 단위
|
||||
- **분류 차원**: API명, API Gateway Instance, ClientId, Scope, 업무구분코드 (값이 없을 경우 'NONE' 으로 대체)
|
||||
|
||||
### 메트릭
|
||||
- **처리 건수**:
|
||||
- 총 건수
|
||||
- 성공 건수
|
||||
- 오류 건수 (Timeout / System Error / Business Error)
|
||||
- **응답시간 통계**:
|
||||
- 평균 응답시간
|
||||
- 최소 응답시간
|
||||
- 최대 응답시간
|
||||
- **추가 검토사항**:
|
||||
- P50, P95 백분위 응답시간
|
||||
|
||||
### 집계 방식
|
||||
- **집계 주기**: 매분 배치 집계
|
||||
- **백분위 계산**: HdrHistogram 라이브러리 사용 (근사값, 메모리 효율적)
|
||||
|
||||
---
|
||||
|
||||
## 테이블 DDL
|
||||
|
||||
```sql
|
||||
-- API Gateway 분단위 통계 테이블
|
||||
CREATE TABLE API_STATS_MINUTE (
|
||||
STAT_TIME TIMESTAMP(0) NOT NULL, -- 통계 시간 (분 단위, 초는 00)
|
||||
API_NAME VARCHAR2(100) NOT NULL, -- API명
|
||||
GW_INSTANCE_ID VARCHAR2(50) NOT NULL, -- API Gateway 인스턴스 ID
|
||||
CLIENT_ID VARCHAR2(100) NOT NULL, -- 클라이언트 ID
|
||||
SCOPE VARCHAR2(100) DEFAULT 'NONE' NOT NULL, -- 스코프
|
||||
BIZ_DIV_CODE VARCHAR2(50) DEFAULT 'NONE' NOT NULL, -- 업무구분코드
|
||||
|
||||
-- 건수 메트릭
|
||||
TOTAL_CNT NUMBER(12) DEFAULT 0 NOT NULL,
|
||||
SUCCESS_CNT NUMBER(12) DEFAULT 0 NOT NULL,
|
||||
TIMEOUT_CNT NUMBER(12) DEFAULT 0 NOT NULL,
|
||||
SYSTEM_ERR_CNT NUMBER(12) DEFAULT 0 NOT NULL,
|
||||
BIZ_ERR_CNT NUMBER(12) DEFAULT 0 NOT NULL,
|
||||
|
||||
-- 응답시간 메트릭 (ms, 소수점 3자리)
|
||||
AVG_RESP_TIME NUMBER(10,3) DEFAULT 0,
|
||||
MIN_RESP_TIME NUMBER(10,3) DEFAULT 0,
|
||||
MAX_RESP_TIME NUMBER(10,3) DEFAULT 0,
|
||||
P50_RESP_TIME NUMBER(10,3) DEFAULT 0,
|
||||
P95_RESP_TIME NUMBER(10,3) DEFAULT 0,
|
||||
|
||||
-- 관리 정보
|
||||
REG_DTIME TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,
|
||||
UPD_DTIME TIMESTAMP DEFAULT SYSTIMESTAMP,
|
||||
|
||||
CONSTRAINT PK_API_STATS_MINUTE PRIMARY KEY (
|
||||
STAT_TIME, API_NAME, GW_INSTANCE_ID, CLIENT_ID, SCOPE, BIZ_DIV_CODE
|
||||
)
|
||||
);
|
||||
|
||||
-- 코멘트
|
||||
COMMENT ON TABLE API_STATS_MINUTE IS 'API Gateway 분단위 처리 통계';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.STAT_TIME IS '통계시간(분단위, 초는 00초로 절사)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.API_NAME IS 'API 명칭';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.GW_INSTANCE_ID IS 'API Gateway 인스턴스 ID';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.CLIENT_ID IS '클라이언트 ID';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.SCOPE IS '스코프 (없으면 NONE)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.BIZ_DIV_CODE IS '업무구분코드 (없으면 NONE)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.TOTAL_CNT IS '총 처리 건수';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.SUCCESS_CNT IS '성공 건수';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.TIMEOUT_CNT IS 'Timeout 오류 건수';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.SYSTEM_ERR_CNT IS '시스템 오류 건수';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.BIZ_ERR_CNT IS '업무 오류 건수';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.AVG_RESP_TIME IS '평균 응답시간(ms)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.MIN_RESP_TIME IS '최소 응답시간(ms)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.MAX_RESP_TIME IS '최대 응답시간(ms)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.P50_RESP_TIME IS '50 백분위 응답시간(ms)';
|
||||
COMMENT ON COLUMN API_STATS_MINUTE.P95_RESP_TIME IS '95 백분위 응답시간(ms)';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -19,8 +19,46 @@ public class KjbPropertyInjector {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public KjbProperty inject() {
|
||||
return inject(new KjbProperty());
|
||||
/**
|
||||
* KjbProperty의 URL 값들이 설정되어 있는지 확인
|
||||
* @param property 검사할 KjbProperty 객체
|
||||
* @return URL 값들이 모두 설정되어 있으면 true
|
||||
*/
|
||||
public boolean isUrlConfigured(KjbProperty property) {
|
||||
if (property == null) return false;
|
||||
|
||||
// 주요 URL 값들 중 하나라도 설정되어 있으면 true
|
||||
return StringUtils.isNotEmpty(property.getEaiBatchUrl())
|
||||
|| StringUtils.isNotEmpty(property.getUmsHostUrl())
|
||||
|| StringUtils.isNotEmpty(property.getObpUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* URL 값이 비어있을 경우 DB에서 재로딩 시도
|
||||
* @param property 기존 KjbProperty 객체
|
||||
* @return 재로딩된 KjbProperty 객체 (재로딩 실패 시 기존 객체 반환)
|
||||
*/
|
||||
public KjbProperty reloadIfUrlEmpty(KjbProperty property) {
|
||||
if (property == null) {
|
||||
return inject(new KjbProperty());
|
||||
}
|
||||
|
||||
if (!isUrlConfigured(property)) {
|
||||
log.info("KjbProperty URL 값이 비어있어 DB에서 재로딩 시도");
|
||||
try {
|
||||
KjbProperty reloaded = inject(new KjbProperty());
|
||||
if (isUrlConfigured(reloaded)) {
|
||||
log.info("KjbProperty 재로딩 성공");
|
||||
return reloaded;
|
||||
} else {
|
||||
log.warn("KjbProperty 재로딩 후에도 URL 값이 비어있음");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("KjbProperty 재로딩 실패: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
public <T> T inject(T property) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.eactive.ext.kjb.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiLogUI {
|
||||
|
||||
private String apiServiceNumber;
|
||||
|
||||
private String txDate;
|
||||
|
||||
private List<ApiMessageLogUI> logs;
|
||||
|
||||
private Long totalProcessingTime;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.ext.kjb.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiMessageLogUI {
|
||||
|
||||
private String apiServiceNumber;
|
||||
|
||||
private int processNumber;
|
||||
|
||||
private String txDate;
|
||||
|
||||
private String url;
|
||||
|
||||
private String queryString;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String method;
|
||||
|
||||
private Integer HttpStatus;
|
||||
|
||||
private Map<String, String> header;
|
||||
|
||||
private Object body;
|
||||
|
||||
private String exdata;
|
||||
|
||||
private Long processingTime;
|
||||
|
||||
private String guid;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.eactive.ext.kjb.web;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.interceptor.InterceptorSkipController;
|
||||
import com.eactive.eai.rms.data.entity.onl.logger.ApiLogDTO;
|
||||
import com.eactive.eai.rms.data.entity.onl.logger.ApiMessageLogDTO;
|
||||
import com.eactive.eai.rms.data.entity.onl.logger.EAILogService;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class ApiTransactionLogController implements InterceptorSkipController {
|
||||
|
||||
private final EAILogService eaiLogService;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@GetMapping("/api/transaction/log.do")
|
||||
@PostMapping("/api/transaction/log.do")
|
||||
public ResponseEntity<ApiLogUI> getApiLog(String txDate, String apiServiceNumber) {
|
||||
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW));
|
||||
|
||||
// txDate가 없으면 오늘 날짜 설정
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
LocalDate searchDate;
|
||||
if (StringUtils.hasText(txDate)) {
|
||||
searchDate = LocalDate.parse(txDate, formatter);
|
||||
} else {
|
||||
searchDate = LocalDate.now();
|
||||
}
|
||||
|
||||
// 최대 10일 전까지 조회 시도
|
||||
ApiLogDTO dto = null;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String searchDateStr = searchDate.format(formatter);
|
||||
dto = eaiLogService.getApiLog(searchDateStr, apiServiceNumber);
|
||||
|
||||
// 결과가 있으면 종료
|
||||
if (dto != null && dto.getLogs() != null && !dto.getLogs().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 하루 전으로 이동
|
||||
searchDate = searchDate.minusDays(1);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(convertToUI(dto));
|
||||
}
|
||||
|
||||
private ApiLogUI convertToUI(ApiLogDTO dto) {
|
||||
ApiLogUI ui = new ApiLogUI();
|
||||
ui.setApiServiceNumber(dto.getApiServiceNumber());
|
||||
ui.setTxDate(dto.getTxDate());
|
||||
ui.setTotalProcessingTime(dto.getTotalProcessingTime());
|
||||
|
||||
if (dto.getLogs() != null) {
|
||||
List<ApiMessageLogUI> uiLogs = dto.getLogs().stream().map(this::convertMessageToUI)
|
||||
.collect(Collectors.toList());
|
||||
ui.setLogs(uiLogs);
|
||||
}
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
private ApiMessageLogUI convertMessageToUI(ApiMessageLogDTO dto) {
|
||||
ApiMessageLogUI ui = new ApiMessageLogUI();
|
||||
ui.setApiServiceNumber(dto.getApiServiceNumber());
|
||||
ui.setProcessNumber(dto.getProcessNumber());
|
||||
ui.setTxDate(dto.getTxDate());
|
||||
ui.setUrl(dto.getUrl());
|
||||
ui.setQueryString(dto.getQueryString());
|
||||
ui.setClientId(dto.getClientId());
|
||||
ui.setMethod(dto.getMethod());
|
||||
ui.setHttpStatus(dto.getHttpStatus());
|
||||
ui.setExdata(dto.getExdata());
|
||||
ui.setProcessingTime(dto.getProcessingTime());
|
||||
ui.setGuid(dto.getKeymgtmsgctnt());
|
||||
|
||||
// header: JSON 문자열 → Map<String, String>
|
||||
if (dto.getHeader() != null) {
|
||||
try {
|
||||
List<Map<String, String>> headerList = objectMapper.readValue(dto.getHeader(),
|
||||
new TypeReference<List<Map<String, String>>>() {
|
||||
});
|
||||
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
for (Map<String, String> headerItem : headerList) {
|
||||
String name = headerItem.get("name");
|
||||
String value = headerItem.get("value");
|
||||
if (name != null) {
|
||||
headerMap.put(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
// header에서 client*id 패턴 추출 (정규식, ignoreCase)
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
if (entry.getKey() != null && entry.getKey().matches("(?i)client.*id")) {
|
||||
ui.setClientId(entry.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui.setHeader(headerMap);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to parse header JSON: {}", dto.getHeader(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// body: JSON 문자열 → Object
|
||||
if (dto.getBody() != null) {
|
||||
try {
|
||||
Object bodyObject = objectMapper.readValue(dto.getBody(), Object.class);
|
||||
ui.setBody(bodyObject);
|
||||
} catch (Exception e) {
|
||||
// JSON 파싱 실패 시 원본 문자열 사용
|
||||
ui.setBody(dto.getBody());
|
||||
}
|
||||
}
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.eactive.ext.kjb.web;
|
||||
@@ -32,7 +32,7 @@
|
||||
FROM (
|
||||
SELECT
|
||||
CLIENTID AS CLIENT_ID,
|
||||
RAND() AS REQUEST_URI,
|
||||
DBMS_RANDOM.VALUE AS REQUEST_URI,
|
||||
'$startTime$' AS STATISTICS_TIME,
|
||||
EAISVCNAME AS API_ID,
|
||||
NULL AS API_NAME,
|
||||
@@ -49,7 +49,7 @@
|
||||
UNION ALL
|
||||
SELECT
|
||||
CLIENTID AS CLIENT_ID,
|
||||
RAND() AS REQUEST_URI,
|
||||
DBMS_RANDOM.VALUE AS REQUEST_URI,
|
||||
'$startTime$' AS STATISTICS_TIME,
|
||||
EAISVCNAME AS API_ID,
|
||||
NULL AS API_NAME,
|
||||
@@ -59,8 +59,8 @@
|
||||
ORGID AS ORG_ID,
|
||||
ORGNAME AS ORG_NAME,
|
||||
CASE
|
||||
WHEN SUBSTRING(RSPNSERRCDNAME, 1, 2) = 'RE' THEN 0
|
||||
WHEN SUBSTRING(RSPNSERRCDNAME, 1, 2) = 'FE' THEN 0
|
||||
WHEN SUBSTR(RSPNSERRCDNAME, 1, 2) = 'RE' THEN 0
|
||||
WHEN SUBSTR(RSPNSERRCDNAME, 1, 2) = 'FE' THEN 0
|
||||
ELSE 1
|
||||
END AS END_COUNT,
|
||||
0 AS START_COUNT
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
||||
<sqlMap namespace="JmsQueueMonitor">
|
||||
<!-- #### JMS Queue Monitor ### -->
|
||||
<!-- 목록 조회 -->
|
||||
<statement id="selectListCount" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM $schemaId$.TSEAIQM01 Q1, $schemaId$.TSEAICM01 C1
|
||||
WHERE Q1.EAIBZWKDSTCD = C1.EAIBZWKDSTCD
|
||||
AND Q1.QUEUSEYN = '1'
|
||||
<isNotEmpty prepend="AND" property="searchEaiBzwkdstcd">
|
||||
Q1.EAIBZWKDSTCD LIKE '%' || #searchEaiBzwkdstcd# || '%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchEaiQueBzwkCtnt">
|
||||
Q1.EAIQUEBZWKCTNT LIKE '%' || #searchEaiQueBzwkCtnt# ||'%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchInst">
|
||||
Q1.EAISEVRINSTNCNAME LIKE '%'|| #searchInst#
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchQueName">
|
||||
Q1.NONSYNCZTRANQUENAME LIKE '%' || #searchQueName# || '%'
|
||||
</isNotEmpty>
|
||||
</statement>
|
||||
<statement id="selectList" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY Q1.EAIBZWKDSTCD, Q1.EAISEVRINSTNCNAME) AS "ROWNO",
|
||||
Q1.EAIBZWKDSTCD "EAIBZWKDSTCD",
|
||||
C1.BZWKDSTICNAME "BZWKDSTICNAME",
|
||||
Q1.EAIQUEBZWKDTALSCTNT "EAIQUEBZWKCTNT",
|
||||
Q1.EAISEVRINSTNCNAME "EAISEVRINSTNCNAME",
|
||||
Q1.QUEUSAGDSTCD "QUEUSAGDSTCD",
|
||||
Q1.NONSYNCZTRANQUENAME "NONSYNCZTRANQUENAME",
|
||||
CASE WHEN QUEUSAGDSTCD = '1'
|
||||
THEN 0
|
||||
END AS "SENDQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '2'
|
||||
THEN 0
|
||||
END AS "RECEIVEQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '3'
|
||||
THEN 0
|
||||
END AS "SENDERRORQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '4'
|
||||
THEN 0
|
||||
END AS "RECEIVEERRORCOUNT"
|
||||
FROM $schemaId$.TSEAIQM01 Q1, $schemaId$.TSEAICM01 C1
|
||||
WHERE Q1.EAIBZWKDSTCD = C1.EAIBZWKDSTCD
|
||||
AND Q1.QUEUSEYN = '1'
|
||||
<isNotEmpty prepend="AND" property="searchEaiBzwkdstcd">
|
||||
Q1.EAIBZWKDSTCD LIKE '%' || #searchEaiBzwkdstcd# || '%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchEaiQueBzwkCtnt">
|
||||
Q1.EAIQUEBZWKCTNT LIKE '%' || #searchEaiQueBzwkCtnt# ||'%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchInst">
|
||||
Q1.EAISEVRINSTNCNAME LIKE '%'|| #searchInst#
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchQueName">
|
||||
Q1.NONSYNCZTRANQUENAME LIKE '%' || #searchQueName# || '%'
|
||||
</isNotEmpty>
|
||||
ORDER BY Q1.EAIBZWKDSTCD, Q1.EAIQUEBZWKCTNT, Q1.EAISEVRINSTNCNAME
|
||||
) TMP WHERE "ROWNO" BETWEEN #startNum# AND #endNum#
|
||||
</statement>
|
||||
<statement id="selectListToExcel" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
|
||||
SELECT $headersStr$ FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY Q1.EAIBZWKDSTCD, Q1.EAISEVRINSTNCNAME) AS "ROWNO",
|
||||
Q1.EAIBZWKDSTCD "EAIBZWKDSTCD",
|
||||
C1.BZWKDSTICNAME "BZWKDSTICNAME",
|
||||
Q1.EAIQUEBZWKCTNT "EAIQUEBZWKCTNT",
|
||||
Q1.EAISEVRINSTNCNAME "EAISEVRINSTNCNAME",
|
||||
Q1.QUEUSAGDSTCD "QUEUSAGDSTCD",
|
||||
Q1.NONSYNCZTRANQUENAME "NONSYNCZTRANQUENAME",
|
||||
CAST (CASE WHEN QUEUSAGDSTCD = '1'
|
||||
THEN 0
|
||||
END AS VARCHAR )AS "SENDQUEUECOUNT",
|
||||
CAST (CASE WHEN QUEUSAGDSTCD = '2'
|
||||
THEN 0
|
||||
END AS VARCHAR )AS "RECEIVEQUEUECOUNT",
|
||||
CAST (CASE WHEN QUEUSAGDSTCD = '3'
|
||||
THEN 0
|
||||
END AS VARCHAR )AS "SENDERRORQUEUECOUNT",
|
||||
CAST (CASE WHEN QUEUSAGDSTCD = '4'
|
||||
THEN 0
|
||||
END AS VARCHAR ) "RECEIVEERRORCOUNT"
|
||||
FROM $schemaId$.TSEAIQM01 Q1, $schemaId$.TSEAICM01 C1
|
||||
WHERE Q1.EAIBZWKDSTCD = C1.EAIBZWKDSTCD
|
||||
AND Q1.QUEUSEYN = '1'
|
||||
<isNotEmpty prepend="AND" property="searchEaiBzwkdstcd">
|
||||
Q1.EAIBZWKDSTCD LIKE '%' || #searchEaiBzwkdstcd# || '%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchEaiQueBzwkCtnt">
|
||||
Q1.EAIQUEBZWKCTNT LIKE '%' || #searchEaiQueBzwkCtnt# ||'%'
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchInst">
|
||||
Q1.EAISEVRINSTNCNAME LIKE '%'|| #searchInst#
|
||||
</isNotEmpty>
|
||||
<isNotEmpty prepend="AND" property="searchQueName">
|
||||
Q1.NONSYNCZTRANQUENAME LIKE '%' || #searchQueName# || '%'
|
||||
</isNotEmpty>
|
||||
ORDER BY Q1.EAIBZWKDSTCD, Q1.EAIQUEBZWKCTNT, Q1.EAISEVRINSTNCNAME
|
||||
) TMP
|
||||
</statement>
|
||||
<statement id="selectDetail" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
|
||||
select
|
||||
Q1.EAIBzwkDstcd,
|
||||
C1.BzwkDsticName,
|
||||
Q1.EAIQueBzwkCtnt,
|
||||
Q1.EAISevrInstncName,
|
||||
Q1.QueUsagDstcd,
|
||||
Q1.NonSynczTranQueName
|
||||
from $schemaId$.tseaiqm01 Q1, $schemaId$.tseaicm01 C1
|
||||
where Q1.EAIBzwkDstcd = C1.EAIBzwkDstcd
|
||||
and Q1.QueUseYn = '1'
|
||||
<isNotEmpty prepend="AND" property="nonSynczTranQueName">
|
||||
Q1.NonSynczTranQueName = #nonSynczTranQueName#
|
||||
</isNotEmpty>
|
||||
ORDER BY Q1.EAIBzwkDstcd, Q1.EAIQueBzwkCtnt, Q1.EAISevrInstncName
|
||||
</statement>
|
||||
|
||||
<statement id="connectionInfo" resultClass="java.util.HashMap">
|
||||
SELECT PrptyName, Prpty2Val
|
||||
FROM $schemaId$.TSEAICM03
|
||||
WHERE PrptyGroupName = #prptyGroupName#
|
||||
</statement>
|
||||
|
||||
<statement id="serviceInfo" resultClass="java.util.HashMap">
|
||||
SELECT EAISvcName, EAISvcDesc
|
||||
FROM $schemaId$.TSEAIHE01
|
||||
</statement>
|
||||
|
||||
<statement id="selectBoxCount" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
|
||||
SELECT MAX(SUBSTR(EAISEVRINSTNCNAME,7,1))
|
||||
FROM $schemaId$.TSEAISY02
|
||||
WHERE EAISEVRIP != '*'
|
||||
</statement>
|
||||
|
||||
<statement id="selectInstCount" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
|
||||
SELECT MAX(SUBSTR(EAISEVRINSTNCNAME,8,1))
|
||||
FROM $schemaId$.TSEAISY02
|
||||
WHERE EAISEVRIP != '*'
|
||||
</statement>
|
||||
<statement id="selectQueueMonitoringList" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
|
||||
SELECT
|
||||
Q1.EAIBZWKDSTCD, C1.BZWKDSTICNAME, Q1.EAIQUEBZWKCTNT, Q1.EAISEVRINSTNCNAME, Q1.QUEUSAGDSTCD, Q1.NONSYNCZTRANQUENAME ,
|
||||
CASE WHEN QUEUSAGDSTCD = '1'
|
||||
THEN 0
|
||||
END AS "SENDQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '2'
|
||||
THEN 0
|
||||
END AS "RECEIVEQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '3'
|
||||
THEN 0
|
||||
END AS "SENDERRORQUEUECOUNT",
|
||||
CASE WHEN QUEUSAGDSTCD = '4'
|
||||
THEN 0
|
||||
END AS "RECEIVEERRORCOUNT"
|
||||
FROM $schemaId$.TSEAIQM01 Q1
|
||||
INNER JOIN $schemaId$.TSEAICM01 C1 ON Q1.EAIBZWKDSTCD = C1.EAIBZWKDSTCD
|
||||
WHERE Q1.QUEUSEYN = '1'
|
||||
ORDER BY Q1.EAIBZWKDSTCD, Q1.EAIQUEBZWKCTNT, Q1.EAISEVRINSTNCNAME
|
||||
</statement>
|
||||
</sqlMap>
|
||||
@@ -1,9 +1,81 @@
|
||||
# HotSwapAgent 설정
|
||||
# Spring 관련
|
||||
Spring.reload=true
|
||||
# Hibernate 관련
|
||||
Hibernate.reload=true
|
||||
# 로그 레벨
|
||||
logLevel=INFO
|
||||
# 자동 Hot Swap 활성화
|
||||
# ============================================================
|
||||
# HotswapAgent Configuration for eapim-admin (Spring Legacy)
|
||||
# ============================================================
|
||||
|
||||
# \uC790\uB3D9 \uD56B\uC2A4\uC651 \uD65C\uC131\uD654
|
||||
autoHotswap=true
|
||||
|
||||
# \uB85C\uAE45 \uB808\uBCA8 (TRACE, DEBUG, INFO, WARNING, ERROR)
|
||||
LOGGER.level=INFO
|
||||
|
||||
# ============================================================
|
||||
# \uBA85\uC2DC\uC801 \uD50C\uB7EC\uADF8\uC778 \uBE44\uD65C\uC131\uD654 (\uC27C\uD45C \uAD6C\uBD84)
|
||||
# ============================================================
|
||||
disabledPlugins=org.hotswap.agent.plugin.ibatis.IBatisPlugin,org.hotswap.agent.plugin.mybatis.MyBatisPlugin
|
||||
|
||||
# ============================================================
|
||||
# Core Plugin \uD65C\uC131\uD654
|
||||
# ============================================================
|
||||
|
||||
# Spring Framework (\uD544\uC218) - Bean \uC7AC\uB4F1\uB85D
|
||||
spring.enabled=true
|
||||
spring.basePackagePrefix=com.eactive.
|
||||
|
||||
# Hibernate/JPA - \uC5D4\uD2F0\uD2F0 \uBCC0\uACBD \uAC10\uC9C0
|
||||
hibernate.enabled=true
|
||||
|
||||
# Logback - \uB85C\uADF8 \uC124\uC815 \uB9AC\uB85C\uB4DC
|
||||
logback.enabled=true
|
||||
|
||||
# Proxy - AOP \uD504\uB85D\uC2DC \uC7AC\uC0DD\uC131
|
||||
proxy.enabled=true
|
||||
|
||||
# ============================================================
|
||||
# \uBE44\uD65C\uC131\uD654 Plugin (\uBBF8\uC0AC\uC6A9 \uB610\uB294 \uCDA9\uB3CC \uBC29\uC9C0)
|
||||
# ============================================================
|
||||
|
||||
# iBatis (Spring\uC758 SqlMapClientFactoryBean\uACFC \uCDA9\uB3CC)
|
||||
ibatis.enabled=false
|
||||
mybatis.enabled=false
|
||||
jsf.enabled=false
|
||||
seam.enabled=false
|
||||
wicket.enabled=false
|
||||
mojarra.enabled=false
|
||||
omnifaces.enabled=false
|
||||
el.enabled=false
|
||||
weld.enabled=false
|
||||
owb.enabled=false
|
||||
cdi.enabled=false
|
||||
resteasy.enabled=false
|
||||
jersey1.enabled=false
|
||||
jersey2.enabled=false
|
||||
|
||||
# ============================================================
|
||||
# Watch Resources (\uB9AC\uC18C\uC2A4 \uBCC0\uACBD \uAC10\uC9C0)
|
||||
# ============================================================
|
||||
|
||||
# \uD074\uB798\uC2A4\uD328\uC2A4 \uC678 \uCD94\uAC00 \uAC10\uC2DC \uACBD\uB85C (XML \uC124\uC815 \uB4F1)
|
||||
watchResources=src/main/resources,WebContent/WEB-INF
|
||||
|
||||
# ============================================================
|
||||
# Spring \uC804\uC6A9 \uC124\uC815
|
||||
# ============================================================
|
||||
|
||||
# \uCEF4\uD3EC\uB10C\uD2B8 \uC2A4\uCE94 \uBCA0\uC774\uC2A4 \uD328\uD0A4\uC9C0
|
||||
spring.scanBasePackage=com.eactive.eai,com.eactive.apim
|
||||
|
||||
# \uD504\uB85D\uC2DC \uC7AC\uC0DD\uC131 (AOP, @Transactional \uC0AC\uC6A9 \uC2DC \uD544\uC218)
|
||||
spring.proxyRegeneration=true
|
||||
|
||||
# Bean \uC815\uC758 \uBCC0\uACBD \uC2DC \uB9AC\uB85C\uB4DC
|
||||
spring.reloadBeanDefinition=true
|
||||
|
||||
# ============================================================
|
||||
# \uB514\uBC84\uAE45 (\uBB38\uC81C \uBC1C\uC0DD \uC2DC \uD65C\uC131\uD654)
|
||||
# ============================================================
|
||||
|
||||
# \uC0C1\uC138 \uB85C\uADF8 \uCD9C\uB825 (\uD544\uC694\uC2DC DEBUG\uB85C \uBCC0\uACBD)
|
||||
# LOGGER.level=DEBUG
|
||||
|
||||
# \uD074\uB798\uC2A4 \uBCC0\uACBD \uCD94\uC801
|
||||
# LOGGER.org.hotswap.agent.plugin.spring=DEBUG
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user