调用
Optional<CommunicateDataHandle> handleOptional = communicateDataHandleList.stream().filter(resolver -> resolver.support(tabId, blockId)).findFirst();
if (handleOptional.isPresent()) {
return handleOptional.get().queryData(tabId,blockId,statDate, session, param,dimensionMap);
} else {
throw new BaseException(BaseExceptionMessage.SYSTEM_ERROR);
}
接口
public interface CommunicateDataHandle {
CommunicateDataDTO queryData(Long tabId, Long blockId, String statDate, Session session, String param, Map<String, DimensionHierarchy> dimensionMap);
}
实现
@Slf4j
@Service
public class MonthlyScaleReachCommunicate implements CommunicateDataHandle {
@Override
public boolean support(Long tabId, Long blockId) {
return CommonConstants.TAB_WHOLE_MANAGE.equals(tabId) && CommonConstants.BLOCK_8.equals(blockId);
}
@Override
public CommunicateDataDTO queryData(Long tabId, Long blockId, String statDate, Session session, String param, Map<String, DimensionHierarchy> dimensionMap) {
IndicatorReqDTO req = new IndicatorReqDTO();
}
}