| Line 33... |
Line 33... |
| 33 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 34 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
34 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
35 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
36 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
37 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.webRepository.NavBarRepository;
|
- |
|
| 39 |
import com.spice.profitmandi.service.CustomerService;
|
38 |
import com.spice.profitmandi.service.CustomerService;
|
| 40 |
import com.spice.profitmandi.service.EmailService;
|
39 |
import com.spice.profitmandi.service.EmailService;
|
| 41 |
import com.spice.profitmandi.service.NotificationService;
|
40 |
import com.spice.profitmandi.service.NotificationService;
|
| 42 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
41 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 43 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
42 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| Line 54... |
Line 53... |
| 54 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
53 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| 55 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
54 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
| 56 |
import io.swagger.annotations.ApiImplicitParam;
|
55 |
import io.swagger.annotations.ApiImplicitParam;
|
| 57 |
import io.swagger.annotations.ApiImplicitParams;
|
56 |
import io.swagger.annotations.ApiImplicitParams;
|
| 58 |
import io.swagger.annotations.ApiOperation;
|
57 |
import io.swagger.annotations.ApiOperation;
|
| - |
|
58 |
import org.apache.commons.lang.ObjectUtils;
|
| 59 |
import org.apache.commons.lang3.StringUtils;
|
59 |
import org.apache.commons.lang3.StringUtils;
|
| 60 |
import org.apache.http.conn.HttpHostConnectException;
|
60 |
import org.apache.http.conn.HttpHostConnectException;
|
| 61 |
import org.apache.logging.log4j.LogManager;
|
61 |
import org.apache.logging.log4j.LogManager;
|
| 62 |
import org.apache.logging.log4j.Logger;
|
62 |
import org.apache.logging.log4j.Logger;
|
| 63 |
import org.json.JSONArray;
|
63 |
import org.json.JSONArray;
|
| Line 337... |
Line 337... |
| 337 |
}
|
337 |
}
|
| 338 |
}
|
338 |
}
|
| 339 |
|
339 |
|
| 340 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
340 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 341 |
public ResponseEntity<?> resetPassword(@RequestBody UserModel userModel) throws Exception {
|
341 |
public ResponseEntity<?> resetPassword(@RequestBody UserModel userModel) throws Exception {
|
| - |
|
342 |
if ((userModel.getMobile() == null || userModel.getMobile().isEmpty()) && (userModel.getPassword() == null || userModel.getPassword().isEmpty())) {
|
| - |
|
343 |
throw new ProfitMandiBusinessException("error", "", "all field are required");
|
| - |
|
344 |
}
|
| - |
|
345 |
try{
|
| 342 |
customerService.resetPassword(userModel.getMobile(), userModel.getPassword());
|
346 |
customerService.resetPassword(userModel.getMobile(), userModel.getPassword());
|
| - |
|
347 |
}
|
| - |
|
348 |
catch (ProfitMandiBusinessException p){
|
| - |
|
349 |
throw new ProfitMandiBusinessException("error", "", "An error occurred while resetting password");
|
| - |
|
350 |
}
|
| - |
|
351 |
|
| 343 |
return responseSender.ok(true);
|
352 |
return responseSender.ok(true);
|
| 344 |
}
|
353 |
}
|
| 345 |
|
354 |
|
| 346 |
@RequestMapping(value = "/store/changePassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
355 |
@RequestMapping(value = "/store/changePassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 347 |
public ResponseEntity<?> changePassword(@RequestBody UserModel userModel) throws Exception {
|
356 |
public ResponseEntity<?> changePassword(@RequestBody UserModel userModel) throws Exception {
|
| 348 |
logger.info("UserModel - " + userModel);
|
357 |
logger.info("UserModel - "+userModel);
|
| 349 |
if (customerService.changePassword(userModel.getMobile(), userModel.getOldPassword(), userModel.getPassword())) {
|
358 |
if ((userModel.getOldPassword() == null || userModel.getOldPassword().isEmpty()) && (userModel.getMobile() == null || userModel.getMobile().isEmpty()) &&( userModel.getPassword() == null || userModel.getPassword().isEmpty())) {
|
| 350 |
return responseSender.ok(true);
|
- |
|
| 351 |
} else {
|
- |
|
| 352 |
throw new ProfitMandiBusinessException("error", "", "Error while changing the password ");
|
359 |
throw new ProfitMandiBusinessException("error", "", "all fields are required");
|
| 353 |
}
|
360 |
}
|
| - |
|
361 |
try{
|
| - |
|
362 |
customerService.changePassword(userModel.getMobile(), userModel.getOldPassword(),userModel.getPassword());
|
| - |
|
363 |
}
|
| - |
|
364 |
catch (ProfitMandiBusinessException p){
|
| - |
|
365 |
throw new ProfitMandiBusinessException("error", "", "An error occurred while changing password");
|
| - |
|
366 |
}
|
| - |
|
367 |
return responseSender.ok(true);
|
| 354 |
}
|
368 |
}
|
| 355 |
|
369 |
|
| 356 |
@RequestMapping(value = "/store/register", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
370 |
@RequestMapping(value = "/store/register", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 357 |
public ResponseEntity<?> register(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
371 |
public ResponseEntity<?> register(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
| 358 |
Customer customer = new Customer();
|
372 |
Customer customer = new Customer();
|
| Line 391... |
Line 405... |
| 391 |
try {
|
405 |
try {
|
| 392 |
Map<String, List<MobileInsurancePlan>> productDurationPlans = insuranceService.getAllPlans(itemId, sellingPrice, true);
|
406 |
Map<String, List<MobileInsurancePlan>> productDurationPlans = insuranceService.getAllPlans(itemId, sellingPrice, true);
|
| 393 |
return productDurationPlans;
|
407 |
return productDurationPlans;
|
| 394 |
} catch (Exception e) {
|
408 |
} catch (Exception e) {
|
| 395 |
logger.info(e, e);
|
409 |
logger.info(e, e);
|
| 396 |
throw new ProfitMandiBusinessException("Fetch Insurance Plans", "Insurance",
|
410 |
throw new ProfitMandiBusinessException("Fetch Insurance Plans", "Insurance", "Could not fetch insurance Plans");
|
| 397 |
"Could not fetch insurance Plans");
|
- |
|
| 398 |
}
|
411 |
}
|
| 399 |
|
412 |
|
| 400 |
}
|
413 |
}
|
| 401 |
|
414 |
|
| 402 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
415 |
@RequestMapping(value = "/store/confirmOrder", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 503... |
Line 516... |
| 503 |
|
516 |
|
| 504 |
}
|
517 |
}
|
| 505 |
return responseSender.ok(returnMap);
|
518 |
return responseSender.ok(returnMap);
|
| 506 |
|
519 |
|
| 507 |
}
|
520 |
}
|
| 508 |
|
- |
|
| 509 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
521 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 510 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
522 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 511 |
@ApiOperation(value = "Get brand list and count for category")
|
523 |
@ApiOperation(value = "Get brand list and count for category")
|
| 512 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
524 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
| 513 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
525 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| Line 515... |
Line 527... |
| 515 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
|
527 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
|
| 516 |
|
528 |
|
| 517 |
return responseSender.ok(customRetailer.getAddress());
|
529 |
return responseSender.ok(customRetailer.getAddress());
|
| 518 |
|
530 |
|
| 519 |
}
|
531 |
}
|
| 520 |
|
- |
|
| 521 |
@RequestMapping(value = "/store/address/defaultAddress/{addressId}/{customerId}", method = RequestMethod.POST)
|
532 |
@RequestMapping(value = "/store/address/defaultAddress/{addressId}/{customerId}", method = RequestMethod.POST)
|
| 522 |
@ApiImplicitParams({
|
533 |
@ApiImplicitParams({
|
| 523 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")
|
534 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")
|
| 524 |
})
|
535 |
})
|
| 525 |
@ApiOperation(value = "Set default address for a store")
|
536 |
@ApiOperation(value = "Set default address for a store")
|
| 526 |
public ResponseEntity<?> setDefaultAddress(HttpServletRequest request, @PathVariable int addressId, @PathVariable int customerId) throws Exception {
|
537 |
public ResponseEntity<?> setDefaultAddress(HttpServletRequest request,@PathVariable int addressId, @PathVariable int customerId) throws Exception {
|
| 527 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
538 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 528 |
CustomerAddress defaultAddress;
|
539 |
CustomerAddress defaultAddress;
|
| 529 |
try {
|
540 |
try {
|
| 530 |
defaultAddress = customerAddressRepository.selectById(addressId);
|
541 |
defaultAddress = customerAddressRepository.selectById(addressId);
|
| 531 |
} catch (ProfitMandiBusinessException e) {
|
542 |
} catch (ProfitMandiBusinessException e) {
|
| Line 875... |
Line 886... |
| 875 |
cashback = cashback == null ? 0 : cashback;
|
886 |
cashback = cashback == null ? 0 : cashback;
|
| 876 |
float itemSellingPrice = tagListing.getMop() - cashback;
|
887 |
float itemSellingPrice = tagListing.getMop() - cashback;
|
| 877 |
CartItemResponseModel cartItemResponseModel = new CartItemResponseModel();
|
888 |
CartItemResponseModel cartItemResponseModel = new CartItemResponseModel();
|
| 878 |
cartItemResponseModel.setSellingPrice(cartItem.getSellingPrice());
|
889 |
cartItemResponseModel.setSellingPrice(cartItem.getSellingPrice());
|
| 879 |
cartItemResponseModel.setPendingOrderItemPolicyPlan(cartItem.getPendingOrderItemPolicyPlan());
|
890 |
cartItemResponseModel.setPendingOrderItemPolicyPlan(cartItem.getPendingOrderItemPolicyPlan());
|
| 880 |
logger.info("itemSellingPrice: {}", itemSellingPrice);
|
891 |
logger.info("itemSellingPrice: {}",itemSellingPrice);
|
| 881 |
logger.info("cartItem: {}", cartItem.getSellingPrice());
|
892 |
logger.info("cartItem: {}",cartItem.getSellingPrice());
|
| 882 |
logger.info("cashback: {}", cashback);
|
893 |
logger.info("cashback: {}",cashback);
|
| 883 |
if (itemSellingPrice != cartItem.getSellingPrice()) {
|
894 |
if (itemSellingPrice != cartItem.getSellingPrice()) {
|
| 884 |
itemMsg.setType("price");
|
895 |
itemMsg.setType("price");
|
| 885 |
itemMsg.setMessageText("Price has changed to " + itemSellingPrice);
|
896 |
itemMsg.setMessageText("Price has changed to "+itemSellingPrice);
|
| 886 |
cartItemResponseModel.setSellingPrice(itemSellingPrice);
|
897 |
cartItemResponseModel.setSellingPrice(itemSellingPrice);
|
| 887 |
cartMessageChanged++;
|
898 |
cartMessageChanged++;
|
| 888 |
}
|
899 |
}
|
| 889 |
int estimate = -2;
|
900 |
int estimate = -2;
|
| 890 |
LocalDateTime promiseDeliveryTime = LocalDateTime.now();
|
901 |
LocalDateTime promiseDeliveryTime = LocalDateTime.now();
|
| 891 |
int qtyRequired = (int) cartItem.getQuantity();
|
902 |
int qtyRequired = (int) cartItem.getQuantity();
|
| 892 |
AvailabilityModel availabilityModel = inventoryItemAvailabilityMap.get(cartItem.getItemId());
|
903 |
AvailabilityModel availabilityModel = inventoryItemAvailabilityMap.get(cartItem.getItemId());
|
| 893 |
cartItemResponseModel.setMaxQuantity(availabilityModel.getMaxAvailability());
|
904 |
cartItemResponseModel.setMaxQuantity(availabilityModel.getMaxAvailability());
|
| 894 |
if (availabilityModel.getStoreAvailability() >= qtyRequired) {
|
905 |
if (availabilityModel.getStoreAvailability() >= qtyRequired) {
|
| 895 |
itemMsg.setType("estimate0");
|
906 |
itemMsg.setType("estimate0");
|
| 896 |
itemMsg.setMessageText("Store availability is " + availabilityModel.getStoreAvailability());
|
907 |
itemMsg.setMessageText("Store availability is "+ availabilityModel.getStoreAvailability());
|
| 897 |
estimate = 0;
|
908 |
estimate = 0;
|
| 898 |
} else if (availabilityModel.getWarehouseAvailability() >= qtyRequired) {
|
909 |
} else if (availabilityModel.getWarehouseAvailability() >= qtyRequired) {
|
| 899 |
itemMsg.setType("estimate2");
|
910 |
itemMsg.setType("estimate2");
|
| 900 |
itemMsg.setMessageText("Store availability is " + availabilityModel.getWarehouseAvailability());
|
911 |
itemMsg.setMessageText("Store availability is "+ availabilityModel.getWarehouseAvailability());
|
| 901 |
estimate = 2;
|
912 |
estimate = 2;
|
| 902 |
} else if (availabilityModel.getStoreAvailability() > 0) {
|
913 |
} else if (availabilityModel.getStoreAvailability() > 0) {
|
| 903 |
estimate = 0;
|
914 |
estimate = 0;
|
| 904 |
qtyRequired = availabilityModel.getStoreAvailability();
|
915 |
qtyRequired = availabilityModel.getStoreAvailability();
|
| 905 |
cartMessageChanged++;
|
916 |
cartMessageChanged++;
|
| 906 |
itemMsg.setType("quantity0");
|
917 |
itemMsg.setType("quantity0");
|
| 907 |
itemMsg.setMessageText("quantity is updated " + qtyRequired);
|
918 |
itemMsg.setMessageText("quantity is updated "+qtyRequired);
|
| 908 |
} else if (availabilityModel.getWarehouseAvailability() > 0) {
|
919 |
} else if (availabilityModel.getWarehouseAvailability() > 0) {
|
| 909 |
qtyRequired = availabilityModel.getWarehouseAvailability();
|
920 |
qtyRequired = availabilityModel.getWarehouseAvailability();
|
| 910 |
estimate = 2;
|
921 |
estimate = 2;
|
| 911 |
cartMessageChanged++;
|
922 |
cartMessageChanged++;
|
| 912 |
itemMsg.setType("quantity2");
|
923 |
itemMsg.setType("quantity2");
|
| 913 |
itemMsg.setMessageText("quantity is updated " + qtyRequired);
|
924 |
itemMsg.setMessageText("quantity is updated "+qtyRequired);
|
| 914 |
} else {
|
925 |
} else {
|
| 915 |
qtyRequired = 0;
|
926 |
qtyRequired = 0;
|
| 916 |
cartMessageChanged++;
|
927 |
cartMessageChanged++;
|
| 917 |
itemMsg.setType("item");
|
928 |
itemMsg.setType("item");
|
| 918 |
itemMsg.setMessageText(item.getItemDescriptionNoColor() + " is out of stock");
|
929 |
itemMsg.setMessageText(item.getItemDescriptionNoColor() + " is out of stock");
|
| Line 956... |
Line 967... |
| 956 |
|
967 |
|
| 957 |
}
|
968 |
}
|
| 958 |
|
969 |
|
| 959 |
@RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
970 |
@RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 960 |
public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
|
971 |
public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
|
| 961 |
@RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
|
972 |
@RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
|
| 962 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
|
973 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
|
| 963 |
@RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
|
974 |
@RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
|
| 964 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
975 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 965 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
976 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 966 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
977 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 967 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
978 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| 968 |
dealResponse = this.getCatalogResponse(
|
979 |
dealResponse = this.getCatalogResponse(
|