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,135 @@
package com.eactive.eai.common.inflow;
import java.util.ArrayList;
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.inflow.loader.InflowControlLoader;
import com.eactive.eai.common.inflow.loader.InflowControlLogLogger;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.data.entity.onl.inflow.InflowControl;
import com.eactive.eai.data.entity.onl.inflow.InflowControlLog;
import com.eactive.eai.data.entity.onl.inflow.InflowControlLogId;
@Service
@Transactional
public class InflowControlDAO extends BaseDAO {
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
@Autowired
private InflowControlLoader inflowControlLoader;
@Autowired
private InflowControlLogLogger inflowControlLogLogger;
public List<InflowTargetVO> getInflowAdapterList() throws DAOException {
return getInflowList("01");
}
public List<InflowTargetVO> getInflowInterfaceList() throws DAOException {
return getInflowList("02");
}
public Map<String, InflowTargetVO> getInflowTargetByAdater(String name) throws DAOException {
return getInflowMap("01", name);
}
public Map<String, InflowTargetVO> getInflowTargetByInterface(String name) throws DAOException {
return getInflowMap("02", name);
}
private List<InflowTargetVO> getInflowList(String type) throws DAOException {
try {
Iterable<InflowControl> inflowControls = inflowControlLoader.findByConditions(type, "");
List<InflowTargetVO> targetList = new ArrayList<>();
logger.info("[ @@ Load InflowControl Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (InflowControl inflowControl : inflowControls) {
InflowTargetVO vo = new InflowTargetVO();
vo.setName(inflowControl.getId().getName());
vo.setThreshold(inflowControl.getThreshold());
vo.setThresholdPerSecond(inflowControl.getThresholdpersecond());
vo.setThresholdTimeUnit(inflowControl.getThresholdtimeunit());
vo.setActivate(!"0".equals(inflowControl.getUseyn()));
targetList.add(vo);
}
logger.info("[>>Load InflowControl Configuration - ended ]");
return targetList;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
private Map<String, InflowTargetVO> getInflowMap(String type, String name) throws DAOException {
try {
Iterable<InflowControl> inflowControls = inflowControlLoader.findByConditions(type, name);
Map<String, InflowTargetVO> targetList = new HashMap<>();
logger.info("[ @@ Load InflowControl getInflowMap Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (InflowControl inflowControl : inflowControls) {
InflowTargetVO vo = new InflowTargetVO();
vo.setName(inflowControl.getId().getName());
vo.setThreshold(inflowControl.getThreshold());
vo.setThresholdPerSecond(inflowControl.getThresholdpersecond());
vo.setThresholdTimeUnit(inflowControl.getThresholdtimeunit());
vo.setActivate(!"0".equals(inflowControl.getUseyn()));
targetList.put(vo.getName(), vo);
}
logger.info("[>>Load InflowControl getInflowMap Configuration - ended ]");
return targetList;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
/**
* 1. 기능 : 유량제어 로그를 INSERT하는 메서드 2. 처리 개요 : 파라미터의 코드, 메시지를 테이블에 INSERT한다. - 3.
* 주의사항
*
* @param EAIBzwkDstcd EAI업무구분코드
* @param MsgDpstYMS 메시지수신일시
* @param EAISvcSerno EAI서비스일련번호
* @param EAISevrInstncName EAI서버인스턴스명
* @param EAISvcName EAI서비스명
* @param EAIOsidInstiCd EAI대외기관코드
* @exception DAOException JDBC 관련 오류(SQLException)
**/
// bzwkDstcd + msgDpstYMS + eAISvcSerno
// String bzwkDstcd, String msgDpstYMS, String eAISvcSerno,
// String eAISevrInstncName, String eAISvcName, String adapterGroupName,
// long limitPerSecond, long limit, String timeUnit
public void addInflowServicetLog(String bzwkDstcd, String msgDpstYMS, String eAISvcSerno, String eAISevrInstncName,
String eAISvcName, String adapterGroupName, long limitPerSecond, long limit, String timeUnit)
throws DAOException {
try {
InflowControlLog inflowControlLog = new InflowControlLog();
InflowControlLogId id = new InflowControlLogId();
id.setEaibzwkdstcd(bzwkDstcd);
id.setMsgdpstyms(msgDpstYMS);
id.setEaisvcserno(eAISvcSerno);
inflowControlLog.setId(id);
inflowControlLog.setEaisevrinstncname(eAISevrInstncName);
inflowControlLog.setEaisvcname(eAISvcName);
inflowControlLog.setAdptrbzwkgroupname(adapterGroupName);
inflowControlLog.setThresholdpersecond((int) limitPerSecond);
inflowControlLog.setThreshold((int) limit);
inflowControlLog.setThresholdtimeunit(timeUnit);
inflowControlLogLogger.save(inflowControlLog);
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
}