Subversion Repositories SmartDukaan

Rev

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

Rev 28024 Rev 28071
Line 145... Line 145...
145
	public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
145
	public String retailerInfoByEmailIdOrMobileNumber(HttpServletRequest request,
146
			@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
146
			@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER) String emailIdOrMobileNumber,
147
			Model model) throws ProfitMandiBusinessException {
147
			Model model) throws ProfitMandiBusinessException {
148
		LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
148
		LOGGER.info("Request Received at url {} with emailIdOrMobileNumber {}", request.getRequestURI(),
149
				emailIdOrMobileNumber);
149
				emailIdOrMobileNumber);
150
	
150
 
151
				Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
151
		Map<String, Object> map = retailerService.getByEmailIdOrMobileNumber(emailIdOrMobileNumber);
152
		
152
 
153
		model.addAllAttributes(map);
153
		model.addAllAttributes(map);
154
		
-
 
155
	
154
 
156
		model.addAttribute("counterSizes", CounterSize.values());
155
		model.addAttribute("counterSizes", CounterSize.values());
157
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
156
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
158
		LOGGER.info("warehouseMap", warehouseMap);
157
		LOGGER.info("warehouseMap", warehouseMap);
159
		model.addAttribute("warehouses", warehouseMap);
158
		model.addAttribute("warehouses", warehouseMap);
160
		if (map.containsKey("retailer")) {
159
		if (map.containsKey("retailer")) {
Line 172... Line 171...
172
	@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
171
	@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
173
	public String updateRetailerDetails(HttpServletRequest request,
172
	public String updateRetailerDetails(HttpServletRequest request,
174
			@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
173
			@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
175
		LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
174
		LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
176
		Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
175
		Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
177
        
-
 
178
		
176
 
179
		model.addAllAttributes(map);
177
		model.addAllAttributes(map);
180
		model.addAttribute("counterSizes", CounterSize.values());
178
		model.addAttribute("counterSizes", CounterSize.values());
181
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
179
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
182
		LOGGER.info("warehouseMap", warehouseMap);
180
		LOGGER.info("warehouseMap", warehouseMap);
183
		model.addAttribute("warehouses", warehouseMap);
181
		model.addAttribute("warehouses", warehouseMap);
Line 642... Line 640...
642
 
640
 
643
		return "partner-readonly-info";
641
		return "partner-readonly-info";
644
 
642
 
645
	}
643
	}
646
 
644
 
-
 
645
	@RequestMapping(value = "/getBlockBrandMapping")
-
 
646
	public String getBlockBrandMapping(HttpServletRequest request, Model model) throws Exception {
-
 
647
 
-
 
648
		int fofoId = Utils.SYSTEM_PARTNER_ID;
-
 
649
		Set<String> brands = null;
-
 
650
 
-
 
651
		brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name"))
-
 
652
				.collect(Collectors.toSet());
-
 
653
 
-
 
654
		LOGGER.info("brands" + brands);
-
 
655
		model.addAttribute("brands", brands);
-
 
656
 
-
 
657
		return "block-brand-mapping";
-
 
658
 
-
 
659
	}
-
 
660
 
-
 
661
	@RequestMapping(value = "/getBlockBrand")
-
 
662
	public String getBlockBrand(HttpServletRequest request,
-
 
663
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
-
 
664
			throws Exception {
-
 
665
 
-
 
666
		List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
-
 
667
 
-
 
668
		List<Integer> blockBrandPartners = retailerBlockBrands.stream().map(x -> x.getFofoId())
-
 
669
				.collect(Collectors.toList());
-
 
670
		Map<Integer, CustomRetailer> customRetailers = retailerService.getFofoRetailers(true);
-
 
671
		LOGGER.info("retailerBlockBrands" + retailerBlockBrands);
-
 
672
		model.addAttribute("blockBrandPartners", blockBrandPartners);
-
 
673
		model.addAttribute("retailerBlockBrands", retailerBlockBrands);
-
 
674
		model.addAttribute("customRetailers", customRetailers);
-
 
675
 
-
 
676
		return "retailer-block-brand";
-
 
677
 
-
 
678
	}
-
 
679
 
-
 
680
	@RequestMapping(value = "/getRetailerBlockBrandMappping", method = RequestMethod.POST)
-
 
681
	public String getBlockBrandMappping(HttpServletRequest request,
-
 
682
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
683
			@RequestParam(name = "fofoIds", required = true, defaultValue = "0") List<Integer> fofoIds, Model model)
-
 
684
			throws Exception {
-
 
685
		List<RetailerBlockBrands> retailerBlockBrands = retailerBlockBrandsRepository.selectAllByBrands(brand);
-
 
686
		if (!retailerBlockBrands.isEmpty()) {
-
 
687
			retailerBlockBrandsRepository.deleteAllbyBrands(brand);
-
 
688
		}
-
 
689
 
-
 
690
		for (int id : fofoIds) {
-
 
691
			RetailerBlockBrands retailerBlockBrand = new RetailerBlockBrands();
-
 
692
			retailerBlockBrand.setFofoId(id);
-
 
693
			retailerBlockBrand.setBlockBrands(brand);
-
 
694
			retailerBlockBrandsRepository.persist(retailerBlockBrand);
-
 
695
 
-
 
696
		}
-
 
697
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
-
 
698
 
-
 
699
		return "response";
-
 
700
	}
-
 
701
 
647
}
702
}