| Line 446... |
Line 446... |
| 446 |
|
446 |
|
| 447 |
// Short-circuit when the caller has no Position rows. getTodayBulletin's
|
447 |
// Short-circuit when the caller has no Position rows. getTodayBulletin's
|
| 448 |
// `positions` parameter is @NotEmpty validated — handing it an empty list
|
448 |
// `positions` parameter is @NotEmpty validated — handing it an empty list
|
| 449 |
// throws "List should not be empty" and 500s the dashboard. A user with
|
449 |
// throws "List should not be empty" and 500s the dashboard. A user with
|
| 450 |
// no positions simply has no bulletins to see, so render an empty page.
|
450 |
// no positions simply has no bulletins to see, so render an empty page.
|
| - |
|
451 |
//
|
| - |
|
452 |
// Bulletin fetch is best-effort: it fans out to several sub-services
|
| - |
|
453 |
// (catalog offers / schemes / web offers / prebooking). If any one of
|
| - |
|
454 |
// them throws, we'd otherwise bubble a 500/400 to the caller. For this
|
| - |
|
455 |
// endpoint we prefer to degrade to an empty list rather than fail the
|
| - |
|
456 |
// page — the frontend renders nothing, which is what the user asked for.
|
| 451 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> dbBulletins =
|
457 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> dbBulletins;
|
| 452 |
(positions == null || positions.isEmpty())
|
458 |
if (positions == null || positions.isEmpty()) {
|
| 453 |
? new HashMap<>()
|
459 |
dbBulletins = new HashMap<>();
|
| - |
|
460 |
} else {
|
| - |
|
461 |
try {
|
| 454 |
: adminUser.getTodayBulletin(positions, selectedDate.atStartOfDay());
|
462 |
dbBulletins = adminUser.getTodayBulletin(positions, selectedDate.atStartOfDay());
|
| - |
|
463 |
} catch (Exception e) {
|
| - |
|
464 |
LOGGER.warn("getTodayBulletin failed for date={} authUserId={}: {}",
|
| - |
|
465 |
date, authUser != null ? authUser.getId() : null, e.getMessage());
|
| - |
|
466 |
dbBulletins = new HashMap<>();
|
| - |
|
467 |
}
|
| - |
|
468 |
}
|
| 455 |
|
469 |
|
| 456 |
// Final ordered map (STRICT enum order)
|
470 |
// Final ordered map (STRICT enum order)
|
| 457 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletins =
|
471 |
Map<ProfitMandiConstants.BULLETIN_TYPE_ENUM, List<BulletinOfferModal>> bulletins =
|
| 458 |
new LinkedHashMap<>();
|
472 |
new LinkedHashMap<>();
|
| 459 |
|
473 |
|