本文介绍了如何为Express Delivery构建业务层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的项目中,我有一个问题是构建业务层来调用不同的快速服务提供商的API,例如UPS,Fedex,DHL ,EMS等。我需要调用一些服务,例如从每个服务提供商处获取交付号码,但是所有
他们都有不同的请求正文和响应结果。如何创建一个公共访问点以获得每个提供商的不同结果? 


我试图构建一个抽象类并定义一些常见的抽象方法,然后让它们每个Provider类都继承此抽象类并实现每个方法。但是,由于请求体和响应体的不同,我无法构建一个合适的
抽象方法,也无法使基本请求类和响应类转移到所需的值。


有人可以帮助我,非常感谢你。

解决方案

hi,

in my project, i have a problem to build the bussiness layer to call the APIs of different Express Service Provider, such as UPS, Fedex, DHL, EMS etc. I need to call some service such as getting delivery number from each Service Provider, but all of them have the different request body and response result. How can i make a common access point to  the get different result of each Provider? 

I have tried to build a abstract class and define some common abstract methods, and then let each Provider class inherits this abstract class and implements every method. But, due to different request body and response body, i couldn't build a proper abstract method, and also couldn't make a base request class and response class to transfer to needed values.

Could someone help me, thank you very much.

解决方案


这篇关于如何为Express Delivery构建业务层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 07:15