| Line 194... |
Line 194... |
| 194 |
List<String> retailerBlockBrands = null;
|
194 |
List<String> retailerBlockBrands = null;
|
| 195 |
Set<String> brands = null;
|
195 |
Set<String> brands = null;
|
| 196 |
if (retailer.getId() != fofoId) {
|
196 |
if (retailer.getId() != fofoId) {
|
| 197 |
brands = mongoClient.getMongoBrands(retailer.getId(), null, 3).stream()
|
197 |
brands = mongoClient.getMongoBrands(retailer.getId(), null, 3).stream()
|
| 198 |
.map(x -> (String) x.get("name")).collect(Collectors.toSet());
|
198 |
.map(x -> (String) x.get("name")).collect(Collectors.toSet());
|
| 199 |
retailerBlockBrands = retailerBlockBrandsRepository.selectAllByRetailer(retailer.getId()).stream().map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
199 |
retailerBlockBrands = retailerBlockBrandsRepository.selectAllByRetailer(retailer.getId()).stream()
|
| - |
|
200 |
.map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
| 200 |
|
201 |
|
| 201 |
LOGGER.info("loginDetailsFofoId" + retailer.getId());
|
202 |
LOGGER.info("loginDetailsFofoId" + retailer.getId());
|
| 202 |
} else {
|
203 |
} else {
|
| 203 |
LOGGER.info("fofoId" + fofoId);
|
204 |
LOGGER.info("fofoId" + fofoId);
|
| 204 |
brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
205 |
brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
|
| 205 |
.collect(Collectors.toSet());
|
206 |
.collect(Collectors.toSet());
|
| Line 311... |
Line 312... |
| 311 |
Retailer retailer = (Retailer) map.get("retailer");
|
312 |
Retailer retailer = (Retailer) map.get("retailer");
|
| 312 |
retailer = this.updateRetailer(user, retailer, updateRetailerRequest);
|
313 |
retailer = this.updateRetailer(user, retailer, updateRetailerRequest);
|
| 313 |
|
314 |
|
| 314 |
map.put("retailer", retailer);
|
315 |
map.put("retailer", retailer);
|
| 315 |
|
316 |
|
| 316 |
List<String> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByRetailer(retailer.getId())
|
317 |
List<String> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByRetailer(retailer.getId()).stream()
|
| 317 |
.stream().map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
318 |
.map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
| - |
|
319 |
|
| - |
|
320 |
LOGGER.info("retailerBlockBrands" + retailerBlockBrands);
|
| 318 |
|
321 |
|
| 319 |
LOGGER.info("retailerBlockBrands"+retailerBlockBrands);
|
- |
|
| 320 |
|
- |
|
| 321 |
if (!retailerBlockBrands.isEmpty()) {
|
322 |
if (!retailerBlockBrands.isEmpty()) {
|
| 322 |
retailerBlockBrandsRepository.deleteBrands(retailer.getId());
|
323 |
retailerBlockBrandsRepository.deleteBrands(retailer.getId());
|
| 323 |
}
|
324 |
}
|
| 324 |
|
325 |
|
| 325 |
for (String blockBrand : updateRetailerRequest.getBlocksBrands()) {
|
326 |
for (String blockBrand : updateRetailerRequest.getBlocksBrands()) {
|
| Line 845... |
Line 846... |
| 845 |
String latestStoreCode = fofoStoreRepository.selectLatestStore().getCode();
|
846 |
String latestStoreCode = fofoStoreRepository.selectLatestStore().getCode();
|
| 846 |
int latestCodeCounter = Integer.parseInt(latestStoreCode.replaceAll("[A-Z]", ""));
|
847 |
int latestCodeCounter = Integer.parseInt(latestStoreCode.replaceAll("[A-Z]", ""));
|
| 847 |
String fofoStoreCode = StringUtils.generateFofoStoreSequence(
|
848 |
String fofoStoreCode = StringUtils.generateFofoStoreSequence(
|
| 848 |
districtMaster.getStateShortName() + districtMaster.getShortName(), latestCodeCounter + 1);
|
849 |
districtMaster.getStateShortName() + districtMaster.getShortName(), latestCodeCounter + 1);
|
| 849 |
fofoStore.setCode(fofoStoreCode);
|
850 |
fofoStore.setCode(fofoStoreCode);
|
| - |
|
851 |
fofoStore.setBagsLastCredited(LocalDateTime.now());
|
| 850 |
fofoStoreRepository.persist(fofoStore);
|
852 |
fofoStoreRepository.persist(fofoStore);
|
| 851 |
}
|
853 |
}
|
| 852 |
|
854 |
|
| 853 |
return fofoStore;
|
855 |
return fofoStore;
|
| 854 |
}
|
856 |
}
|