| Line 3283... |
Line 3283... |
| 3283 |
sb.append("</tbody></table></body></html>");
|
3283 |
sb.append("</tbody></table></body></html>");
|
| 3284 |
|
3284 |
|
| 3285 |
return sb.toString();
|
3285 |
return sb.toString();
|
| 3286 |
}
|
3286 |
}
|
| 3287 |
|
3287 |
|
| 3288 |
private String getMessageForUnauthorizedBuying(List<NonSdBuying> nsb) throws
|
- |
|
| 3289 |
ProfitMandiBusinessException {
|
- |
|
| 3290 |
StringBuilder sb = new StringBuilder();
|
- |
|
| 3291 |
sb.append("<html><body><p>Alert</p><p>Unauthorized Buying-</p>" + "<br/>" +
|
- |
|
| 3292 |
"<table style='border:1px solid black ;padding: 5px';>");
|
- |
|
| 3293 |
sb.append("<tbody>" +
|
- |
|
| 3294 |
"<tr>" +
|
- |
|
| 3295 |
"<th style='border:1px solid black;padding: 5px'>PartnerName</th>" +
|
- |
|
| 3296 |
"<th style='border:1px solid black;padding: 5px'>Brand Name</th>" +
|
- |
|
| 3297 |
"<th style='border:1px solid black;padding: 5px'>Brand Value</th>" +
|
- |
|
| 3298 |
"<th style='border:1px solid black;padding: 5px'>Created At</th>" +
|
- |
|
| 3299 |
"<th style='border:1px solid black;padding: 5px'>Reason</th>" +
|
- |
|
| 3300 |
"</tr>");
|
- |
|
| 3301 |
for (NonSdBuying entry : nsb) {
|
- |
|
| 3302 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(entry.getFofoId());
|
- |
|
| 3303 |
List<Integer> brandIds = Collections.singletonList(entry.getBrandId());
|
- |
|
| 3304 |
BrandCatalog brandsDisplay = brandsRepository.selectByIds(brandIds).get(0);
|
- |
|
| 3305 |
sb.append("<tr>");
|
- |
|
| 3306 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + customRetailer.getBusinessName() + "(" + customRetailer.getCode() + ")" + "</td>");
|
- |
|
| 3307 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + brandsDisplay.getName() + "</td>");
|
- |
|
| 3308 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + entry.getBrandValue() + "</td>");
|
- |
|
| 3309 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + entry.getCreateTimestamp().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + "</td>");
|
- |
|
| 3310 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + entry.getReason() + "</td>");
|
- |
|
| 3311 |
sb.append("</tr>");
|
- |
|
| 3312 |
}
|
- |
|
| 3313 |
|
- |
|
| 3314 |
sb.append("</tbody></table></body></html>");
|
- |
|
| 3315 |
|
- |
|
| 3316 |
return sb.toString();
|
- |
|
| 3317 |
}
|
- |
|
| 3318 |
|
- |
|
| 3319 |
public void reverseWallet() throws Exception {
|
3288 |
public void reverseWallet() throws Exception {
|
| 3320 |
LocalDate localDate = LocalDate.of(2020, 10, 28);
|
3289 |
LocalDate localDate = LocalDate.of(2020, 10, 28);
|
| 3321 |
List<UserWalletHistory> uwhList = userWalletHistoryRepository.selectAllByDateType(localDate.atStartOfDay(), localDate.plusDays(1).atStartOfDay(), Arrays.asList(WalletReferenceType.SCHEME_IN, WalletReferenceType.SCHEME_OUT));
|
3290 |
List<UserWalletHistory> uwhList = userWalletHistoryRepository.selectAllByDateType(localDate.atStartOfDay(), localDate.plusDays(1).atStartOfDay(), Arrays.asList(WalletReferenceType.SCHEME_IN, WalletReferenceType.SCHEME_OUT));
|
| 3322 |
for (UserWalletHistory uwh : uwhList) {
|
3291 |
for (UserWalletHistory uwh : uwhList) {
|
| 3323 |
if (uwh.getBusinessTimestamp().getMonth().equals(Month.SEPTEMBER)) {
|
3292 |
if (uwh.getBusinessTimestamp().getMonth().equals(Month.SEPTEMBER)) {
|
| Line 3694... |
Line 3663... |
| 3694 |
}
|
3663 |
}
|
| 3695 |
|
3664 |
|
| 3696 |
@Autowired
|
3665 |
@Autowired
|
| 3697 |
private NonSdBuyingRepository nonSdBuyingRepository;
|
3666 |
private NonSdBuyingRepository nonSdBuyingRepository;
|
| 3698 |
|
3667 |
|
| 3699 |
//Non Sd Buying
|
- |
|
| 3700 |
public void reviewNonSdBuyingBrand() throws
|
- |
|
| 3701 |
ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
- |
|
| 3702 |
List<NonSdBuying> nonSdByuingActiveList = nonSdBuyingRepository.selectAllActiveNonSDBuyingList(true);
|
- |
|
| 3703 |
Map<Integer, NonSdBuying> unAuthorizedBuyingMap = nonSdByuingActiveList.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
- |
|
| 3704 |
|
- |
|
| 3705 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
- |
|
| 3706 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM), true).entrySet()) {
|
- |
|
| 3707 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
- |
|
| 3708 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
- |
|
| 3709 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
- |
|
| 3710 |
String subject = "Unauthorized Buying";
|
- |
|
| 3711 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
- |
|
| 3712 |
|
- |
|
| 3713 |
MimeMessage message = gmailRelaySender.createMimeMessage();
|
- |
|
| 3714 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
- |
|
| 3715 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
- |
|
| 3716 |
|
- |
|
| 3717 |
helper.setSubject(subject);
|
- |
|
| 3718 |
helper.setText(messageText, true);
|
- |
|
| 3719 |
helper.setTo(email);
|
- |
|
| 3720 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
- |
|
| 3721 |
helper.setFrom(senderAddress);
|
- |
|
| 3722 |
gmailRelaySender.send(message);
|
- |
|
| 3723 |
LOGGER.info("unAuthorizedfilteredRows {}", unAuthorizedfilteredRows);
|
- |
|
| 3724 |
}
|
- |
|
| 3725 |
|
- |
|
| 3726 |
}
|
- |
|
| 3727 |
|
- |
|
| 3728 |
}
|
- |
|
| 3729 |
}
|
- |
|
| 3730 |
|
- |
|
| 3731 |
@Autowired
|
3668 |
@Autowired
|
| 3732 |
private LoanRepository loanRepository;
|
3669 |
private LoanRepository loanRepository;
|
| 3733 |
|
3670 |
|
| 3734 |
@Autowired
|
3671 |
@Autowired
|
| 3735 |
private LoanStatementRepository loanStatementRepository;
|
3672 |
private LoanStatementRepository loanStatementRepository;
|