Subversion Repositories SmartDukaan

Rev

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

Rev 30668 Rev 31238
Line 240... Line 240...
240
			currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
240
			currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
241
			monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
241
			monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
242
			LOGGER.info("monthlyPlanned" + monthlyPlanned);
242
			LOGGER.info("monthlyPlanned" + monthlyPlanned);
243
			saveMonthlyPlanned(monthlyPlanned, fofoId, currentMonthDate, catalogId, itemQty);
243
			saveMonthlyPlanned(monthlyPlanned, fofoId, currentMonthDate, catalogId, itemQty);
244
		}
244
		}
245
		model.addAttribute("response", mvcResponseSender.createResponseString(false));
245
		model.addAttribute("response1", mvcResponseSender.createResponseString(false));
246
		return "response";
246
		return "response";
247
	}
247
	}
248
 
248
 
249
	private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
249
	private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
250
									int catalogId, int itemQty) {
250
									int catalogId, int itemQty) {
Line 300... Line 300...
300
			planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
300
			planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
301
			monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
301
			monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
302
 
302
 
303
			confirmMonthlyPlanned(monthlyPlanned, customRetailer, fofoId);
303
			confirmMonthlyPlanned(monthlyPlanned, customRetailer, fofoId);
304
		}
304
		}
305
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
305
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
306
 
306
 
307
		return "response";
307
		return "response";
308
	}
308
	}
309
 
309
 
310
	private void confirmMonthlyPlanned(MonthlyPlanned monthlyPlanned, CustomRetailer customRetailer, int fofoId)
310
	private void confirmMonthlyPlanned(MonthlyPlanned monthlyPlanned, CustomRetailer customRetailer, int fofoId)
Line 483... Line 483...
483
		JSONArray response = new JSONArray();
483
		JSONArray response = new JSONArray();
484
		itemsColorMap.keySet().stream().forEach(x -> {
484
		itemsColorMap.keySet().stream().forEach(x -> {
485
			response.put(new JSONObject().put("color", itemsColorMap.get(x)).put("id", x).put("active",
485
			response.put(new JSONObject().put("color", itemsColorMap.get(x)).put("id", x).put("active",
486
					tagsMap.get(x) == null ? false : tagsMap.get(x).isActive()));
486
					tagsMap.get(x) == null ? false : tagsMap.get(x).isActive()));
487
		});
487
		});
488
		model.addAttribute("response", response.toString());
488
		model.addAttribute("response1", response.toString());
489
		return "response";
489
		return "response";
490
 
490
 
491
	}
491
	}
492
 
492
 
493
	@RequestMapping(value = "/hotdealsitemsByCatalogId")
493
	@RequestMapping(value = "/hotdealsitemsByCatalogId")
Line 508... Line 508...
508
		JSONArray response = new JSONArray();
508
		JSONArray response = new JSONArray();
509
		itemsColorMap.keySet().stream().forEach(x -> {
509
		itemsColorMap.keySet().stream().forEach(x -> {
510
			response.put(new JSONObject().put("color", itemsColorMap.get(x)).put("id", x).put("hotDeals",
510
			response.put(new JSONObject().put("color", itemsColorMap.get(x)).put("id", x).put("hotDeals",
511
					tagsMap.get(x) == null ? false : tagsMap.get(x).isHotDeals()));
511
					tagsMap.get(x) == null ? false : tagsMap.get(x).isHotDeals()));
512
		});
512
		});
513
		model.addAttribute("response", response.toString());
513
		model.addAttribute("response1", response.toString());
514
		return "response";
514
		return "response";
515
 
515
 
516
	}
516
	}
517
 
517
 
518
	private List<Order> filterValidOrders(List<Order> lastOrdersList) {
518
	private List<Order> filterValidOrders(List<Order> lastOrdersList) {
Line 550... Line 550...
550
				if (!tl.isActive()) {
550
				if (!tl.isActive()) {
551
					saholicCISTableRepository.selectAllByItemId(tl.getItemId()).stream().forEach(x -> saholicCISTableRepository.delete(x));
551
					saholicCISTableRepository.selectAllByItemId(tl.getItemId()).stream().forEach(x -> saholicCISTableRepository.delete(x));
552
				}
552
				}
553
			}
553
			}
554
		}
554
		}
555
		model.addAttribute("response", true);
555
		model.addAttribute("response1", true);
556
		return "response";
556
		return "response";
557
	}
557
	}
558
 
558
 
559
	@RequestMapping(value = "/indent/confirm-hotdeals-pause", method = RequestMethod.POST)
559
	@RequestMapping(value = "/indent/confirm-hotdeals-pause", method = RequestMethod.POST)
560
	public String hotdealUpdate(HttpServletRequest request, Model model, @RequestBody String jsonArrayString)
560
	public String hotdealUpdate(HttpServletRequest request, Model model, @RequestBody String jsonArrayString)
Line 569... Line 569...
569
			} else {
569
			} else {
570
				tl.setHotDeals(obj.getBoolean("hotDeals"));
570
				tl.setHotDeals(obj.getBoolean("hotDeals"));
571
				tagListingRepository.persist(tl);
571
				tagListingRepository.persist(tl);
572
			}
572
			}
573
		}
573
		}
574
		model.addAttribute("response", true);
574
		model.addAttribute("response1", true);
575
		return "response";
575
		return "response";
576
	}
576
	}
577
 
577
 
578
	@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
578
	@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
579
	public String raisePO(HttpServletRequest request, Model model) throws Exception {
579
	public String raisePO(HttpServletRequest request, Model model) throws Exception {
Line 608... Line 608...
608
				e1.printStackTrace();
608
				e1.printStackTrace();
609
				LOGGER.error("Unable to update status of transaction. Thrift Exception:", e1);
609
				LOGGER.error("Unable to update status of transaction. Thrift Exception:", e1);
610
			}
610
			}
611
			resetCart(transactionClient.getTransaction(transactionId));
611
			resetCart(transactionClient.getTransaction(transactionId));
612
		}
612
		}
613
		model.addAttribute("response", mvcResponseSender.createResponseString(success));
613
		model.addAttribute("response1", mvcResponseSender.createResponseString(success));
614
		return "response";
614
		return "response";
615
	}
615
	}
616
 
616
 
617
	private void createPayment(User user, double totalAmount, long transactionId)
617
	private void createPayment(User user, double totalAmount, long transactionId)
618
			throws NumberFormatException, PaymentException, TException {
618
			throws NumberFormatException, PaymentException, TException {
Line 1351... Line 1351...
1351
	@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
1351
	@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
1352
	public String removeFocusedModelItem(HttpServletRequest request,
1352
	public String removeFocusedModelItem(HttpServletRequest request,
1353
										 @RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
1353
										 @RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
1354
 
1354
 
1355
		focusedModelRepository.deleteById(id);
1355
		focusedModelRepository.deleteById(id);
1356
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1356
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1357
		return "response";
1357
		return "response";
1358
	}
1358
	}
1359
 
1359
 
1360
	@RequestMapping(value = "/getPartnerloadContent")
1360
	@RequestMapping(value = "/getPartnerloadContent")
1361
	public String getPartnerloadContent(HttpServletRequest request, Model model,
1361
	public String getPartnerloadContent(HttpServletRequest request, Model model,
Line 1858... Line 1858...
1858
 
1858
 
1859
		FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
1859
		FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
1860
 
1860
 
1861
		fofoStore.setActivationType(activationType);
1861
		fofoStore.setActivationType(activationType);
1862
 
1862
 
1863
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1863
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1864
		return "response";
1864
		return "response";
1865
 
1865
 
1866
	}
1866
	}
1867
 
1867
 
1868
	@RequestMapping(value = "/createPo", method = RequestMethod.POST)
1868
	@RequestMapping(value = "/createPo", method = RequestMethod.POST)
Line 1895... Line 1895...
1895
		sendNotificationModel.setMessageType(MessageType.notification);
1895
		sendNotificationModel.setMessageType(MessageType.notification);
1896
		int userId = userAccountRepository.selectUserIdByRetailerId(monthlyPoModel.getFofoId());
1896
		int userId = userAccountRepository.selectUserIdByRetailerId(monthlyPoModel.getFofoId());
1897
 
1897
 
1898
		sendNotificationModel.setUserIds(Arrays.asList(userId));
1898
		sendNotificationModel.setUserIds(Arrays.asList(userId));
1899
		notificationService.sendNotification(sendNotificationModel);
1899
		notificationService.sendNotification(sendNotificationModel);
1900
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1900
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1901
 
1901
 
1902
		return "response";
1902
		return "response";
1903
	}
1903
	}
1904
 
1904
 
1905
	@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
1905
	@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
Line 2261... Line 2261...
2261
 
2261
 
2262
			List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
2262
			List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
2263
			sendNotificationModel.setUserIds(userIds);
2263
			sendNotificationModel.setUserIds(userIds);
2264
			notificationService.sendNotification(sendNotificationModel);
2264
			notificationService.sendNotification(sendNotificationModel);
2265
		}
2265
		}
2266
		model.addAttribute("response", true);
2266
		model.addAttribute("response1", true);
2267
		return "response";
2267
		return "response";
2268
	}
2268
	}
2269
 
2269
 
2270
}
2270
}
2271
2271