OBP 과금용 gw metric 데이터 추가

This commit is contained in:
Rinjae
2025-12-05 10:39:20 +09:00
parent f05f5d7bbc
commit 974830846b
10 changed files with 197 additions and 12 deletions
@@ -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")
@@ -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);
@@ -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"
);
///////////////////////////////////////////////
// 로컬테스트용
@@ -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("\\", "/");
}
}
@@ -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")
StandardMessageInfo toStandardMessageInfo(ApiInterfaceUI vo);
@AfterMapping
@@ -0,0 +1,50 @@
package com.eactive.eai.rms.onl.common.util;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import java.io.File;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class FileSystemUtilTest {
@Test
@EnabledOnOs(OS.LINUX)
void testPathNormalize_Linux() {
assertEquals("/asd1/asd2/asd3", FileSystemUtil.pathNormalize("/asd1/asd2", "asd3"));
assertEquals("/asd1/asd2/asd3", FileSystemUtil.pathNormalize("/asd1/asd2/", "/asd3"));
assertEquals("/asd1/asd2/asd3", FileSystemUtil.pathNormalize("/asd1/asd2", "/asd3"));
assertEquals("/asd1/asd2/asd3", FileSystemUtil.pathNormalize("/asd1/asd2/", "asd3/"));
assertEquals("/a/b/c", FileSystemUtil.pathNormalize("/a/", "/b/", "/c/"));
assertEquals("a/b/c", FileSystemUtil.pathNormalize("a", "b", "c"));
assertEquals("/a", FileSystemUtil.pathNormalize("/a"));
}
@Test
@EnabledOnOs(OS.WINDOWS)
void testPathNormalize_Windows() {
assertEquals("\\asd1\\asd2\\asd3", FileSystemUtil.pathNormalize("/asd1/asd2", "asd3"));
assertEquals("\\asd1\\asd2\\asd3", FileSystemUtil.pathNormalize("/asd1/asd2/", "/asd3"));
assertEquals("\\asd1\\asd2\\asd3", FileSystemUtil.pathNormalize("/asd1/asd2", "/asd3"));
assertEquals("\\asd1\\asd2\\asd3", FileSystemUtil.pathNormalize("/asd1/asd2/", "asd3/"));
assertEquals("C:\\Users\\Test", FileSystemUtil.pathNormalize("C:/Users", "Test"));
assertEquals("C:\\Users\\Test", FileSystemUtil.pathNormalize("C:\\Users", "Test"));
assertEquals("\\a\\b\\c", FileSystemUtil.pathNormalize("/a/", "/b/", "/c/"));
assertEquals("a\\b\\c", FileSystemUtil.pathNormalize("a", "b", "c"));
assertEquals("\\a", FileSystemUtil.pathNormalize("/a"));
}
@Test
void testPathNormalize_General() {
String expected = "a" + File.separator + "b" + File.separator + "c";
assertEquals(expected, FileSystemUtil.pathNormalize("a", "b", "c"));
assertEquals("", FileSystemUtil.pathNormalize(""));
assertEquals("", FileSystemUtil.pathNormalize(null));
assertEquals("", FileSystemUtil.pathNormalize());
assertEquals("a", FileSystemUtil.pathNormalize("a"));
assertEquals("a", FileSystemUtil.pathNormalize("a/"));
assertEquals("a", FileSystemUtil.pathNormalize("/a"));
}
}