| Line 69... |
Line 69... |
| 69 |
int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
|
69 |
int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
|
| 70 |
AuthUser authUser = authRepository.selectById(rbmId);
|
70 |
AuthUser authUser = authRepository.selectById(rbmId);
|
| 71 |
String[] emailTo;
|
71 |
String[] emailTo;
|
| 72 |
String[] ccTo;
|
72 |
String[] ccTo;
|
| 73 |
if (authUser == null){
|
73 |
if (authUser == null){
|
| 74 |
emailTo = new String[] { "sdtech@smartdukaan.com", "mohit.gulati@smartdukaan.com", "manish.gupta1@smartdukaan.com" };
|
74 |
emailTo = new String[] { "sdtech@smartdukaan.com", "mohit.gulati@smartdukaan.com", "manish.gupta1@smartdukaan.com", "sourcing@smartdukaan.com" };
|
| 75 |
ccTo = new String[]{};
|
75 |
ccTo = new String[]{};
|
| 76 |
} else {
|
76 |
} else {
|
| 77 |
emailTo = new String[] { user.getEmailId(), "sdtech@smartdukaan.com" };
|
77 |
emailTo = new String[] { user.getEmailId(), "sdtech@smartdukaan.com" };
|
| 78 |
ccTo = new String[]{authUser.getEmailId()};
|
78 |
ccTo = new String[]{authUser.getEmailId()};
|
| 79 |
}
|
79 |
}
|
| Line 97... |
Line 97... |
| 97 |
AuthUser authUser = authRepository.selectById(userId);
|
97 |
AuthUser authUser = authRepository.selectById(userId);
|
| 98 |
String[] emailTo = {authUser.getEmailId(), "sourcing@smartdukaan.com", "sdtech@smartdukaan.com"};
|
98 |
String[] emailTo = {authUser.getEmailId(), "sourcing@smartdukaan.com", "sdtech@smartdukaan.com"};
|
| 99 |
|
99 |
|
| 100 |
String[] ccTo = authService.getAllManagers(userId).stream().map(AuthUser::getEmailId).toArray(String[]::new);
|
100 |
String[] ccTo = authService.getAllManagers(userId).stream().map(AuthUser::getEmailId).toArray(String[]::new);
|
| 101 |
String subject = "Liquidation Report";
|
101 |
String subject = "Liquidation Report";
|
| 102 |
String message = "Dear Team,\n\n"
|
102 |
String message = "Dear Team,<br><br>"
|
| 103 |
+ "Liquidation has been completed. Here is the summary:\n\n"
|
103 |
+ "Liquidation has been completed. Here is the summary:<br><br>"
|
| 104 |
+ content;
|
104 |
+ content;
|
| 105 |
|
105 |
|
| 106 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
106 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
| 107 |
}
|
107 |
}
|
| 108 |
}
|
108 |
}
|
| Line 264... |
Line 264... |
| 264 |
}
|
264 |
}
|
| 265 |
|
265 |
|
| 266 |
return message;
|
266 |
return message;
|
| 267 |
}
|
267 |
}
|
| 268 |
|
268 |
|
| - |
|
269 |
public void sendLiquidationReport(List<Map<String, Object>> liquidations) throws Exception {
|
| - |
|
270 |
Map<Integer, CustomRetailer> retailers = retailerService.getAllFofoRetailers();
|
| - |
|
271 |
StringBuilder sb = new StringBuilder();
|
| - |
|
272 |
sb.append("<h4>Bidding Summary</h3>");
|
| - |
|
273 |
sb.append("<table border='1' cellpadding='5' cellspacing='0' style='border-collapse: collapse;'>");
|
| - |
|
274 |
sb.append("<thead>");
|
| - |
|
275 |
for (Map<String, Object> liquidation : liquidations) {
|
| - |
|
276 |
sb.append("<tr style='background-color: red; color: white;'>")
|
| - |
|
277 |
.append("<th>Liquidation ID</th>")
|
| - |
|
278 |
.append("<th>Item Name</th>")
|
| - |
|
279 |
.append("<th>Bidding Price</th>")
|
| - |
|
280 |
.append("<th>Stock Qty</th>")
|
| - |
|
281 |
.append("<th>End Time</th>")
|
| - |
|
282 |
.append("</tr>");
|
| - |
|
283 |
sb.append("<tr>")
|
| - |
|
284 |
.append("<td>").append(liquidation.get("id")).append("</td>")
|
| - |
|
285 |
.append("<td>").append(liquidation.get("catalog")).append("</td>")
|
| - |
|
286 |
.append("<td>").append(liquidation.get("basePrice")).append("</td>")
|
| - |
|
287 |
.append("<td>").append(liquidation.get("openingStock")).append("/").append(liquidation.get("closingStock")).append("</td>")
|
| - |
|
288 |
.append("<td>").append(liquidation.get("endDate")).append("</td>")
|
| - |
|
289 |
.append("</tr>");
|
| - |
|
290 |
sb.append("<tr style='background-color: black; color: white;'>")
|
| - |
|
291 |
.append("<th>Bidder</th>")
|
| - |
|
292 |
.append("<th>Bid Amount</th>")
|
| - |
|
293 |
.append("<th>Quantity</th>")
|
| - |
|
294 |
.append("<th>Status</th>")
|
| - |
|
295 |
.append("<th>Bid Time</th>")
|
| - |
|
296 |
.append("</tr>");
|
| - |
|
297 |
sb.append("</thead>");
|
| - |
|
298 |
sb.append("<tbody>");
|
| - |
|
299 |
|
| - |
|
300 |
@SuppressWarnings("unchecked")
|
| - |
|
301 |
List<Bid> bids = (List<Bid>) liquidation.get("bids");
|
| - |
|
302 |
if (bids.size() > 0) {
|
| - |
|
303 |
for (Bid bid : bids) {
|
| - |
|
304 |
sb.append("<tr>")
|
| - |
|
305 |
.append("<td>").append(retailers.get(bid.getFofoId()).getDisplayName()).append("</td>")
|
| - |
|
306 |
.append("<td>").append(bid.getBiddingAmount()).append("</td>")
|
| - |
|
307 |
.append("<td>").append(bid.getQuantity()).append("</td>")
|
| - |
|
308 |
.append("<td>").append(bid.getStatus().name()).append("</td>")
|
| - |
|
309 |
.append("<td>").append(StringUtils.toLocalDateTime(String.valueOf(bid.getCreatedAt()))).append("</td>")
|
| - |
|
310 |
.append("</tr>");
|
| - |
|
311 |
}
|
| - |
|
312 |
} else {
|
| - |
|
313 |
sb.append("<tr>").append("<td colspan='5' style='text-align: center;'>No Bids</td>");
|
| - |
|
314 |
}
|
| - |
|
315 |
|
| - |
|
316 |
sb.append("</tbody>");
|
| - |
|
317 |
}
|
| - |
|
318 |
sb.append("</table>");
|
| - |
|
319 |
|
| - |
|
320 |
String[] emailTo = {"sdtech@smartdukaan.com", "sourcing@smartdukaan.com", "tarun.verma@smartdukaan.com"};
|
| - |
|
321 |
|
| - |
|
322 |
String subject = "Liquidation Report";
|
| - |
|
323 |
String message = "Dear Team,<br><br>"
|
| - |
|
324 |
+ "<h3>Liquidation has been completed. Here is the summary:</h3><br><br>"
|
| - |
|
325 |
+ sb.toString();
|
| - |
|
326 |
|
| - |
|
327 |
Utils.sendMailWithAttachments(mailSender, emailTo, null, subject, message);
|
| - |
|
328 |
}
|
| - |
|
329 |
|
| 269 |
}
|
330 |
}
|