| Line 278... |
Line 278... |
| 278 |
|
278 |
|
| 279 |
}
|
279 |
}
|
| 280 |
|
280 |
|
| 281 |
@RequestMapping(value = "/itemsByCatalogId")
|
281 |
@RequestMapping(value = "/itemsByCatalogId")
|
| 282 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
282 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| - |
|
283 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| - |
|
284 |
throws ProfitMandiBusinessException
|
| - |
|
285 |
{
|
| 283 |
@RequestParam int catalogId) {
|
286 |
if (catalogId == 0) {
|
| - |
|
287 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| - |
|
288 |
}
|
| 284 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
289 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| 285 |
Map<Integer, String> itemsColorMap = items.stream().collect(Collectors.toMap(Item::getId, Item::getColor));
|
290 |
Map<Integer, String> itemsColorMap = items.stream().collect(Collectors.toMap(Item::getId, Item::getColor));
|
| - |
|
291 |
List<TagListing> tags = tagListingRepository
|
| 286 |
List<TagListing> tags = tagListingRepository.selectByItemIdsAndTagIds(items.stream().map(x->x.getId()).collect(Collectors.toSet()), defaultTags);
|
292 |
.selectByItemIdsAndTagIds(items.stream().map(x -> x.getId()).collect(Collectors.toSet()), defaultTags);
|
| 287 |
JSONArray response = new JSONArray();
|
293 |
JSONArray response = new JSONArray();
|
| 288 |
tags.stream().forEach(x->
|
294 |
tags.stream().forEach(x -> {
|
| 289 |
{
|
- |
|
| 290 |
response.put(new JSONObject()
|
- |
|
| 291 |
.put("color", itemsColorMap.get(x.getItemId()))
|
295 |
response.put(new JSONObject().put("color", itemsColorMap.get(x.getItemId())).put("id", x.getItemId())
|
| 292 |
.put("id", x.getItemId())
|
- |
|
| 293 |
.put("active", x.isActive()));
|
296 |
.put("active", x.isActive()));
|
| 294 |
});
|
297 |
});
|
| 295 |
model.addAttribute("response", response.toString());
|
298 |
model.addAttribute("response", response.toString());
|
| 296 |
return "response";
|
299 |
return "response";
|
| 297 |
|
300 |
|
| 298 |
}
|
301 |
}
|
| 299 |
|
302 |
|
| 300 |
@RequestMapping(value = "/indent/loadIndent")
|
303 |
@RequestMapping(value = "/indent/loadIndent")
|
| 301 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
304 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
| 302 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
305 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| Line 486... |
Line 489... |
| 486 |
}
|
489 |
}
|
| 487 |
return lastOrdersList;
|
490 |
return lastOrdersList;
|
| 488 |
}
|
491 |
}
|
| 489 |
|
492 |
|
| 490 |
@RequestMapping(value = "/indent/confirm-pause", method = RequestMethod.POST)
|
493 |
@RequestMapping(value = "/indent/confirm-pause", method = RequestMethod.POST)
|
| 491 |
public String raisePO(HttpServletRequest request, Model model, @RequestBody String jsonArrayString) throws Exception {
|
494 |
public String raisePO(HttpServletRequest request, Model model, @RequestBody String jsonArrayString)
|
| - |
|
495 |
throws Exception {
|
| 492 |
JSONArray jsonArray = new JSONArray(jsonArrayString);
|
496 |
JSONArray jsonArray = new JSONArray(jsonArrayString);
|
| 493 |
for(int i=0;i<jsonArray.length();i++) {
|
497 |
for (int i = 0; i < jsonArray.length(); i++) {
|
| 494 |
JSONObject obj = jsonArray.getJSONObject(i);
|
498 |
JSONObject obj = jsonArray.getJSONObject(i);
|
| 495 |
TagListing tl = tagListingRepository.selectByItemId(obj.getInt("id"));
|
499 |
TagListing tl = tagListingRepository.selectByItemId(obj.getInt("id"));
|
| 496 |
tl.setActive(obj.getBoolean("active"));
|
500 |
tl.setActive(obj.getBoolean("active"));
|
| 497 |
tagListingRepository.persist(tl);
|
501 |
tagListingRepository.persist(tl);
|
| 498 |
}
|
502 |
}
|
| - |
|
503 |
model.addAttribute("response", true);
|
| 499 |
return "response";
|
504 |
return "response";
|
| 500 |
}
|
505 |
}
|
| 501 |
|
506 |
|
| 502 |
@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
|
507 |
@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
|
| 503 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|
508 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|