Subversion Repositories SmartDukaan

Rev

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

Rev 2141 Rev 2157
Line 20... Line 20...
20
import in.shop2020.serving.utils.DataLogger.Event;
20
import in.shop2020.serving.utils.DataLogger.Event;
21
import in.shop2020.thrift.clients.CatalogServiceClient;
21
import in.shop2020.thrift.clients.CatalogServiceClient;
22
import in.shop2020.thrift.clients.UserContextServiceClient;
22
import in.shop2020.thrift.clients.UserContextServiceClient;
23
 
23
 
24
 
24
 
25
import org.apache.commons.lang.StringUtils;
-
 
26
import org.apache.log4j.Logger;
25
import org.apache.log4j.Logger;
27
import org.apache.struts2.convention.annotation.InterceptorRef;
26
import org.apache.struts2.convention.annotation.InterceptorRef;
28
import org.apache.struts2.convention.annotation.InterceptorRefs;
27
import org.apache.struts2.convention.annotation.InterceptorRefs;
29
import org.apache.struts2.convention.annotation.Result;
28
import org.apache.struts2.convention.annotation.Result;
30
import org.apache.struts2.convention.annotation.Results;
29
import org.apache.struts2.convention.annotation.Results;
Line 41... Line 40...
41
})
40
})
42
public class ShippingController extends BaseController{
41
public class ShippingController extends BaseController{
43
	
42
	
44
	private static final long serialVersionUID = 1L;
43
	private static final long serialVersionUID = 1L;
45
	private static Logger log = Logger.getLogger(Class.class);
44
	private static Logger log = Logger.getLogger(Class.class);
46
	private static Logger dataLog = DataLogger.getLogger();
-
 
47
	
45
	
48
	private long addressId = 0;
46
	private long addressId = 0;
49
	private String errorMsg = "";
47
	private String errorMsg = "";
50
	
48
	
51
	private String name;
49
	private String name;
Line 90... Line 88...
90
		if(actionErrors != null && !actionErrors.isEmpty()){
88
		if(actionErrors != null && !actionErrors.isEmpty()){
91
			for (String str : actionErrors) {
89
			for (String str : actionErrors) {
92
			    errorMsg += "<BR/>" + str;
90
			    errorMsg += "<BR/>" + str;
93
			}
91
			}
94
		}
92
		}
95
		dataLog.info(StringUtils.join(
-
 
96
                new String[] { Event.SHIPPINIG_ACCESS.name(),
93
        DataLogger.logData(Event.SHIPPINIG_ACCESS.name(), Long.toString(userinfo.getUserId()), userinfo.getEmail(),
97
                        userinfo.getEmail(),
-
 
98
                        Long.toString(cartId) }, ", "));
94
                Long.toString(cartId));
99
		
95
		
100
    	return "index";
96
    	return "index";
101
	 }
97
	 }
102
 
98
 
103
	// POST /entity
99
	// POST /entity
Line 150... Line 146...
150
						address.setEnabled(true);
146
						address.setEnabled(true);
151
						address.setType(AddressType.HOME);
147
						address.setType(AddressType.HOME);
152
						long addressId = userClient.addAddressForUser(userinfo.getUserId(), address, false);
148
						long addressId = userClient.addAddressForUser(userinfo.getUserId(), address, false);
153
						userClient.addAddressToCart(userinfo.getCartId(), addressId);
149
						userClient.addAddressToCart(userinfo.getCartId(), addressId);
154
						addActionMessage("Address added successfully.");
150
						addActionMessage("Address added successfully.");
155
                        dataLog.info(StringUtils.join(
-
 
156
                                new String[] {
-
 
157
                                        Event.SHIPPINIG_ADD_ADDRESS.name(),
-
 
158
                                        userinfo.getEmail(), address.getName(),
151
                        DataLogger.logData(Event.SHIPPINIG_ADD_ADDRESS.name(), Long.toString(userinfo.getUserId()), userinfo.getEmail(), address.getName(),
159
                                        address.getCity(), address.getPhone(),
152
                                        address.getCity(), address.getPhone(), address.getPin());
160
                                        address.getPin() }, ", "));
-
 
161
					}
153
					}
162
					return "redirect";				
154
					return "redirect";				
163
				}
155
				}
164
				
156
				
165
				if(action.equals("change"))	{
157
				if(action.equals("change"))	{
166
					addressId = Long.parseLong(this.request.getParameter("addressid"));
158
					addressId = Long.parseLong(this.request.getParameter("addressid"));
167
					userClient.addAddressToCart(userinfo.getCartId(), addressId);
159
					userClient.addAddressToCart(userinfo.getCartId(), addressId);
168
					
160
					
169
					errorMsg = userClient.validateCart(userinfo.getCartId());
161
					errorMsg = userClient.validateCart(userinfo.getCartId());
170
                    dataLog.info(StringUtils.join(
-
 
171
                            new String[] { Event.SHIPPINIG_ADD_CHANGE.name(),
162
                    DataLogger.logData(Event.SHIPPINIG_ADD_CHANGE.name(), Long.toString(userinfo.getUserId()), userinfo.getEmail(),
172
                                    userinfo.getEmail(),
-
 
173
                                    Long.toString(userinfo.getCartId()),
163
                            Long.toString(userinfo.getCartId()), Long.toString(addressId));
174
                                    Long.toString(addressId) }, ", "));
-
 
175
					return "index";
164
					return "index";
176
				}
165
				}
177
			}
166
			}
178
		} catch (Exception e) {
167
		} catch (Exception e) {
179
			return "failure";
168
			return "failure";