| Line 305... |
Line 305... |
| 305 |
public Map<String, Object> getFilter(int warehouseId, String email, LocalDateTime date, LocalDateTime endDate)
|
305 |
public Map<String, Object> getFilter(int warehouseId, String email, LocalDateTime date, LocalDateTime endDate)
|
| 306 |
throws ProfitMandiBusinessException {
|
306 |
throws ProfitMandiBusinessException {
|
| 307 |
Map<String, Object> map = new HashMap<>();
|
307 |
Map<String, Object> map = new HashMap<>();
|
| 308 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
308 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 309 |
Map<Integer, CustomRetailer> crm = null;
|
309 |
Map<Integer, CustomRetailer> crm = null;
|
| 310 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
- |
|
| 311 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
- |
|
| 312 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
310 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 313 |
|
311 |
|
| 314 |
Set<Integer> fofoIds = null;
|
312 |
Set<Integer> fofoIds = csService.getAuthFofoIds(email);
|
| 315 |
fofoIds = storeGuyMap.get(authUser.getEmailId());
|
- |
|
| 316 |
if (emails.contains(authUser.getEmailId())) {
|
- |
|
| 317 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
- |
|
| 318 |
|
- |
|
| 319 |
}
|
- |
|
| 320 |
|
- |
|
| 321 |
if (fofoIds == null) {
|
- |
|
| 322 |
List<Position> positions1 = positionRepository.selectAll(authUser.getId());
|
- |
|
| 323 |
if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
|
- |
|
| 324 |
.count() > 0) {
|
- |
|
| 325 |
fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream().flatMap(x -> x.stream())
|
- |
|
| 326 |
.map(x -> x.getPartnerId()).collect(Collectors.toSet());
|
- |
|
| 327 |
}
|
- |
|
| 328 |
}
|
- |
|
| 329 |
|
313 |
|
| 330 |
if (warehouseId != 0) {
|
314 |
if (warehouseId != 0) {
|
| 331 |
|
315 |
|
| 332 |
fofoIds = fofoStoreRepository.selectPartnerByfofoIdAndWarehouse(new ArrayList<>(fofoIds), warehouseId)
|
316 |
fofoIds = fofoStoreRepository.selectPartnerByfofoIdAndWarehouse(new ArrayList<>(fofoIds), warehouseId)
|
| 333 |
.stream().map(x -> x).collect(Collectors.toSet());
|
317 |
.stream().map(x -> x).collect(Collectors.toSet());
|
| Line 488... |
Line 472... |
| 488 |
long stockValue = 0;
|
472 |
long stockValue = 0;
|
| 489 |
long stockQty = 0;
|
473 |
long stockQty = 0;
|
| 490 |
long pendingIndent = 0;
|
474 |
long pendingIndent = 0;
|
| 491 |
long tertiary = 0;
|
475 |
long tertiary = 0;
|
| 492 |
|
476 |
|
| 493 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
- |
|
| 494 |
|
- |
|
| 495 |
Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
|
477 |
Set<Integer> fofoIds = csService.getAuthFofoIds(email);
|
| 496 |
if (emails.contains(authUser.getEmailId())) {
|
- |
|
| 497 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
- |
|
| 498 |
LOGGER.info("fofoIds" + fofoIds);
|
- |
|
| 499 |
}
|
- |
|
| 500 |
if (fofoIds == null) {
|
- |
|
| 501 |
List<Position> positions1 = positionRepository.selectAll(authUser.getId());
|
- |
|
| 502 |
if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
|
- |
|
| 503 |
.count() > 0) {
|
- |
|
| 504 |
fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream()
|
- |
|
| 505 |
.flatMap(x -> x.stream()).map(x -> x.getPartnerId()).collect(Collectors.toSet());
|
- |
|
| 506 |
}
|
- |
|
| 507 |
}
|
- |
|
| 508 |
|
478 |
|
| 509 |
if (fofoIds != null && fofoIds.size() > 0) {
|
479 |
if (fofoIds != null && fofoIds.size() > 0) {
|
| 510 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
480 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| 511 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
481 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
| 512 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|
482 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|