Subversion Repositories SmartDukaan

Rev

Rev 6050 | Rev 6066 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6050 Rev 6057
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import java.util.HashMap;
3
import java.util.HashMap;
4
import java.util.List;
4
import java.util.List;
5
import java.util.Map;
5
import java.util.Map;
-
 
6
import java.util.Set;
6
 
7
 
7
import org.apache.log4j.Logger;
8
import org.apache.log4j.Logger;
8
import org.apache.thrift.TException;
9
import org.apache.thrift.TException;
9
import org.apache.thrift.transport.TTransportException;
10
import org.apache.thrift.transport.TTransportException;
10
 
11
 
-
 
12
import in.shop2020.logistics.LogisticsService;
-
 
13
import in.shop2020.logistics.PickupStore;
-
 
14
import in.shop2020.model.v1.order.RechargeType;
11
import in.shop2020.thrift.clients.HelperClient;
15
import in.shop2020.thrift.clients.HelperClient;
-
 
16
import in.shop2020.thrift.clients.LogisticsClient;
-
 
17
import in.shop2020.thrift.clients.TransactionClient;
12
import in.shop2020.utils.HelperServiceException;
18
import in.shop2020.utils.HelperServiceException;
13
import in.shop2020.utils.QuickLink;
19
import in.shop2020.utils.QuickLink;
14
 
20
 
15
public class RechargeController extends BaseController {
21
public class RechargeController extends BaseController {
16
    
22
    
17
    /**
23
    /**
18
     * 
24
     * 
19
     */
25
     */
20
    private String serviceType = "";
26
    private String serviceType = "1";
21
    private String form = "";
27
    private String form = "";
-
 
28
    private Set<Long> providerKeys;
-
 
29
    private Map<Long, String> providers;
22
    
30
    
23
    private static final long serialVersionUID = 2079308723099307749L;
31
    private static final long serialVersionUID = 2079308723099307749L;
24
 
32
 
25
    private static Logger log = Logger.getLogger(Class.class);
33
    private static Logger log = Logger.getLogger(Class.class);
26
    
34
    
-
 
35
 
-
 
36
/*    static{
-
 
37
        TransactionClient tc;
-
 
38
        try {
-
 
39
            tc = new TransactionClient();
-
 
40
            providers = tc.getClient().getServiceProviders(RechargeType.valueOf(serviceType));
-
 
41
        } catch (Exception e) {
-
 
42
            log.error("Cannot get providers");
-
 
43
        }
-
 
44
        setProviderKeys(providers.keySet());
-
 
45
    }*/
-
 
46
    
27
    public String index() {
47
    public String index() {
-
 
48
        System.out.println("1");
28
        return "index";
49
        return "index";
29
    }
50
    }
30
    
51
    
31
    public String create() {
52
    public String create() {
32
        if(form.equals("serviceSelect")) {
53
        if(form.equals("serviceSelect")) {
33
            return index();
54
            return index();
34
        }
55
        }
35
        return "hello";
56
        return "hello";
36
    }
57
    }
-
 
58
    
-
 
59
    public Map<Long, String> getProviderMap() {
-
 
60
        System.out.println("2");
-
 
61
        TransactionClient tc;
-
 
62
        try {
-
 
63
            tc = new TransactionClient();
-
 
64
            System.out.println("3");
-
 
65
            providers = tc.getClient().getServiceProviders(RechargeType.findByValue(Integer.parseInt(serviceType)));
-
 
66
            System.out.println("4");
-
 
67
            setProviderKeys(providers.keySet());
-
 
68
            System.out.println("5");
-
 
69
        } catch (Exception e) {
-
 
70
            log.error("Cannot get providers", e);
-
 
71
        }
-
 
72
        return providers;
-
 
73
    }
-
 
74
 
-
 
75
    private void setProviderKeys(Set<Long> keySet) {
-
 
76
        this.providerKeys = keySet;
-
 
77
    }
-
 
78
    
-
 
79
    public Set<Long> getProviderKeys() {
-
 
80
        System.out.println("6");
-
 
81
        return providerKeys;
-
 
82
    }
37
 
83
 
38
    public void setServiceType(String serviceType) {
84
    public void setServiceType(String incomingServiceType) {
39
        this.serviceType = serviceType;
85
        serviceType = incomingServiceType;
40
    }
86
    }
41
 
87
 
42
    public String getServiceType() {
88
    public String getServiceType() {
43
        return serviceType;
89
        return serviceType;
44
    }
90
    }