| Line 77... |
Line 77... |
| 77 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
77 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 78 |
import com.spice.profitmandi.common.util.PdfUtils;
|
78 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 79 |
import com.spice.profitmandi.common.util.Utils;
|
79 |
import com.spice.profitmandi.common.util.Utils;
|
| 80 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
80 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 81 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
81 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| - |
|
82 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| 82 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModelByPassRequest;
|
83 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModelByPassRequest;
|
| - |
|
84 |
import com.spice.profitmandi.dao.entity.catalog.HighDemandItem;
|
| 83 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
85 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 84 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
86 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 85 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
87 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
| 86 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
88 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 87 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
89 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| Line 112... |
Line 114... |
| 112 |
import com.spice.profitmandi.dao.model.Specification;
|
114 |
import com.spice.profitmandi.dao.model.Specification;
|
| 113 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
115 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
| 114 |
import com.spice.profitmandi.dao.model.UserCart;
|
116 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 115 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
117 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 116 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelByPassRepository;
|
118 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelByPassRepository;
|
| - |
|
119 |
import com.spice.profitmandi.dao.repository.catalog.HighDemandItemsRepository;
|
| 117 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
120 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 118 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
121 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 119 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
122 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
| 120 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
123 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 121 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
124 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| Line 259... |
Line 262... |
| 259 |
AuthRepository authRepository;
|
262 |
AuthRepository authRepository;
|
| 260 |
|
263 |
|
| 261 |
@Autowired
|
264 |
@Autowired
|
| 262 |
PositionRepository positionRepository;
|
265 |
PositionRepository positionRepository;
|
| 263 |
|
266 |
|
| - |
|
267 |
@Autowired
|
| - |
|
268 |
HighDemandItemsRepository highDemandItemsRepository;
|
| - |
|
269 |
|
| 264 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
270 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 265 |
public String getCurrentAvailability(HttpServletRequest request,
|
271 |
public String getCurrentAvailability(HttpServletRequest request,
|
| 266 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
272 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 267 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
273 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 268 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
274 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| Line 1837... |
Line 1843... |
| 1837 |
|
1843 |
|
| 1838 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1844 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1839 |
return "response";
|
1845 |
return "response";
|
| 1840 |
}
|
1846 |
}
|
| 1841 |
|
1847 |
|
| - |
|
1848 |
@RequestMapping(value = "/highDemandItem", method = RequestMethod.GET)
|
| - |
|
1849 |
public String highDemandItem(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
1850 |
List<HighDemandItem> hdis = highDemandItemsRepository.selectAll();
|
| - |
|
1851 |
if (!hdis.isEmpty()) {
|
| - |
|
1852 |
Map<Integer, Item> itemMap = this.getItemByCatalogId(hdis);
|
| - |
|
1853 |
model.addAttribute("itemMap", itemMap);
|
| - |
|
1854 |
}
|
| - |
|
1855 |
|
| - |
|
1856 |
model.addAttribute("hdis", hdis);
|
| - |
|
1857 |
|
| - |
|
1858 |
return "high_demand_item";
|
| - |
|
1859 |
}
|
| - |
|
1860 |
|
| - |
|
1861 |
private Map<Integer, Item> getItemByCatalogId(List<HighDemandItem> hdis) {
|
| - |
|
1862 |
Map<Integer, Item> itemMap = new HashMap<>();
|
| - |
|
1863 |
for (HighDemandItem hdi : hdis) {
|
| - |
|
1864 |
List<Item> items = itemRepository.selectAllByCatalogItemId(hdi.getCatalogId());
|
| - |
|
1865 |
itemMap.put(items.get(0).getCatalogItemId(), items.get(0));
|
| - |
|
1866 |
}
|
| - |
|
1867 |
|
| - |
|
1868 |
return itemMap;
|
| - |
|
1869 |
}
|
| - |
|
1870 |
|
| - |
|
1871 |
@RequestMapping(value = "/addHighDemandItem", method = RequestMethod.POST)
|
| - |
|
1872 |
public String addHighDemandItem(HttpServletRequest request, @RequestParam int catalogId, @RequestParam int qty,
|
| - |
|
1873 |
Model model) throws Exception {
|
| - |
|
1874 |
HighDemandItem hdi = highDemandItemsRepository.selectByFofoIdAndCatalogId(catalogId);
|
| - |
|
1875 |
|
| - |
|
1876 |
if (hdi == null) {
|
| - |
|
1877 |
hdi = new HighDemandItem();
|
| - |
|
1878 |
hdi.setCatalogId(catalogId);
|
| - |
|
1879 |
hdi.setQty(qty);
|
| - |
|
1880 |
hdi.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
1881 |
hdi.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
1882 |
highDemandItemsRepository.persist(hdi);
|
| - |
|
1883 |
}
|
| - |
|
1884 |
|
| - |
|
1885 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
1886 |
return "response";
|
| - |
|
1887 |
}
|
| - |
|
1888 |
|
| - |
|
1889 |
@RequestMapping(value = "/removeHighDemandItem", method = RequestMethod.DELETE)
|
| - |
|
1890 |
public String removeHighDemandItem(HttpServletRequest request,
|
| - |
|
1891 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| - |
|
1892 |
highDemandItemsRepository.deleteById(id);
|
| - |
|
1893 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
1894 |
return "response";
|
| - |
|
1895 |
}
|
| - |
|
1896 |
|
| 1842 |
}
|
1897 |
}
|