| Line 42... |
Line 42... |
| 42 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
42 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 43 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
43 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 44 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
44 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 45 |
import com.spice.profitmandi.web.model.FofoDetails;
|
45 |
import com.spice.profitmandi.web.model.FofoDetails;
|
| 46 |
import com.spice.profitmandi.web.response.ValidateCart;
|
46 |
import com.spice.profitmandi.web.response.ValidateCart;
|
| 47 |
import com.spice.profitmandi.web.util.CookiesFetcher;
|
47 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 48 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
48 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 49 |
|
49 |
|
| 50 |
@Controller
|
50 |
@Controller
|
| 51 |
@Transactional(rollbackFor=Throwable.class)
|
51 |
@Transactional(rollbackFor=Throwable.class)
|
| 52 |
public class InventoryController {
|
52 |
public class InventoryController {
|
| Line 70... |
Line 70... |
| 70 |
|
70 |
|
| 71 |
@Autowired
|
71 |
@Autowired
|
| 72 |
MVCResponseSender mvcResponseSender;
|
72 |
MVCResponseSender mvcResponseSender;
|
| 73 |
|
73 |
|
| 74 |
@Autowired
|
74 |
@Autowired
|
| 75 |
CookiesFetcher cookiesFetcher;
|
75 |
CookiesProcessor cookiesProcessor;
|
| 76 |
|
76 |
|
| 77 |
@Value("${saholic.api.host}")
|
77 |
@Value("${saholic.api.host}")
|
| 78 |
private String host;
|
78 |
private String host;
|
| 79 |
@Value("${saholic.api.port}")
|
79 |
@Value("${saholic.api.port}")
|
| 80 |
private int port;
|
80 |
private int port;
|
| Line 84... |
Line 84... |
| 84 |
|
84 |
|
| 85 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
85 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 86 |
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 Exception{
|
86 |
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 Exception{
|
| 87 |
FofoDetails fofoDetails;
|
87 |
FofoDetails fofoDetails;
|
| 88 |
try {
|
88 |
try {
|
| 89 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
89 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 90 |
} catch (ProfitMandiBusinessException e) {
|
90 |
} catch (ProfitMandiBusinessException e) {
|
| 91 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
91 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 92 |
return "response";
|
92 |
return "response";
|
| 93 |
}
|
93 |
}
|
| 94 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
94 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
| Line 108... |
Line 108... |
| 108 |
|
108 |
|
| 109 |
@RequestMapping(value = "/getBadInventorySnapshot")
|
109 |
@RequestMapping(value = "/getBadInventorySnapshot")
|
| 110 |
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 Exception{
|
110 |
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 Exception{
|
| 111 |
FofoDetails fofoDetails;
|
111 |
FofoDetails fofoDetails;
|
| 112 |
try {
|
112 |
try {
|
| 113 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
113 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 114 |
} catch (ProfitMandiBusinessException e) {
|
114 |
} catch (ProfitMandiBusinessException e) {
|
| 115 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
115 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 116 |
return "response";
|
116 |
return "response";
|
| 117 |
}
|
117 |
}
|
| 118 |
model.addAttribute("badInventorySnapshot",new ArrayList<>());
|
118 |
model.addAttribute("badInventorySnapshot",new ArrayList<>());
|
| Line 122... |
Line 122... |
| 122 |
|
122 |
|
| 123 |
@RequestMapping(value = "/getPaginatedCurrentInventorySnapshot")
|
123 |
@RequestMapping(value = "/getPaginatedCurrentInventorySnapshot")
|
| 124 |
public String getCurrentAvailabilityPaginated(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 Exception{
|
124 |
public String getCurrentAvailabilityPaginated(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 Exception{
|
| 125 |
FofoDetails fofoDetails;
|
125 |
FofoDetails fofoDetails;
|
| 126 |
try {
|
126 |
try {
|
| 127 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
127 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 128 |
} catch (ProfitMandiBusinessException e) {
|
128 |
} catch (ProfitMandiBusinessException e) {
|
| 129 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
129 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 130 |
return "response";
|
130 |
return "response";
|
| 131 |
}
|
131 |
}
|
| 132 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
132 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
| Line 136... |
Line 136... |
| 136 |
|
136 |
|
| 137 |
@RequestMapping(value = "/getCatalog")
|
137 |
@RequestMapping(value = "/getCatalog")
|
| 138 |
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 Exception{
|
138 |
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 Exception{
|
| 139 |
FofoDetails fofoDetails;
|
139 |
FofoDetails fofoDetails;
|
| 140 |
try {
|
140 |
try {
|
| 141 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
141 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 142 |
} catch (ProfitMandiBusinessException e) {
|
142 |
} catch (ProfitMandiBusinessException e) {
|
| 143 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
143 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 144 |
return "response";
|
144 |
return "response";
|
| 145 |
}
|
145 |
}
|
| 146 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
146 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
| Line 160... |
Line 160... |
| 160 |
|
160 |
|
| 161 |
@RequestMapping(value = "/getPaginatedCatalog")
|
161 |
@RequestMapping(value = "/getPaginatedCatalog")
|
| 162 |
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 Exception{
|
162 |
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 Exception{
|
| 163 |
FofoDetails fofoDetails;
|
163 |
FofoDetails fofoDetails;
|
| 164 |
try {
|
164 |
try {
|
| 165 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
165 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 166 |
} catch (ProfitMandiBusinessException e) {
|
166 |
} catch (ProfitMandiBusinessException e) {
|
| 167 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
167 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 168 |
return "response";
|
168 |
return "response";
|
| 169 |
}
|
169 |
}
|
| 170 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
170 |
List<CurrentInventorySnapshot> currentInventorySnapshot = currentInventorySnapshotRepository.getCurrentInventorySnapshot(fofoDetails.getFofoId(), offset, limit, searchTerm);
|
| Line 202... |
Line 202... |
| 202 |
}
|
202 |
}
|
| 203 |
@RequestMapping(value = "/checkItemAvailability")
|
203 |
@RequestMapping(value = "/checkItemAvailability")
|
| 204 |
public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model) throws Exception{
|
204 |
public String getItemAvailability(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model) throws Exception{
|
| 205 |
FofoDetails fofoDetails;
|
205 |
FofoDetails fofoDetails;
|
| 206 |
try {
|
206 |
try {
|
| 207 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
207 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 208 |
} catch (ProfitMandiBusinessException e) {
|
208 |
} catch (ProfitMandiBusinessException e) {
|
| 209 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
209 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 210 |
return "response";
|
210 |
return "response";
|
| 211 |
}
|
211 |
}
|
| 212 |
try{
|
212 |
try{
|
| Line 224... |
Line 224... |
| 224 |
|
224 |
|
| 225 |
@RequestMapping(value = "/cart")
|
225 |
@RequestMapping(value = "/cart")
|
| 226 |
public String addToCart(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
226 |
public String addToCart(HttpServletRequest request, @RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
| 227 |
FofoDetails fofoDetails;
|
227 |
FofoDetails fofoDetails;
|
| 228 |
try {
|
228 |
try {
|
| 229 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
229 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 230 |
} catch (ProfitMandiBusinessException e) {
|
230 |
} catch (ProfitMandiBusinessException e) {
|
| 231 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
231 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 232 |
return "response";
|
232 |
return "response";
|
| 233 |
}
|
233 |
}
|
| 234 |
|
234 |
|
| Line 278... |
Line 278... |
| 278 |
|
278 |
|
| 279 |
@RequestMapping(value = "/validate-cart")
|
279 |
@RequestMapping(value = "/validate-cart")
|
| 280 |
public String validateCart(HttpServletRequest request, HttpServletResponse response,@RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
280 |
public String validateCart(HttpServletRequest request, HttpServletResponse response,@RequestParam(name = "cartData") String cartData, Model model) throws Exception{
|
| 281 |
FofoDetails fofoDetails = null;
|
281 |
FofoDetails fofoDetails = null;
|
| 282 |
try {
|
282 |
try {
|
| 283 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
283 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 284 |
} catch (ProfitMandiBusinessException e) {
|
284 |
} catch (ProfitMandiBusinessException e) {
|
| 285 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
285 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 286 |
return "response";
|
286 |
return "response";
|
| 287 |
}
|
287 |
}
|
| 288 |
|
288 |
|
| Line 337... |
Line 337... |
| 337 |
|
337 |
|
| 338 |
@RequestMapping(value = "/grnHistory")
|
338 |
@RequestMapping(value = "/grnHistory")
|
| 339 |
public String grnHistoryByFofoId(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 Exception{
|
339 |
public String grnHistoryByFofoId(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 Exception{
|
| 340 |
FofoDetails fofoDetails;
|
340 |
FofoDetails fofoDetails;
|
| 341 |
try {
|
341 |
try {
|
| 342 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
342 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 343 |
} catch (ProfitMandiBusinessException e) {
|
343 |
} catch (ProfitMandiBusinessException e) {
|
| 344 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
344 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 345 |
return "response";
|
345 |
return "response";
|
| 346 |
}
|
346 |
}
|
| 347 |
|
347 |
|
| Line 381... |
Line 381... |
| 381 |
|
381 |
|
| 382 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
382 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
| 383 |
public String getGrnHistoryPaginated(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 Exception{
|
383 |
public String getGrnHistoryPaginated(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 Exception{
|
| 384 |
FofoDetails fofoDetails;
|
384 |
FofoDetails fofoDetails;
|
| 385 |
try {
|
385 |
try {
|
| 386 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
386 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 387 |
} catch (ProfitMandiBusinessException e) {
|
387 |
} catch (ProfitMandiBusinessException e) {
|
| 388 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
388 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 389 |
return "response";
|
389 |
return "response";
|
| 390 |
}
|
390 |
}
|
| 391 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
391 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
| Line 398... |
Line 398... |
| 398 |
|
398 |
|
| 399 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|
399 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|
| 400 |
public String grnHistoryByPurchaseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_ID) int purchaseId, Model model) throws Exception{
|
400 |
public String grnHistoryByPurchaseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_ID) int purchaseId, Model model) throws Exception{
|
| 401 |
FofoDetails fofoDetails;
|
401 |
FofoDetails fofoDetails;
|
| 402 |
try {
|
402 |
try {
|
| 403 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
403 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 404 |
} catch (ProfitMandiBusinessException e) {
|
404 |
} catch (ProfitMandiBusinessException e) {
|
| 405 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
405 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 406 |
return "response";
|
406 |
return "response";
|
| 407 |
}
|
407 |
}
|
| 408 |
Purchase purchase = null;
|
408 |
Purchase purchase = null;
|
| Line 419... |
Line 419... |
| 419 |
|
419 |
|
| 420 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseReference")
|
420 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseReference")
|
| 421 |
public String grnHistoryByPurchaseReference(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE) String purchaseReference, Model model) throws Exception{
|
421 |
public String grnHistoryByPurchaseReference(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE) String purchaseReference, Model model) throws Exception{
|
| 422 |
FofoDetails fofoDetails;
|
422 |
FofoDetails fofoDetails;
|
| 423 |
try {
|
423 |
try {
|
| 424 |
fofoDetails = cookiesFetcher.getCookiesObject(request);
|
424 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 425 |
} catch (ProfitMandiBusinessException e) {
|
425 |
} catch (ProfitMandiBusinessException e) {
|
| 426 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
426 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
| 427 |
return "response";
|
427 |
return "response";
|
| 428 |
}
|
428 |
}
|
| 429 |
Purchase purchase = null;
|
429 |
Purchase purchase = null;
|