| Line 4... |
Line 4... |
| 4 |
import java.util.Arrays;
|
4 |
import java.util.Arrays;
|
| 5 |
import java.util.Collections;
|
5 |
import java.util.Collections;
|
| 6 |
import java.util.Comparator;
|
6 |
import java.util.Comparator;
|
| 7 |
import java.util.DoubleSummaryStatistics;
|
7 |
import java.util.DoubleSummaryStatistics;
|
| 8 |
import java.util.HashMap;
|
8 |
import java.util.HashMap;
|
| - |
|
9 |
import java.util.HashSet;
|
| 9 |
import java.util.Iterator;
|
10 |
import java.util.Iterator;
|
| 10 |
import java.util.List;
|
11 |
import java.util.List;
|
| 11 |
import java.util.Map;
|
12 |
import java.util.Map;
|
| 12 |
import java.util.Optional;
|
13 |
import java.util.Optional;
|
| 13 |
import java.util.Set;
|
14 |
import java.util.Set;
|
| Line 75... |
Line 76... |
| 75 |
import in.shop2020.model.v1.order.TransactionService;
|
76 |
import in.shop2020.model.v1.order.TransactionService;
|
| 76 |
import in.shop2020.model.v1.order.TransactionStatus;
|
77 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| 77 |
import in.shop2020.model.v1.user.ItemPriceQuantity;
|
78 |
import in.shop2020.model.v1.user.ItemPriceQuantity;
|
| 78 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
79 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
| 79 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
80 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| - |
|
81 |
import in.shop2020.model.v1.user.UserContextService.forgotPassword_args;
|
| 80 |
import in.shop2020.payments.Attribute;
|
82 |
import in.shop2020.payments.Attribute;
|
| 81 |
import in.shop2020.payments.PaymentException;
|
83 |
import in.shop2020.payments.PaymentException;
|
| 82 |
import in.shop2020.payments.PaymentStatus;
|
84 |
import in.shop2020.payments.PaymentStatus;
|
| 83 |
|
85 |
|
| 84 |
@Controller
|
86 |
@Controller
|
| 85 |
@Transactional(rollbackFor = Throwable.class)
|
87 |
@Transactional(rollbackFor = Throwable.class)
|
| 86 |
public class IndentController {
|
88 |
public class IndentController {
|
| 87 |
|
89 |
|
| 88 |
private static final Logger LOGGER = LogManager.getLogger(IndentController.class);
|
90 |
private static final Logger LOGGER = LogManager.getLogger(IndentController.class);
|
| 89 |
private static final int WALLET_GATEWAY_ID = 8;
|
91 |
private static final int WALLET_GATEWAY_ID = 8;
|
| - |
|
92 |
private static final Set<Integer> defaultTags = new HashSet<Integer>(Arrays.asList(4));
|
| 90 |
|
93 |
|
| 91 |
private final List<OrderStatus> validOrderStatusList = Arrays.asList(OrderStatus.ACCEPTED,
|
94 |
private final List<OrderStatus> validOrderStatusList = Arrays.asList(OrderStatus.ACCEPTED,
|
| 92 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
95 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
| 93 |
OrderStatus.DELIVERY_SUCCESS, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
96 |
OrderStatus.DELIVERY_SUCCESS, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
| 94 |
OrderStatus.REACHED_DESTINATION_CITY);
|
97 |
OrderStatus.REACHED_DESTINATION_CITY);
|
| Line 277... |
Line 280... |
| 277 |
|
280 |
|
| 278 |
@RequestMapping(value = "/itemsByCatalogId")
|
281 |
@RequestMapping(value = "/itemsByCatalogId")
|
| 279 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
282 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| 280 |
@RequestParam int catalogId) {
|
283 |
@RequestParam int catalogId) {
|
| 281 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
284 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| - |
|
285 |
Map<Integer, String> itemsColorMap = items.stream().collect(Collectors.toMap(Item::getId, Item::getColor));
|
| - |
|
286 |
List<TagListing> tags = tagListingRepository.selectByItemIdsAndTagIds(items.stream().map(x->x.getId()).collect(Collectors.toSet()), defaultTags);
|
| 282 |
JSONArray response = new JSONArray();
|
287 |
JSONArray response = new JSONArray();
|
| 283 |
items.stream().forEach(x->
|
288 |
tags.stream().forEach(x->
|
| 284 |
{
|
289 |
{
|
| - |
|
290 |
response.put(new JSONObject()
|
| 285 |
response.put(new JSONObject().put("color", x.getColor()).put("id", x.getId()));
|
291 |
.put("color", itemsColorMap.get(x.getItemId()))
|
| - |
|
292 |
.put("id", x.getItemId())
|
| - |
|
293 |
.put("active", x.isActive()));
|
| 286 |
});
|
294 |
});
|
| 287 |
model.addAttribute("response", response.toString());
|
295 |
model.addAttribute("response", response.toString());
|
| 288 |
return "response";
|
296 |
return "response";
|
| 289 |
|
297 |
|
| 290 |
}
|
298 |
}
|
| Line 477... |
Line 485... |
| 477 |
}
|
485 |
}
|
| 478 |
}
|
486 |
}
|
| 479 |
return lastOrdersList;
|
487 |
return lastOrdersList;
|
| 480 |
}
|
488 |
}
|
| 481 |
|
489 |
|
| 482 |
@RequestMapping(value = "/indent/confirm-pause/{tagId}", method = RequestMethod.POST)
|
490 |
@RequestMapping(value = "/indent/confirm-pause", method = RequestMethod.POST)
|
| 483 |
public String raisePO(HttpServletRequest request, Model model, @PathVariable int tagId) throws Exception {
|
491 |
public String raisePO(HttpServletRequest request, Model model, @RequestBody String jsonArrayString) throws Exception {
|
| - |
|
492 |
JSONArray jsonArray = new JSONArray(jsonArrayString);
|
| - |
|
493 |
for(int i=0;i<jsonArray.length();i++) {
|
| - |
|
494 |
JSONObject obj = jsonArray.getJSONObject(i);
|
| 484 |
tagListingRepository.updateActiveById(tagId, false);
|
495 |
TagListing tl = tagListingRepository.selectByItemId(obj.getInt("id"));
|
| 485 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
496 |
tl.setActive(obj.getBoolean("active"));
|
| - |
|
497 |
tagListingRepository.persist(tl);
|
| - |
|
498 |
}
|
| 486 |
return "response";
|
499 |
return "response";
|
| 487 |
}
|
500 |
}
|
| 488 |
|
501 |
|
| 489 |
@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
|
502 |
@RequestMapping(value = "/indent/create-po", method = RequestMethod.POST)
|
| 490 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|
503 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|