This commit is contained in:
Rinjae
2025-09-05 18:57:45 +09:00
commit aacc1a389e
1229 changed files with 167963 additions and 0 deletions
@@ -0,0 +1,74 @@
package com.eactive.eai.common.restrict;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.restrict.logger.RestrictInfoLoader;
import com.eactive.eai.common.restrict.logger.RestrictInfoLogLogger;
import com.eactive.eai.common.restrict.mapper.RestrictInfoMapper;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.NullControl;
import com.eactive.eai.data.entity.onl.restrict.RestrictInfo;
import com.eactive.eai.data.entity.onl.restrict.RestrictInfoLog;
import com.eactive.eai.data.entity.onl.restrict.RestrictInfoLogId;
@Service
@Transactional
public class RestrictInfoDAO extends BaseDAO {
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
@Autowired
private RestrictInfoLoader restrictInfoLoader;
@Autowired
private RestrictInfoLogLogger restrictInfoLogLogger;
@Autowired
private RestrictInfoMapper restrictInfoMapper;
public Map<String, RestrictInfoVO> getAllMessages() throws DAOException {
try {
Map<String, RestrictInfoVO> routingMap = new HashMap<>();
List<RestrictInfo> restrictInfos = restrictInfoLoader.findAll();
if (logger.isInfo())
logger.info("[ @@ Load RestrictInfo Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (RestrictInfo restrictInfo : restrictInfos) {
RestrictInfoVO vo = restrictInfoMapper.toVo(restrictInfo);
routingMap.put(vo.getEAICtrlName(), vo);
if (logger.isInfo())
logger.info("@ " + vo.toString());
}
if (logger.isInfo())
logger.info("[>>Load RestrictInfo Configuration - ended ]");
return routingMap;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICIM101"));
}
}
public void addResrtictLog(String bzwkDstcd, String msgDpstYMS, String eAISvcSerno, String eAISevrInstncName,
String eAISvcName, String eAIOsidInstiCd, String eAICtrlNameDstcd) throws DAOException {
try {
RestrictInfoLog restrictInfoLog = new RestrictInfoLog();
RestrictInfoLogId id = new RestrictInfoLogId();
id.setEaibzwkdstcd(bzwkDstcd);
id.setMsgdpstyms(msgDpstYMS);
id.setEaisvcserno(NullControl.addSpace(eAISvcSerno));
restrictInfoLog.setId(id);
restrictInfoLog.setEaisevrinstncname(eAISevrInstncName);
restrictInfoLog.setEaisvcname(eAISvcName);
restrictInfoLog.setEaiosidinsticd(NullControl.addSpace(eAIOsidInstiCd));
restrictInfoLog.setEaictrlnamedstcd(NullControl.addSpace(eAICtrlNameDstcd));
restrictInfoLogLogger.save(restrictInfoLog);
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICIM102"));
}
}
}
@@ -0,0 +1,127 @@
package com.eactive.eai.common.restrict;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.ApplicationContextProvider;
import com.eactive.eai.common.util.Logger;
@Component
public class RestrictInfoManager implements Lifecycle {
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
private static RestrictInfoManager instance = new RestrictInfoManager();
private Map<String, RestrictInfoVO> messages;
private LifecycleSupport lifecycle = new LifecycleSupport(this);
private boolean started;
@Autowired
RestrictInfoDAO restrictInfoDAO;
public static RestrictInfoManager getInstance() {
return ApplicationContextProvider.getContext().getBean(RestrictInfoManager.class);
}
public void addResrtictLog(String bzwkDstcd, String msgDpstYMS, String eAISvcSerno, String eAISevrInstncName,
String eAISvcName, String eAIOsidInstiCd, String eAICtrlNameDstcd) throws DAOException {
restrictInfoDAO.addResrtictLog(bzwkDstcd, msgDpstYMS, eAISvcSerno, eAISevrInstncName, eAISvcName, eAIOsidInstiCd, eAICtrlNameDstcd);
}
public void start() throws LifecycleException {
if (started)
throw new LifecycleException("RECEAICIM201");
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
try {
init();
} catch (Exception e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICIM202"));
}
started = true;
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
private void init() throws Exception {
messages = restrictInfoDAO.getAllMessages();
}
public synchronized void reload() throws Exception {
if (logger.isWarn()) {
logger.warn("RestrictInfoManager] reload all Started ...");
}
init();
if (logger.isWarn()) {
logger.warn("RestrictInfoManager] reload all finished ...");
}
}
public void stop() throws LifecycleException {
if (!started)
throw new LifecycleException("RECEAICIM203");
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
messages.clear();
started = false;
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
public void addLifecycleListener(LifecycleListener listener) {
lifecycle.addLifecycleListener(listener);
}
public LifecycleListener[] findLifecycleListeners() {
return lifecycle.findLifecycleListeners();
}
public void removeLifecycleListener(LifecycleListener listener) {
lifecycle.removeLifecycleListener(listener);
}
public boolean isStarted() {
return this.started;
}
public RestrictInfoVO getRestrictInfoVO(String keyCode) {
if (keyCode == null)
return null;
RestrictInfoVO vo = messages.get(keyCode);
return vo;
}
public void setRestrictInfoVO(String keyCode, RestrictInfoVO vo) {
messages.put(keyCode, vo);
}
public void setRestrictInfoVO(RestrictInfoVO vo) {
messages.put(vo.getEAICtrlName(), vo);
}
public void removeRestrictInfoVO(String keyCode) {
messages.remove(keyCode);
}
public void clearRestrictInfoVO() {
messages.clear();
}
public Map<String, RestrictInfoVO> getAllRestrictInfos() {
return this.messages;
}
public String[] getAllCodes() {
return messages.keySet().toArray(new String[0]);
}
}
@@ -0,0 +1,59 @@
package com.eactive.eai.common.restrict;
import java.io.Serializable;
public class RestrictInfoVO implements Serializable {
private String eAICtrlName; // EAI통제명 TSEAITI01.EAICtrlName
private String eAICtrlNameDstcd; // EAI통제명구분코드 TSEAITI01.EAICtrlNameDstcd
private String eAICtrlDsticCtnt; // EAI통제구분내용 TSEAITI01.EAICtrlDsticCtnt
private String ctrlPrcssYMS; // 통제처리일시 TSEAITI01.CtrlPrcssYMS
private String tranCtrlPrcssName; // 거래제어처리명 TSEAITI01.TranCtrlPrcssName
public String getCtrlPrcssYMS() {
return ctrlPrcssYMS;
}
public void setCtrlPrcssYMS(String ctrlPrcssYMS) {
this.ctrlPrcssYMS = ctrlPrcssYMS;
}
public String getEAICtrlDsticCtnt() {
return eAICtrlDsticCtnt;
}
public void setEAICtrlDsticCtnt(String ctrlDsticCtnt) {
eAICtrlDsticCtnt = ctrlDsticCtnt;
}
public String getEAICtrlName() {
return eAICtrlName;
}
public void setEAICtrlName(String ctrlName) {
eAICtrlName = ctrlName;
}
public String getEAICtrlNameDstcd() {
return eAICtrlNameDstcd;
}
public void setEAICtrlNameDstcd(String ctrlNameDstcd) {
eAICtrlNameDstcd = ctrlNameDstcd;
}
public String getTranCtrlPrcssName() {
return tranCtrlPrcssName;
}
public void setTranCtrlPrcssName(String tranCtrlPrcssName) {
this.tranCtrlPrcssName = tranCtrlPrcssName;
}
public RestrictInfoVO() {
this("");
}
public RestrictInfoVO(String eAICtrlName) {
this.eAICtrlName = eAICtrlName;
}
}
@@ -0,0 +1,24 @@
package com.eactive.eai.common.restrict.mapper;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import com.eactive.eai.common.restrict.RestrictInfoVO;
import com.eactive.eai.data.entity.onl.restrict.RestrictInfo;
import com.eactive.eai.data.mapper.GenericMapper;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface RestrictInfoMapper extends GenericMapper<RestrictInfoVO, RestrictInfo> {
@Mapping(source = "id", target = "EAICtrlName")
@Mapping(source = "eaictrlnamedstcd", target = "EAICtrlNameDstcd")
@Mapping(source = "eaictrldsticctnt", target = "EAICtrlDsticCtnt")
@Mapping(source = "ctrlprcssyms", target = "ctrlPrcssYMS")
@Mapping(source = "tranctrlprcssname", target = "tranCtrlPrcssName")
@Override
RestrictInfoVO toVo(RestrictInfo entity);
@InheritInverseConfiguration
RestrictInfo toEntity(RestrictInfoVO vo);
}