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:

SAP Hybris Commerce功能介绍:Consignment tracking

Once payment is done, customer could see payment detail.

SAP Hybris Commerce功能介绍:Consignment tracking

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.

SAP Hybris Commerce功能介绍:Consignment tracking

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.

SAP Hybris Commerce功能介绍:Consignment tracking

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.

SAP Hybris Commerce功能介绍:Consignment tracking
SAP Hybris Commerce功能介绍:Consignment tracking

Implementation detail go through

Please find Java classes involved in the enhancement implementation:

SAP Hybris Commerce功能介绍:Consignment tracking

The mentioned Java classes are implemented in these five projects:

SAP Hybris Commerce功能介绍:Consignment tracking

ConsignmentTrackingController

This controller is responsible to react on the Tracking button press event and delegate the call to the tracking detail popup page.

SAP Hybris Commerce功能介绍:Consignment tracking

The logic of progress bar display is done here: ( so only three values in progress bar: 0, 50 and 100 ):

SAP Hybris Commerce功能介绍:Consignment tracking

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”:

SAP Hybris Commerce功能介绍:Consignment tracking

the fields for “ORDERED”, “SHIPPED” and “ARRIVED”:

SAP Hybris Commerce功能介绍:Consignment tracking
SAP Hybris Commerce功能介绍:Consignment tracking

Progress bar:

SAP Hybris Commerce功能介绍:Consignment tracking

ConsignmentData

SAP Hybris Commerce功能介绍:Consignment tracking

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

SAP Hybris Commerce功能介绍:Consignment tracking

DefaultConsignmentTrackingFacade

This facade simply delegates the execution to Service layer and does some post conversion based on returned result:

SAP Hybris Commerce功能介绍:Consignment tracking
SAP Hybris Commerce功能介绍:Consignment tracking

EventData

SAP Hybris Commerce功能介绍:Consignment tracking

The fields are modelled in file “consignmenttrackingservices\resources\consignmenttrackingservices-beans.xml”:

SAP Hybris Commerce功能介绍:Consignment tracking

ConsignmentDAO

Data Access Object, generates dynamic statement to fire flexible query to get data from persistence layer:

SAP Hybris Commerce功能介绍:Consignment tracking

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:

SAP Hybris Commerce功能介绍:Consignment tracking

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.

SAP Hybris Commerce功能介绍:Consignment tracking

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:

SAP Hybris Commerce功能介绍:Consignment tracking
SAP Hybris Commerce功能介绍:Consignment tracking

So customer can simply replace the default mockCarrierAdapter into their customized Adapter to make it take effect.

SAP Hybris Commerce功能介绍:Consignment tracking

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
SAP Hybris Commerce功能介绍:Consignment tracking