Subversion Repositories SmartDukaan

Rev

Rev 7029 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7029 Rev 7030
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import in.shop2020.config.ConfigException;
-
 
4
import in.shop2020.serving.model.ShipmentUpdate;
3
import in.shop2020.serving.model.ShipmentUpdate;
5
import in.shop2020.thrift.clients.TransactionClient;
4
import in.shop2020.serving.services.RedExpressTrackingService;
-
 
5
 
6
 
6
 
7
import java.util.List;
7
import java.util.List;
8
import java.util.ArrayList;
8
import java.util.ArrayList;
9
 
9
 
10
import org.apache.log4j.Logger;
10
import org.apache.log4j.Logger;
Line 13... Line 13...
13
 
13
 
14
	private static final long serialVersionUID = -7381937038033808767L;
14
	private static final long serialVersionUID = -7381937038033808767L;
15
 
15
 
16
	private static Logger log = Logger.getLogger(Class.class);
16
	private static Logger log = Logger.getLogger(Class.class);
17
	private String id;
17
	private String id;
18
	private List<ShipmentUpdate> updates = new ArrayList<ShipmentUpdate>();
18
	private List<ShipmentUpdate> updates;
19
 
19
 
20
	public RedexpressUpdatesController(){
20
	public RedexpressUpdatesController(){
21
		super();
21
		super();
22
	}
22
	}
23
 
23
 
24
	public String show() {
24
	public String show() {
25
    	log.info("RedExpress Updates Controller " + id);
25
    	log.info("RedExpress Updates Controller " + id);
26
    	try{
-
 
27
	    	TransactionClient tc = new TransactionClient();
26
    	RedExpressTrackingService trackService = new RedExpressTrackingService();
28
	    	List<String> tokens= tc.getClient().receiveUpdatesForRedExpress(id);
-
 
29
	    	for(String token: tokens){
-
 
30
	    		String[] parts = token.split("~!~");
-
 
31
	    		ShipmentUpdate update = new ShipmentUpdate();
27
    	updates = trackService.getUpdates(id);
32
	        	update.date = parts[0];
-
 
33
	        	update.time = "          " + parts[1];
-
 
34
	        	update.description = parts[2];
-
 
35
	        	update.city = "--";
-
 
36
	        	updates.add(update);
-
 
37
	    	}
-
 
38
    	} catch (Exception e) {
-
 
39
    		log.info("Some problem while fetching");
-
 
40
    	}
-
 
41
		return "show";
28
		return "show";
42
	}
29
	}
43
 
30
 
44
	public String getId(){
31
	public String getId(){
45
		return id;
32
		return id;