| Line 1... |
Line 1... |
| 1 |
package in.shop2020.support.controllers;
|
1 |
package in.shop2020.support.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.order.LineItem;
|
3 |
import in.shop2020.model.v1.order.LineItem;
|
| 4 |
import in.shop2020.model.v1.order.Order;
|
4 |
import in.shop2020.model.v1.order.Order;
|
| - |
|
5 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 5 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
6 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 6 |
import in.shop2020.model.v1.user.Affiliate;
|
7 |
import in.shop2020.model.v1.user.Affiliate;
|
| 7 |
import in.shop2020.model.v1.user.MasterAffiliate;
|
8 |
import in.shop2020.model.v1.user.MasterAffiliate;
|
| 8 |
import in.shop2020.model.v1.user.TrackLog;
|
9 |
import in.shop2020.model.v1.user.TrackLog;
|
| 9 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
10 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| Line 84... |
Line 85... |
| 84 |
PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
|
85 |
PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
|
| 85 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
86 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
| 86 |
|
87 |
|
| 87 |
Client userClient = userContextServiceClient.getClient();
|
88 |
Client userClient = userContextServiceClient.getClient();
|
| 88 |
in.shop2020.payments.PaymentService.Client paymentClient = paymentServiceClient.getClient();
|
89 |
in.shop2020.payments.PaymentService.Client paymentClient = paymentServiceClient.getClient();
|
| 89 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
- |
|
| 90 |
|
90 |
|
| 91 |
Set<Long> Payments = new HashSet<Long>();
|
91 |
Set<Long> Payments = new HashSet<Long>();
|
| 92 |
List<Map<String, String>> contentRows = new LinkedList<Map<String,String>>();
|
92 |
List<Map<String, String>> contentRows = new LinkedList<Map<String,String>>();
|
| 93 |
List<Affiliate> affiliates;
|
93 |
List<Affiliate> affiliates;
|
| 94 |
if (mAfId == -1) {
|
94 |
if (mAfId == -1) {
|
| Line 96... |
Line 96... |
| 96 |
for(MasterAffiliate mAffiliate : userClient.getAllMasterAffiliates()) {
|
96 |
for(MasterAffiliate mAffiliate : userClient.getAllMasterAffiliates()) {
|
| 97 |
affiliates.addAll(userClient.getAffiliatesByMasterAffiliate(mAffiliate.getId()));
|
97 |
affiliates.addAll(userClient.getAffiliatesByMasterAffiliate(mAffiliate.getId()));
|
| 98 |
}
|
98 |
}
|
| 99 |
}
|
99 |
}
|
| 100 |
else {
|
100 |
else {
|
| 101 |
MasterAffiliate mAffiliate = userClient.getMasterAffiliateById(mAfId);
|
- |
|
| 102 |
affiliates = userClient.getAffiliatesByMasterAffiliate(mAfId);
|
101 |
affiliates = userClient.getAffiliatesByMasterAffiliate(mAfId);
|
| 103 |
}
|
102 |
}
|
| - |
|
103 |
|
| 104 |
for (Affiliate aff : affiliates) {
|
104 |
for (Affiliate aff : affiliates) {
|
| 105 |
MasterAffiliate mAffiliate = userClient.getMasterAffiliateById(aff.getMasterAffiliateId());
|
105 |
MasterAffiliate mAffiliate = userClient.getMasterAffiliateById(aff.getMasterAffiliateId());
|
| 106 |
for (TrackLog tracklog : userClient.getTrackLogsByAffiliate(aff.getId())) {
|
106 |
for (TrackLog tracklog : userClient.getTrackLogsByAffiliate(aff.getId())) {
|
| - |
|
107 |
boolean orderCompleted = false;
|
| 107 |
Map<String, String> contentRow = new HashMap<String, String>();
|
108 |
Map<String, String> contentRow = new HashMap<String, String>();
|
| 108 |
contentRow.put("mAffiliate", mAffiliate.getName());
|
109 |
contentRow.put("mAffiliate", mAffiliate.getName());
|
| 109 |
contentRow.put("affiliate", aff.getName());
|
110 |
contentRow.put("affiliate", aff.getName());
|
| 110 |
contentRow.put("affiliateUrl", aff.getUrl());
|
111 |
contentRow.put("affiliateUrl", aff.getUrl());
|
| 111 |
contentRow.put("date",String.valueOf(tracklog.getAddedOn()));
|
112 |
contentRow.put("date",String.valueOf(tracklog.getAddedOn()));
|
| Line 126... |
Line 127... |
| 126 |
payment.getUserId());
|
127 |
payment.getUserId());
|
| 127 |
contentRow.put("amount",
|
128 |
contentRow.put("amount",
|
| 128 |
Double.toString(payment.getAmount()));
|
129 |
Double.toString(payment.getAmount()));
|
| 129 |
String itemString = "";
|
130 |
String itemString = "";
|
| 130 |
for (Order order : orders) {
|
131 |
for (Order order : orders) {
|
| - |
|
132 |
if (order.getStatus() == OrderStatus.DELIVERY_SUCCESS) {
|
| - |
|
133 |
orderCompleted = true;
|
| - |
|
134 |
}
|
| 131 |
List<LineItem> items = order.getLineitems();
|
135 |
List<LineItem> items = order.getLineitems();
|
| 132 |
for (LineItem item : items) {
|
136 |
for (LineItem item : items) {
|
| 133 |
itemString += item.getBrand() + " "
|
137 |
itemString += item.getBrand() + " "
|
| 134 |
+ item.getModel_name() + " "
|
138 |
+ item.getModel_name() + " "
|
| 135 |
+ item.getModel_number() + "("
|
139 |
+ item.getModel_number() + "("
|
| Line 141... |
Line 145... |
| 141 |
} catch (Exception e) {
|
145 |
} catch (Exception e) {
|
| 142 |
e.printStackTrace();
|
146 |
e.printStackTrace();
|
| 143 |
}
|
147 |
}
|
| 144 |
}
|
148 |
}
|
| 145 |
contentRow.put("data", tracklog.getData());
|
149 |
contentRow.put("data", tracklog.getData());
|
| - |
|
150 |
if (orderCompleted) {
|
| 146 |
contentRows.add(contentRow);
|
151 |
contentRows.add(contentRow);
|
| - |
|
152 |
}
|
| 147 |
}
|
153 |
}
|
| 148 |
}
|
154 |
}
|
| 149 |
|
155 |
|
| 150 |
// Preparing XLS file for output
|
156 |
// Preparing XLS file for output
|
| 151 |
response.setContentType("application/vnd.ms-excel");
|
157 |
response.setContentType("application/vnd.ms-excel");
|