Merge branch 'jenkins_with_weblogic' into devs/app_approval

# Conflicts:
#	CLAUDE.md
#	settings.gradle
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/PortalApprovalManService.java
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/app/PortalAppApprovalListener.java
#	src/main/java/com/eactive/eai/rms/onl/apim/approval/user/PortalUserApprovalListener.java
This commit is contained in:
Rinjae
2025-11-17 11:38:30 +09:00
119 changed files with 6107 additions and 3560 deletions
@@ -3,6 +3,8 @@ package com.eactive.eai.custom;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
import com.eactive.eai.rms.env.EmsConfig;
import com.eactive.eai.transformer.message.ISO8583MessageFactory;
/**
@@ -36,5 +38,8 @@ public class CustomizingAppInitializer implements InitializingBean {
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", MESSAGE_TYPE_SVL, ISO8583_SVL_CLASS_NAME));
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", LAYOUT_TYPE_H2H, ISO8583_H2H_CLASS_NAME));
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", LAYOUT_TYPE_SVL, ISO8583_SVL_CLASS_NAME));
// PortalSchemaProviderHolder 초기화 (eai.tableowner 주입)
PortalSchemaProviderHolder.setProvider(() -> System.getProperty(EmsConfig.TABLE_OWNER));
}
}
@@ -53,7 +53,7 @@ public class BapConnSessionController extends BapBaseAnnotationController {
}
@RequestMapping(value= "/bap/adapter/socket/connStatus.json", params = "cmd=TRANSACTION")
@RequestMapping(value= "/bap/adapter/socket/connStatus.json", params = "cmd=CONTROL")
public ModelAndView control(HttpServletRequest request, String startStop, String uuid) throws Exception {
String[] args = new String[4];
@@ -80,7 +80,7 @@ public class BapTelePropertyController extends BapBaseAnnotationController {
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
service.insert(map,list);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.teleproperty.UpdatePropertyCommand",(String)map.get("prptyGroupName"));
CommonCommand command = new CommonCommand("com.eactive.eai.agent.property.UpdatePropertyCommand",(String)map.get("prptyGroupName"));
agentUtilService.broadcast(command);
return null;
@@ -94,7 +94,7 @@ public class BapTelePropertyController extends BapBaseAnnotationController {
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
service.update(map,list);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.teleproperty.UpdatePropertyCommand",(String)map.get("prptyGroupName"));
CommonCommand command = new CommonCommand("com.eactive.eai.agent.property.UpdatePropertyCommand",(String)map.get("prptyGroupName"));
agentUtilService.broadcast(command);
return null;
@@ -107,7 +107,7 @@ public class BapTelePropertyController extends BapBaseAnnotationController {
paramMap.put("prptyGroupName", prptyGroupName);
service.delete(paramMap);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.teleproperty.RemovePropertyCommand",prptyGroupName);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.property.RemovePropertyCommand",prptyGroupName);
agentUtilService.broadcast(command);
return null;
@@ -101,7 +101,7 @@ public class BapServerController extends BapBaseAnnotationController {
public ModelAndView initCombo( HttpServletRequest request,
HttpServletResponse response,String eaiSvcName) throws Exception {
List<Map<String, Object>> listServer = ibatisComboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'YN' ");
List<Map<String, Object>> listServer = ibatisComboService.selectListComboForTable("TSEAIBP03","EAISEVRINSTNCNAME","EAISEVRINSTNCNAME");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("serverRows" , listServer);
@@ -88,7 +88,7 @@ public class BapClassMapController extends BapBaseAnnotationController {
HttpServletResponse response,@RequestParam HashMap<String,Object> map ) throws Exception {
// 전문클래스ID 공백 제거
map.replace("telgmClsID",map.get("telgmClsID").toString().trim());
// map.replace("telgmClsID",map.get("telgmClsID").toString().trim());
service.insert(map);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.rule.telegraminfo.UpdateTelegramInfoCommand", map.get("telgmClsID"));
@@ -1,8 +1,6 @@
package com.eactive.eai.rms.bap.manage.message.messageMeta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@@ -122,88 +120,5 @@ public class BapMessageMetaController extends BapBaseAnnotationController {
return null;
}
@RequestMapping(value= "/bap/admin/message/messageMetaMan.json",params = "cmd=LIST_DELETE")
public String deleteList(HttpServletRequest request,
HttpServletResponse response, @RequestParam HashMap<String, Object> paramMap ) throws Exception {
for (String msgMetaDstcd : paramMap.get("msgMetaDstcdList").toString().split(",")) {
HashMap<String, Object> paramDetail = new HashMap<String,Object>();
paramDetail.put("msgMetaDstcd", msgMetaDstcd);
service.delete(paramDetail);
}
return null;
}
@SuppressWarnings("unchecked")
@RequestMapping(value= "/bap/admin/message/messageMetaMan.json",params = "cmd=CLONE")
public ModelAndView clone(HttpServletRequest request,
HttpServletResponse response,@RequestParam HashMap<String,Object> map) throws Exception {
String msgMetaDstcd = map.get("msgMetaDstcd").toString();
HashMap<String, Object> detailMap = service.selectDetail(msgMetaDstcd);
HashMap<String, Object> detail = (HashMap<String, Object>)detailMap.get("detail");
List<Map<String, Object>> list = (List<Map<String, Object>>)detailMap.get("list");
// detail insert 데이터키 치환 (insert_bm03)
String newMsgMetaDstcd = map.get("newMsgMetaDstcd").toString();
detail.put("msgMetaDstcd", newMsgMetaDstcd);
detail.put("msgDesc" , map.get("newMsgDesc") != null ? map.get("newMsgDesc") : detail.get("MSGDESC"));
detail.put("thisMsgUseYn", detail.get("THISMSGUSEYN"));
String searchMsgMetaDstcd = map.get("searchMsgMetaDstcd").toString();
String cloneMsgMetaDstcd = map.get("cloneMsgMetaDstcd").toString();
// gridList insert 데이터키 치환 (insert_bm02)
HashMap<String, Object>[] gridList = list.toArray(new HashMap[list.size()]);
for (int i=0; i<list.size(); i++) {
Map<String, Object> listMap = (Map<String, Object>)list.get(i);
gridList[i].put("msgMetaDstcd" , ((String)listMap.get("MSGMETADSTCD")).replace(searchMsgMetaDstcd,cloneMsgMetaDstcd));
gridList[i].put("thisMsgUseYn" , listMap.get("THISMSGCLMNUSEYN"));
// 메시지항목명을 치환하면 메시지항목 테이블(BM01)에 항목이 없으므로 메타 Item 리스트에 보이지 않음 --> 치환 안함으로 변경
// gridList[i].replace("MSGITEMDSTICNAME" , ((String)listMap.get("MSGITEMDSTICNAME")).replace(searchMsgMetaDstcd,cloneMsgMetaDstcd));
gridList[i].replace("MSGITEMDSTICNAME" , listMap.get("MSGITEMDSTICNAME"));
gridList[i].replace("MSGCLMNSEQ" , listMap.get("MSGCLMNSEQ"));
}
String userid = com.eactive.eai.rms.common.login.SessionManager.getUserId(request);
detail.put("userid", userid );
service.insert(detail,gridList);
CommonCommand command = new CommonCommand("com.eactive.eai.agent.telegram.UpdateTelegramCommand",map.get("newMsgMetaDstcd"));
agentUtilService.broadcast(command);
HashMap<String, Object> result = new HashMap<String, Object>();
result.put("detail",detail);
result.put("list",gridList);
ModelAndView modelAndView = new ModelAndView("jsonView", result);
return modelAndView;
}
@SuppressWarnings("unchecked")
@RequestMapping(value= "/bap/admin/message/messageMetaMan.json",params = "cmd=LIST_DOWNLOAD_SQL")
public ModelAndView downloadSql(HttpServletRequest request,
HttpServletResponse response,@RequestParam HashMap<String,Object> map) throws Exception {
List<Map<String, Object>> msgMetaList = new ArrayList<Map<String, Object>>();
for (String searchMsgMetaDstcd : map.get("searchMsgMetaDstcdList").toString().split(",")) {
HashMap<String, Object> msgMeta = service.selectDetail(searchMsgMetaDstcd);
msgMetaList.add((Map<String, Object>)msgMeta.get("detail"));
}
HashMap<String,Object> messageMeta = new HashMap<String,Object>();
messageMeta.put("list", msgMetaList);
messageMeta.put("userid",com.eactive.eai.rms.common.login.SessionManager.getUserId(request));
messageMeta.put("fileName", map.get("fileName"));
messageMeta.put("svrType", map.get("svrType"));
ModelAndView modelAndView = new ModelAndView("jsonView",service.mkInserSqlForMsgMeta(messageMeta));
return modelAndView;
}
@RequestMapping(value= "/bap/admin/message/messageMetaMan.view",params = "cmd=LIST_FILE_DOWNLOAD")
public String fileDownload(HttpServletRequest request) throws Exception {
return "/bap/admin/common/filedownload";
}
}
}
@@ -1,9 +1,5 @@
package com.eactive.eai.rms.bap.manage.message.messageMeta;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -13,8 +9,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.eactive.eai.rms.bap.common.base.BapBaseService;
import com.eactive.eai.rms.bap.manage.comm.property.BapPropertyDao;
import com.eactive.eai.rms.common.util.SqlUtil;
@Service("bapMessageMetaService")
public class BapMessageMetaService extends BapBaseService {
@@ -23,17 +17,13 @@ public class BapMessageMetaService extends BapBaseService {
@Qualifier("bapMessageMetaDao")
private BapMessageMetaDao dao;
@Autowired
@Qualifier("bapPropertyDao")
private BapPropertyDao propDao;
public HashMap<String, Object> selectList(int startNum,int endNum, HashMap<String, Object> paramMap) throws Exception {
// 전체 목록수 얻기
// 전체 목록 수 얻기
int totalCount = dao.selectListCount(paramMap);
paramMap.put("startNum" , startNum);// 시작 record
paramMap.put("endNum" , endNum);// record
paramMap.put("startNum" , startNum);// record
paramMap.put("endNum" , endNum);// record
List<Map<String, Object>> list = dao.selectList(paramMap);
HashMap<String, Object> map = new HashMap<String, Object>();
@@ -44,11 +34,6 @@ public class BapMessageMetaService extends BapBaseService {
return map;
}
public int selectTotalCount(HashMap<String, Object> paramMap) throws Exception {
return dao.selectListCount(paramMap); // 전체 목록수 얻기
}
public HashMap<String, Object> selectDetail(String msgMetaDstcd) throws Exception {
HashMap<String, Object> detail = dao.selectDetail(msgMetaDstcd);
@@ -94,162 +79,4 @@ public class BapMessageMetaService extends BapBaseService {
dao.deleteList(paramMap);
}
@SuppressWarnings("unchecked")
public HashMap<String,String> mkInserSqlForMsgMeta(HashMap<String, Object> msgMetaMap) throws Exception {
StringBuffer msgMetaInsertSql = new StringBuffer();
String[] columnUserId = {"THISMSGREGSNTID","THISMSGAMNDRID","THISMSGCLMNREGSNTID","THISMSGCLMNAMNDRID"}; // userID 입력컬럼 구분
String[] columnDateTime = {"THISMSGREGIHMS","THISMSGAMNDHMS","THISMSGCLMNREGIHMS","THISMSGCLMNAMNDHMS"}; // DateTime 입력컬럼 구분
List<Map<String, Object>> msgMetaList = (List<Map<String, Object>>)msgMetaMap.get("list");
String userid = msgMetaMap.containsKey("userid") ? msgMetaMap.get("userid").toString() : "";
for (Map<String,Object> meta : msgMetaList) {
// MESSAGE META LIST into BM03
List<String> columnArr = new ArrayList<String>();
String[] columnList = {"MSGMETADSTCD","MSGDESC","THISMSGUSEYN","THISMSGREGSNTID","THISMSGREGIHMS","THISMSGAMNDRID","THISMSGAMNDHMS"};
columnArr = Arrays.asList(columnList);
msgMetaInsertSql.append("INSERT INTO EAIPKG.TSEAIBM03 (");
// 필드명 입력
for (String column : columnArr) {
msgMetaInsertSql.append((column.equals(columnArr.get(columnArr.size()-1))) ? column : column+",");
}
msgMetaInsertSql.append(") VALUES (");
// 필드값 입력
for (String column : columnArr) {
if (column.equals(columnArr.get(columnArr.size()-1))) {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"');\n");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'));\n");
} else {
msgMetaInsertSql.append("'"+(meta.containsKey(column) ? meta.get(column) : "")+"');\n");
}
} else {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"',");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'),");
} else {
msgMetaInsertSql.append("'"+(meta.containsKey(column) ? meta.get(column) : "")+"',");
}
}
}
HashMap<String, Object> metaMap = selectDetail(meta.get("MSGMETADSTCD").toString());
List<Map<String, Object>> metaItemList = (List<Map<String, Object>>)metaMap.get("list");
// MESSAGE META LIST into BM02
for (Map<String, Object> metaItem : metaItemList) {
List<String> columnItemArr = new ArrayList<String>();
String[] columnItemList = {"MSGMETADSTCD","MSGCLMNSEQ","MSGITEMDSTICNAME","THISMSGCLMNUSEYN","THISMSGREGSNTID","THISMSGREGIHMS","THISMSGAMNDRID","THISMSGAMNDHMS"};
columnItemArr = Arrays.asList(columnItemList);
msgMetaInsertSql.append("INSERT INTO EAIPKG.TSEAIBM02 (MSGGROUPDSTCD,");
// 필드명 입력
for (String columnItem : columnItemArr) {
if (columnItem.equals("MSGMETADSTCD")) continue;
msgMetaInsertSql.append((columnItem.equals(columnItemArr.get(columnItemArr.size()-1))) ? columnItem : columnItem+",");
}
msgMetaInsertSql.append(") VALUES (");
// 필드값 입력
for (String column : columnItemArr) {
if (column.equals(columnItemArr.get(columnItemArr.size()-1))) {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"');\n");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'));\n");
} else {
msgMetaInsertSql.append("'"+(metaItem.containsKey(column) ? metaItem.get(column) : "")+"');\n");
}
} else {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"',");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'),");
} else {
msgMetaInsertSql.append("'"+(metaItem.containsKey(column) ? metaItem.get(column) : "")+"',");
}
}
}
}
// MESSAGE META LIST into BM01
for (Map<String, Object> metaItem : metaItemList) {
List<String> columnClmArr = new ArrayList<String>();
String[] columnClmList = {"MSGITEMDSTICNAME","THISMSGCLMNUSEYN","MSGCLMNNAME","MSGCLMNATTRIPTRNCD","MSGCLMNVAL","THISMSGCLMNREGSNTID","THISMSGCLMNREGIHMS","THISMSGCLMNAMNDRID","THISMSGCLMNAMNDHMS"};
columnClmArr = Arrays.asList(columnClmList);
msgMetaInsertSql.append("MERGE INTO EAIPKG.TSEAIBM01 r USING (VALUES(");
// 필드값 입력
for (String column : columnClmArr) {
if (column.equals(columnClmArr.get(columnClmArr.size()-1))) {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"')) ");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'))) ");
} else {
msgMetaInsertSql.append("'"+(metaItem.containsKey(column) ? metaItem.get(column) : "")+"')) ");
}
} else {
if (Arrays.asList(columnUserId).contains(column)) {
msgMetaInsertSql.append("'"+userid+"',");
} else if (Arrays.asList(columnDateTime).contains(column)) {
msgMetaInsertSql.append("TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDDHH24MISSFF3'),");
} else {
msgMetaInsertSql.append("'"+(metaItem.containsKey(column) ? metaItem.get(column) : "")+"',");
}
}
}
// 필드명 입력
msgMetaInsertSql.append("AS s(");
for (String columnClm : columnClmArr) {
msgMetaInsertSql.append((columnClm.equals(columnClmArr.get(columnClmArr.size()-1))) ? columnClm+")\n" : columnClm+",");
}
msgMetaInsertSql.append("ON r.MSGITEMDSTICNAME = s.MSGITEMDSTICNAME WHEN NOT MATCHED THEN\n");
msgMetaInsertSql.append("INSERT (");
for (String columnClm : columnClmArr) {
msgMetaInsertSql.append((columnClm.equals(columnClmArr.get(columnClmArr.size()-1))) ? "r."+columnClm : "r."+columnClm+",");
}
msgMetaInsertSql.append(") VALUES (");
for (String columnClm : columnClmArr) {
msgMetaInsertSql.append((columnClm.equals(columnClmArr.get(columnClmArr.size()-1))) ? "s."+columnClm+");\n" : "s."+columnClm+",");
}
}
}
HashMap<String,String> retMap = new HashMap<String,String>();
if (msgMetaMap.get("fileName") != null) {
OutputStream output = null;
try {
String sqlDownloadPath = getProperties("SQL_DOWNLOAD", "DOWNLOAD_PATH");
String sqlDownloadFile = sqlDownloadPath+msgMetaMap.get("fileName");
output = new FileOutputStream(sqlDownloadFile);
if (sqlDownloadPath != null) {
byte[] bt = msgMetaInsertSql.toString().getBytes();
output.write(bt);
output.close();
}
retMap.put("path", sqlDownloadPath);
} catch (Exception e) {
logger.error( e.getMessage(), e);
} finally {
if(output != null) try { output.close(); } catch(Exception ee) {logger.error( ee.getMessage(), ee);}
}
} else {
retMap = SqlUtil.executeSql(msgMetaInsertSql.toString(), "BAP_"+msgMetaMap.get("svrType").toString().toUpperCase());
}
return retMap;
}
private String getProperties(String propGroup, String propName) throws Exception {
HashMap<String,Object> params = new HashMap<String,Object>();
params.put("prptyGroupName", propGroup);
params.put("prptyName", propName);
HashMap<String, Object> props = propDao.getProperties(params);
return props.get("PRPTY2VAL").toString();
}
}
}
@@ -137,20 +137,20 @@ public class BapMessageProcController extends BapBaseAnnotationController {
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> bjobInstiDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ06", "OSIDINSTIDSTCD", "OSIDINSTINAME");
//
// List<Map<String, Object>> sysCd = comboService.selectListComboForTableWithCode("TSEAIBJ11", "SYSCD", "SYSNAME");
List<Map<String, Object>> uapplCd = //comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
comboService.selectListComboForTable("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME","systeminoutdstcd = 'I' ");
List<Map<String, Object>> bJobCycleGb = //comboService.selectListCombo("BAP_CYCLE_GB"); // BATCH작업주기구분
comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'BAP_CYCLE_GB' ");
List<Map<String, Object>> sysCd = comboService.selectListComboForTableWithCode("TSEAIBJ11", "SYSCD", "SYSNAME");
// List<Map<String, Object>> uapplCd = //comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
// comboService.selectListComboForTable("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME","systeminoutdstcd = 'I' ");
// List<Map<String, Object>> bJobCycleGb = //comboService.selectListCombo("BAP_CYCLE_GB"); // BATCH작업주기구분
// comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'BAP_CYCLE_GB' ");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("bjobBzwkDstcd" , bjobBzwkDstcd);
resultMap.put("bjobInstiDstcd", bjobInstiDstcd);
// resultMap.put("groupCoCd" , groupCoCd);
// resultMap.put("sysCd" , sysCd);
resultMap.put("uapplCd" , uapplCd);
resultMap.put("bJobCycleGb" , bJobCycleGb);
resultMap.put("sysCd" , sysCd);
// resultMap.put("uapplCd" , uapplCd);
// resultMap.put("bJobCycleGb" , bJobCycleGb);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
@@ -159,21 +159,13 @@ public class BapMessageProcController extends BapBaseAnnotationController {
@RequestMapping(value= "/bap/admin/work/messageProcMan.json",params = "cmd=LIST_PROP")
public ModelAndView getProps( HttpServletRequest request,
HttpServletResponse response,
@RequestParam String bjobBzwkDstcd,
@RequestParam String bjobMsgDstcd
@RequestParam String bjobBzwkDstcd
) throws Exception {
Map<String, Object> resultMap = new HashMap<String, Object>();
HashMap<String, Object> map = service.getProps(bjobBzwkDstcd);
if(!StringUtils.isEmpty(bjobBzwkDstcd)) {
HashMap<String, Object> propMap = service.getProps(bjobBzwkDstcd, bjobMsgDstcd); // 프로퍼티 정보
HashMap<String, Object> InstMap = service.selectOsidInstiDstcd(bjobBzwkDstcd);
resultMap.put("propMap", propMap);
resultMap.put("InstMap", InstMap);
}
ModelAndView modelAndView = new ModelAndView("jsonView", map);
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
return modelAndView;
}
@@ -87,4 +87,9 @@ public class BapMessageProcDao extends SqlMapClientTemplateDao {
public void deleteVerifyInfo(HashMap<String, Object> param) throws Exception{
this.template.delete("BapMessageProc.deleteVerifyInfo", param);
}
public void deleteBS01(HashMap<String, Object> param) throws Exception{
this.template.delete("BapMessageProc.deleteBS01", param);
}
}
@@ -43,9 +43,10 @@ public class BapMessageProcService extends BapBaseService {
HashMap<String, Object> detail = dao.selectDetail(param);
String bjobBzwkDstcd = (String)detail.get("BJOBBZWKDSTCD");
String bjobMsgDstcd = (String)detail.get("BJOBMSGDSTCD");
String bjobTranDstcdName = (String)detail.get("BJOBTRANDSTCDNAME");
param.put("bjobBzwkDstcd", bjobBzwkDstcd );
param.put("propGroupName", "TelegramInfo{" + bjobMsgDstcd + "}");
param.put("propGroupName", "TelegramInfo{" + bjobBzwkDstcd + "_" + bjobTranDstcdName + "}");
List<Map<String, Object>> list = dao.getProps(param);
HashMap<String, Object> map = new HashMap<String, Object>();
@@ -75,9 +76,8 @@ public class BapMessageProcService extends BapBaseService {
}
}
public void insert(HashMap<String, Object> paramMap, HashMap<String, Object>[] list, HashMap<String, Object> connList) throws Exception {
// paramMap.put( "bjobMsgDstcd", dao.generatePK(paramMap));
public void insert(HashMap<String, Object> paramMap, HashMap<String, Object>[] list, HashMap<String, Object> connList) throws Exception {
paramMap.put( "bjobMsgDstcd", dao.generatePK(paramMap));
dao.insert(paramMap);
telePropDao.delete(paramMap);
telePropDao.deleteProperty(paramMap);
@@ -99,7 +99,8 @@ public class BapMessageProcService extends BapBaseService {
public void delete(HashMap<String, Object> paramMap) throws Exception {
dao.delete(paramMap);
dao.deleteVerifyInfo(paramMap);
// dao.deleteVerifyInfo(paramMap);
dao.deleteBS01(paramMap);
telePropDao.delete(paramMap);
telePropDao.deleteProperty(paramMap);
}
@@ -114,6 +115,18 @@ public class BapMessageProcService extends BapBaseService {
map.put("rows", list);
return map;
}
public HashMap<String, Object> getProps(String bjobBzwkDstcd) throws Exception {
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("bjobBzwkDstcd", bjobBzwkDstcd);
List<Map<String, Object>> list = dao.getProps(param);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("rows", list);
return map;
}
public HashMap<String, Object> selectOsidInstiDstcd(String bjobBzwkDstcd) throws Exception {
@@ -92,14 +92,14 @@ public class BapProcWorkController extends BapBaseAnnotationController {
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> osidInstiDstcd = statusService.selectOsidInstiDstcd("");
List<Map<String, Object>> svcPrcssNo = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'SVC_PRCSS_NO' ");
// List<Map<String, Object>> svcPrcssNo = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'SVC_PRCSS_NO' ");
//comboService.selectListCombo("SVC_PRCSS_NO");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("bjobBzwkDstcd" , bjobBzwkDstcd);
resultMap.put("osidInstiDstcd" , osidInstiDstcd);
resultMap.put("svcPrcssNo" , svcPrcssNo);
// resultMap.put("svcPrcssNo" , svcPrcssNo);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
@@ -50,43 +50,63 @@ public class BapTransactionStatusController extends BapBaseAnnotationController
* @throws Exception
*/
@RequestMapping(value= "/bap/transaction/transactionStatusMan.json", params = "cmd=LIST")
public ModelAndView selectList(HttpServletRequest request,
public ModelAndView selectList(HttpServletRequest request, JsonPageVo pageVo,
@RequestParam HashMap<String, Object> paramMap) throws Exception {
// String date = (String)paramMap.get("searchStartYYYYMMDD");
// CommonCommand command = new CommonCommand("com.eactive.eai.agent.schedule.GetScheduleBasisListCommand",date);
String date = (String)paramMap.get("searchStartYYYYMMDD");
CommonCommand command = new CommonCommand("com.eactive.eai.agent.schedule.GetScheduleBasisListCommand",date);
Map<String, Object> returnMap = agentUtilService.broadcast(command);
Iterator<String> iter = returnMap.keySet().iterator();
String svrName = iter.next();
String[] basis = null;
if(returnMap.get(svrName) instanceof String[]) {
basis = (String[])returnMap.get(svrName);
}
// String[] basis = null;
Map<String, Object> returnMap = null;
Iterator<String> iter = null;
String svrName = "";
// try {
// returnMap = agentUtilService.broadcast(command);
// iter = returnMap.keySet().iterator();
// svrName = iter.next();
// basis = (String[])returnMap.get(svrName);
// } catch (Exception e) {
// basis = new String[1];
// basis[0] = "D";
// }
// paramMap.put("basis", basis);
if ( basis == null ){
basis = new String[1];
basis[0] = "D";
}
paramMap.put("basis", basis);
String activeTab = (String)paramMap.get("activeTab");
if ( activeTab.equals("tabS") ){
CommonCommand command = new CommonCommand("com.eactive.eai.agent.transaction.ProcessingFileTransferCommand","");
command = new CommonCommand("com.eactive.eai.agent.transaction.ProcessingFileTransferCommand","");
returnMap = agentUtilService.broadcast(command);
iter = returnMap.keySet().iterator();
svrName = iter.next();
@SuppressWarnings("unchecked")
List<Map<String, Serializable>> list = (List<Map<String, Serializable>>)returnMap.get(svrName);
paramMap.put("procList", list);
Object value = returnMap.get(svrName);
if(value instanceof List) {
@SuppressWarnings("unchecked")
List<Map<String, Serializable>> list = (List<Map<String, Serializable>>)value;
paramMap.put("procList", list);
}else {
paramMap.put("procList", null);
}
}
Map<String, Object> resultMap = service.selectList( paramMap);
//Map<String, Object> resultMap = service.selectList( paramMap);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
//ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
Map<String, Object> listMap = service.selectList(pageVo.getStartNum(), pageVo.getEndNum(), paramMap);
pageVo.setTotalCount((Integer)listMap.get("totalCount"));
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
resultMap.put("records", pageVo.getTotalCount()); //전체 레코드건수
resultMap.put("rows" , listMap.get("rows"));
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
}
@@ -135,22 +155,19 @@ public class BapTransactionStatusController extends BapBaseAnnotationController
public ModelAndView initCombo( HttpServletRequest request,
HttpServletResponse response) throws Exception {
List<Map<String, Object>> groupCoCd = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'EAIGROUPCOCD' ");
//comboService.selectListCombo("EAIGROUPCOCD");
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> osidInstiDstcd = service.selectOsidInstiDstcd("");
List<Map<String, Object>> uapplCd = comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> osidInstiDstcd = service.selectOsidInstiDstcd("");
// List<Map<String, Object>> uapplCd = comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("bjobBzwkDstcd" , bjobBzwkDstcd);
resultMap.put("osidInstiDstcd" , osidInstiDstcd);
resultMap.put("groupCoCd" , groupCoCd);
resultMap.put("uapplCd" , uapplCd);
// resultMap.put("uapplCd" , uapplCd);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
}
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
}
@RequestMapping(value= "/bap/transaction/transactionStatusMan.json",params = "cmd=LIST_ORGN_COMBO")
public ModelAndView initOrgnCombo( HttpServletRequest request,
@@ -15,18 +15,31 @@ public class BapTransactionStatusDao extends SqlMapClientTemplateDao {
public List<Map<String, Object>> findStatusList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.list_normal", param);
}
public int findStatusListCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.list_normal_count", param);
}
public List<Map<String, Object>> findErrorList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.list_e", param);
}
public int findErrorListCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.list_e_count", param);
}
public List<Map<String, Object>> findFutureList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.list_f", param);
}
public int findFutureListCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.list_f_count", param);
}
public List<Map<String, Object>> findDelayList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.list_l", param);
}
public List<Map<String, Object>> findSpecList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.speclist", param);
}
}
public int findSpecListCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.speclist_count", param);
}
public HashMap<String, Object> selectDetail(HashMap<String, Object> param) throws Exception {
return (HashMap<String, Object>)template.queryForObject("BapTranStatus.masterlog", param);
@@ -41,11 +54,11 @@ public class BapTransactionStatusDao extends SqlMapClientTemplateDao {
}
public int getFileLogCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.getFileLogCount", param);
return (Integer)template.queryForObject("BapTranStatus.filelogcount", param);
}
public int getStageLogCount(HashMap<String, Object> param) throws Exception {
return (Integer)template.queryForObject("BapTranStatus.getStageLogCount", param);
return (Integer)template.queryForObject("BapTranStatus.stagelogcount", param);
}
public List<Map<String, Object>> selectOsidInstiDstcd(HashMap<String, Object> param) throws Exception {
@@ -20,46 +20,51 @@ public class BapTransactionStatusService extends BapBaseService {
@Qualifier("bapTransactionStatusDao")
private BapTransactionStatusDao dao;
public HashMap<String, Object> selectList(HashMap<String, Object> paramMap) throws Exception {
public HashMap<String, Object> selectList(int startNum,int endNum, HashMap<String, Object> paramMap) throws Exception {
String activeTab = (String)paramMap.get("activeTab");
ArrayList<String> tranPrcssDstcds = new ArrayList<String>();
ArrayList<String> tranPrcssDstcds2 = new ArrayList<String>();
paramMap.put("startNum" , startNum);
paramMap.put("endNum" , endNum);
HashMap<String, Object> map = new HashMap<String, Object>();
if ( activeTab.equals("tabE")){
tranPrcssDstcds.add("T");
//tranPrcssDstcds.add("R");
tranPrcssDstcds.add("R");
paramMap.put("tranPrcssDstcds", tranPrcssDstcds);
paramMap.put("tranPrcssDstcds2", tranPrcssDstcds2);
List<Map<String, Object>> listNomal = dao.findStatusList(paramMap);
List<Map<String, Object>> listError = dao.findErrorList(paramMap);
map.put("rows", processErrorList(listNomal, listError));
map.put("totalCount", dao.findErrorListCount(paramMap));
}else if ( activeTab.equals("tabF")){
List<Map<String, Object>> listF = dao.findFutureList(paramMap);
map.put("rows", listF);
map.put("totalCount", dao.findFutureListCount(paramMap));
}else if ( activeTab.equals("tabQ")){
tranPrcssDstcds.add("Q");
paramMap.put("tranPrcssDstcds", tranPrcssDstcds);
List<Map<String, Object>> waitlist = dao.findStatusList(paramMap);
map.put("rows", waitlist);
map.put("totalCount", dao.findStatusListCount(paramMap));
}else if ( activeTab.equals("tabS")){
tranPrcssDstcds2.add("S");
tranPrcssDstcds.add("S");
paramMap.put("tranPrcssDstcds", tranPrcssDstcds);
paramMap.put("tranPrcssDstcds2", tranPrcssDstcds2);
List<Map<String, Object>> sendlist = dao.findStatusList(paramMap);
@SuppressWarnings("unchecked")
List<Map<String, Serializable>> memList = (List<Map<String, Serializable>>)paramMap.get("procList");
processMemList(sendlist, memList);
if(memList != null) {
processMemList(sendlist, memList);
}
map.put("rows", sendlist);
map.put("totalCount", dao.findStatusListCount(paramMap));
}else if ( activeTab.equals("tabA")){
List<Map<String, Object>> listA = dao.findSpecList(paramMap);
map.put("rows", listA);
map.put("totalCount", dao.findSpecListCount(paramMap));
}
return map;
@@ -17,7 +17,6 @@ import org.springframework.web.servlet.ModelAndView;
import com.eactive.eai.agent.command.CommonCommand;
import com.eactive.eai.rms.common.base.BapBaseAnnotationController;
import com.eactive.eai.rms.common.combo.ComboService;
import com.eactive.eai.rms.common.combo.IbatisComboService;
import com.eactive.eai.rms.common.login.SessionManager;
import com.eactive.eai.rms.common.util.CamelCaseUtil;
@@ -72,15 +71,15 @@ public class BapTransactionTraceController extends BapBaseAnnotationController
public ModelAndView initCombo( HttpServletRequest request,
HttpServletResponse response) throws Exception {
List<Map<String, Object>> groupCoCd = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'EAIGROUPCOCD' ");
// List<Map<String, Object>> groupCoCd = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'EAIGROUPCOCD' ");
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> uapplCd = comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
// List<Map<String, Object>> uapplCd = comboService.selectListComboForTableWithCode("TSEAICM01", "TRIM(EAIBZWKDSTCD)", "BZWKDSTICNAME");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("bjobBzwkDstcd" , bjobBzwkDstcd);
resultMap.put("groupCoCd" , groupCoCd);
resultMap.put("uapplCd" , uapplCd);
// resultMap.put("groupCoCd" , groupCoCd);
// resultMap.put("uapplCd" , uapplCd);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
@@ -19,4 +19,8 @@ public class BapTransactionTraceDao extends SqlMapClientTemplateDao {
public List<Map<String, Object>> selectList(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTransactionTrace.selectList", param);
}
public List<Map<String, Object>> selectOsidInstiDstcd(HashMap<String, Object> param) throws Exception {
return (List<Map<String, Object>>)template.queryForList("BapTranStatus.selectOsidInstiDstcd", param);
}
}
@@ -34,6 +34,14 @@ public class BapTransactionTraceService extends BapBaseService {
return map;
}
}
public List<Map<String, Object>> selectOsidInstiDstcd(String bjobBzwkDstcd) throws Exception {
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("bjobBzwkDstcd", bjobBzwkDstcd);
return dao.selectOsidInstiDstcd(param);
}
}
@@ -86,14 +86,14 @@ public class BapTransactionWaitController extends BapBaseAnnotationController {
List<Map<String, Object>> bjobBzwkDstcd = comboService.selectListComboForTableWithCode("TSEAIBJ02", "BJOBBZWKDSTCD", "BJOBBZWKNAME");
List<Map<String, Object>> osidInstiDstcd = statusService.selectOsidInstiDstcd("");
List<Map<String, Object>> svcPrcssNo = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'SVC_PRCSS_NO' ");
// List<Map<String, Object>> svcPrcssNo = comboService.selectListComboForTable("TSEAICM20", "code", "codename","codegroup = 'SVC_PRCSS_NO' ");
//comboService.selectListCombo("SVC_PRCSS_NO");
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("bjobBzwkDstcd" , bjobBzwkDstcd);
resultMap.put("osidInstiDstcd" , osidInstiDstcd);
resultMap.put("svcPrcssNo" , svcPrcssNo);
// resultMap.put("svcPrcssNo" , svcPrcssNo);
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
return modelAndView;
@@ -60,7 +60,7 @@ public class BapTransactionWaitService extends BapBaseService {
public void delete(HashMap paramMap) throws Exception {
dao.updateBJ03(paramMap);
dao.updateBJ08(paramMap);
//dao.updateBJ08(paramMap);
dao.delete(paramMap);
}
}
@@ -37,11 +37,9 @@ public class CrossScriptingFilter implements Filter {
String uri = request.getRequestURL().toString();
String servletPath = request.getServletPath();
String baseUrl = uri.replace(servletPath, "");
boolean isValidUrl = returnUrl.startsWith(baseUrl);
// System.out.println("checkReturnUrl => "+ uri + " : "+ servletPath);
// System.out.println("checkReturnUrl => "+ baseUrl + " : "+ returnUrl);
// System.out.println("checkReturnUrl => "+ returnUrl + " : "+ isValidUrl);
return isValidUrl;
// 25.11.10 - weblogic https://host:443/ 문제 대응
baseUrl = baseUrl.replace(":443", "");
return returnUrl.startsWith(baseUrl);
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
@@ -52,7 +50,6 @@ public class CrossScriptingFilter implements Filter {
String returnUrl = (String)request.getParameter("returnUrl");
if(returnUrl != null) {
if(!checkReturnUrl(request, returnUrl)) {
System.out.println("CrossScriptingFilter] bad request. - " + returnUrl);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "bad request. - "+returnUrl);
return;
}
@@ -71,6 +71,7 @@ public class MonitoringFrontFilter implements Filter {
|| uri.indexOf(request.getContextPath() +"/LoginServlet") > -1
|| uri.indexOf(request.getContextPath() +"/login/") > -1
|| uri.indexOf(request.getContextPath() +"/dashboard") > -1
|| uri.indexOf(request.getContextPath() +"/dashmain3.do") > -1
|| uri.indexOf(request.getContextPath() + "/loginForm.do") > -1
|| uri.indexOf(request.getContextPath() + "/login.do") > -1
|| uri.indexOf(request.getContextPath() + "/ssoLogin.do") > -1
@@ -563,14 +563,14 @@ public class MainController implements InterceptorSkipController {
@RequestMapping("/changePassword.do")
public String changePassword(HttpServletRequest request,
String changePassword, String confirmPassword,
String userId, String password) {
String resetUserId, String resetPassword) {
HttpSession session = request.getSession();
try {
// 로그인 User ID 체크.
Optional<UserInfo> userInfoOptional = userInfoService
.findById(userId);
.findById(resetUserId);
if (!userInfoOptional.isPresent()) {
UserAccessLogger.log(request, LOG_CATEGORY_LOGIN, "F",
@@ -604,8 +604,8 @@ public class MainController implements InterceptorSkipController {
}
// 3. 비밀번호 체크
if (!userInfo.getPassword().equals(Seed.encrypt(password))
&& !userInfo.getUserid().equals(userId)) {
if (!userInfo.getPassword().equals(Seed.encrypt(resetPassword))
&& !userInfo.getUserid().equals(resetUserId)) {
UserAccessLogger.log(request, LOG_CATEGORY_LOGIN, "F",
localeMessage
.getString("login.pwdmismatch5"));
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import com.eactive.eai.rms.common.datasource.DataSourceType;
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
import com.eactive.eai.rms.env.EmsConfig;
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
@@ -22,7 +24,13 @@ public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor
public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
throws BeansException {
// PortalSchemaProviderHolder 초기화 (Hibernate EntityManagerFactory 생성 전에 필요)
PortalSchemaProviderHolder.setProvider(() -> System.getProperty(EmsConfig.TABLE_OWNER));
if (logger.isDebugEnabled()) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + System.getProperty(EmsConfig.TABLE_OWNER));
}
List<DataSourceType> dataSourceTypes = new ArrayList<DataSourceType>();
Map maps = factory.getBeansOfType(DataSourceType.class);
@@ -1,8 +1,5 @@
package com.eactive.eai.rms.common.startup;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
@@ -11,115 +8,117 @@ import com.eactive.eai.rms.common.util.CommonConstants;
import com.eactive.eai.rms.env.EmsConfig;
import com.eactive.eai.rms.onl.common.service.AdapterStatusSendThreadPool;
public class AppInitializer implements InitializingBean, DisposableBean {
public class AppInitializer implements InitializingBean, DisposableBean {
final Logger logger = Logger.getLogger(AppInitializer.class);
boolean debug = true;
private String instName;
private String tableOwner;
private String systemMode = "D"; //EAI System Mode : [P/T/D/S]
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init()
{
if (debug) {
logger.debug("applicationInitialized");
}
//MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if(serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if(tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
//모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if(tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
//env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
private String systemMode = "D"; // EAI System Mode : [P/T/D/S]
//데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if(eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); //env 프라퍼티
}
if(debug) {
logger.debug("SERVER_TYPE ="+CommonConstants.SERVER_TYPE);
}
}
public void destroy()
{
AdapterStatusSendThreadPool.destroy();
if(debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init() {
if (debug) {
logger.debug("applicationInitialized");
}
// MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if (serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if (tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
// 모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if (tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
// env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
// 데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if (eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); // env 프라퍼티
}
if (debug) {
logger.debug("SERVER_TYPE =" + CommonConstants.SERVER_TYPE);
}
if (debug) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + tableOwner);
}
}
public void destroy() {
AdapterStatusSendThreadPool.destroy();
if (debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
@Override
public void afterPropertiesSet() throws Exception {
init();
init();
}
}
}
@@ -35,6 +35,20 @@ public class MonitoringPropertyService
return property.map(MonitoringProperty::getPrpty2Val).orElse(null);
}
public String getPropertyValue(String prptyGroupName, String prptyName, String defaultValue) {
MonitoringPropertyId id = new MonitoringPropertyId();
id.setPrptyGroupName(prptyGroupName);
id.setPrptyName(prptyName);
Optional<MonitoringProperty> property = repository.findById(id);
if (property.isPresent() && !property.get().getPrpty2Val().isEmpty()) {
return property.get().getPrpty2Val();
} else {
return defaultValue;
}
}
public Iterable<MonitoringProperty> findAllByIdPrptyName(String prptyName) {
BooleanExpression predicate = QMonitoringProperty.monitoringProperty.id.prptyName.eq(prptyName);
return repository.findAll(predicate);
@@ -38,7 +38,8 @@ public class JobHistoryService extends AbstractEMSDataSerivce<JobHistory, String
.select(qJobHistory.status)
.from(qJobHistory)
.where(qJobHistory.endDate.eq(maxEndDateQuery))
.fetchOne();
.fetchFirst(); // unique 에러 발생 대응
//.fetchOne();
}
public void updateStatus(String jobName, String startDate, String endDate, String status) throws Exception {
@@ -51,7 +52,7 @@ public class JobHistoryService extends AbstractEMSDataSerivce<JobHistory, String
String rctStatus = findRecentStatus(jobName, instanceName); // 최근 Data 조회
log.info("[DHJEONG]1_rctStatus-->{}, jobName-->{}, instanceName-->{}", rctStatus, jobName, instanceName);
// log.info("[DHJEONG]1_rctStatus-->{}, jobName-->{}, instanceName-->{}", rctStatus, jobName, instanceName);
if (!status.equals(rctStatus) || !"E".equals(jobInfo.getChkStatus())) {
// 'Y' 이면 무조건 등록, 'E' 이면 ==> Status 바뀌면 등록
@@ -11,6 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
@@ -30,7 +31,20 @@ public class UserAthrRoleChgHistory extends AbstractEntity<String> implements Se
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// @GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(
name = "TB_APIMS_USER_ATHR_ROLE_CHG_H_GEN",
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "TB_APIMS_USER_ATHR_ROLE_CHG_H_SEQ"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
}
)
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "TB_APIMS_USER_ATHR_ROLE_CHG_H_GEN"
)
@Column(name = "CHG_LOG_ID", unique = true, nullable = false)
@Comment("사용자 정보 변경 로그 식별 ID")
private int chgLogId;
@@ -11,6 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import com.eactive.eai.data.entity.AbstractEntity;
@@ -30,7 +31,20 @@ public class UserLoginHistory extends AbstractEntity<String> implements Serializ
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// @GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(
name = "TB_APIMS_LOIN_L_GEN",
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "TB_APIMS_LOIN_L_SEQ"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
}
)
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "TB_APIMS_LOIN_L_GEN"
)
@Column(name="LOIN_LOG_ID", unique = true, nullable = false)
@Comment("로그인 로그 식별자")
private int loginLogId;
@@ -9,6 +9,7 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.envers.RevisionEntity;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;
@@ -23,8 +24,18 @@ import lombok.Data;
@SequenceGenerator(name = "revision_seq", sequenceName = "revision_info_seq", allocationSize = 1)
public class CustomRevisionEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "revision_seq")
@Id
// @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "revision_seq")
@GenericGenerator(
name = "revision_seq_gen",
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "REVISION_INFO_SEQ"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
}
)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "revision_seq_gen")
@RevisionNumber
@Column(name = "REV")
private long rev;
@@ -37,5 +48,4 @@ public class CustomRevisionEntity {
@Column(name = "USERID")
@Comment("변경자ID")
private String userId;
}
@@ -143,13 +143,15 @@ public class PortalApprovalManService extends BaseService {
AppRequest appRequest = optRequest.get();
appApprovalUI.setRequestType(appRequest.getType());
if (StringUtils.isNotEmpty(appRequest.getApiGroupList())) {
String[] apiGroupList = appRequest.getApiGroupList().split(",");
for (String apiGroupId : apiGroupList) {
apiGroupService.findByIdWithApiList(apiGroupId).ifPresent(apiGroup ->
appApprovalUI.getApiServices().add(apiGroupUIMapper.toVo(apiGroup))
);
}
if (appRequest.getApiGroupList() == null || appRequest.getApiGroupList().isEmpty()) {
appRequest.setApiGroupList("");
}
String[] apiGroupList = appRequest.getApiGroupList().split(",");
for (String apiGroupId : apiGroupList) {
apiGroupService.findByIdWithApiList(apiGroupId).ifPresent(apiGroup ->
appApprovalUI.getApiServices().add(apiGroupUIMapper.toVo(apiGroup))
);
}
List<String> currentGroupNameList = new ArrayList<>();
@@ -71,31 +71,50 @@ public class PortalAppApprovalListener implements ApprovalListener {
private final ClientManService clientManService;
private final MessageSendService messageSendService;
@Override
public void execute(Approval approval, Map<String, Object> option1) throws ApprovalDeployException {
Optional<AppRequest> optRequest = appRequestRepository.findAppRequestByApproval(approval);
AppRequest appRequest = optRequest.orElseGet(null);
if (appRequest != null) {
AppRequestType type = appRequest.getType();
CredentialUI credentialUI = null;
// Portal DB에 credential 저장 (트랜잭션 커밋 보장)
CredentialUI credentialUI = saveCredential(appRequest, type);
if (appRequest.getType().equals(AppRequestType.NEW)) {
credentialUI = createAndSaveCredentialUI(optRequest.get());
} else if (appRequest.getType().equals(AppRequestType.MODIFY)) {
credentialUI = modifyClientUI(optRequest.get());
} else if (appRequest.getType().equals(AppRequestType.DELETE)) {
credentialManService.delete(optRequest.get().getClientId());
credentialUI = new CredentialUI();
credentialUI.setClientid(optRequest.get().getClientId());
}
// 위 메서드가 반환되면 트랜잭션이 커밋되어 Portal DB에 영구 저장됨
// 이제 APIGW 동기화 및 GW 리로드 수행
syncTargetServer(type, credentialUI);
sendApprovalResult(appRequest);
}
}
/**
* Portal DB에 credential 정보를 저장하고 트랜잭션을 커밋합니다.
* GW 동기화 이전에 Portal DB의 변경사항이 확정되어야 하므로 별도 트랜잭션으로 분리합니다.
*
* @param appRequest 앱 등록/수정/삭제 요청 정보
* @param type 요청 타입 (NEW/MODIFY/DELETE)
* @return 저장된 credential 정보
*/
@Transactional
public CredentialUI saveCredential(AppRequest appRequest, AppRequestType type) {
CredentialUI credentialUI = null;
if (type.equals(AppRequestType.NEW)) {
credentialUI = createAndSaveCredentialUI(appRequest);
} else if (type.equals(AppRequestType.MODIFY)) {
credentialUI = modifyClientUI(appRequest);
} else if (type.equals(AppRequestType.DELETE)) {
credentialManService.delete(appRequest.getClientId());
credentialUI = new CredentialUI();
credentialUI.setClientid(appRequest.getClientId());
}
return credentialUI;
}
private void sendApprovalResult(AppRequest appRequest) {
MessageRecipient recipient = new MessageRecipient();
recipient.setPhone(appRequest.getApproval().getRequester().getMobileNumber());
@@ -118,15 +137,10 @@ public class PortalAppApprovalListener implements ApprovalListener {
clientManService.delete(credentialUI.getClientid());
}
//TODO: commit 처리
CommonCommand.builder()
.name(CommonCommand.RELOAD_CLIENT_COMMAND)
.args(credentialUI.getClientid())
.build().broadcast(agentUtilService);
}
private CredentialUI modifyClientUI(AppRequest appRequest) {
@@ -88,7 +88,7 @@ public class PortalUserApprovalListener implements ApprovalListener {
portalOrg.setOrgStatus(OrgStatus.ACTIVE);
portalOrgService.save(portalOrg);
syncStaging(portalOrgUIMapper.toVo(portalOrg));
// syncStaging(portalOrgUIMapper.toVo(portalOrg));
sendApprovalResult(portalUser);
}
@@ -97,42 +97,50 @@ public class PortalUserApprovalListener implements ApprovalListener {
recipient.setPhone(portalUser.getMobileNumber());
recipient.setUserId(portalUser.getEmailAddr());
Map<String, String> params = new HashMap<>();
messageSendService.sendMessage(MessageCode.USER_REGISTRATION_APPROVED, recipient, params);
// messageSendService.sendMessage(MessageCode.USER_REGISTRATION_APPROVED, recipient, params);
messageSendService.sendMessage(MessageCode.MANAGER_WITH_ORG_REGISTER_APPROVED, recipient, params);
}
/**
* @deprecated 광주은행에서는 사용하지 않음. (개발/운영 완전 분리)
* @param portalOrgUI
* @throws ApprovalDeployException
*/
private void syncStaging(PortalOrgUI portalOrgUI) throws ApprovalDeployException {
// 프록시를 통한 스테이징 서버 호출 추가
Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
String apiKey = properties.get("apiKey");
String proxyUrl = properties.get("portal.url");
String timeout = properties.getOrDefault("deploy.proxy_timeout", "10000");
String proxyEndpoint = proxyUrl + "/_onl/apim/portalorg/portalOrgMan.json";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("X-API-KEY", apiKey);
headers.set("target_host", "stg");
headers.set("action", "insert");
portalOrgUI.setCompRegFile(null);
HttpEntity<PortalOrgUI> request = new HttpEntity<>(portalOrgUI, headers);
try {
ResponseEntity<String> response = createRestTemplateWithTimeout(Integer.parseInt(timeout)).exchange(
proxyEndpoint,
HttpMethod.POST,
request,
String.class
);
if (!response.getStatusCode().is2xxSuccessful()) {
logger.error("Failed to sync with staging server. Status: {}, Body: {}", response.getStatusCode(), response.getBody());
throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
}
} catch (Exception e) {
logger.error("Failed to sync with staging server. {}", e.getMessage());
throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
}
throw new RuntimeException("Unable use this method(syncStaging())");
// // 프록시를 통한 스테이징 서버 호출 추가
// Map<String, String> properties = portalPropertyService.getPortalPropertiesAsMap(PORTAL_PROPERTY_GROUP);
// String apiKey = properties.get("apiKey");
// String proxyUrl = properties.get("portal.url");
// String timeout = properties.getOrDefault("deploy.proxy_timeout", "10000");
// String proxyEndpoint = proxyUrl + "/_onl/apim/portalorg/portalOrgMan.json";
//
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("X-API-KEY", apiKey);
// headers.set("target_host", "stg");
// headers.set("action", "insert");
//
// portalOrgUI.setCompRegFile(null);
// HttpEntity<PortalOrgUI> request = new HttpEntity<>(portalOrgUI, headers);
//
// try {
// ResponseEntity<String> response = createRestTemplateWithTimeout(Integer.parseInt(timeout)).exchange(
// proxyEndpoint,
// HttpMethod.POST,
// request,
// String.class
// );
//
// if (!response.getStatusCode().is2xxSuccessful()) {
// logger.error("Failed to sync with staging server. Status: {}, Body: {}", response.getStatusCode(), response.getBody());
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
// }
// } catch (Exception e) {
// logger.error("Failed to sync with staging server. {}", e.getMessage());
// throw new ApprovalDeployException("기관 정보 배포에 실패 했습니다.");
// }
}
@Override
@@ -5,9 +5,11 @@ import com.eactive.apim.portal.file.entity.FileInfo;
import com.eactive.apim.portal.file.service.FileService;
import com.eactive.apim.portal.file.service.FileTypeContext;
import com.eactive.apim.portal.portalNotice.entity.PortalNotice;
import com.eactive.eai.common.util.ContainerUtil;
import com.eactive.eai.rms.common.base.BaseService;
import com.eactive.eai.rms.data.entity.onl.apim.portalnotice.PortalNoticeService;
import com.eactive.eai.rms.data.entity.onl.apim.portalnotice.PortalNoticeUISearch;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,19 +20,28 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
@Service
@Transactional(transactionManager = "transactionManagerForEMS")
@Slf4j
public class PortalNoticeManService extends BaseService {
private final PortalNoticeService portalNoticeService;
private final PortalNoticeUIMapper portalNoticeUIMapper;
private final FileService fileService;
private final FileService fileService;
private String decodeString(String value) {
// return new String(value.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
try {
return new String(value.getBytes("euc-kr"), StandardCharsets.UTF_8);
} catch (UnsupportedEncodingException e) {
log.warn("Failed euc-kr to UTF-8", e);
return value;
}
}
return new String(value.getBytes(Charset.defaultCharset()), StandardCharsets.UTF_8);
}
@@ -102,7 +113,7 @@ public class PortalNoticeManService extends BaseService {
if (file != null && !file.isEmpty()) { // 새로운 파일이 업로드된 경우에만 처리
String decodedFileName = decodeString(portalNoticeUI.getFileName());
FileTypeContext.setFileType("notice");
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName);
FileInfo fileInfo = fileService.createOrUpdateSingleFile(portalNotice.getFileId(), file, decodedFileName, true);
if (fileInfo != null) {
portalNotice.setFileId(fileInfo.getFileId());
@@ -56,15 +56,6 @@ public class PortalOrgManController extends BaseAnnotationController {
return ResponseEntity.ok(result);
}
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=UNMASK")
public ResponseEntity<Map<String, Object>> selectDetailUnmask(String id, String reason) {
if (StringUtils.isBlank(reason)) {
throw new BizException("마스킹 해제 사유를 입력해 주세요.");
}
Map<String, Object> result = portalOrgManService.selectDetailWithUsersUnmask(id);
return ResponseEntity.ok(result);
}
@PostMapping(value = "/onl/apim/portalorg/portalOrgMan.json", params = "cmd=LIST_INIT_COMBO")
public ResponseEntity<Map<String, Object>> initCombo() {
List<ComboVo> approvalStatusList = comboService.getMonitoringCodeSortedBySeq("APPROVE_STATUS_CODE"); // 승인상태코드
@@ -172,25 +172,9 @@ public class PortalOrgManService extends BaseService {
private PortalUserCorpManagerUI convertCorporateManagerToUIWithMaskOption(PortalUser corporateManager, boolean isMasked) {
PortalUserCorpManagerUI ui = portalUserCorpManagerUIMapper.toVo(corporateManager);
if (ui != null && isMasked) {
if (StringUtils.isNotBlank(ui.getUserName())) {
ui.setUserName(MaskingUtils.maskName(ui.getUserName()));
}
if (StringUtils.isNotBlank(ui.getEmailAddr())) {
ui.setEmailAddr(MaskingUtils.maskEmailId(ui.getEmailAddr()));
}
if (StringUtils.isNotBlank(ui.getMobileNumber())) {
ui.setMobileNumber(MaskingUtils.maskPhoneNumber(ui.getMobileNumber()));
}
}
return ui;
}
public Map<String, Object> selectDetailWithUsersUnmask(String id) {
return getDetailWithUsers(id, false);
}
private void setFileInfo(PortalOrg portalOrg, PortalOrgUI ui) {
Optional.ofNullable(portalOrg.getCompRegFile())
.filter(StringUtils::isNotBlank)
@@ -41,9 +41,11 @@ public class PortalUserManService extends BaseService {
private final PortalOrgService portalOrgService;
private final FileService fileService;
private final PortalOrgManService portalOrgManService;
private final PasswordEncoder passwordEncoder;
// private final PasswordEncoder passwordEncoder;
private final PasswordEncoder kjbSafedbPasswordEncoder;
private final PortalUserTermsService portalUserTermsService;
public Page<PortalUserUI> selectList(Pageable pageable, PortalUserUISearch portalUserUISearch) {
Page<PortalUser> portalUser = portalUserService.findAll(pageable, portalUserUISearch);
return portalUser.map(entity -> {
@@ -122,7 +124,7 @@ public class PortalUserManService extends BaseService {
}
PortalUser portalUser = portalUserUIMapper.toEntity(portalUserUI);
portalUser.setPasswordHash(passwordEncoder.encode("!" + portalUserUI.getLoginId()));
portalUser.setPasswordHash(kjbSafedbPasswordEncoder.encode("!" + portalUserUI.getLoginId()));
portalUser.setLoginFailureCount(0);
portalUser.setAccountLockYn("N");
portalUser.setEmailAddr(portalUserUI.getLoginId());
@@ -50,4 +50,5 @@ public class PortalUserUI {
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
private LocalDateTime lastModifiedDate;
private String accountLockYn;
}
@@ -1,6 +1,5 @@
package com.eactive.eai.rms.onl.apim.template;
import com.eactive.apim.portal.template.entity.MessageCode;
import com.eactive.apim.portal.template.entity.MessageTemplate;
import com.eactive.eai.rms.common.base.BaseService;
import com.eactive.eai.rms.data.entity.onl.apim.template.MessageTemplateSearch;
@@ -2,11 +2,16 @@ package com.eactive.eai.rms.onl.common.service;
import com.eactive.eai.rms.onl.common.service.ums.UmsDispatchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Admin Job Configuration
* ----------------------
@@ -17,17 +22,37 @@ import org.springframework.beans.factory.annotation.Autowired;
// Cron Expression: */5 * * * * ?
@Slf4j
public class UmsDispatchJob implements Job {
private final UmsDispatchService umsDispatchService;
@Autowired
public UmsDispatchJob(UmsDispatchService umsDispatchService) {
this.umsDispatchService = umsDispatchService;
}
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("Starting Message Dispatch Job...");
// inst.Name 이 지정된 경우 해당 인스턴스에서만 동작
String jobInstName = context.getJobDetail().getJobDataMap().getString("execute.instances");
if (StringUtils.isNotEmpty(jobInstName)) {
log.debug("Job 실행 인스턴스 명이 지정되어 있음 - {}", jobInstName);
jobInstName = jobInstName.toLowerCase();
Set<String> propInstances = Arrays.stream(jobInstName.split(",")).map(String::trim).collect(Collectors.toSet());
String instanceName = System.getProperty("inst.Name");
if (StringUtils.isNotEmpty(instanceName)) {
log.debug("현재 인스턴스 명 : {}", instanceName);
instanceName = instanceName.trim().toLowerCase();
if (!propInstances.contains(instanceName)) {
log.debug("Job 인스턴스명과 현재 인스턴스명이 다름. 종료 처리");
return;
}
}
}
try {
umsDispatchService.processMessages();
} catch (Exception e) {
@@ -1,8 +1,12 @@
package com.eactive.eai.rms.onl.common.service.ums;
import com.eactive.apim.portal.template.entity.MessageRequest;
import edu.emory.mathcs.backport.java.util.Collections;
import com.eactive.apim.portal.template.repository.MessageRequestRepository;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
import com.eactive.ext.kjb.common.KjbProperty;
import com.eactive.ext.kjb.ums.KjbEmailSendModule;
import com.eactive.ext.kjb.ums.KjbUmsService;
import com.eactive.ext.kjb.util.KjbPropertyInjector;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -15,15 +19,17 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@Transactional(transactionManager = "transactionManagerForEMS")
public class UmsDispatchService {
public static final String PROP_GORUP_ID = "Monitoring";
private final ThreadPoolExecutor executorService;
private final TransactionTemplate transactionTemplate;
@@ -36,15 +42,25 @@ public class UmsDispatchService {
@PersistenceContext(unitName = "entityManagerFactoryForEMS")
private EntityManager entityManager;
@Autowired
private UmsSender umsSender;
private final MessageRequestRepository messageRequestRepository;
private final KjbUmsService kjbUmsService;
private final KjbEmailSendModule kjbEmailSendModule;
private final KjbPropertyInjector kjbPropertyInjector;
@Autowired
private StandardMessageFactory messageFactory;
@Autowired
public UmsDispatchService(
@Qualifier("transactionManagerForEMS") PlatformTransactionManager transactionManager) {
@Qualifier("transactionManagerForEMS") PlatformTransactionManager transactionManager,
MonitoringPropertyService monitoringPropertyService,
MessageRequestRepository messageRequestRepository
) {
this.kjbPropertyInjector = new KjbPropertyInjector(monitoringPropertyService, PROP_GORUP_ID);
this.messageRequestRepository = messageRequestRepository;
// this.kjbEmailService = kjbEmailService;
// this.kjbSafedbWrapper = kjbSafedbWrapper;
// this.monitoringPropertyService = monitoringPropertyService;
this.executorService = new ThreadPoolExecutor(
CORE_POOL_SIZE,
MAX_POOL_SIZE,
@@ -56,6 +72,20 @@ public class UmsDispatchService {
this.transactionTemplate = new TransactionTemplate(transactionManager);
log.debug("UmsDispatchService initialized with thread pool - core: {}, max: {}, queue: {}",
CORE_POOL_SIZE, MAX_POOL_SIZE, QUEUE_CAPACITY);
KjbProperty prop = new KjbProperty();
// prop.setEaiBatchUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.url"));
// prop.setUmsEaiBatchSendDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.send_dir"));
// prop.setUmsEaiBatchBackupDir(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.backup_dir"));
// prop.setUmsEaiBatchInterfaceId(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.eai_batch.interface_id"));
// prop.setUmsHostUrl(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.host_url"));
// prop.setUmsApiKey(monitoringPropertyService.getPrpty2ValById(PROP_GORUP_ID, "kjb.ums.api_key"));
prop = kjbPropertyInjector.inject(prop);
this.kjbUmsService = new KjbUmsService(prop);
this.kjbEmailSendModule = KjbEmailSendModule.getInstance(prop, messageRequestRepository);
}
@SuppressWarnings("unchecked")
@@ -98,6 +128,9 @@ public class UmsDispatchService {
}
} else {
log.info("No pending messages found");
// 발송 메세지가 없을 때 파일 삭제 처리 진행
}
}
@@ -110,7 +143,17 @@ public class UmsDispatchService {
try {
transactionTemplate.execute(status -> {
try {
processMessage(message);
// 광주은행에서는 사용하지 않는 메소드
// processMessage(message);
if (KjbUmsService.isAllowChannel(message)) {
kjbUmsService.send(message);
}
if (KjbEmailSendModule.isAllowChannel(message)) {
kjbEmailSendModule.sendEmail(message);
}
return null;
} catch (Exception e) {
log.error("Failed to process message: {} - Error: {}",
@@ -127,21 +170,27 @@ public class UmsDispatchService {
});
}
public void processMessage(MessageRequest message) throws IOException {
try {
String standardMessage = messageFactory.createMessage(message);
log.debug("Processing message ID: {} - Type: {}", message.getId(), message.getMessageType());
umsSender.sendMessage(standardMessage);
updateMessageStatus(message, "SENT");
log.debug("Successfully processed and sent message ID: {}", message.getId());
} catch (Exception e) {
log.error("Message processing failed for ID: {} - Error: {}",
message.getId(), e.getMessage(), e);
updateMessageStatus(message, "FAILED");
throw e;
}
}
/**
* kbank 방식으로 광주은행에서는 사용하지 않음
* @param message
* @throws IOException
*/
// @Deprecated
// public void processMessage(MessageRequest message) throws IOException {
// try {
// String standardMessage = messageFactory.createMessage(message);
// log.debug("Processing message ID: {} - Type: {}", message.getId(), message.getMessageType());
//
// umsSender.sendMessage(standardMessage);
// updateMessageStatus(message, "SENT");
// log.debug("Successfully processed and sent message ID: {}", message.getId());
// } catch (Exception e) {
// log.error("Message processing failed for ID: {} - Error: {}",
// message.getId(), e.getMessage(), e);
// updateMessageStatus(message, "FAILED");
// throw e;
// }
// }
public void updateMessageStatus(MessageRequest message, String status) {
message.setRequestStatus(status);
@@ -16,8 +16,12 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* 25.11.05 - 광주은행 미사용 클래스
*/
@Slf4j
@Component
@Deprecated
public class UmsSender {
private final MonitoringPropertyService monitoringPropertyService;
@@ -268,7 +268,7 @@ public class ApiInterfaceController extends OnlBaseAnnotationController {
.body(exportData.getExportFileContent());
}
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=INSERT_CLONE")
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=CLONE")
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode, String newApiInterfaceId, String newInboundHttpMethod, String newInboundRestPath) throws BizException {
try {
ApiInterfaceUI orgApiInterfaceUI = service.selectDetail(orgApiInterfaceId);
@@ -216,6 +216,20 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setInboundResponseStandardMessageItems(convertMapToStdMessageItems(restOption.getStandardCommonFields()));
}
}
if("syncAsync".equals(apiInterfaceUI.getSyncAsyncType()) && serviceMessageEntityList != null && serviceMessageEntityList.size() > 1){
ServiceMessageEntity extraServiceMessageEntity = serviceMessageEntityList.get(1);
apiInterfaceUI.setToResponseAdapter(extraServiceMessageEntity.getPsvsysadptrbzwkgroupname());
String restOptionStr = extraServiceMessageEntity.getRestoption();
if(StringUtils.isNotBlank(restOptionStr)) {
ObjectMapper mapper = new ObjectMapper();
RestOption restOption = mapper.readValue(restOptionStr, RestOption.class);
apiInterfaceUI.setOutboundResponseHttpMethod(restOption.getMethod());
apiInterfaceUI.setOutboundResponseRestPath(restOption.getExtraPath());
}
}
apiInterfaceUI.setTransformYn(transformYn);
apiInterfaceUI.setErrTransformYn(errTransformYn); // 추가
@@ -430,8 +444,8 @@ public class ApiInterfaceService extends OnlBaseService {
public void setServiceMessageRoutingInfo(ApiInterfaceUI vo, EAIMessageEntity eaiMessageEntity, List<ServiceMessageEntity> serviceMessageEntityList) throws Exception {
// 기본 요청 ServiceMessageEntity 설정
ServiceMessageEntity requestEntity = serviceMessageEntityList.get(0);
if ("async".equals(vo.getSyncAsyncType())) {
if ("async".equals(vo.getSyncAsyncType()) || "syncAsync".equals(vo.getSyncAsyncType())) {
requestEntity.setPsvintfacdsticname("ASYN");
}
@@ -462,6 +476,32 @@ public class ApiInterfaceService extends OnlBaseService {
setRouteInfo(vo, vo.getInboundResponseHttpMethod(), vo.getInboundResponseRestPath(), vo.getFromResponseAdapter(), responseEntity, vo.getInboundResponseStandardMessageItems());
}
// syncAsync 타입인 경우 응답용 ServiceMessageEntity 추가 처리
if ("syncAsync".equals(vo.getSyncAsyncType())) {
ServiceMessageEntity responseEntity;
// ServiceMessageEntity가 없으면 새로 생성
if (serviceMessageEntityList.size() < 2) {
responseEntity = new ServiceMessageEntity();
responseEntity.setId(new ServiceMessageEntityId(vo.getEaiSvcName(), 2));
responseEntity.setEaimessage(eaiMessageEntity);
serviceMessageEntityList.add(responseEntity);
} else {
responseEntity = serviceMessageEntityList.get(1);
}
// ServiceMessageEntity 설정
responseEntity.setPsvsysadptrbzwkgroupname(vo.getToResponseAdapter());
responseEntity.setPsvintfacdsticname("ASYN");
// REST 정보 설정
AdapterGroupUI responseAdapter = adapterService.selectDetail(vo.getToResponseAdapter());
String responseRoutName = getOutboundProcessorName(responseAdapter);
responseEntity.setOutbndroutname(responseRoutName);
setRouteInfo(vo, vo.getOutboundResponseHttpMethod(), vo.getOutboundResponseRestPath(), vo.getToResponseAdapter(), responseEntity, vo.getStandardMessageItems());
}
}
public static List<StdMessageItemUI> convertMapToStdMessageItems(Map<String, String> standardCommonFields) {
@@ -669,6 +709,8 @@ public class ApiInterfaceService extends OnlBaseService {
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 300 * 30);
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 200 * 30);
sheet.setColumnWidth(ci++, 300 * 30);
sheet.setColumnWidth(ci, 300 * 30);
int rowNum = 0;
@@ -690,6 +732,8 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getEaiSvcDesc());
createCell(row, cellIndex++, headerStyle, "변환여부(Y/N)");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getTransformYn());
createCell(row, cellIndex++, headerStyle, "Sync/Async 타입");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getSyncAsyncType());
rowNum = addTitle(sheet, ++rowNum, titleStyle, "어댑터 설정");
row = sheet.createRow(rowNum++);
@@ -698,8 +742,23 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, headerStyle, "인바운드 어댑터");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getFromAdapter());
createCell(row, cellIndex++, headerStyle, "아웃바운드 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getToAdapter());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getToAdapter());
//SYNC TYPE 에 따라 추가정보 생성
String syncAsyncType = apiInterfaceUI.getSyncAsyncType();
if (syncAsyncType.equals("asyncSync") || syncAsyncType.equals("syncAsync")) {
if (apiInterfaceUI.getSyncAsyncType().equals("asyncSync")) {
createCell(row, cellIndex++, headerStyle, "INBOUND (ASYNC) 응답 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getFromResponseAdapter());
} else {
createCell(row, cellIndex++, headerStyle, "OUTBOUND (ASYNC) 응답 어댑터");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getToResponseAdapter());
}
}
rowNum = addTitle(sheet, ++rowNum, titleStyle, "REST 설정");
row = sheet.createRow(rowNum++);
row.setHeightInPoints(height); // 행 높이를 20 포인트로 설정
@@ -707,14 +766,30 @@ public class ApiInterfaceService extends OnlBaseService {
createCell(row, cellIndex++, headerStyle, "수신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundHttpMethod());
createCell(row, cellIndex++, headerStyle, "수신 PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getInboundRestPath());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundRestPath());
if(apiInterfaceUI.getSyncAsyncType().equals("asyncSync")) {
createCell(row, cellIndex++, headerStyle, "응답 송신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getInboundResponseHttpMethod());
createCell(row, cellIndex++, headerStyle, "응답 송신 REST PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getInboundResponseRestPath());
}
row = sheet.createRow(rowNum++);
row.setHeightInPoints(height); // 행 높이를 20 포인트로 설정
cellIndex = 0; // 초기 셀 인덱스
createCell(row, cellIndex++, headerStyle, "송신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundHttpMethod());
createCell(row, cellIndex++, headerStyle, "송신 PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getOutboundRestPath());
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundRestPath());
if(apiInterfaceUI.getSyncAsyncType().equals("syncAsync")) {
createCell(row, cellIndex++, headerStyle, "응답 수신 메소드");
createCell(row, cellIndex++, textStyle, apiInterfaceUI.getOutboundResponseHttpMethod());
createCell(row, cellIndex++, headerStyle, "송신 REST PATH(URL)");
createCell(row, cellIndex, textStyle, apiInterfaceUI.getOutboundResponseRestPath());
}
if ("Y".equals(apiInterfaceUI.getTransformYn())) {
rowNum = addTitle(sheet, ++rowNum, titleStyle, "변환 설정");
@@ -768,9 +843,27 @@ public class ApiInterfaceService extends OnlBaseService {
String interfaceDesc = PoiUtils.getCellValue(sheet, 2, 1);
String transformYn = PoiUtils.getCellValue(sheet, 2, 3);
String syncAsyncType = PoiUtils.getCellValue(sheet, 2, 5);
String inboundAdapterGroupName = PoiUtils.getCellValue(sheet, 5, 1);
String outboundAdapterGroupName = PoiUtils.getCellValue(sheet, 5, 3);
String inboundResponseHttpMethod = "";
String inboundResponseRestPath = "";
String fromResponseAdapter = "";
String outboundResponseHttpMethod = "";
String outboundResponseRestPath = "";
String toResponseAdapter = "";
if (syncAsyncType.equals("asyncSync")) {
inboundResponseHttpMethod = PoiUtils.getCellValue(sheet, 8, 5);
inboundResponseRestPath = PoiUtils.getCellValue(sheet, 8, 7);
fromResponseAdapter = PoiUtils.getCellValue(sheet, 5, 5);
} else if (syncAsyncType.equals("syncAsync")) {
outboundResponseHttpMethod = PoiUtils.getCellValue(sheet, 9, 5);
outboundResponseRestPath = PoiUtils.getCellValue(sheet, 9, 7);
toResponseAdapter = PoiUtils.getCellValue(sheet, 5, 5);
}
String inboundHttpMethod = PoiUtils.getCellValue(sheet, 8, 1);
String inboundRestPath = PoiUtils.getCellValue(sheet, 8, 3);
@@ -784,6 +877,7 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setEaiSvcName(elinkServiceId);
apiInterfaceUI.setEaiSvcDesc(interfaceDesc);
apiInterfaceUI.setTransformYn(transformYn);
apiInterfaceUI.setSyncAsyncType(syncAsyncType);
apiInterfaceUI.setFromAdapter(inboundAdapterGroupName);
apiInterfaceUI.setToAdapter(outboundAdapterGroupName);
@@ -792,6 +886,14 @@ public class ApiInterfaceService extends OnlBaseService {
apiInterfaceUI.setInboundRestPath(inboundRestPath);
apiInterfaceUI.setOutboundHttpMethod(outboundHttpMethod);
apiInterfaceUI.setOutboundRestPath(outboundRestPath);
apiInterfaceUI.setInboundResponseHttpMethod(inboundResponseHttpMethod);
apiInterfaceUI.setInboundResponseRestPath(inboundResponseRestPath);
apiInterfaceUI.setFromResponseAdapter(fromResponseAdapter);
apiInterfaceUI.setOutboundResponseHttpMethod(outboundResponseHttpMethod);
apiInterfaceUI.setOutboundResponseRestPath(outboundResponseRestPath);
apiInterfaceUI.setToResponseAdapter(toResponseAdapter);
apiInterfaceUI.setIsHeaderRouting(false);
@@ -110,6 +110,10 @@ public interface ApiInterfaceUIMapper {
syncAsyncType = "asyncSync";
}
vo.setSyncAsyncType(syncAsyncType);
// 가상응답 여부
String simYn = "T".equals(eaiMessageEntity.getTrantype()) ? "Y" : "N";
vo.setSimYn(simYn);
vo.setToAdapter(requestEntity.getPsvsysadptrbzwkgroupname());
vo.setToutVal(requestEntity.getToutval());
@@ -186,6 +190,11 @@ public interface ApiInterfaceUIMapper {
if(vo == null || vo.getSyncAsyncType() == null){
return;
}
// 가상응답 여부
String tranType = "Y".equals(vo.getSimYn()) ? "T" : "R";
entity.setTrantype(tranType);
switch(vo.getSyncAsyncType()){
case "async":
case "asyncSync":
@@ -193,4 +202,4 @@ public interface ApiInterfaceUIMapper {
break;
}
}
}
}
@@ -54,6 +54,11 @@ public class ApiInterfaceUI {
private String inboundResponseHttpMethod;
private String inboundResponseRestPath;
private String fromResponseAdapter;
//SYNC-ASYNC 용
private String outboundResponseHttpMethod;
private String outboundResponseRestPath;
private String toResponseAdapter;
private String inboundErrResponseLayout;
private String errResponseTransform;
@@ -0,0 +1,19 @@
package com.eactive.ext.kjb.spring;
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
import org.springframework.security.crypto.password.PasswordEncoder;
public class KjbSafedbPasswordEncoder implements PasswordEncoder {
@Override
public String encode(CharSequence rawPassword) {
KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance();
return safedb.encryptPassword(rawPassword.toString());
}
@Override
public boolean matches(CharSequence rawPassword, String encodedPassword) {
KjbSafedbWrapper safedb = KjbSafedbWrapper.getInstance();
String encoded = safedb.encryptPassword(rawPassword.toString());
return encoded.equals(encodedPassword);
}
}
@@ -0,0 +1,62 @@
package com.eactive.ext.kjb.util;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
import com.eactive.ext.kjb.common.KjbProperty;
import com.eactive.ext.kjb.common.KjbPropertyValue;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
@Slf4j
public class KjbPropertyInjector {
private final MonitoringPropertyService monitoringPropertyService;
private final String groupId;
public KjbPropertyInjector(MonitoringPropertyService monitoringPropertyService, String groupId) {
this.monitoringPropertyService = monitoringPropertyService;
this.groupId = groupId;
}
public <T> T inject(T property) {
Class<?> clazz = property.getClass();
for (Field field : clazz.getDeclaredFields()) {
KjbPropertyValue anno = field.getAnnotation(KjbPropertyValue.class);
if (anno != null) {
String key = anno.key();
String rawValue = monitoringPropertyService.getPropertyValue(groupId, key, anno.defaultValue());
Object convertedValue = convertValue(field.getType(), rawValue);
field.setAccessible(true);
try {
field.set(property, convertedValue);
} catch (IllegalAccessException e) {
log.error("Failed to inject property: {} - {}", field.getName(), key, e);
throw new RuntimeException(e);
}
}
}
return property;
}
private static Object convertValue(Class<?> type, String rawValue) {
if (rawValue == null) return null;
if (StringUtils.isEmpty(rawValue)) return "";
if (type == String.class) return rawValue;
if (type == Integer.class || type == int.class) return Integer.valueOf(rawValue);
if (type == Long.class || type == long.class) return Long.valueOf(rawValue);
if (type == Double.class || type == double.class) return Double.valueOf(rawValue);
if (type == Boolean.class || type == boolean.class) return Boolean.valueOf(rawValue);
if (type == Float.class || type == float.class) return Float.valueOf(rawValue);
if (type == Short.class || type == short.class) return Short.valueOf(rawValue);
if (type == Byte.class || type == byte.class) return Byte.valueOf(rawValue);
return rawValue;
}
}