inflow group 추가

This commit is contained in:
yunjy-hp
2025-12-11 10:04:24 +09:00
parent 5274ce811d
commit 39244dc0df
8 changed files with 508 additions and 31 deletions
@@ -12,10 +12,14 @@ 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.InflowControlGroupLoader;
import com.eactive.eai.common.inflow.loader.InflowControlGroupMappingLoader;
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.InflowControlGroup;
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
import com.eactive.eai.data.entity.onl.inflow.InflowControlLog;
import com.eactive.eai.data.entity.onl.inflow.InflowControlLogId;
@@ -30,6 +34,12 @@ public class InflowControlDAO extends BaseDAO {
@Autowired
private InflowControlLogLogger inflowControlLogLogger;
@Autowired
private InflowControlGroupLoader inflowControlGroupLoader;
@Autowired
private InflowControlGroupMappingLoader inflowControlGroupMappingLoader;
public List<InflowTargetVO> getInflowAdapterList() throws DAOException {
return getInflowList("01");
}
@@ -132,4 +142,89 @@ public class InflowControlDAO extends BaseDAO {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
// ==================== 그룹 관련 메서드 ====================
/**
* 활성화된 유량제어 그룹 목록 조회
*/
public List<InflowGroupVO> getInflowGroupList() throws DAOException {
try {
Iterable<InflowControlGroup> groups = inflowControlGroupLoader.findActiveGroups();
List<InflowGroupVO> groupList = new ArrayList<>();
logger.info("[ @@ Load InflowControlGroup Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (InflowControlGroup group : groups) {
InflowGroupVO vo = convertToGroupVO(group);
// 그룹에 속한 인터페이스 목록 조회
Iterable<InflowControlGroupMapping> mappings = inflowControlGroupMappingLoader.findActiveByGroupId(group.getGroupId());
for (InflowControlGroupMapping mapping : mappings) {
vo.addInterface(mapping.getInterfaceId());
}
groupList.add(vo);
}
logger.info("[>>Load InflowControlGroup Configuration - ended. count=" + groupList.size() + " ]");
return groupList;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
/**
* 인터페이스ID → 그룹ID 매핑 조회
*/
public Map<String, String> getInterfaceToGroupMap() throws DAOException {
try {
Iterable<InflowControlGroupMapping> mappings = inflowControlGroupMappingLoader.findActiveMappings();
Map<String, String> interfaceToGroupMap = new HashMap<>();
logger.info("[ @@ Load InterfaceToGroupMap Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (InflowControlGroupMapping mapping : mappings) {
interfaceToGroupMap.put(mapping.getInterfaceId(), mapping.getGroupId());
}
logger.info("[>>Load InterfaceToGroupMap Configuration - ended. count=" + interfaceToGroupMap.size() + " ]");
return interfaceToGroupMap;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
/**
* 특정 그룹 조회
*/
public Map<String, InflowGroupVO> getInflowTargetByGroup(String groupId) throws DAOException {
try {
Iterable<InflowControlGroup> groups = inflowControlGroupLoader.findByConditions(groupId);
Map<String, InflowGroupVO> groupMap = new HashMap<>();
logger.info("[ @@ Load InflowControlGroup getInflowTargetByGroup Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (InflowControlGroup group : groups) {
InflowGroupVO vo = convertToGroupVO(group);
// 그룹에 속한 인터페이스 목록 조회
Iterable<InflowControlGroupMapping> mappings = inflowControlGroupMappingLoader.findActiveByGroupId(group.getGroupId());
for (InflowControlGroupMapping mapping : mappings) {
vo.addInterface(mapping.getInterfaceId());
}
groupMap.put(vo.getGroupId(), vo);
}
logger.info("[>>Load InflowControlGroup getInflowTargetByGroup Configuration - ended ]");
return groupMap;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICMM101"));
}
}
/**
* Entity → VO 변환
*/
private InflowGroupVO convertToGroupVO(InflowControlGroup group) {
InflowGroupVO vo = new InflowGroupVO();
vo.setGroupId(group.getGroupId());
vo.setGroupName(group.getGroupName());
vo.setThreshold(group.getThreshold() != null ? group.getThreshold() : 0);
vo.setThresholdPerSecond(group.getThresholdPerSecond() != null ? group.getThresholdPerSecond() : 0);
vo.setThresholdTimeUnit(group.getThresholdTimeUnit());
vo.setActivate(!"0".equals(group.getUseYn()));
return vo;
}
}