광주은행 표준전문 관련 작업
This commit is contained in:
+11
-8
@@ -5,6 +5,7 @@ import com.eactive.eai.adapter.http.client.HttpClient5AdapterServiceSupport;
|
|||||||
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
|
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
|
||||||
import com.eactive.eai.adapter.http.client.HttpClientAdapterVO;
|
import com.eactive.eai.adapter.http.client.HttpClientAdapterVO;
|
||||||
import com.eactive.eai.common.TransactionContextKeys;
|
import com.eactive.eai.common.TransactionContextKeys;
|
||||||
|
import com.eactive.eai.common.message.MessageType;
|
||||||
import com.eactive.eai.common.util.CommonLib;
|
import com.eactive.eai.common.util.CommonLib;
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -57,14 +58,16 @@ public class HttpClient5AdapterServiceBody extends HttpClient5AdapterServiceSupp
|
|||||||
} else if (data instanceof byte[]) {
|
} else if (data instanceof byte[]) {
|
||||||
sendData = new String((byte[]) data, vo.getEncode());
|
sendData = new String((byte[]) data, vo.getEncode());
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
if(MessageType.JSON.equals(prop.getProperty("messageType"))) {
|
||||||
ObjectNode jsonNode = (ObjectNode) mapper.readTree(sendData);
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
ObjectNode headerPart = (ObjectNode) jsonNode.get("header_part");
|
ObjectNode jsonNode = (ObjectNode) mapper.readTree(sendData);
|
||||||
|
ObjectNode headerPart = (ObjectNode) jsonNode.get("header_part");
|
||||||
if( headerPart.get("mciIntfId") != null && headerPart.get("mciIntfId").asText().trim().length() > 0 ) {
|
|
||||||
headerPart.put("eaiIntfId", "");
|
if( headerPart.get("mciIntfId") != null && headerPart.get("mciIntfId").asText().trim().length() > 0 ) {
|
||||||
sendData = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);
|
headerPart.put("eaiIntfId", "");
|
||||||
|
sendData = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("Y".equals(vo.getUrlEncodeYn())) {
|
if ("Y".equals(vo.getUrlEncodeYn())) {
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ public abstract class Process {
|
|||||||
String outboundAdapterGroupName = eaiMessage.getCurrentSvcMsg().getPsvSysItfTp();
|
String outboundAdapterGroupName = eaiMessage.getCurrentSvcMsg().getPsvSysItfTp();
|
||||||
AdapterGroupVO outboundAdapterGvo = AdapterManager.getInstance().getAdapterGroupVO(outboundAdapterGroupName);
|
AdapterGroupVO outboundAdapterGvo = AdapterManager.getInstance().getAdapterGroupVO(outboundAdapterGroupName);
|
||||||
standardMessage.setBizData(bizObject, outboundAdapterGvo.getMessageEncode());
|
standardMessage.setBizData(bizObject, outboundAdapterGvo.getMessageEncode());
|
||||||
|
|
||||||
|
StandardMessageManager.getInstance().getMessageCoordinator().coordinateBeforeStandardMessageSend(standardMessage, msgType, charset);
|
||||||
|
|
||||||
if(MessageType.JSON.equals(msgType)) {
|
if(MessageType.JSON.equals(msgType)) {
|
||||||
return standardMessage.toJson();
|
return standardMessage.toJson();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1222,6 +1222,9 @@ public class RequestProcessor extends RequestProcessorSupport {
|
|||||||
logger.error("convertToSub failed.", e);
|
logger.error("convertToSub failed.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//응답 전 표준 전문의 로직 처리 필요 한 경우를 위해 호출
|
||||||
|
standardManager.getMessageCoordinator().coordinateBeforeResponse(standardMessage, vo, prop, inboundCharset);
|
||||||
|
|
||||||
// 10. 응답 거래로그 Logging
|
// 10. 응답 거래로그 Logging
|
||||||
if(EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) &&
|
if(EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) &&
|
||||||
|
|||||||
@@ -107,16 +107,22 @@ public class FlatReader implements StandardReader {
|
|||||||
case StandardType.GROUP:
|
case StandardType.GROUP:
|
||||||
logger.debug("@GROUP name={}, getLength={}, getRefPath={}, getRefValue=[{}]"
|
logger.debug("@GROUP name={}, getLength={}, getRefPath={}, getRefValue=[{}]"
|
||||||
, currentItem.getName(), currentItem.getLength(), currentItem.getRefPath(), currentItem.getRefValue());
|
, currentItem.getName(), currentItem.getLength(), currentItem.getRefPath(), currentItem.getRefValue());
|
||||||
if( currentItem.getSize() == 0
|
if( currentItem.getSize() == 0
|
||||||
&& StringUtils.isNotBlank(currentItem.getRefPath())
|
&& StringUtils.isNotBlank(currentItem.getRefPath())
|
||||||
&& StringUtils.isNotBlank(currentItem.getRefValue()) ) {
|
&& StringUtils.isNotBlank(currentItem.getRefValue()) ) {
|
||||||
String refItemValue = itemMap.get(currentItem.getRefPath());
|
//2024.08.07 아래추가로직은 Group 하위의 field 값에 따라서
|
||||||
|
//파싱을 해야 될경우 추가
|
||||||
|
String refItemValue ="";
|
||||||
|
if (currentItem.getRefPath().startsWith(fieldName)){
|
||||||
|
refItemValue = getRefItemValue(currentItem.getRefPath(), fieldName, srcbytes, currentItem, start);
|
||||||
|
}else{
|
||||||
|
refItemValue = itemMap.get(currentItem.getRefPath());
|
||||||
|
}
|
||||||
logger.debug("@GROUP name={}, getRefPath={}, refItemValue=[{}], getRefValue=[{}]"
|
logger.debug("@GROUP name={}, getRefPath={}, refItemValue=[{}], getRefValue=[{}]"
|
||||||
, currentItem.getName(), currentItem.getRefPath(), refItemValue, currentItem.getRefValue());
|
, currentItem.getName(), currentItem.getRefPath(), refItemValue, currentItem.getRefValue());
|
||||||
|
|
||||||
if(refItemValue != null) refItemValue = refItemValue.trim();
|
if(refItemValue != null) refItemValue = refItemValue.trim();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 값의 경우의수 NR,ER,""(blank)
|
* 값의 경우의수 NR,ER,""(blank)
|
||||||
* ER이 아닐경우 표현하고 싶어서 ! 를 추가했음
|
* ER이 아닐경우 표현하고 싶어서 ! 를 추가했음
|
||||||
@@ -284,6 +290,26 @@ public class FlatReader implements StandardReader {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRefItemValue(String orgRef, String fieldName, byte[] srcbytes , StandardItem currentItem ,int start ){
|
||||||
|
String currentFieldName = orgRef.replace(fieldName+".","");
|
||||||
|
ArrayList<StandardItem> childList = currentItem.getChildsList();
|
||||||
|
String refItemValue ="";
|
||||||
|
for(StandardItem item : childList) {
|
||||||
|
if (currentFieldName.indexOf(".") < 0) {
|
||||||
|
byte[] tempValue = null;
|
||||||
|
if (orgRef.equals(fieldName + "." + item.getName())) {
|
||||||
|
tempValue = cut(fieldName, srcbytes, start, item.getLength());
|
||||||
|
return new String(tempValue);
|
||||||
|
}else{
|
||||||
|
start = start + item.getLength();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return getRefItemValue(orgRef, fieldName+"."+item.getName(), srcbytes, item, start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return refItemValue;
|
||||||
|
}
|
||||||
// public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
+8
-1
@@ -25,6 +25,11 @@ public class DefaultStandardMessageCoordinator implements StandardMessageCoordin
|
|||||||
mapper.setGuid(standardMessage, UUIDGenerator.getGUID(eaiServerManager.getSystemType()));
|
mapper.setGuid(standardMessage, UUIDGenerator.getGUID(eaiServerManager.getSystemType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void coordinateBeforeStandardMessageSend(StandardMessage standardMessage, String msgType, String charset) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void coordinateInReturnObject(StandardMessage standardMessage) {
|
public void coordinateInReturnObject(StandardMessage standardMessage) {
|
||||||
}
|
}
|
||||||
@@ -72,5 +77,7 @@ public class DefaultStandardMessageCoordinator implements StandardMessageCoordin
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void coordinateBeforeResponse(StandardMessage standardMessage, ProcessVO processVO, Properties prop, String charset) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,14 @@ public interface StandardMessageCoordinator {
|
|||||||
* @param prop
|
* @param prop
|
||||||
*/
|
*/
|
||||||
public void coordinateAfterCreateMessageByRule(StandardMessage standardMessage, Object paramObject, Properties prop);
|
public void coordinateAfterCreateMessageByRule(StandardMessage standardMessage, Object paramObject, Properties prop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 표준전문 송신 전 메시지 조립 전 처리
|
||||||
|
*
|
||||||
|
* @param standardMessage
|
||||||
|
*/
|
||||||
|
public void coordinateBeforeStandardMessageSend(StandardMessage standardMessage, String msgType, String charset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 표준 메시지일경우 ReturnObject 에서 처리
|
* 표준 메시지일경우 ReturnObject 에서 처리
|
||||||
*
|
*
|
||||||
@@ -97,4 +104,15 @@ public interface StandardMessageCoordinator {
|
|||||||
* @param responseMessage
|
* @param responseMessage
|
||||||
*/
|
*/
|
||||||
public void coordinateAfterRecvNonStdSyncResponse(StandardMessage responseMessage);
|
public void coordinateAfterRecvNonStdSyncResponse(StandardMessage responseMessage);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RequestProcess 400 응답 로그 전 표준 메시지 조작 처리
|
||||||
|
*
|
||||||
|
* @param standardMessage
|
||||||
|
* @param processVO
|
||||||
|
* @param prop
|
||||||
|
* @param charset
|
||||||
|
*/
|
||||||
|
public void coordinateBeforeResponse(StandardMessage standardMessage, ProcessVO processVO, Properties prop, String charset);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user