Subversion Repositories SmartDukaan

Rev

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

package in.shop2020.hotspot.dashbaord.server;

import in.shop2020.logistics.PickupStore;
import in.shop2020.logistics.Provider;
import in.shop2020.logistics.LogisticsService.Client;
import in.shop2020.thrift.clients.LogisticsClient;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LogisticsUtils {
        public static Map<Long, String> getAllProviders(){
                Map<Long, String> providerMap = new HashMap<Long, String>();
                List<Provider> providers = null;
                LogisticsClient lsc;
                try {
                        lsc = new LogisticsClient();
                        Client client = lsc.getClient();
                        providers = client.getAllProviders();
                        for(Provider provider: providers)
                                providerMap.put(provider.getId(), provider.getName());
                } catch (Exception e) {
                        e.printStackTrace();
                }
                
                return providerMap;
        }
        
        public static Map<Long, String> getAllStores(){
                Map<Long, String> storeMap = new HashMap<Long, String>();
                List<PickupStore> stores = null;
                LogisticsClient lsc;
                try {
                        lsc = new LogisticsClient();
                        Client client = lsc.getClient();
                        stores = client.getAllPickupStores();
                        for(PickupStore store: stores)
                                storeMap.put(store.getId(), store.getHotspotId() + " " + store.getName());
                } catch (Exception e) {
                        e.printStackTrace();
                }
                
                return storeMap;
        }
}