| 1866 |
vikas |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import java.util.Date;
|
|
|
4 |
|
|
|
5 |
import in.shop2020.serving.controllers.BaseController;
|
|
|
6 |
import in.shop2020.serving.interceptors.TrackingInterceptor;
|
|
|
7 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
|
|
8 |
|
|
|
9 |
import org.apache.log4j.Logger;
|
|
|
10 |
|
|
|
11 |
public class TrackingController extends BaseController{
|
|
|
12 |
|
|
|
13 |
private static final long serialVersionUID = 1L;
|
|
|
14 |
private static Logger log = Logger.getLogger(TrackingController.class);
|
|
|
15 |
private String event = null;
|
|
|
16 |
private String url = null;
|
|
|
17 |
private String data = null;
|
|
|
18 |
|
|
|
19 |
public TrackingController(){
|
|
|
20 |
super();
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public void create() {
|
|
|
24 |
try {
|
|
|
25 |
UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
|
|
|
26 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient
|
|
|
27 |
.getClient();
|
|
|
28 |
|
| 1999 |
vikas |
29 |
long affId = Long.parseLong(cookiesMap.get(
|
|
|
30 |
TrackingInterceptor.AFF_COOKIE).getValue());
|
| 1868 |
vikas |
31 |
long userId = 0;
|
|
|
32 |
if (userinfo != null) {
|
|
|
33 |
userId = userinfo.getUserId();
|
|
|
34 |
}
|
| 1999 |
vikas |
35 |
userClient.addTrackLog(affId, userId, event, url,
|
| 1866 |
vikas |
36 |
data, (new Date()).getTime());
|
|
|
37 |
} catch (Exception e) {
|
|
|
38 |
log.error(e);
|
|
|
39 |
}
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public void setEvent(String event) {
|
|
|
43 |
this.event = event;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
public void setUrl(String url) {
|
|
|
47 |
this.url = url;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
public void setData(String data) {
|
|
|
51 |
this.data = data;
|
|
|
52 |
}
|
| 1999 |
vikas |
53 |
}
|