| 7030 |
rajveer |
1 |
package in.shop2020.serving.services;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.config.ConfigException;
|
|
|
4 |
import in.shop2020.serving.model.ShipmentUpdate;
|
|
|
5 |
import in.shop2020.thrift.clients.TransactionClient;
|
|
|
6 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
|
|
7 |
|
|
|
8 |
import java.util.ArrayList;
|
|
|
9 |
import java.util.List;
|
|
|
10 |
|
|
|
11 |
import javax.xml.xpath.XPath;
|
|
|
12 |
import javax.xml.xpath.XPathConstants;
|
|
|
13 |
import javax.xml.xpath.XPathExpressionException;
|
|
|
14 |
import javax.xml.xpath.XPathFactory;
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
import org.apache.log4j.Logger;
|
|
|
18 |
import org.w3c.dom.Element;
|
|
|
19 |
import org.w3c.dom.NodeList;
|
|
|
20 |
import org.xml.sax.InputSource;
|
|
|
21 |
|
|
|
22 |
public class RedExpressTrackingService {
|
|
|
23 |
private static Logger log = Logger.getLogger(Class.class);
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
public List<ShipmentUpdate> getUpdates(String awbNumber){
|
|
|
27 |
List<ShipmentUpdate> updates = new ArrayList<ShipmentUpdate>();
|
|
|
28 |
try{
|
|
|
29 |
TransactionClient tc = new TransactionClient();
|
|
|
30 |
List<String> tokens= tc.getClient().receiveUpdatesForRedExpress(id);
|
|
|
31 |
for(String token: tokens){
|
|
|
32 |
String[] parts = token.split("~!~");
|
|
|
33 |
ShipmentUpdate update = new ShipmentUpdate();
|
|
|
34 |
update.date = parts[0];
|
|
|
35 |
update.time = " " + parts[1];
|
|
|
36 |
update.description = parts[2];
|
|
|
37 |
update.city = "--";
|
|
|
38 |
updates.add(update);
|
|
|
39 |
}
|
|
|
40 |
} catch (Exception e) {
|
|
|
41 |
log.info("Some problem while fetching");
|
|
|
42 |
}
|
|
|
43 |
return updates;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
}
|