@RequestMapping("xiao-inventory") public String showInventory(Model model) { super.setModelAttributes(model, "xiao-inventory"); MyAdminUser myAdminUser = (MyAdminUser) securityVerifier.getPersistentAdminUser(); model.addAttribute( "inventorys", inventoryService.readInventoryForFulfillmentLocation(myAdminUser.getFulfillmentLocation())); return SHOW_INVENTORY; }
@ResponseBody @RequestMapping("inventory-warn") protected List<SkuOfInventoryForm> InventoryWarn(HttpServletRequest request) { MyAdminUser myAdminUser = (MyAdminUser) securityVerifier.getPersistentAdminUser(); List<Inventory> inventoryes = inventoryService.readInventoryForLessThanQuantity( inventoryThreshold, myAdminUser.getFulfillmentLocation().getId()); List<SkuOfInventoryForm> skuForms = new ArrayList<SkuOfInventoryForm>(); for (int i = 0; i < inventoryes.size(); i++) { SkuOfInventoryForm skuForm = new SkuOfInventoryForm(); skuForm.setId(inventoryes.get(i).getSku().getId()); skuForm.setName(inventoryes.get(i).getSku().getName()); skuForm.setQuantity(inventoryes.get(i).getQuantityAvailable()); skuForms.add(skuForm); } return skuForms; }