SAP Hybris Commerce功能介绍:Consignment tracking
This new feature is developed by Chengdu Hybris dev team. When a customer decides to buy a given product, in step 4 Payment Method, customer chooses the way to pay:
Once payment is done, customer could see payment detail.
A new button is added in the screen which allows our end user to check the logistics status of current good delivery once the good is purchased.
Below is a sample popup once the button is clicked. All the data you saw below is the test data prepared by Hybris dev colleague manually, since we didn’t actually purchase any good.
The test data is inserted by the following console ( internal tool which is used only for testing ) so that they could be displayed later once the tracking button is pressed.
Implementation detail go through
Please find Java classes involved in the enhancement implementation:
The mentioned Java classes are implemented in these five projects:
ConsignmentTrackingController
This controller is responsible to react on the Tracking button press event and delegate the call to the tracking detail popup page.
The logic of progress bar display is done here: ( so only three values in progress bar: 0, 50 and 100 ):
Popup view( delivery detail )
The view is implemented in file: consignmenttrackingaddon/acceleratoraddon/web/webroot/WEB-INF/views/responsive/pages/consignment/trackPackage.jsp
For example, the field for “Expected delivery”:
the fields for “ORDERED”, “SHIPPED” and “ARRIVED”:
Progress bar:
ConsignmentData
This bean class holds the data to be displayed in the tracking detail popup view.
You can find its detail configuration from this file via the path: consignmenttrackingfacades\resources\consignmenttrackingfacades-beans.xml
DefaultConsignmentTrackingFacade
This facade simply delegates the execution to Service layer and does some post conversion based on returned result:
EventData
The fields are modelled in file “consignmenttrackingservices\resources\consignmenttrackingservices-beans.xml”:
ConsignmentDAO
Data Access Object, generates dynamic statement to fire flexible query to get data from persistence layer:
ConsignmentService
Since customer could choose their own carrier and integrate into the scenaro via custom development, so here ConsignmentService again delegates the call to the actual CarrierAdapter:
MockAddon
In order to guide customer to integrate their specific carrier into tracking scenario, SAP delivers a mock addon containing all necessary technical implementation for implementation reference.
So how customer’s specific CarrierAdapter could be used?
In ConsignmentService implementation, the corresponding CarrierAdapter instance is fetched according to its code.
The code is searched against the CarrierMap, which is injected by Spring in file “consignmenttrackingservices\resources\consignmenttrackingservices-spring.xml” plus annotation org.springframework.beans.factory.annotation.Required:
So customer can simply replace the default mockCarrierAdapter into their customized Adapter to make it take effect.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":