Merge remote-tracking branch 'origin/jenkins_with_weblogic' into jenkins_with_weblogic
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
let fullMessageData;
|
||||
let layoutInfo = [];
|
||||
let bzwkdatatntInfo;
|
||||
var isPrettyView = false;
|
||||
|
||||
var eaiSvcCode = "";
|
||||
|
||||
@@ -388,10 +389,6 @@
|
||||
|
||||
$('#btn_pretty_body').click(function(){
|
||||
const syntax = $('#selectBodySyntax').val();
|
||||
|
||||
// FLAT view를 위해 생성된 데이터 -> 기존 업무데이터
|
||||
bodyCodeEditor.setValue(bzwkdatatntInfo);
|
||||
|
||||
const value = bodyCodeEditor.getValue();
|
||||
let prettyValue = value;
|
||||
if(syntax === 'JSN'){
|
||||
@@ -431,7 +428,6 @@
|
||||
$('#btn_pretty_body').css('display', 'block');
|
||||
bodyCodeEditor.setOption("mode", "application/json");
|
||||
}else if(syntax === 'XML'){
|
||||
$('#btn_pretty_body').css('display', 'block');
|
||||
$('#btn_pretty_body').css('display', 'block');
|
||||
bodyCodeEditor.setOption("mode", "application/xml");
|
||||
}else{
|
||||
@@ -842,112 +838,141 @@ $(document).ready(function() {
|
||||
alert('전체 전문 복사되었습니다.')
|
||||
});
|
||||
|
||||
// FLAT 데이터를 전문정보로 잘라서 JSON / XML VIEW 로 볼 수 있는 버튼
|
||||
$('#btn_convert_view').click(function() {
|
||||
var type = $('select[id=selectBodySyntax]').val();
|
||||
|
||||
if (!fullMessageData || !layoutInfo) {
|
||||
alert("데이터가 없습니다.");
|
||||
$('#btn_pretty_print').click(function () {
|
||||
|
||||
var $button = $(this);
|
||||
|
||||
// Pretty View → 원본 복구
|
||||
if (typeof isPrettyView !== 'undefined' && isPrettyView) {
|
||||
|
||||
var originalData = (typeof bzwkdatatntInfo !== 'undefined')
|
||||
? bzwkdatatntInfo
|
||||
: "";
|
||||
|
||||
if (typeof bodyCodeEditor !== 'undefined') {
|
||||
bodyCodeEditor.setValue(originalData);
|
||||
}
|
||||
|
||||
isPrettyView = false;
|
||||
$button.text("PRETTY_PRINT");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parserCommon(fullMessageData, layoutInfo, type);
|
||||
});
|
||||
var intrefaceId = ($("input[name=eaiSvcName]").val() || "").trim();
|
||||
var logProcessNo = ($("input[name=logPrcssSerno]").val() || "").trim();
|
||||
var bizData = (typeof bzwkdatatntInfo !== 'undefined')
|
||||
? bzwkdatatntInfo
|
||||
: "";
|
||||
|
||||
function parserCommon(flatData, layoutInfo, type) {
|
||||
var cursor = 0;
|
||||
var parsedList = [];
|
||||
var error = false;
|
||||
|
||||
layoutInfo.forEach(function(field) {
|
||||
var fieldLen = field.length;
|
||||
var errContent = ($("textarea[name=eaiErrCtnt]").val() || "").trim();
|
||||
if (errContent.length > 0) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (fieldLen > 0) {
|
||||
var rawValue = flatData.substring(cursor, cursor + fieldLen);
|
||||
if (!intrefaceId || !logProcessNo || !bizData) {
|
||||
alert("필수값이 누락되어 조회가 불가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
parsedList.push({
|
||||
engName: field.name,
|
||||
korName: field.desc || field.name,
|
||||
value: rawValue // trim 금지.
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
cmd: "DETAIL_PRETTY_VIEW",
|
||||
intrefaceId: intrefaceId,
|
||||
logProcessNo: logProcessNo,
|
||||
bizData: bizData
|
||||
},
|
||||
|
||||
cursor += fieldLen;
|
||||
success: function (response) {
|
||||
|
||||
var xmlString = response.result;
|
||||
|
||||
if (xmlString) {
|
||||
|
||||
if (typeof bodyCodeEditor !== 'undefined') {
|
||||
bodyCodeEditor.setValue(xmlString);
|
||||
}
|
||||
|
||||
$('#selectBodySyntax')
|
||||
.val('XML')
|
||||
.trigger('change');
|
||||
|
||||
isPrettyView = true;
|
||||
$button.text("업무데이터 보기");
|
||||
|
||||
} else {
|
||||
alert("변환된 데이터 내용이 없습니다.");
|
||||
}
|
||||
},
|
||||
|
||||
error: function (xhr, status, error) {
|
||||
|
||||
console.error("AJAX Error:", xhr);
|
||||
|
||||
var errorMsg = "처리 중 오류가 발생했습니다.";
|
||||
|
||||
if (xhr.responseJSON) {
|
||||
|
||||
var errResponse = xhr.responseJSON;
|
||||
|
||||
if (errResponse.result) {
|
||||
errorMsg = errResponse.result;
|
||||
}
|
||||
else if (errResponse.message) {
|
||||
errorMsg = errResponse.message;
|
||||
}
|
||||
|
||||
}
|
||||
// JSON 파싱 실패 대비
|
||||
else if (xhr.responseText) {
|
||||
errorMsg = xhr.responseText;
|
||||
}
|
||||
|
||||
alert(errorMsg);
|
||||
}
|
||||
});
|
||||
|
||||
// CodeMirror 에디터에 값 세팅
|
||||
var finalString = "";
|
||||
|
||||
if (type == "JSN") {
|
||||
|
||||
var jsonResult = {};
|
||||
|
||||
parsedList.forEach(function(item) {
|
||||
jsonResult[item.engName] = {
|
||||
"한글명": item.korName,
|
||||
"값": item.value
|
||||
};
|
||||
});
|
||||
|
||||
finalString = JSON.stringify(jsonResult, null, 4);
|
||||
|
||||
} else if (type == "XML") {
|
||||
|
||||
var xmlResult = "<Root>\n";
|
||||
|
||||
parsedList.forEach(function(item) {
|
||||
var cleanTagName = item.korName.replace(/[^a-zA-Z0-9가-힣]/g, "");
|
||||
if (!cleanTagName) cleanTagName = item.engName;
|
||||
|
||||
xmlResult += "\t<" + cleanTagName + ">" + item.value + "</" + cleanTagName + ">\n";
|
||||
});
|
||||
xmlResult += "</Root>";
|
||||
|
||||
finalString = xmlResult;
|
||||
|
||||
} else {
|
||||
finalString = flatData;
|
||||
}
|
||||
|
||||
bodyCodeEditor.setValue(finalString);
|
||||
$('#selectBodySyntax').val(type).trigger('change');
|
||||
|
||||
// console.log("변환 완료:", parsedList);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 문자열의 바이트 수 계산 (한글 2바이트, 영문/숫자 1바이트)
|
||||
*/
|
||||
function getByteLength(str) {
|
||||
let byteCount = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const charCode = str.charCodeAt(i);
|
||||
byteCount += (charCode >= 0xAC00 && charCode <= 0xD7A3) ? 2 : 1;
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 주어진 바이트 수만큼 패딩
|
||||
* @param {string} str - 원본 문자열
|
||||
* @param {number} targetBytes - 목표 바이트 수
|
||||
* @param {string} position - 'left' 또는 'right' (기본: 'right')
|
||||
* @param {string} padChar - 패딩 문자 (기본: 공백)
|
||||
* @returns {string} - 패딩된 문자열
|
||||
*/
|
||||
function padByteString(str, targetBytes, position = 'right', padChar = ' ') {
|
||||
const currentBytes = getByteLength(str);
|
||||
|
||||
if (currentBytes >= targetBytes) {
|
||||
return str; // 이미 목표 바이트 이상이면 그대로 반환
|
||||
}
|
||||
|
||||
const paddingBytes = targetBytes - currentBytes;
|
||||
const padding = padChar.repeat(paddingBytes);
|
||||
|
||||
return position === 'left' ? padding + str : str + padding;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 문자열의 바이트 수 계산 (한글 2바이트, 영문/숫자 1바이트)
|
||||
*/
|
||||
function getByteLength(str) {
|
||||
let byteCount = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const charCode = str.charCodeAt(i);
|
||||
byteCount += (charCode >= 0xAC00 && charCode <= 0xD7A3) ? 2 : 1;
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 주어진 바이트 수만큼 패딩
|
||||
* @param {string} str - 원본 문자열
|
||||
* @param {number} targetBytes - 목표 바이트 수
|
||||
* @param {string} position - 'left' 또는 'right' (기본: 'right')
|
||||
* @param {string} padChar - 패딩 문자 (기본: 공백)
|
||||
* @returns {string} - 패딩된 문자열
|
||||
*/
|
||||
function padByteString(str, targetBytes, position = 'right', padChar = ' ') {
|
||||
const currentBytes = getByteLength(str);
|
||||
|
||||
if (currentBytes >= targetBytes) {
|
||||
return str; // 이미 목표 바이트 이상이면 그대로 반환
|
||||
}
|
||||
|
||||
const paddingBytes = targetBytes - currentBytes;
|
||||
const padding = padChar.repeat(paddingBytes);
|
||||
|
||||
return position === 'left' ? padding + str : str + padding;
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.dialog_confirm{
|
||||
|
||||
+109
-2
@@ -4,6 +4,7 @@ import com.eactive.eai.common.EAITable;
|
||||
import com.eactive.eai.common.logger.HttpAdapterExtraLogVo;
|
||||
import com.eactive.eai.common.util.MessageUtil;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.logging.UserAccessLogger;
|
||||
@@ -12,10 +13,12 @@ import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.adapter.AdapterGroupService;
|
||||
import com.eactive.eai.rms.data.entity.onl.logger.EAILogDetailSearch;
|
||||
import com.eactive.eai.rms.data.entity.onl.logger.EAILogSearch;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.transformer.message.ISO8583MessageFactory;
|
||||
import com.eactive.eai.transformer.util.CommonLib;
|
||||
import com.eactive.eai.transformer.util.IConv;
|
||||
import com.eactive.eai.transformer.util.ISO8583DumpUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import org.apache.commons.io.HexDump;
|
||||
@@ -24,11 +27,20 @@ import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.client.HttpStatusCodeException;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -44,15 +56,20 @@ public class DbTrackingController {
|
||||
private final DbTrackingService service;
|
||||
private final MonitoringContext monitoringContext;
|
||||
private final AdapterGroupService adapterGroupService;
|
||||
|
||||
private final EAIServerService eaiServerService;
|
||||
|
||||
private RestTemplate restTemplate = new RestTemplate();
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Autowired
|
||||
public DbTrackingController(DbTrackingService service,
|
||||
MonitoringContext monitoringContext,
|
||||
AdapterGroupService adapterGroupService) {
|
||||
AdapterGroupService adapterGroupService,
|
||||
EAIServerService eaiServerService) {
|
||||
this.service = service;
|
||||
this.monitoringContext = monitoringContext;
|
||||
this.adapterGroupService = adapterGroupService;
|
||||
this.eaiServerService = eaiServerService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/onl/transaction/tracking/trackingMan.view")
|
||||
@@ -538,5 +555,95 @@ public class DbTrackingController {
|
||||
|
||||
return new String(byteArrayOutputStream.toByteArray());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/transaction/tracking/trackingMan.json", params = "cmd=DETAIL_PRETTY_VIEW")
|
||||
public ResponseEntity<?> selectList(@RequestParam Map<String, Object> paramMap) {
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
if (serverList == null || serverList.isEmpty()) {
|
||||
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE)
|
||||
.body(Collections.singletonMap("error", "접속 가능한 서버 목록이 없습니다."));
|
||||
}
|
||||
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(2000);
|
||||
factory.setReadTimeout(5000);
|
||||
RestTemplate restTemplate = new RestTemplate(factory);
|
||||
|
||||
Map<String, Object> requestBody = new HashMap<>();
|
||||
requestBody.put("intrefaceId", paramMap.get("intrefaceId"));
|
||||
requestBody.put("logProcessNo", paramMap.get("logProcessNo"));
|
||||
requestBody.put("bizData", paramMap.get("bizData"));
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(requestBody, headers);
|
||||
|
||||
Map<String, Object> resultResponse = null;
|
||||
boolean isSuccess = false;
|
||||
String lastErrorMsg = "";
|
||||
|
||||
for(EAIServer server : serverList) {
|
||||
|
||||
String ip = server.getEaisevrip();
|
||||
String port = server.getSevrlsnportname();
|
||||
|
||||
if(ip == null || port == null) continue;
|
||||
|
||||
String targetUrl = "http://" + ip + ":" + port + "/PrettyPrint";
|
||||
|
||||
try {
|
||||
|
||||
ResponseEntity<Map> response = restTemplate.exchange(
|
||||
targetUrl,
|
||||
HttpMethod.POST,
|
||||
entity,
|
||||
Map.class
|
||||
);
|
||||
|
||||
if(response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
|
||||
resultResponse = response.getBody();
|
||||
isSuccess = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} catch (ResourceAccessException e) {
|
||||
lastErrorMsg = "Network Error: " + e.getMessage();
|
||||
logger.debug("서버 접속 실패 : " + lastErrorMsg);
|
||||
continue;
|
||||
|
||||
} catch (HttpStatusCodeException e) {
|
||||
String errorBodyString = e.getResponseBodyAsString();
|
||||
logger.debug("서버 내부 에러 [" + targetUrl + "] : " + errorBodyString);
|
||||
|
||||
try {
|
||||
// 에러 문자열을 Map(JSON 객체)으로 변환 시도
|
||||
Map<String, Object> errorMap = objectMapper.readValue(errorBodyString, Map.class);
|
||||
return ResponseEntity.status(e.getStatusCode()).body(errorMap);
|
||||
} catch (Exception parseError) {
|
||||
// 일반 텍스트를 보냈다면 수동으로 Map 생성
|
||||
Map<String, Object> manualErrorMap = new HashMap<>();
|
||||
manualErrorMap.put("error", true);
|
||||
manualErrorMap.put("result", errorBodyString);
|
||||
return ResponseEntity.status(e.getStatusCode()).body(manualErrorMap);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isSuccess && resultResponse != null) {
|
||||
|
||||
return ResponseEntity.ok(resultResponse);
|
||||
} else {
|
||||
// 모든 서버 실패
|
||||
Map<String, Object> errorMap = new HashMap<>();
|
||||
errorMap.put("error", true);
|
||||
errorMap.put("result", "서버 연결 실패");
|
||||
// errorMap.put("result", "서버 연결 실패 (Last Error: " + lastErrorMsg + ")");
|
||||
logger.debug("서버 POST 요청 에러 : " + lastErrorMsg);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class DbTrackingService extends BaseService {
|
||||
Matcher matcher = pattern.matcher(input);
|
||||
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1).trim();
|
||||
return matcher.group(1);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user