Subversion Repositories SmartDukaan

Rev

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

Rev 24088 Rev 24168
Line 199... Line 199...
199
		}
199
		}
200
		model.addAttribute("response", mvcResponseSender.createResponseString(pm));
200
		model.addAttribute("response", mvcResponseSender.createResponseString(pm));
201
		return "response";
201
		return "response";
202
	}
202
	}
203
 
203
 
-
 
204
	@RequestMapping(value = "/item", method = RequestMethod.GET)
-
 
205
	public String getItemPricing(HttpServletRequest request, Model model, @RequestParam String query) throws Throwable {
-
 
206
		List<ItemDescriptionModel> customItems = itemRepository.selectPartnerItemsBySearchTerm(query, 20).stream()
-
 
207
				.map(x -> {
-
 
208
					ItemDescriptionModel itemDescriptionModel = new ItemDescriptionModel();
-
 
209
					itemDescriptionModel.setItemId(x.getId());
-
 
210
					itemDescriptionModel.setItemDescription(x.getItemDescription() + "(" + x.getId() + ")");
-
 
211
					return itemDescriptionModel;
-
 
212
				}).collect(Collectors.toList());
-
 
213
 
-
 
214
		model.addAttribute("response", mvcResponseSender.createResponseString(customItems));
-
 
215
		return "response";
-
 
216
	}
-
 
217
 
204
	/*
218
	/*
205
	 * @RequestMapping(value = "/price-drop/imes1/download") public
219
	 * @RequestMapping(value = "/price-drop/imes1/download") public
206
	 * ResponseEntity<ByteArrayResource> downloadPriceDropImeis1(HttpServletRequest
220
	 * ResponseEntity<ByteArrayResource> downloadPriceDropImeis1(HttpServletRequest
207
	 * request,
221
	 * request,
208
	 * 
222
	 * 
Line 449... Line 463...
449
 
463
 
450
	@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
464
	@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
451
	public String downloadTotalPriceDropIMEI(HttpServletRequest request,
465
	public String downloadTotalPriceDropIMEI(HttpServletRequest request,
452
			@RequestBody PriceDropImeisModel priceDropImeisModel, Model model)
466
			@RequestBody PriceDropImeisModel priceDropImeisModel, Model model)
453
			throws ProfitMandiBusinessException, Exception {
467
			throws ProfitMandiBusinessException, Exception {
454
		PriceDropImeiStatus status=PriceDropImeiStatus.PENDING;;
468
		PriceDropImeiStatus status = PriceDropImeiStatus.PENDING;
-
 
469
		;
455
 
470
 
456
		switch (priceDropImeisModel.getUpdatedStatus()) {
471
		switch (priceDropImeisModel.getUpdatedStatus()) {
457
		case "pending": {
472
		case "pending": {
458
			status = PriceDropImeiStatus.PENDING;
473
			status = PriceDropImeiStatus.PENDING;
459
			break;
474
			break;
Line 476... Line 491...
476
			if (!priceDropImeisModel.getUpdatedImeis().contains(priceDropIMEI.getImei())
491
			if (!priceDropImeisModel.getUpdatedImeis().contains(priceDropIMEI.getImei())
477
					|| priceDropIMEI.getStatus().equals(PriceDropImeiStatus.APPROVED)
492
					|| priceDropIMEI.getStatus().equals(PriceDropImeiStatus.APPROVED)
478
					|| priceDropIMEI.getStatus().equals(status)) {
493
					|| priceDropIMEI.getStatus().equals(status)) {
479
				continue;
494
				continue;
480
			} else {
495
			} else {
481
				if(status.equals(PriceDropImeiStatus.APPROVED)) {
496
				if (status.equals(PriceDropImeiStatus.APPROVED)) {
482
					priceDropIMEIsToProcess.add(priceDropIMEI);
497
					priceDropIMEIsToProcess.add(priceDropIMEI);
483
				}
498
				}
484
				priceDropIMEI.setStatus(status);
499
				priceDropIMEI.setStatus(status);
485
				priceDropIMEI.setUpdateTimestamp(LocalDateTime.now());
500
				priceDropIMEI.setUpdateTimestamp(LocalDateTime.now());
486
				priceDropIMEIRepository.persist(priceDropIMEI);
501
				priceDropIMEIRepository.persist(priceDropIMEI);
Line 510... Line 525...
510
						"Payout of Rs.{4} per unit for Price Drop of Rs.{0} on {1}, on {3}. Total {2} item(s)",
525
						"Payout of Rs.{4} per unit for Price Drop of Rs.{0} on {1}, on {3}. Total {2} item(s)",
511
						priceDrop.getAmount(), description, fofoInventoryList.size(),
526
						priceDrop.getAmount(), description, fofoInventoryList.size(),
512
						FormattingUtils.formatDate(priceDrop.getAffectedOn()), priceDrop.getPartnerPayout());
527
						FormattingUtils.formatDate(priceDrop.getAffectedOn()), priceDrop.getPartnerPayout());
513
				inventoryService.updatePriceDrop(fofoInventoryList, priceDrop.getAmount());
528
				inventoryService.updatePriceDrop(fofoInventoryList, priceDrop.getAmount());
514
				if (item.getBrand().equals("Samsung")) {
529
				if (item.getBrand().equals("Samsung")) {
515
					schemeService.reverseSchemes(fofoInventoryList, priceDrop.getId(),
530
					schemeService.reverseSchemes(fofoInventoryList, priceDrop.getId(), reversalReason);
516
							reversalReason);
-
 
517
				}
531
				}
518
				walletService.addAmountToWallet(fofoId, priceDrop.getId(), WalletReferenceType.PRICE_DROP, aReason,
532
				walletService.addAmountToWallet(fofoId, priceDrop.getId(), WalletReferenceType.PRICE_DROP, aReason,
519
						priceDrop.getPartnerPayout() * fofoInventoryList.size());
533
						priceDrop.getPartnerPayout() * fofoInventoryList.size());
520
			}
534
			}
521
 
535
 
522
		}
536
		}
523
		
-
 
524
		
537
 
525
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
538
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
526
		return "response";
539
		return "response";
527
 
540
 
528
	}
541
	}
529
 
542