| Line 727... |
Line 727... |
| 727 |
public void rollOutUpgardedMargins() throws Exception {
|
727 |
public void rollOutUpgardedMargins() throws Exception {
|
| 728 |
LocalDate today = LocalDate.now();
|
728 |
LocalDate today = LocalDate.now();
|
| 729 |
LocalDate yesterday = today.minusDays(1);
|
729 |
LocalDate yesterday = today.minusDays(1);
|
| 730 |
int upgradedCount = 0;
|
730 |
int upgradedCount = 0;
|
| 731 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
731 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
| - |
|
732 |
|
| - |
|
733 |
// Bulk fetch partner types to avoid N+1 queries
|
| - |
|
734 |
List<Integer> fofoIds = stores.stream().map(FofoStore::getId).collect(Collectors.toList());
|
| - |
|
735 |
Map<Integer, PartnerType> yesterdayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, yesterday);
|
| - |
|
736 |
Map<Integer, PartnerType> todayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, today);
|
| - |
|
737 |
|
| 732 |
StringBuilder sb = new StringBuilder();
|
738 |
StringBuilder sb = new StringBuilder();
|
| 733 |
for (FofoStore store : stores) {
|
739 |
for (FofoStore store : stores) {
|
| 734 |
int fofoId = store.getId();
|
740 |
int fofoId = store.getId();
|
| 735 |
|
741 |
|
| 736 |
PartnerType yesterdayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, yesterday);
|
742 |
PartnerType yesterdayPartnerType = yesterdayTypeMap.get(fofoId);
|
| 737 |
PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, today);
|
743 |
PartnerType todayPartnerType = todayTypeMap.get(fofoId);
|
| - |
|
744 |
if (yesterdayPartnerType == null || todayPartnerType == null) {
|
| - |
|
745 |
continue;
|
| - |
|
746 |
}
|
| 738 |
if (!yesterdayPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
|
747 |
if (!yesterdayPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
|
| 739 |
continue;
|
748 |
continue;
|
| 740 |
}
|
749 |
}
|
| 741 |
if (!yesterdayPartnerType.equals(todayPartnerType)) {
|
750 |
if (!yesterdayPartnerType.equals(todayPartnerType)) {
|
| 742 |
upgradedCount++;
|
751 |
upgradedCount++;
|