| Line 8... |
Line 8... |
| 8 |
import java.util.HashSet;
|
8 |
import java.util.HashSet;
|
| 9 |
import java.util.List;
|
9 |
import java.util.List;
|
| 10 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 11 |
import java.util.Optional;
|
11 |
import java.util.Optional;
|
| 12 |
import java.util.Set;
|
12 |
import java.util.Set;
|
| - |
|
13 |
import java.util.stream.Collector;
|
| 13 |
import java.util.stream.Collectors;
|
14 |
import java.util.stream.Collectors;
|
| 14 |
|
15 |
|
| 15 |
import javax.servlet.http.HttpServletRequest;
|
16 |
import javax.servlet.http.HttpServletRequest;
|
| 16 |
|
17 |
|
| 17 |
import org.apache.commons.lang3.StringUtils;
|
18 |
import org.apache.commons.lang3.StringUtils;
|
| Line 40... |
Line 41... |
| 40 |
import com.google.gson.reflect.TypeToken;
|
41 |
import com.google.gson.reflect.TypeToken;
|
| 41 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
42 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 43 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
44 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
| 44 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| - |
|
46 |
import com.spice.profitmandi.common.model.CustomerOrderDetail;
|
| - |
|
47 |
import com.spice.profitmandi.common.model.Notification;
|
| 45 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
48 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 46 |
import com.spice.profitmandi.common.model.UserInfo;
|
49 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 47 |
import com.spice.profitmandi.common.solr.SolrService;
|
50 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 48 |
import com.spice.profitmandi.common.web.client.RestClient;
|
51 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 49 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
52 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 50 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
53 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 51 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
54 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 52 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
55 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 53 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
56 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 54 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
57 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
| 55 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
58 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
| - |
|
59 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
| 56 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 57 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
61 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
| 58 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
62 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| 59 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
63 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
| 60 |
import com.spice.profitmandi.dao.model.CartItem;
|
64 |
import com.spice.profitmandi.dao.model.CartItem;
|
| Line 66... |
Line 70... |
| 66 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
70 |
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
|
| 67 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
71 |
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
|
| 68 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
72 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 69 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
73 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
| 70 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
74 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| - |
|
75 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
| - |
|
76 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
| 71 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
77 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
| 72 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
78 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| 73 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
79 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 74 |
import com.spice.profitmandi.service.CustomerService;
|
80 |
import com.spice.profitmandi.service.CustomerService;
|
| 75 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
81 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| Line 161... |
Line 167... |
| 161 |
private WebProductListingRepository webProductListingRepository;
|
167 |
private WebProductListingRepository webProductListingRepository;
|
| 162 |
|
168 |
|
| 163 |
@Autowired
|
169 |
@Autowired
|
| 164 |
private RoleManager roleManagerService;
|
170 |
private RoleManager roleManagerService;
|
| 165 |
|
171 |
|
| - |
|
172 |
@Autowired
|
| - |
|
173 |
private PendingOrderRepository pendingOrderRepository;
|
| - |
|
174 |
|
| - |
|
175 |
@Autowired
|
| - |
|
176 |
private PendingOrderItemRepository pendingOrderItemRepository;
|
| - |
|
177 |
|
| 166 |
List<String> filterableParams = Arrays.asList("brand");
|
178 |
List<String> filterableParams = Arrays.asList("brand");
|
| 167 |
|
179 |
|
| 168 |
@ApiImplicitParams({
|
180 |
@ApiImplicitParams({
|
| 169 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
181 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 170 |
@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
182 |
@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 354... |
Line 366... |
| 354 |
}
|
366 |
}
|
| 355 |
|
367 |
|
| 356 |
@RequestMapping(value = "/store/otp/generateOTP", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
368 |
@RequestMapping(value = "/store/otp/generateOTP", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 357 |
public ResponseEntity<?> generateOtp(HttpServletRequest request, @RequestParam String mobile) throws Exception {
|
369 |
public ResponseEntity<?> generateOtp(HttpServletRequest request, @RequestParam String mobile) throws Exception {
|
| 358 |
|
370 |
|
| 359 |
return responseSender.ok(otpProcessor.generateOtp(mobile, OtpType.REGISTRATION));
|
371 |
return responseSender.ok(otpProcessor.generateOtp(mobile, OtpType.PREBOOKING_ORDER));
|
| 360 |
|
372 |
|
| 361 |
}
|
373 |
}
|
| 362 |
|
374 |
|
| 363 |
@RequestMapping(value = "/store/checkmobile/{mobile}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
375 |
@RequestMapping(value = "/store/checkmobile/{mobile}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 364 |
public ResponseEntity<?> checkRegistrationUsingMobile(HttpServletRequest request, @PathVariable String mobile)
|
376 |
public ResponseEntity<?> checkRegistrationUsingMobile(HttpServletRequest request, @PathVariable String mobile)
|
| Line 378... |
Line 390... |
| 378 |
return responseSender.ok(true);
|
390 |
return responseSender.ok(true);
|
| 379 |
} else {
|
391 |
} else {
|
| 380 |
return responseSender.ok(false);
|
392 |
return responseSender.ok(false);
|
| 381 |
}
|
393 |
}
|
| 382 |
}
|
394 |
}
|
| 383 |
|
395 |
|
| 384 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
396 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 385 |
public ResponseEntity<?> resetPassword(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
397 |
public ResponseEntity<?> resetPassword(HttpServletRequest request, @RequestBody UserModel userModel)
|
| - |
|
398 |
throws Exception {
|
| 386 |
customerService.changePassword(userModel.getMobile(), userModel.getPassword());
|
399 |
customerService.changePassword(userModel.getMobile(), userModel.getPassword());
|
| 387 |
return responseSender.ok(true);
|
400 |
return responseSender.ok(true);
|
| 388 |
}
|
401 |
}
|
| 389 |
|
402 |
|
| 390 |
@RequestMapping(value = "/store/register", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 391 |
public ResponseEntity<?> register(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
- |
|
| 392 |
Customer customer = new Customer();
|
- |
|
| 393 |
customer.setPassword(userModel.getPassword());
|
- |
|
| 394 |
customer.setEmailId(userModel.getEmail());
|
- |
|
| 395 |
customer.setFirstName(userModel.getFirstName());
|
- |
|
| 396 |
customer.setLastName(userModel.getLastName());
|
- |
|
| 397 |
customer.setMobileNumber(userModel.getMobile());
|
- |
|
| 398 |
return responseSender.ok(customerService.addCustomer(customer));
|
- |
|
| 399 |
}
|
- |
|
| 400 |
|
- |
|
| 401 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
403 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 402 |
public ResponseEntity<?> confirmCart(HttpServletRequest request,
|
404 |
public ResponseEntity<?> confirmCart(HttpServletRequest request,
|
| 403 |
@RequestBody CreatePendingOrderRequest createPendingOrderRequest) throws Exception {
|
405 |
@RequestBody CreatePendingOrderRequest createPendingOrderRequest) throws Exception {
|
| 404 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
406 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 405 |
Integer storeId = userInfo.getRetailerId();
|
407 |
Integer storeId = userInfo.getRetailerId();
|
| Line 407... |
Line 409... |
| 407 |
this.pendingOrderService.createPendingOrder(createPendingOrderRequest);
|
409 |
this.pendingOrderService.createPendingOrder(createPendingOrderRequest);
|
| 408 |
return responseSender.ok(true);
|
410 |
return responseSender.ok(true);
|
| 409 |
|
411 |
|
| 410 |
}
|
412 |
}
|
| 411 |
|
413 |
|
| - |
|
414 |
@RequestMapping(value = "/store/order", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
415 |
public ResponseEntity<?> getOrderDetail(HttpServletRequest request, @RequestParam(value = "id") int id,
|
| - |
|
416 |
@RequestParam(name = "offset") int offset, @RequestParam(name = "limit") int limit)
|
| - |
|
417 |
throws ProfitMandiBusinessException {
|
| - |
|
418 |
List<CustomerOrderDetail> customerOrderDetails = new ArrayList<>();
|
| - |
|
419 |
|
| - |
|
420 |
List<PendingOrder> pendingOrders = pendingOrderRepository.selectByCustomerId(id, offset, limit);
|
| - |
|
421 |
if (!pendingOrders.isEmpty()) {
|
| - |
|
422 |
for (PendingOrder po : pendingOrders) {
|
| - |
|
423 |
List<PendingOrderItem> pois = pendingOrderItemRepository.selectByOrderId(po.getId());
|
| - |
|
424 |
for (PendingOrderItem poi : pois) {
|
| - |
|
425 |
|
| - |
|
426 |
CustomerOrderDetail customerOrderDetail = new CustomerOrderDetail();
|
| - |
|
427 |
|
| - |
|
428 |
Item item = itemRepository.selectById(poi.getItemId());
|
| - |
|
429 |
customerOrderDetail.setBrand(item.getBrand());
|
| - |
|
430 |
customerOrderDetail.setColor(item.getColor());
|
| - |
|
431 |
customerOrderDetail.setId(poi.getOrderId());
|
| - |
|
432 |
customerOrderDetail.setItemId(poi.getItemId());
|
| - |
|
433 |
customerOrderDetail.setModelName(item.getModelName());
|
| - |
|
434 |
customerOrderDetail.setModelNumber(item.getModelNumber());
|
| - |
|
435 |
customerOrderDetail.setQuantity(poi.getQuantity());
|
| - |
|
436 |
customerOrderDetail.setStatus(poi.getStatus());
|
| - |
|
437 |
customerOrderDetail.setTotalPrice(poi.getSellingPrice());
|
| - |
|
438 |
customerOrderDetail.setPayMethod(po.getPayMethod());
|
| - |
|
439 |
customerOrderDetails.add(customerOrderDetail);
|
| - |
|
440 |
}
|
| - |
|
441 |
}
|
| - |
|
442 |
}
|
| - |
|
443 |
|
| - |
|
444 |
return responseSender.ok(customerOrderDetails);
|
| - |
|
445 |
}
|
| - |
|
446 |
|
| 412 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
447 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 413 |
@ApiImplicitParams({
|
448 |
@ApiImplicitParams({
|
| 414 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
449 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 415 |
@ApiOperation(value = "Get brand list and count for category")
|
450 |
@ApiOperation(value = "Get brand list and count for category")
|
| 416 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
451 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
| Line 666... |
Line 701... |
| 666 |
@RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
|
701 |
@RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
|
| 667 |
public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
|
702 |
public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
|
| 668 |
return responseSender.ok(customerAddressRepository.selectByCustomerId(customerId));
|
703 |
return responseSender.ok(customerAddressRepository.selectByCustomerId(customerId));
|
| 669 |
}
|
704 |
}
|
| 670 |
|
705 |
|
| 671 |
@RequestMapping(value = "/store/address", method = RequestMethod.POST)
|
- |
|
| 672 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CustomerAddress customerAddress)
|
- |
|
| 673 |
throws Throwable {
|
- |
|
| 674 |
customerAddressRepository.persist(customerAddress);
|
- |
|
| 675 |
return responseSender.ok(customerAddress);
|
- |
|
| 676 |
}
|
- |
|
| 677 |
|
- |
|
| 678 |
}
|
706 |
}
|
| 679 |
|
707 |
|
| 680 |
class UserModel {
|
708 |
class UserModel {
|
| 681 |
@JsonProperty(required = true)
|
- |
|
| 682 |
private String mobile;
|
709 |
private String mobile;
|
| 683 |
@JsonProperty(required = true)
|
- |
|
| 684 |
private String password;
|
710 |
private String password;
|
| 685 |
@JsonProperty(required = false)
|
- |
|
| 686 |
private String firstName;
|
- |
|
| 687 |
@JsonProperty(required = false)
|
- |
|
| 688 |
private String lastName;
|
- |
|
| 689 |
@JsonProperty(required = false)
|
- |
|
| 690 |
private String email;
|
- |
|
| 691 |
|
711 |
|
| 692 |
@Override
|
712 |
@Override
|
| 693 |
public String toString() {
|
713 |
public String toString() {
|
| 694 |
return "UserModel [mobile=" + mobile + ", password=" + password + "]";
|
714 |
return "UserModel [mobile=" + mobile + ", password=" + password + "]";
|
| 695 |
}
|
715 |
}
|
| Line 707... |
Line 727... |
| 707 |
}
|
727 |
}
|
| 708 |
|
728 |
|
| 709 |
public void setPassword(String password) {
|
729 |
public void setPassword(String password) {
|
| 710 |
this.password = password;
|
730 |
this.password = password;
|
| 711 |
}
|
731 |
}
|
| 712 |
|
- |
|
| 713 |
public String getFirstName() {
|
- |
|
| 714 |
return firstName;
|
- |
|
| 715 |
}
|
- |
|
| 716 |
|
- |
|
| 717 |
public void setFirstName(String firstName) {
|
- |
|
| 718 |
this.firstName = firstName;
|
- |
|
| 719 |
}
|
- |
|
| 720 |
|
- |
|
| 721 |
public String getLastName() {
|
- |
|
| 722 |
return lastName;
|
- |
|
| 723 |
}
|
- |
|
| 724 |
|
- |
|
| 725 |
public void setLastName(String lastName) {
|
- |
|
| 726 |
this.lastName = lastName;
|
- |
|
| 727 |
}
|
- |
|
| 728 |
|
- |
|
| 729 |
public String getEmail() {
|
- |
|
| 730 |
return email;
|
- |
|
| 731 |
}
|
- |
|
| 732 |
|
- |
|
| 733 |
public void setEmail(String email) {
|
- |
|
| 734 |
this.email = email;
|
- |
|
| 735 |
}
|
- |
|
| 736 |
|
- |
|
| 737 |
}
|
732 |
}
|
| 738 |
|
733 |
|
| 739 |
class CustomerModel {
|
734 |
class CustomerModel {
|
| 740 |
|
735 |
|
| 741 |
@JsonProperty(required = false)
|
736 |
@JsonProperty(required = false)
|