Subversion Repositories SmartDukaan

Rev

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

Rev 29646 Rev 29654
Line 141... Line 141...
141
 
141
 
142
	@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
142
	@RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
143
	public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
143
	public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
144
		List<PriceDrop> priceDrops = priceDropRepository.selectAllIncomplete();
144
		List<PriceDrop> priceDrops = priceDropRepository.selectAllIncomplete();
145
		Set<Integer> catalogIds = priceDrops.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
145
		Set<Integer> catalogIds = priceDrops.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
146
		
146
 
147
		List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
147
		List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
148
		Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
148
		Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
149
				x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
149
				x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
150
		model.addAttribute("priceDrops", priceDrops);
150
		model.addAttribute("priceDrops", priceDrops);
151
		model.addAttribute("catalogDescription", catalogDescription);
151
		model.addAttribute("catalogDescription", catalogDescription);
Line 452... Line 452...
452
		List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository
452
		List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository
453
				.selectByPriceDropId(priceDropImeisModel.getPriceDropId());
453
				.selectByPriceDropId(priceDropImeisModel.getPriceDropId());
454
 
454
 
455
		List<PriceDropIMEI> priceDropIMEIsToProcess = priceDropIMEIs.stream()
455
		List<PriceDropIMEI> priceDropIMEIsToProcess = priceDropIMEIs.stream()
456
				.filter(x -> priceDropImeisModel.getUpdatedImeis().contains(x.getImei()))
456
				.filter(x -> priceDropImeisModel.getUpdatedImeis().contains(x.getImei()))
457
				.filter(x -> !x.getStatus().equals(finalStatus))
457
				.filter(x -> !x.getStatus().equals(finalStatus)).collect(Collectors.toList());
458
				.collect(Collectors.toList());
-
 
459
 
458
 
460
		for (PriceDropIMEI priceDropIMEI : priceDropIMEIsToProcess) {
459
		for (PriceDropIMEI priceDropIMEI : priceDropIMEIsToProcess) {
461
			priceDropIMEI.setUpdateTimestamp(LocalDateTime.now());
460
			priceDropIMEI.setUpdateTimestamp(LocalDateTime.now());
462
		}
461
		}
463
 
462
 
Line 623... Line 622...
623
				Arrays.asList(brand), LocalDateTime.now(),
622
				Arrays.asList(brand), LocalDateTime.now(),
624
				LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
623
				LocalDateTime.now().plusDays(1).toLocalDate().atStartOfDay());
625
 
624
 
626
		for (PriceCircularModel pc : priceCircular) {
625
		for (PriceCircularModel pc : priceCircular) {
627
 
626
 
628
			Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getTertiaryPayout()
627
			Long totalScheme = pc.getBasePayout() + pc.getCashDiscount() + pc.getUpfrontMargin()
629
					+ pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout() + pc.getModelSpecfic();
628
					+ pc.getTertiaryPayout() + pc.getHygienePayout() + pc.getCategoryPayout() + pc.getInvestmentPayout()
-
 
629
					+ pc.getModelSpecfic();
630
			pc.setTotalScheme(totalScheme);
630
			pc.setTotalScheme(totalScheme);
631
			long netprice = pc.getSellingPrice() - pc.getTotalScheme();
631
			long netprice = pc.getSellingPrice() - pc.getTotalScheme();
632
			pc.setNetPrice(netprice);
632
			pc.setNetPrice(netprice);
633
			int mopdpdiff = pc.getMop() - pc.getSellingPrice();
633
			int mopdpdiff = pc.getMop() - pc.getSellingPrice();
634
			pc.setMopdp(mopdpdiff);
634
			pc.setMopdp(mopdpdiff);