Merge branch 'jenkins_with_weblogic' of ssh://192.168.240.178:18081/eapim/elink-online-common into jenkins_with_weblogic
This commit is contained in:
+430
-399
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,8 @@ public interface HttpAdapterServiceKey {
|
||||
static final String ENCRYPT_AES256_IV = "ENCRYPT_AES256_IV"; // jwhong
|
||||
static final String ENCRYPT_AES256_KEY = "ENCRYPT_AES256_KEY"; // jwhong
|
||||
static final String INBOUND_REQUESTED_TIME = "INBOUND_REQUESTED_TIME"; // jwhong
|
||||
static final String GUID = "GUID"; // jwhong
|
||||
static final String API_SERVICE_CODE = "API_SERVICE_CODE"; // jwhong
|
||||
|
||||
//응답 처리 용 표준 전문 오브젝트
|
||||
static final String STANDARD_MESSAGE_OBJECT = "STANDARD_MESSAGE_OBJECT";
|
||||
|
||||
@@ -24,8 +24,10 @@ public class HttpDynamicInAdapterManager implements Lifecycle {
|
||||
|
||||
private static HttpDynamicInAdapterManager instance = new HttpDynamicInAdapterManager();
|
||||
|
||||
private ConcurrentHashMap<String, HttpDynamicInAdapterUri> adptUriMap = new ConcurrentHashMap<String, HttpDynamicInAdapterUri>();
|
||||
//private ConcurrentHashMap<String, HttpDynamicInAdapterUri> adptUriMap = new ConcurrentHashMap<String, HttpDynamicInAdapterUri>();
|
||||
public ConcurrentHashMap<String, HttpDynamicInAdapterUri> adptUriMap = new ConcurrentHashMap<String, HttpDynamicInAdapterUri>();
|
||||
|
||||
|
||||
public static HttpDynamicInAdapterManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
+9
-2
@@ -51,7 +51,7 @@ import com.openbanking.eai.common.token.AccessTokenVO;
|
||||
import com.openbanking.eai.common.token.OAuth2AccessTokenVO;
|
||||
import org.springframework.security.web.util.UrlUtils;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 1. 기능 : HTTP 웹 컴포넌트를 POST 방식으로 호출할 수 있는 기능을 제공한다. 2. 처리 개요 : * - 2009.11.24
|
||||
* retry 로직 제거 : 요청 3. 주의사항
|
||||
*
|
||||
@@ -224,17 +224,20 @@ public class HttpClientAccessTokenServiceWithParam implements HttpClientAccessTo
|
||||
logger.debug("contentType = [" + contentType + "]");
|
||||
logger.debug("encode = [" + encode + "]");
|
||||
|
||||
OAuth2AccessTokenVO accessToken = new OAuth2AccessTokenVO();
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
if (response.getCode() != 200) {
|
||||
System.out.println("OAuth token receive status fail value= "+ response.getCode());
|
||||
throw new Exception("OAuth token receive status fail value= " + response.getCode());
|
||||
}
|
||||
System.out.println("OAuth token receive status SUCCESS value= "+ response.getCode());
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseString = EntityUtils.toString(entity, encode);
|
||||
logger.debug("oauthToken RECV = [" + responseString + "]");
|
||||
|
||||
if (StringUtils.isNotBlank(responseString)) {
|
||||
OAuth2AccessTokenVO accessToken = new OAuth2AccessTokenVO();
|
||||
//OAuth2AccessTokenVO accessToken = new OAuth2AccessTokenVO();
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode responseJSON = objectMapper.readTree(responseString);
|
||||
@@ -259,6 +262,10 @@ public class HttpClientAccessTokenServiceWithParam implements HttpClientAccessTo
|
||||
} else {
|
||||
throw new Exception("oauth token return null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("[HttpClientAccessTokenServiceWithParam] retrieve accessToken exception :" + e.getMessage());
|
||||
return accessToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ import com.ext.eai.common.stdmessage.STDMessageKeys;
|
||||
// safeDB
|
||||
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
||||
import com.eactive.ext.kjb.safedb.Utils;
|
||||
// until here
|
||||
|
||||
|
||||
@Service
|
||||
|
||||
@@ -2,11 +2,15 @@ package com.eactive.eai.common.logger;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class HttpAdapterExtraHeaderVo {
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public HttpAdapterExtraHeaderVo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
public class HttpAdapterExtraLogVo {
|
||||
private String guid;
|
||||
private int serviceProcessNumber;
|
||||
private String prcsDate;
|
||||
private String adapterGroupName;
|
||||
private String adapterName;
|
||||
private String url;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.eactive.eai.common.logger.async;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.server.EAIServerManager;
|
||||
import com.eactive.eai.common.util.LogKeys;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraHeader;
|
||||
//import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraHeader;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraLog;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
@@ -66,7 +66,7 @@ public class HttpAdapterExtraLogH2Factory {
|
||||
|
||||
// 엔티티 클래스 추가
|
||||
configuration.addAnnotatedClass(HttpAdapterExtraLog.class);
|
||||
configuration.addAnnotatedClass(HttpAdapterExtraHeader.class);
|
||||
// configuration.addAnnotatedClass(HttpAdapterExtraHeader.class);
|
||||
|
||||
return configuration.buildSessionFactory();
|
||||
} catch (Throwable ex) {
|
||||
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
package com.eactive.eai.common.logger.mapper;
|
||||
|
||||
import com.eactive.eai.common.logger.HttpAdapterExtraHeaderVo;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraHeader;
|
||||
import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
@Mapper(config = BaseMapperConfig.class)
|
||||
public interface HttpAdapterExtraHeaderMapper extends GenericMapper<HttpAdapterExtraHeaderVo, HttpAdapterExtraHeader> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "id.name", target = "name")
|
||||
HttpAdapterExtraHeaderVo toVo(HttpAdapterExtraHeader entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
HttpAdapterExtraHeader toEntity(HttpAdapterExtraHeaderVo vo);
|
||||
}
|
||||
//package com.eactive.eai.common.logger.mapper;
|
||||
//
|
||||
//import com.eactive.eai.common.logger.HttpAdapterExtraHeaderVo;
|
||||
//import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraHeader;
|
||||
//import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
//import com.eactive.eai.data.mapper.GenericMapper;
|
||||
//
|
||||
//import org.mapstruct.InheritInverseConfiguration;
|
||||
//import org.mapstruct.Mapper;
|
||||
//import org.mapstruct.Mapping;
|
||||
//
|
||||
//@Mapper(config = BaseMapperConfig.class)
|
||||
//public interface HttpAdapterExtraHeaderMapper extends GenericMapper<HttpAdapterExtraHeaderVo, HttpAdapterExtraHeader> {
|
||||
//
|
||||
// @Override
|
||||
// @Mapping(source = "id.name", target = "name")
|
||||
// HttpAdapterExtraHeaderVo toVo(HttpAdapterExtraHeader entity);
|
||||
//
|
||||
// @Override
|
||||
// @InheritInverseConfiguration
|
||||
// HttpAdapterExtraHeader toEntity(HttpAdapterExtraHeaderVo vo);
|
||||
//}
|
||||
|
||||
@@ -1,42 +1,80 @@
|
||||
package com.eactive.eai.common.logger.mapper;
|
||||
|
||||
import com.eactive.eai.common.logger.HttpAdapterExtraHeaderVo;
|
||||
import com.eactive.eai.common.logger.HttpAdapterExtraLogVo;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraHeaderId;
|
||||
import com.eactive.eai.data.entity.onl.logger.HttpAdapterExtraLog;
|
||||
import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mapstruct.*;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Optional;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(config = BaseMapperConfig.class, uses = HttpAdapterExtraHeaderMapper.class)
|
||||
public interface HttpAdapterExtraLogMapper extends GenericMapper<HttpAdapterExtraLogVo, HttpAdapterExtraLog> {
|
||||
@Slf4j
|
||||
@Mapper(config = BaseMapperConfig.class)
|
||||
public abstract class HttpAdapterExtraLogMapper implements GenericMapper<HttpAdapterExtraLogVo, HttpAdapterExtraLog> {
|
||||
|
||||
private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||
private static final DateTimeFormatter SDF_YYYYMMDD = DateTimeFormatter.ofPattern( "yyyyMMdd");
|
||||
|
||||
@Override
|
||||
@Mapping(source = "id.guid", target = "guid")
|
||||
@Mapping(source = "id.serviceProcessNumber", target = "serviceProcessNumber")
|
||||
HttpAdapterExtraLogVo toVo(HttpAdapterExtraLog entity);
|
||||
abstract public HttpAdapterExtraLogVo toVo(HttpAdapterExtraLog entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
HttpAdapterExtraLog toEntity(HttpAdapterExtraLogVo vo);
|
||||
abstract public HttpAdapterExtraLog toEntity(HttpAdapterExtraLogVo vo);
|
||||
|
||||
@AfterMapping
|
||||
default void setHeaderIdAndWeekday(@MappingTarget HttpAdapterExtraLog entity, HttpAdapterExtraLogVo vo) {
|
||||
DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); // 현재 요일
|
||||
int dayOfWeekNumber = dayOfWeek.getValue() % 7 + 1; // 1 (일요일)부터 7 (토요일)까지
|
||||
entity.getId().setWeekday(dayOfWeekNumber);
|
||||
Optional.ofNullable(entity.getHeaderList())
|
||||
.ifPresent(headers -> headers.forEach(header -> {
|
||||
if (header.getId() == null) {
|
||||
header.setId(new HttpAdapterExtraHeaderId());
|
||||
}
|
||||
header.getId().setWeekday(dayOfWeekNumber);
|
||||
header.getId().setGuid(vo.getGuid());
|
||||
header.getId().setServiceProcessNumber(vo.getServiceProcessNumber());
|
||||
}));
|
||||
public void voToEntity(@MappingTarget HttpAdapterExtraLog entity, HttpAdapterExtraLogVo vo) {
|
||||
|
||||
// 1. Set weekday for partition table
|
||||
// DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); // 현재 요일
|
||||
// int dayOfWeekNumber = dayOfWeek.getValue() % 7 + 1; // 1 (일요일)부터 7 (토요일)까지
|
||||
// entity.getId().setWeekday(dayOfWeekNumber);
|
||||
|
||||
// String prcs_date = SDF_YYYYMMDD.format(ZonedDateTime.now());
|
||||
String prcs_date = LocalDate.now().format(SDF_YYYYMMDD);
|
||||
entity.getId().setPrcsDate(prcs_date);
|
||||
|
||||
// 2. Set Content
|
||||
try {
|
||||
String headerContent = objectMapper.writeValueAsString(vo.getHeaderList());
|
||||
entity.setHeaderContent(headerContent);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.warn("Http Header Json Parse 실패", e);
|
||||
entity.setHeaderContent("[{ \"error\": \"parse error\"}]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity → VO 변환 후 추가 처리
|
||||
*/
|
||||
@AfterMapping
|
||||
protected void entityToVo(@MappingTarget HttpAdapterExtraLogVo vo, HttpAdapterExtraLog entity) {
|
||||
String headerContent = entity.getHeaderContent();
|
||||
if (headerContent == null || headerContent.isEmpty()) {
|
||||
vo.setHeaderList(Collections.emptyList());
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<HttpAdapterExtraHeaderVo> headerList = objectMapper.readValue(
|
||||
headerContent,
|
||||
new TypeReference<List<HttpAdapterExtraHeaderVo>>() {}
|
||||
);
|
||||
vo.setHeaderList(headerList);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.warn("Http Header 역직렬화 실패", e);
|
||||
vo.setHeaderList(Collections.emptyList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class HttpAdapterExtraLogUtil {
|
||||
public static List<HttpAdapterExtraHeaderVo> convertHeaderToListOfHttpAdapterExtraHeaderVo(Header[] headers) {
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
return Arrays.stream(headers)
|
||||
.filter(header -> seenNames.add(header.getName())) // 중복된 이름을 스킵
|
||||
// .filter(header -> seenNames.add(header.getName())) // 중복된 이름을 스킵
|
||||
.map(header -> new HttpAdapterExtraHeaderVo(header.getName(), header.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,11 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
String bidInterface = adptGrpVO.getBidInterface();
|
||||
String testMasterYn = adptGrpVO.getTestMasterYn();
|
||||
|
||||
// UUID 생성 : UUID = "-" 없는 32자리 UUID(광주은행 요청)
|
||||
// UUID 생성 : UUID에서 - 없는 32자리
|
||||
String uuid = "";
|
||||
uuid = UUIDGenerator.getUUID().toString().replaceAll("-", "");
|
||||
// UUID 생성 : UUID = server구분4자리 + UUID
|
||||
/*
|
||||
String uuid = "";
|
||||
uuid = UUIDGenerator.getUUID().toString().replaceAll("-", "");
|
||||
|
||||
@@ -135,6 +139,7 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
// if (logger.isError()) logger.error(rspErrorMsg);
|
||||
// throw new RequestProcessorException(rspErrorMsg);
|
||||
// }
|
||||
*/
|
||||
|
||||
ProcessVO vo = new ProcessVO();
|
||||
vo.setAdapterGroupName(adapterGroupName);
|
||||
@@ -337,7 +342,9 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
}
|
||||
|
||||
// 3. EAIMessage Object 생성
|
||||
String eaiSvcCd = mapper.getEaiSvcCode(standardMessage);
|
||||
//String eaiSvcCd = mapper.getEaiSvcCode(standardMessage); // commnet by jwhong
|
||||
String eaiSvcCd = prop.getProperty("API_SERVICE_CODE");
|
||||
System.out.println("***** eaiSvcCd is"+ eaiSvcCd);
|
||||
String guid = mapper.getGuid(standardMessage);
|
||||
String guidSeq = mapper.getGuidSeq(standardMessage);
|
||||
String returnType = mapper.getSendRecvDivision(standardMessage); // S|R
|
||||
|
||||
@@ -440,6 +440,7 @@ public class RESTProcess extends HTTPProcess {
|
||||
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_REMOTE_ADDR);
|
||||
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_SCHEME);
|
||||
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.INBOUND_REQUESTED_TIME); // jwhong
|
||||
PropertiesUtil.copyPropertyIfPresent(this.callProp, this.tempProp, HttpAdapterServiceKey.GUID); // jwhong
|
||||
|
||||
String svcName = getServiceId(this.reqEaiMsg);
|
||||
if (svcName == null) {
|
||||
|
||||
Reference in New Issue
Block a user