package com.fzzy.igds.dzhwk.v1; import com.fzzy.igds.dzhwk.v1.dto.ApiV1ReqDto; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.Map; /** * @Description 解析数据接口分发 * @Author CZT * @Date 2025/6/04 16:10 */ @Component public class ApiV1Manager implements ApplicationContextAware { private static Map serviceMap; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { Map map = applicationContext .getBeansOfType(ApiV1Service.class); serviceMap = new HashMap<>(); for (String key : map.keySet()) { serviceMap.put(map.get(key).getInterfaceId(), map.get(key)); } } /** * 业务执行入口 * @param * @return * @throws Exception */ @Async public void analysis(String interfaceId, String dataStr, ApiV1ReqDto reqDto){ ApiV1Service service = serviceMap.get(interfaceId); if(null == service){ return; } service.analysis(dataStr, reqDto); } }