| Line 32... |
Line 32... |
| 32 |
import org.springframework.web.bind.annotation.RequestMapping;
|
32 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 33 |
import org.springframework.web.bind.annotation.RequestMethod;
|
33 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 34 |
import org.springframework.web.bind.annotation.RequestParam;
|
34 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 35 |
|
35 |
|
| 36 |
import com.eclipsesource.json.JsonObject;
|
36 |
import com.eclipsesource.json.JsonObject;
|
| - |
|
37 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
| 37 |
import com.google.common.collect.Ordering;
|
38 |
import com.google.common.collect.Ordering;
|
| 38 |
import com.google.gson.Gson;
|
39 |
import com.google.gson.Gson;
|
| 39 |
import com.google.gson.reflect.TypeToken;
|
40 |
import com.google.gson.reflect.TypeToken;
|
| 40 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
41 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 41 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| Line 48... |
Line 49... |
| 48 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
49 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 49 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
50 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 50 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
51 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 51 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
52 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 52 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
53 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| - |
|
54 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
| 53 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
55 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 54 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
56 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
| 55 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
57 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| 56 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
58 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
| 57 |
import com.spice.profitmandi.dao.model.CartItem;
|
59 |
import com.spice.profitmandi.dao.model.CartItem;
|
| 58 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
60 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
| 59 |
import com.spice.profitmandi.dao.model.CartResponse;
|
61 |
import com.spice.profitmandi.dao.model.CartResponse;
|
| 60 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
62 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 61 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
63 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 62 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
64 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 63 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
- |
|
| 64 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
65 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
| 65 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
66 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
| 66 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
67 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| - |
|
68 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| 67 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
69 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
| 68 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
70 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| 69 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
71 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 70 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
72 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 71 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
73 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
| Line 115... |
Line 117... |
| 115 |
|
117 |
|
| 116 |
@Autowired
|
118 |
@Autowired
|
| 117 |
private PendingOrderService pendingOrderService;
|
119 |
private PendingOrderService pendingOrderService;
|
| 118 |
|
120 |
|
| 119 |
@Autowired
|
121 |
@Autowired
|
| - |
|
122 |
private CustomerRepository customerRepository;
|
| - |
|
123 |
|
| - |
|
124 |
@Autowired
|
| 120 |
private SolrService commonSolrService;
|
125 |
private SolrService commonSolrService;
|
| 121 |
|
126 |
|
| 122 |
@Autowired
|
127 |
@Autowired
|
| 123 |
private OtpProcessor otpProcessor;
|
128 |
private OtpProcessor otpProcessor;
|
| 124 |
|
129 |
|
| Line 345... |
Line 350... |
| 345 |
|
350 |
|
| 346 |
return responseSender.ok(otpProcessor.generateOtp(email, phone, OtpType.PREBOOKING_ORDER));
|
351 |
return responseSender.ok(otpProcessor.generateOtp(email, phone, OtpType.PREBOOKING_ORDER));
|
| 347 |
|
352 |
|
| 348 |
}
|
353 |
}
|
| 349 |
|
354 |
|
| - |
|
355 |
@RequestMapping(value = "/store/login/{mobile}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
356 |
public ResponseEntity<?> generateOtp(HttpServletRequest request, @RequestParam String mobile) throws Exception {
|
| - |
|
357 |
try {
|
| - |
|
358 |
Customer customer = customerRepository.selectByMobileNumber(mobile);
|
| - |
|
359 |
return responseSender.ok(new CustomerModel(true, customer));
|
| - |
|
360 |
} catch (Exception e) {
|
| - |
|
361 |
return responseSender.ok(new CustomerModel(false, null));
|
| - |
|
362 |
}
|
| - |
|
363 |
}
|
| - |
|
364 |
|
| 350 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
365 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 351 |
public ResponseEntity<?> confirmCart(HttpServletRequest request,
|
366 |
public ResponseEntity<?> confirmCart(HttpServletRequest request,
|
| 352 |
@RequestBody CreatePendingOrderRequest createPendingOrderRequest) throws Exception {
|
367 |
@RequestBody CreatePendingOrderRequest createPendingOrderRequest) throws Exception {
|
| 353 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
368 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 354 |
Integer storeId = userInfo.getRetailerId();
|
369 |
Integer storeId = userInfo.getRetailerId();
|
| Line 385... |
Line 400... |
| 385 |
return responseSender.ok(fofoStoreRepository.selectByRetailerId(fofoId).getCode());
|
400 |
return responseSender.ok(fofoStoreRepository.selectByRetailerId(fofoId).getCode());
|
| 386 |
}
|
401 |
}
|
| 387 |
|
402 |
|
| 388 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
403 |
@RequestMapping(value = "/store/listing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 389 |
@Cacheable(value = "storelisting.all", cacheManager = "thirtyMinsTimeOutCacheManager")
|
404 |
@Cacheable(value = "storelisting.all", cacheManager = "thirtyMinsTimeOutCacheManager")
|
| 390 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request)
|
405 |
public ResponseEntity<?> getStoresListing(HttpServletRequest request) throws Exception {
|
| 391 |
throws Exception {
|
- |
|
| 392 |
List<WebListing> webListings = webListingRepository.selectAllWebListing(Optional.of(true));
|
406 |
List<WebListing> webListings = webListingRepository.selectAllWebListing(Optional.of(true));
|
| 393 |
for (WebListing webListing : webListings) {
|
407 |
for (WebListing webListing : webListings) {
|
| 394 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream()
|
408 |
List<Integer> webProducts = webProductListingRepository.selectAllByWebListingId(webListing.getId()).stream()
|
| 395 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
409 |
.filter(x -> x.getRank() > 0).map(x -> x.getEntityId()).collect(Collectors.toList());
|
| 396 |
|
410 |
|
| Line 611... |
Line 625... |
| 611 |
}
|
625 |
}
|
| 612 |
}
|
626 |
}
|
| 613 |
return dealResponse;
|
627 |
return dealResponse;
|
| 614 |
}
|
628 |
}
|
| 615 |
|
629 |
|
| - |
|
630 |
}
|
| - |
|
631 |
|
| - |
|
632 |
class CustomerModel {
|
| - |
|
633 |
|
| - |
|
634 |
|
| - |
|
635 |
@JsonProperty(required = false)
|
| - |
|
636 |
private Customer customer;
|
| - |
|
637 |
@JsonProperty(required = true)
|
| - |
|
638 |
private boolean exists;
|
| - |
|
639 |
|
| - |
|
640 |
|
| - |
|
641 |
public CustomerModel(boolean exists, Customer customer) {
|
| - |
|
642 |
super();
|
| - |
|
643 |
this.customer = customer;
|
| - |
|
644 |
this.exists = exists;
|
| - |
|
645 |
}
|
| - |
|
646 |
|
| - |
|
647 |
@Override
|
| - |
|
648 |
public String toString() {
|
| - |
|
649 |
return "CustomerModel [customer=" + customer + ", exists=" + exists + "]";
|
| - |
|
650 |
}
|
| - |
|
651 |
|
| - |
|
652 |
public Customer getCustomer() {
|
| - |
|
653 |
return customer;
|
| - |
|
654 |
}
|
| - |
|
655 |
|
| - |
|
656 |
public void setCustomer(Customer customer) {
|
| - |
|
657 |
this.customer = customer;
|
| - |
|
658 |
}
|
| - |
|
659 |
|
| - |
|
660 |
public boolean isExists() {
|
| - |
|
661 |
return exists;
|
| - |
|
662 |
}
|
| - |
|
663 |
|
| - |
|
664 |
public void setExists(boolean exists) {
|
| - |
|
665 |
this.exists = exists;
|
| - |
|
666 |
}
|
| 616 |
}
|
667 |
}
|
| 617 |
|
668 |
|