| 21561 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
| 21555 |
kshitij.so |
2 |
|
| 23076 |
ashik.ali |
3 |
import java.util.List;
|
| 22927 |
ashik.ali |
4 |
import java.util.Map;
|
| 21583 |
ashik.ali |
5 |
|
| 21574 |
ashik.ali |
6 |
import javax.servlet.http.HttpServletRequest;
|
|
|
7 |
|
| 23569 |
govind |
8 |
import org.apache.logging.log4j.Logger;
|
|
|
9 |
import org.apache.logging.log4j.LogManager;
|
| 21574 |
ashik.ali |
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21555 |
kshitij.so |
11 |
import org.springframework.stereotype.Controller;
|
| 21636 |
ashik.ali |
12 |
import org.springframework.transaction.annotation.Transactional;
|
| 21574 |
ashik.ali |
13 |
import org.springframework.ui.Model;
|
| 21555 |
kshitij.so |
14 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
15 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 21583 |
ashik.ali |
16 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 21555 |
kshitij.so |
17 |
|
| 21640 |
kshitij.so |
18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 21583 |
ashik.ali |
19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 23076 |
ashik.ali |
20 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
|
|
21 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 22927 |
ashik.ali |
22 |
import com.spice.profitmandi.service.inventory.PurchaseService;
|
| 22139 |
amit.gupta |
23 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 22069 |
ashik.ali |
24 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 21555 |
kshitij.so |
25 |
|
|
|
26 |
@Controller
|
| 22037 |
amit.gupta |
27 |
@Transactional(rollbackFor=Throwable.class)
|
| 21582 |
kshitij.so |
28 |
public class PurchaseController {
|
| 21555 |
kshitij.so |
29 |
|
| 23569 |
govind |
30 |
private static final Logger LOGGER = LogManager.getLogger(PurchaseController.class);
|
| 22927 |
ashik.ali |
31 |
|
| 21574 |
ashik.ali |
32 |
@Autowired
|
| 22927 |
ashik.ali |
33 |
private PurchaseService purchaseService;
|
| 23076 |
ashik.ali |
34 |
|
|
|
35 |
@Autowired
|
|
|
36 |
private OrderRepository orderRepository;
|
| 21640 |
kshitij.so |
37 |
|
| 21574 |
ashik.ali |
38 |
@Autowired
|
| 22927 |
ashik.ali |
39 |
private CookiesProcessor cookiesProcessor;
|
| 21640 |
kshitij.so |
40 |
|
| 23026 |
ashik.ali |
41 |
@RequestMapping(value = "/purchaseByInvoiceNumber", method = RequestMethod.GET)
|
| 23918 |
amit.gupta |
42 |
public String purchaseByAirwayBillOrInvoiceNumber(HttpServletRequest request,
|
|
|
43 |
@RequestParam(name = ProfitMandiConstants.AIRWAY_BILL_OR_INVOICE_NUMBER)
|
|
|
44 |
String airwayBillOrInvoiceNumber, Model model) throws ProfitMandiBusinessException{
|
| 22139 |
amit.gupta |
45 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 22927 |
ashik.ali |
46 |
LOGGER.info("Request Received at url {} with airwayBillOrInvoiceNumber {}", request.getRequestURI(), airwayBillOrInvoiceNumber);
|
|
|
47 |
Map<String, Object> map = purchaseService.purchaseByInvoiceNumber(airwayBillOrInvoiceNumber, fofoDetails.getFofoId());
|
|
|
48 |
model.addAllAttributes(map);
|
| 21587 |
kshitij.so |
49 |
return "purchase";
|
| 21555 |
kshitij.so |
50 |
}
|
| 21640 |
kshitij.so |
51 |
|
| 21587 |
kshitij.so |
52 |
@RequestMapping(value = "/purchase", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
53 |
public String purchase(HttpServletRequest request) throws Exception{
|
| 21587 |
kshitij.so |
54 |
return "purchase";
|
|
|
55 |
}
|
| 23076 |
ashik.ali |
56 |
|
|
|
57 |
@RequestMapping(value = "/pendingGrn", method = RequestMethod.GET)
|
|
|
58 |
public String pendingGrn(HttpServletRequest request, Model model) throws ProfitMandiBusinessException{
|
|
|
59 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
60 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
|
|
61 |
List<Order> pendingGrns = orderRepository.selectShipmentToDeliveredByRetailerId(fofoDetails.getFofoId());
|
|
|
62 |
model.addAttribute("pendingGrns", pendingGrns);
|
|
|
63 |
return "pending-grn";
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
@RequestMapping(value = "/pendingGrnDetails", method = RequestMethod.GET)
|
|
|
67 |
public String pendingGrnDetails(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) throws ProfitMandiBusinessException{
|
|
|
68 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
69 |
LOGGER.info("Request Received at url [{}] with orderId [{}]", request.getRequestURI(), orderId);
|
|
|
70 |
model.addAttribute("pendingGrnDetails", purchaseService.getShippingDetailByOrderId(orderId, fofoDetails.getFofoId()));
|
|
|
71 |
return "pending-grn-details";
|
|
|
72 |
}
|
|
|
73 |
|
| 21636 |
ashik.ali |
74 |
}
|