| Line 1127... |
Line 1127... |
| 1127 |
|
1127 |
|
| 1128 |
Map<Integer, FofoStore> fofoStoresMap = fofoStoreRepository.selectActiveStores().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
1128 |
Map<Integer, FofoStore> fofoStoresMap = fofoStoreRepository.selectActiveStores().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 1129 |
|
1129 |
|
| 1130 |
Map<Integer, FofoRBMReportingModel> partnerIdRbmHeadersMap = new HashMap<>();
|
1130 |
Map<Integer, FofoRBMReportingModel> partnerIdRbmHeadersMap = new HashMap<>();
|
| 1131 |
|
1131 |
|
| 1132 |
for (CustomRetailer cr : allCrList) {
|
1132 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 1133 |
FofoStore fofoStore = fofoStoresMap.get(cr.getPartnerId());
|
1133 |
for (Map.Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
| 1134 |
if (fofoStore == null) {
|
- |
|
| - |
|
1134 |
|
| 1135 |
LOGGER.info("Could not find Store {} in active Store", cr.getBusinessName());
|
1135 |
CustomRetailer customRetailer = customRetailerEntry.getValue();
|
| 1136 |
continue;
|
- |
|
| 1137 |
}
|
1136 |
|
| 1138 |
String code = fofoStore.getCode();
|
1137 |
String code = customRetailer.getCode();
|
| 1139 |
// String storeName = "SmartDukaan-" +
|
1138 |
// String storeName = "SmartDukaan-" +
|
| 1140 |
// fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
1139 |
// fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
| 1141 |
String businessName = cr.getBusinessName();
|
1140 |
String businessName = customRetailer.getBusinessName();
|
| 1142 |
try {
|
1141 |
try {
|
| 1143 |
String L2User = StringUtils.join(partnerEmailRbmMap.get(cr.getEmail()).getL2(), ", ");
|
1142 |
String L2User = StringUtils.join(partnerEmailRbmMap.get(customRetailer.getEmail()).getL2(), ", ");
|
| 1144 |
String L1USer = StringUtils.join(partnerEmailRbmMap.get(cr.getEmail()).getL1(), ", ");
|
1143 |
String L1USer = StringUtils.join(partnerEmailRbmMap.get(customRetailer.getEmail()).getL1(), ", ");
|
| 1145 |
|
1144 |
|
| 1146 |
if (StringUtils.isEmpty(L1USer)) {
|
1145 |
if (StringUtils.isEmpty(L1USer)) {
|
| 1147 |
L1USer = StringUtils.join(partnerEmailRbmMap.get(cr.getEmail()).getL2(), ", ");
|
1146 |
L1USer = StringUtils.join(partnerEmailRbmMap.get(customRetailer.getEmail()).getL2(), ", ");
|
| 1148 |
}
|
1147 |
}
|
| 1149 |
|
1148 |
|
| 1150 |
FofoRBMReportingModel reportingModel = new FofoRBMReportingModel();
|
1149 |
FofoRBMReportingModel reportingModel = new FofoRBMReportingModel();
|
| 1151 |
reportingModel.setBusinessName(businessName);
|
1150 |
reportingModel.setBusinessName(businessName);
|
| 1152 |
reportingModel.setCode(code);
|
1151 |
reportingModel.setCode(code);
|
| 1153 |
reportingModel.setFofoId(fofoStore.getId());
|
1152 |
reportingModel.setFofoId(customRetailer.getPartnerId());
|
| 1154 |
reportingModel.setL1Manager(L2User);
|
1153 |
reportingModel.setL1Manager(L2User);
|
| 1155 |
reportingModel.setL2Manager(L1USer);
|
1154 |
reportingModel.setL2Manager(L1USer);
|
| 1156 |
partnerIdRbmHeadersMap.put(fofoStore.getId(), reportingModel);
|
1155 |
partnerIdRbmHeadersMap.put(customRetailer.getPartnerId(), reportingModel);
|
| 1157 |
} catch (Exception e) {
|
1156 |
} catch (Exception e) {
|
| 1158 |
LOGGER.warn("Could not find partner with email - {}", cr.getEmail());
|
1157 |
LOGGER.warn("Could not find partner with email - {}", customRetailer.getEmail());
|
| 1159 |
}
|
1158 |
}
|
| 1160 |
}
|
1159 |
}
|
| 1161 |
return partnerIdRbmHeadersMap;
|
1160 |
return partnerIdRbmHeadersMap;
|
| 1162 |
|
1161 |
|
| 1163 |
}
|
1162 |
}
|