| | |
| | | import com.fzzy.api.view.pr.ApiConfsPR; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.data.OrderReq; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | |
| | | * @author czt |
| | | * @date 2023/8/17 |
| | | */ |
| | | @Slf4j |
| | | @Component(OrderManager.BEAN_ID) |
| | | public class OrderManager implements ApplicationContextAware { |
| | | public static final String BEAN_ID = "order.orderManager"; |
| | |
| | | @Async |
| | | public void execute(OrderReq<JSONObject> req){ |
| | | |
| | | //获取配置信息 |
| | | List<ApiConfs> apiConfList = apiConfsPR.listAll(); |
| | | if(null == apiConfList || apiConfList.isEmpty()){ |
| | | return; |
| | | } |
| | | OrderData data = JSONObject.parseObject(req.getData().toString(), OrderData.class); |
| | | |
| | | //根据配置信息执行 |
| | | OrderApiService service; |
| | | for (ApiConfs apiConfs : apiConfList) { |
| | | |
| | | service = serviceMap.get(apiConfs.getPushProtocol()); |
| | | if(null == service){ |
| | | continue; |
| | | try{ |
| | | //获取配置信息 |
| | | List<ApiConfs> apiConfList = apiConfsPR.listAll(); |
| | | if(null == apiConfList || apiConfList.isEmpty()){ |
| | | return; |
| | | } |
| | | OrderData data = JSONObject.parseObject(req.getData().toString(), OrderData.class); |
| | | data.setOrderid(req.getOrderid()); |
| | | //根据配置信息执行 |
| | | OrderApiService service; |
| | | for (ApiConfs conf : apiConfList) { |
| | | |
| | | service.execute(data, req.getType()); |
| | | service = serviceMap.get(conf.getPushProtocol()); |
| | | if(null == service){ |
| | | continue; |
| | | } |
| | | |
| | | service.execute(data, req.getType(), conf, req.getOrderid()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("-----指令解析异常-----指令={}", req); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |