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