Subversion Repositories SmartDukaan

Rev

Rev 4603 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
677 chandransh 1
package in.shop2020.hotspot.dashbaord.server;
2
 
5769 rajveer 3
import in.shop2020.logistics.PickupStore;
677 chandransh 4
import in.shop2020.logistics.Provider;
5
import in.shop2020.logistics.LogisticsService.Client;
3132 rajveer 6
import in.shop2020.thrift.clients.LogisticsClient;
677 chandransh 7
 
8
import java.util.HashMap;
9
import java.util.List;
10
import java.util.Map;
11
 
12
public class LogisticsUtils {
4603 rajveer 13
	public static Map<Long, String> getAllProviders(){
14
		Map<Long, String> providerMap = new HashMap<Long, String>();
677 chandransh 15
		List<Provider> providers = null;
3132 rajveer 16
		LogisticsClient lsc;
677 chandransh 17
		try {
3132 rajveer 18
			lsc = new LogisticsClient();
677 chandransh 19
			Client client = lsc.getClient();
20
			providers = client.getAllProviders();
21
			for(Provider provider: providers)
4603 rajveer 22
				providerMap.put(provider.getId(), provider.getName());
677 chandransh 23
		} catch (Exception e) {
24
			e.printStackTrace();
25
		}
26
 
27
		return providerMap;
28
	}
5769 rajveer 29
 
30
	public static Map<Long, String> getAllStores(){
31
		Map<Long, String> storeMap = new HashMap<Long, String>();
32
		List<PickupStore> stores = null;
33
		LogisticsClient lsc;
34
		try {
35
			lsc = new LogisticsClient();
36
			Client client = lsc.getClient();
37
			stores = client.getAllPickupStores();
38
			for(PickupStore store: stores)
39
				storeMap.put(store.getId(), store.getHotspotId() + " " + store.getName());
40
		} catch (Exception e) {
41
			e.printStackTrace();
42
		}
43
 
44
		return storeMap;
45
	}
677 chandransh 46
}