| Line 308... |
Line 308... |
| 308 |
if (scheme.getExpireTimestamp() != null) {
|
308 |
if (scheme.getExpireTimestamp() != null) {
|
| 309 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.EXPIRE_TIMESTAMP, scheme.getExpireTimestamp(),
|
309 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.EXPIRE_TIMESTAMP, scheme.getExpireTimestamp(),
|
| 310 |
"SCHM_1006");
|
310 |
"SCHM_1006");
|
| 311 |
}
|
311 |
}
|
| 312 |
scheme.setActiveTimestamp(LocalDateTime.now());
|
312 |
scheme.setActiveTimestamp(LocalDateTime.now());
|
| 313 |
schemeRepository.persist(scheme);
|
- |
|
| 314 |
this.sendSchemeNotification(scheme);
|
313 |
this.sendSchemeNotification(scheme);
|
| 315 |
|
314 |
|
| 316 |
|
315 |
|
| 317 |
/*
|
316 |
/*
|
| 318 |
* if (scheme.getType() == SchemeType.IN) {
|
317 |
* if (scheme.getType() == SchemeType.IN) {
|
| Line 323... |
Line 322... |
| 323 |
|
322 |
|
| 324 |
private void sendSchemeNotification(Scheme scheme) throws ProfitMandiBusinessException {
|
323 |
private void sendSchemeNotification(Scheme scheme) throws ProfitMandiBusinessException {
|
| 325 |
if (scheme.getType().equals(SchemeType.ACTIVATION)) {
|
324 |
if (scheme.getType().equals(SchemeType.ACTIVATION)) {
|
| 326 |
|
325 |
|
| 327 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
326 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 328 |
List<SchemeItem> schemeItems = schemeItemRepository.selectBySchemeIds(new HashSet<>(scheme.getId()));
|
327 |
List<SchemeItem> schemeItems = schemeItemRepository.selectBySchemeIds(Collections.singleton(scheme.getId()));
|
| 329 |
Set<Integer> itemIds = schemeItems.stream().map(x -> x.getItemId()).collect(Collectors.toSet());
|
328 |
Set<Integer> itemIds = schemeItems.stream().map(x -> x.getItemId()).collect(Collectors.toSet());
|
| 330 |
List<String> itemDescriptions = itemRepository.selectByIds(itemIds).stream().map(x -> x.getItemDescriptionNoColor()).distinct().collect(Collectors.toList());
|
329 |
List<String> itemDescriptions = itemRepository.selectByIds(itemIds).stream().map(x -> x.getItemDescriptionNoColor()).distinct().collect(Collectors.toList());
|
| 331 |
|
330 |
|
| 332 |
|
331 |
|
| 333 |
String title = "Activation scheme of Rs." + FormattingUtils.formatDecimal(scheme.getAmount()) + " for " + String.join(", ", itemDescriptions);
|
332 |
String title = "Activation scheme of Rs." + FormattingUtils.formatDecimal(scheme.getAmount()) + " for " + String.join(", ", itemDescriptions);
|