Subversion Repositories SmartDukaan

Rev

Rev 28468 | Rev 28472 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28468 Rev 28471
Line 54... Line 54...
54
import com.spice.profitmandi.common.model.ProfitMandiConstants;
54
import com.spice.profitmandi.common.model.ProfitMandiConstants;
55
import com.spice.profitmandi.common.web.util.ResponseSender;
55
import com.spice.profitmandi.common.web.util.ResponseSender;
56
import com.spice.profitmandi.dao.entity.auth.AuthUser;
56
import com.spice.profitmandi.dao.entity.auth.AuthUser;
57
import com.spice.profitmandi.dao.entity.catalog.Item;
57
import com.spice.profitmandi.dao.entity.catalog.Item;
58
import com.spice.profitmandi.dao.entity.catalog.TagListing;
58
import com.spice.profitmandi.dao.entity.catalog.TagListing;
-
 
59
import com.spice.profitmandi.dao.entity.cs.Position;
59
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
60
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
60
import com.spice.profitmandi.dao.entity.dtr.Document;
61
import com.spice.profitmandi.dao.entity.dtr.Document;
61
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
62
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
62
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
63
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
63
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
64
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
Line 84... Line 85...
84
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
85
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
85
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
86
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
86
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
87
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
87
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
88
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
88
import com.spice.profitmandi.dao.repository.cs.CsService;
89
import com.spice.profitmandi.dao.repository.cs.CsService;
-
 
90
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
89
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
91
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
90
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
92
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
91
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
93
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
92
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
94
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
93
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
95
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
Line 239... Line 241...
239
	@Autowired
241
	@Autowired
240
	private OrderRepository orderRepository;
242
	private OrderRepository orderRepository;
241
 
243
 
242
	@Autowired
244
	@Autowired
243
	private FofoUser fofoUser;
245
	private FofoUser fofoUser;
-
 
246
 
-
 
247
	@Autowired
-
 
248
	private PositionRepository positionRepository;
244
	private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
249
	private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
245
 
250
 
246
	@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
251
	@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
247
	public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
252
	public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
248
		boolean isAdmin = false;
253
		boolean isAdmin = false;
Line 712... Line 717...
712
			@RequestParam List<Integer> warehouseId) throws Exception {
717
			@RequestParam List<Integer> warehouseId) throws Exception {
713
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
718
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
714
		String email = loginDetails.getEmailId();
719
		String email = loginDetails.getEmailId();
715
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
720
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
716
		Set<Integer> authfofoIds = storeGuyMap.get(email);
721
		Set<Integer> authfofoIds = storeGuyMap.get(email);
-
 
722
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
-
 
723
 
-
 
724
		if (authfofoIds == null) {
-
 
725
			List<Position> positions1 = positionRepository.selectAll(authUser.getId());
-
 
726
			if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
-
 
727
					.count() > 0) {
-
 
728
				authfofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream()
-
 
729
						.flatMap(x -> x.stream()).map(x -> x.getPartnerId()).collect(Collectors.toSet());
-
 
730
			}
-
 
731
		}
717
 
732
 
718
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
733
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
719
				.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
734
				.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
720
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
735
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
721
		List<WarehouseWiseBrandStockModel> warehouseWiseBrandStock = new ArrayList<>();
736
		List<WarehouseWiseBrandStockModel> warehouseWiseBrandStock = new ArrayList<>();
Line 1264... Line 1279...
1264
		if (emails.contains(authUser.getEmailId())) {
1279
		if (emails.contains(authUser.getEmailId())) {
1265
			fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
1280
			fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
1266
			LOGGER.info("fofoIds" + fofoIds);
1281
			LOGGER.info("fofoIds" + fofoIds);
1267
		}
1282
		}
1268
 
1283
 
-
 
1284
		if (fofoIds == null) {
-
 
1285
			List<Position> positions1 = positionRepository.selectAll(authUser.getId());
-
 
1286
			if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
-
 
1287
					.count() > 0) {
-
 
1288
				fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream().flatMap(x -> x.stream())
-
 
1289
						.map(x -> x.getPartnerId()).collect(Collectors.toSet());
-
 
1290
			}
-
 
1291
		}
-
 
1292
 
1269
		Map<String, BrandWisePartnerSaleModel> partnersBrandSaleMap = null;
1293
		Map<String, BrandWisePartnerSaleModel> partnersBrandSaleMap = null;
1270
		partnersBrandSaleMap = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale(new ArrayList<>(fofoIds))
1294
		partnersBrandSaleMap = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale(new ArrayList<>(fofoIds))
1271
				.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1295
				.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1272
 
1296
 
1273
		List<BrandWiseUnbilledActivateStockModel> unbilledActivatedStock = fofoStoreRepository
1297
		List<BrandWiseUnbilledActivateStockModel> unbilledActivatedStock = fofoStoreRepository
Line 1309... Line 1333...
1309
		if (emails.contains(authUser.getEmailId())) {
1333
		if (emails.contains(authUser.getEmailId())) {
1310
			fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
1334
			fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
1311
			LOGGER.info("fofoIds" + fofoIds);
1335
			LOGGER.info("fofoIds" + fofoIds);
1312
		}
1336
		}
1313
 
1337
 
-
 
1338
		if (fofoIds == null) {
-
 
1339
			List<Position> positions1 = positionRepository.selectAll(authUser.getId());
-
 
1340
			if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
-
 
1341
					.count() > 0) {
-
 
1342
				fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream().flatMap(x -> x.stream())
-
 
1343
						.map(x -> x.getPartnerId()).collect(Collectors.toSet());
-
 
1344
			}
-
 
1345
		}
-
 
1346
 
1314
		List<BrandWisePartnerSaleModel> accessoriesBrandSales = null;
1347
		List<BrandWisePartnerSaleModel> accessoriesBrandSales = null;
1315
 
1348
 
1316
		accessoriesBrandSales = fofoStoreRepository
1349
		accessoriesBrandSales = fofoStoreRepository
1317
				.selectGroupByBrandAccesoriesWarehousePartnerSale(new ArrayList<>(fofoIds));
1350
				.selectGroupByBrandAccesoriesWarehousePartnerSale(new ArrayList<>(fofoIds));
1318
 
1351