| Line 10... |
Line 10... |
| 10 |
import javax.servlet.http.HttpServletResponse;
|
10 |
import javax.servlet.http.HttpServletResponse;
|
| 11 |
|
11 |
|
| 12 |
import org.apache.logging.log4j.Logger;
|
12 |
import org.apache.logging.log4j.Logger;
|
| 13 |
import org.apache.logging.log4j.LogManager;
|
13 |
import org.apache.logging.log4j.LogManager;
|
| 14 |
import org.springframework.beans.factory.annotation.Autowired;
|
14 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
15 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 15 |
import org.springframework.beans.factory.annotation.Value;
|
16 |
import org.springframework.beans.factory.annotation.Value;
|
| 16 |
import org.springframework.core.io.InputStreamResource;
|
17 |
import org.springframework.core.io.InputStreamResource;
|
| 17 |
import org.springframework.http.HttpHeaders;
|
18 |
import org.springframework.http.HttpHeaders;
|
| 18 |
import org.springframework.http.HttpStatus;
|
19 |
import org.springframework.http.HttpStatus;
|
| 19 |
import org.springframework.http.ResponseEntity;
|
20 |
import org.springframework.http.ResponseEntity;
|
| Line 44... |
Line 45... |
| 44 |
|
45 |
|
| 45 |
@Autowired
|
46 |
@Autowired
|
| 46 |
private CookiesProcessor cookiesProcessor;
|
47 |
private CookiesProcessor cookiesProcessor;
|
| 47 |
|
48 |
|
| 48 |
@Autowired
|
49 |
@Autowired
|
| - |
|
50 |
@Qualifier("fofoInventoryService")
|
| 49 |
private InventoryService inventoryService;
|
51 |
private InventoryService inventoryService;
|
| 50 |
|
52 |
|
| 51 |
@Value("${saholic.api.host}")
|
53 |
@Value("${saholic.api.host}")
|
| 52 |
private String host;
|
54 |
private String host;
|
| 53 |
|
55 |
|
| Line 55... |
Line 57... |
| 55 |
private int port;
|
57 |
private int port;
|
| 56 |
|
58 |
|
| 57 |
@Value("${saholic.api.webapp}")
|
59 |
@Value("${saholic.api.webapp}")
|
| 58 |
private String webapp;
|
60 |
private String webapp;
|
| 59 |
|
61 |
|
| 60 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
62 |
@RequestMapping(value = "/getCurrentInventorySnapshot", method = RequestMethod.GET)
|
| 61 |
public String getCurrentAvailability(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
63 |
public String getCurrentAvailability(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
| 62 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
64 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 63 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
65 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 64 |
model.addAllAttributes(map);
|
66 |
model.addAllAttributes(map);
|
| 65 |
return "inventory-snapshot";
|
67 |
return "inventory-snapshot";
|
| 66 |
}
|
68 |
}
|
| 67 |
|
69 |
|
| 68 |
@RequestMapping(value = "/getBadInventorySnapshot")
|
70 |
@RequestMapping(value = "/getBadInventorySnapshot", method = RequestMethod.GET)
|
| 69 |
public String getBadAvailability(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
71 |
public String getBadAvailability(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
| 70 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
72 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 71 |
Map<String, Object> map = inventoryService.getBadInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
73 |
Map<String, Object> map = inventoryService.getBadInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 72 |
model.addAllAttributes(map);
|
74 |
model.addAllAttributes(map);
|
| 73 |
return "bad-inventory-snapshot";
|
75 |
return "bad-inventory-snapshot";
|
| 74 |
}
|
76 |
}
|
| 75 |
|
77 |
|
| 76 |
@RequestMapping(value = "/getPaginatedCurrentInventorySnapshot")
|
78 |
@RequestMapping(value = "/getPaginatedCurrentInventorySnapshot", method = RequestMethod.GET)
|
| 77 |
public String getPaginatedCurrentInventorySnapshot(HttpServletRequest request, @RequestParam(name = "offset", defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm , Model model) throws ProfitMandiBusinessException{
|
79 |
public String getPaginatedCurrentInventorySnapshot(HttpServletRequest request, @RequestParam(name = "offset", defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm , Model model) throws ProfitMandiBusinessException{
|
| 78 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
80 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 79 |
Map<String, Object> map = inventoryService.getPaginatedCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
81 |
Map<String, Object> map = inventoryService.getPaginatedCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 80 |
model.addAllAttributes(map);
|
82 |
model.addAllAttributes(map);
|
| 81 |
return "inventory-snapshot-paginated";
|
83 |
return "inventory-snapshot-paginated";
|
| 82 |
}
|
84 |
}
|
| 83 |
|
85 |
|
| 84 |
@RequestMapping(value = "/getCatalog")
|
86 |
@RequestMapping(value = "/getCatalog", method = RequestMethod.GET)
|
| 85 |
public String getCatalog(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
87 |
public String getCatalog(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit , @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm ,Model model) throws ProfitMandiBusinessException{
|
| 86 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
88 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 87 |
Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
|
89 |
Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 88 |
model.addAllAttributes(map);
|
90 |
model.addAllAttributes(map);
|
| 89 |
return "catalog";
|
91 |
return "catalog";
|
| 90 |
}
|
92 |
}
|
| 91 |
|
93 |
|
| 92 |
@RequestMapping(value = "/getPaginatedCatalog")
|
94 |
@RequestMapping(value = "/getPaginatedCatalog", method = RequestMethod.GET)
|
| 93 |
public String getCatalogPaginated(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm , Model model) throws ProfitMandiBusinessException{
|
95 |
public String getCatalogPaginated(HttpServletRequest request,@RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = "searchTerm", required=false, defaultValue="") String searchTerm , Model model) throws ProfitMandiBusinessException{
|
| 94 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
96 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 95 |
Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
|
97 |
Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 96 |
model.addAllAttributes(map);
|
98 |
model.addAllAttributes(map);
|
| 97 |
return "catalog-paginated";
|
99 |
return "catalog-paginated";
|
| 98 |
}
|
100 |
}
|
| 99 |
|
101 |
|
| 100 |
|
102 |
|
| 101 |
@RequestMapping(value = "/checkItemAvailability")
|
103 |
@RequestMapping(value = "/checkItemAvailability", method = RequestMethod.GET)
|
| 102 |
public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model) throws ProfitMandiBusinessException{
|
104 |
public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model) throws ProfitMandiBusinessException{
|
| 103 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
105 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 104 |
CustomCurrentInventorySnapshot customCurrentInventorySnapshot = inventoryService.checkItemAvailability(itemId, loginDetails.getFofoId());
|
106 |
CustomCurrentInventorySnapshot customCurrentInventorySnapshot = inventoryService.checkItemAvailability(itemId, loginDetails.getFofoId());
|
| 105 |
customCurrentInventorySnapshot.setIconUrl(Utils.getIconUrl(customCurrentInventorySnapshot.getCatalogItemId(), host, port, webapp));
|
107 |
customCurrentInventorySnapshot.setIconUrl(Utils.getIconUrl(customCurrentInventorySnapshot.getCatalogItemId(), host, port, webapp));
|
| 106 |
model.addAttribute("currentInventorySnapshot", new Gson().toJson(customCurrentInventorySnapshot));
|
108 |
model.addAttribute("currentInventorySnapshot", new Gson().toJson(customCurrentInventorySnapshot));
|
| Line 124... |
Line 126... |
| 124 |
Map<String, Object> map = inventoryService.validateCart(cartData, loginDetails.getFofoId());
|
126 |
Map<String, Object> map = inventoryService.validateCart(cartData, loginDetails.getFofoId());
|
| 125 |
model.addAllAttributes(map);
|
127 |
model.addAllAttributes(map);
|
| 126 |
return "validate-cart";
|
128 |
return "validate-cart";
|
| 127 |
}
|
129 |
}
|
| 128 |
|
130 |
|
| 129 |
@RequestMapping(value = "/grnHistory")
|
131 |
@RequestMapping(value = "/grnHistory", method = RequestMethod.GET)
|
| 130 |
public String getGrnHistory(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE,defaultValue="") String purchaseReference, @RequestParam(name = "searchType",defaultValue="") String searchType,Model model) throws ProfitMandiBusinessException{
|
132 |
public String getGrnHistory(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE,defaultValue="") String purchaseReference, @RequestParam(name = "searchType",defaultValue="") String searchType,Model model) throws ProfitMandiBusinessException{
|
| 131 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
133 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 132 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTimeString, endTimeString, offset, limit, purchaseReference, searchType);
|
134 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTimeString, endTimeString, offset, limit, purchaseReference, searchType);
|
| 133 |
model.addAllAttributes(map);
|
135 |
model.addAllAttributes(map);
|
| 134 |
return "grn-history";
|
136 |
return "grn-history";
|
| 135 |
}
|
137 |
}
|
| 136 |
|
138 |
|
| 137 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
139 |
@RequestMapping(value = "/getPaginatedGrnHistory", method = RequestMethod.GET)
|
| 138 |
public String getPaginatedGrnHistory(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE,defaultValue="") String purchaseReference, @RequestParam(name = "searchType",defaultValue="") String searchType,Model model) throws ProfitMandiBusinessException{
|
140 |
public String getPaginatedGrnHistory(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset",defaultValue="0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE,defaultValue="") String purchaseReference, @RequestParam(name = "searchType",defaultValue="") String searchType,Model model) throws ProfitMandiBusinessException{
|
| 139 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
141 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 140 |
Map<String, Object> map = inventoryService.getPaginatedGrnHistory(loginDetails.getFofoId(), startTimeString, endTimeString, offset, limit);
|
142 |
Map<String, Object> map = inventoryService.getPaginatedGrnHistory(loginDetails.getFofoId(), startTimeString, endTimeString, offset, limit);
|
| 141 |
model.addAllAttributes(map);
|
143 |
model.addAllAttributes(map);
|
| 142 |
return "grn-history-paginated";
|
144 |
return "grn-history-paginated";
|
| 143 |
}
|
145 |
}
|
| 144 |
|
146 |
|
| 145 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|
147 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId", method = RequestMethod.GET)
|
| 146 |
public String grnHistoryByPurchaseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_ID) int purchaseId, Model model) throws ProfitMandiBusinessException{
|
148 |
public String grnHistoryByPurchaseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_ID) int purchaseId, Model model) throws ProfitMandiBusinessException{
|
| 147 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
149 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 148 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseId, host, port, webapp);
|
150 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseId, host, port, webapp);
|
| 149 |
model.addAllAttributes(map);
|
151 |
model.addAllAttributes(map);
|
| 150 |
return "grn-details";
|
152 |
return "grn-details";
|
| 151 |
}
|
153 |
}
|
| 152 |
|
154 |
|
| 153 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseReference")
|
155 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseReference", method = RequestMethod.GET)
|
| 154 |
public String grnHistoryByPurchaseReference(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE) String purchaseReference, Model model) throws ProfitMandiBusinessException{
|
156 |
public String grnHistoryByPurchaseReference(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE) String purchaseReference, Model model) throws ProfitMandiBusinessException{
|
| 155 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
157 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 156 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseReference, host, port, webapp);
|
158 |
Map<String, Object> map = inventoryService.getGrnHistoryDetail(loginDetails.getFofoId(), purchaseReference, host, port, webapp);
|
| 157 |
model.addAllAttributes(map);
|
159 |
model.addAllAttributes(map);
|
| 158 |
return "grn-details";
|
160 |
return "grn-details";
|