Merge remote-tracking branch 'origin/jenkins_with_weblogic' of C:/KJB_DEV/git-bundles/bundles/251125/eapim-online_incremental_2025-11-01.bundle into jenkins_with_weblogic
This commit is contained in:
@@ -27,6 +27,8 @@ import com.eactive.eai.adapter.service.ApiAdapterService;
|
|||||||
import com.eactive.eai.common.TransactionContextKeys;
|
import com.eactive.eai.common.TransactionContextKeys;
|
||||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||||
import com.eactive.eai.common.server.EAIServerManager;
|
import com.eactive.eai.common.server.EAIServerManager;
|
||||||
|
import com.eactive.eai.common.stdmessage.STDMessageDAO;
|
||||||
|
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||||
import com.eactive.eai.common.util.DatetimeUtil;
|
import com.eactive.eai.common.util.DatetimeUtil;
|
||||||
import com.eactive.eai.common.util.InboundErrorLogger;
|
import com.eactive.eai.common.util.InboundErrorLogger;
|
||||||
import com.eactive.eai.common.util.Logger;
|
import com.eactive.eai.common.util.Logger;
|
||||||
@@ -42,6 +44,7 @@ import org.json.simple.JSONObject;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import com.eactive.eai.data.entity.onl.stdmessage.StandardMessageInfo;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ApiAdapterController implements HttpAdapterServiceKey {
|
public class ApiAdapterController implements HttpAdapterServiceKey {
|
||||||
@@ -62,16 +65,12 @@ public class ApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
// /api/v1/public/getUserInfo.svc
|
// /api/v1/public/getUserInfo.svc
|
||||||
apiUri = StringUtils.removeStart(apiUri, servletRequest.getContextPath());
|
apiUri = StringUtils.removeStart(apiUri, servletRequest.getContextPath());
|
||||||
apiUri = StringUtils.removeEnd(apiUri, "/");
|
apiUri = StringUtils.removeEnd(apiUri, "/");
|
||||||
|
|
||||||
HttpDynamicInAdapterUri adptUri = findAdptUri(apiUri, HttpDynamicInAdapterManager.getInstance());
|
HttpDynamicInAdapterUri adptUri = findAdptUri(apiUri, HttpDynamicInAdapterManager.getInstance());
|
||||||
|
|
||||||
//Received time , jwhong
|
//Received time , jwhong
|
||||||
long receivedTimeMillis = System.currentTimeMillis();
|
long receivedTimeMillis = System.currentTimeMillis();
|
||||||
String receivedTimeStr = String.valueOf(receivedTimeMillis);
|
String receivedTimeStr = String.valueOf(receivedTimeMillis);
|
||||||
|
|
||||||
System.out.println("현재 시간 밀리초(long): " + receivedTimeMillis);
|
|
||||||
System.out.println("현재 시간 밀리초(String): " + receivedTimeStr);
|
|
||||||
//Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
|
||||||
//System.out.println("현재 Timestamp: " + timestamp);
|
|
||||||
|
|
||||||
if (logger.isDebug()) {
|
if (logger.isDebug()) {
|
||||||
logger.debug("ApiAdapterController] service request uri : " + servletRequest.getRequestURI());
|
logger.debug("ApiAdapterController] service request uri : " + servletRequest.getRequestURI());
|
||||||
@@ -105,7 +104,7 @@ public class ApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
Properties transactionProp = new Properties();
|
Properties transactionProp = new Properties();
|
||||||
//transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeMillis); // jwhong, put api received time
|
//transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeMillis); // jwhong, put api received time
|
||||||
transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeStr);
|
transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeStr);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String responseData = service.callApi(servletRequest, servletResponse, httpProp, adapterGroupVO, adapterVO, transactionProp);
|
String responseData = service.callApi(servletRequest, servletResponse, httpProp, adapterGroupVO, adapterVO, transactionProp);
|
||||||
// if (RESPONSE_TYPE_ASYNC.equals(responseType)) { // table의 값이 ASYNC 로 들어가 있는데 response_type_async는 ASYN 로 되어 있어 아래처럼 비교함 jwhong 2025
|
// if (RESPONSE_TYPE_ASYNC.equals(responseType)) { // table의 값이 ASYNC 로 들어가 있는데 response_type_async는 ASYN 로 되어 있어 아래처럼 비교함 jwhong 2025
|
||||||
@@ -116,8 +115,12 @@ public class ApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
if (httpStatus == 200) {
|
if (httpStatus == 200) {
|
||||||
// 업체별 aync response message 가 다르다.
|
// 업체별 aync response message 가 다르다.
|
||||||
String asyncMsgStyle = httpProp.getProperty("ASYNC_RTNMSG_TYPE", "").toUpperCase();
|
String asyncMsgStyle = httpProp.getProperty("ASYNC_RTNMSG_TYPE", "").toUpperCase();
|
||||||
//String responseBody = makeResponseBodyMsg(asyncMsgStyle);
|
String responseBody ="";
|
||||||
String responseBody = asyncMsgStyle;
|
if (asyncMsgStyle == null || asyncMsgStyle.trim().isEmpty()) {
|
||||||
|
responseBody = makeResponseBodyMsg();
|
||||||
|
} else {
|
||||||
|
responseBody = asyncMsgStyle;
|
||||||
|
}
|
||||||
responseEntity = ResponseEntity.status(httpStatus).contentType(mediaType).body(responseBody);
|
responseEntity = ResponseEntity.status(httpStatus).contentType(mediaType).body(responseBody);
|
||||||
// jwhong
|
// jwhong
|
||||||
} else {
|
} else {
|
||||||
@@ -167,15 +170,25 @@ public class ApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
* @param apiUri
|
* @param apiUri
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private HttpDynamicInAdapterUri findAdptUri(String apiUri, HttpDynamicInAdapterManager manager) {
|
private HttpDynamicInAdapterUri findAdptUri(String apiUri, HttpDynamicInAdapterManager manager) throws Exception {
|
||||||
if (StringUtils.isBlank(apiUri)) {
|
if (StringUtils.isBlank(apiUri)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//** jwhong TSEAIHS04의 api full path와 비교하여 adapter를 가져온다
|
||||||
|
STDMessageDAO dao = ApplicationContextProvider.getContext().getBean(STDMessageDAO.class);
|
||||||
|
StandardMessageInfo stdInfo = dao.getSTDMsgByPath(apiUri);
|
||||||
|
String serviceKey = stdInfo.getBzwksvckeyname();
|
||||||
|
int idx = serviceKey.indexOf(":");
|
||||||
|
String adapterGrpName = (idx != -1) ? serviceKey.substring(0, idx) : serviceKey; // ':' 이전 문자열 추출
|
||||||
|
//***
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
HttpDynamicInAdapterUri adptUri = manager.getAdptUri(apiUri);
|
HttpDynamicInAdapterUri adptUri = manager.getAdptUri(apiUri);
|
||||||
if (adptUri != null) {
|
if (adptUri != null) {
|
||||||
return adptUri;
|
if (adptUri.getAdptGrpName().equals(adapterGrpName)) {
|
||||||
|
return adptUri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /api/v1/public
|
// /api/v1/public
|
||||||
@@ -221,6 +234,23 @@ public class ApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
InboundErrorLogger.error(errorInfoVO);
|
InboundErrorLogger.error(errorInfoVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String makeResponseBodyMsg() {
|
||||||
|
|
||||||
|
Map<String, Object> dataMap = new HashMap<>();
|
||||||
|
dataMap.put("result", 1);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
map.put("code", "200");
|
||||||
|
map.put("data", dataMap);
|
||||||
|
map.put("message", "정상 처리 되었습니다.");
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.putAll(map);
|
||||||
|
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private String makeResponseBodyMsg(String asyncMsgStyle) {
|
private String makeResponseBodyMsg(String asyncMsgStyle) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user