| Line 30... |
Line 30... |
| 30 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
30 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 31 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 33 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
33 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
34 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| - |
|
35 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
36 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 36 |
import com.spice.profitmandi.service.CustomerService;
|
37 |
import com.spice.profitmandi.service.CustomerService;
|
| 37 |
import com.spice.profitmandi.service.EmailService;
|
38 |
import com.spice.profitmandi.service.EmailService;
|
| 38 |
import com.spice.profitmandi.service.NotificationService;
|
39 |
import com.spice.profitmandi.service.NotificationService;
|
| 39 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
40 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| Line 42... |
Line 43... |
| 42 |
import com.spice.profitmandi.service.inventory.*;
|
43 |
import com.spice.profitmandi.service.inventory.*;
|
| 43 |
import com.spice.profitmandi.service.order.OrderService;
|
44 |
import com.spice.profitmandi.service.order.OrderService;
|
| 44 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
45 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 45 |
import com.spice.profitmandi.service.user.RetailerService;
|
46 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 46 |
import com.spice.profitmandi.dao.service.OtpProcessor;
|
47 |
import com.spice.profitmandi.dao.service.OtpProcessor;
|
| - |
|
48 |
import com.spice.profitmandi.web.req.Address;
|
| 47 |
import com.spice.profitmandi.web.res.DealBrands;
|
49 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 48 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
50 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 49 |
import com.spice.profitmandi.web.res.DealsResponse;
|
51 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 50 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
52 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| 51 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
53 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
| Line 329... |
Line 331... |
| 329 |
return responseSender.ok(false);
|
331 |
return responseSender.ok(false);
|
| 330 |
}
|
332 |
}
|
| 331 |
}
|
333 |
}
|
| 332 |
|
334 |
|
| 333 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
335 |
@RequestMapping(value = "/store/resetPassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 334 |
public ResponseEntity<?> resetPassword(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
336 |
public ResponseEntity<?> resetPassword(@RequestBody UserModel userModel) throws Exception {
|
| 335 |
customerService.changePassword(userModel.getMobile(), userModel.getPassword());
|
337 |
customerService.resetPassword(userModel.getMobile(), userModel.getPassword());
|
| 336 |
return responseSender.ok(true);
|
338 |
return responseSender.ok(true);
|
| 337 |
}
|
339 |
}
|
| - |
|
340 |
@RequestMapping(value = "/store/changePassword", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
341 |
public ResponseEntity<?> changePassword(@RequestBody UserModel userModel) throws Exception {
|
| - |
|
342 |
logger.info("UserModel - "+userModel);
|
| - |
|
343 |
if(customerService.changePassword(userModel.getMobile(), userModel.getOldPassword(),userModel.getPassword())) {
|
| - |
|
344 |
return responseSender.ok(true);
|
| - |
|
345 |
}
|
| - |
|
346 |
else {
|
| - |
|
347 |
throw new ProfitMandiBusinessException("error", "", "Error while changing the password ");
|
| - |
|
348 |
}
|
| - |
|
349 |
}
|
| 338 |
|
350 |
|
| 339 |
@RequestMapping(value = "/store/register", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
351 |
@RequestMapping(value = "/store/register", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 340 |
public ResponseEntity<?> register(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
352 |
public ResponseEntity<?> register(HttpServletRequest request, @RequestBody UserModel userModel) throws Exception {
|
| 341 |
Customer customer = new Customer();
|
353 |
Customer customer = new Customer();
|
| 342 |
customer.setPassword(userModel.getPassword());
|
354 |
customer.setPassword(userModel.getPassword());
|
| Line 485... |
Line 497... |
| 485 |
|
497 |
|
| 486 |
}
|
498 |
}
|
| 487 |
return responseSender.ok(returnMap);
|
499 |
return responseSender.ok(returnMap);
|
| 488 |
|
500 |
|
| 489 |
}
|
501 |
}
|
| 490 |
|
- |
|
| 491 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
502 |
@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 492 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
503 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 493 |
@ApiOperation(value = "Get brand list and count for category")
|
504 |
@ApiOperation(value = "Get brand list and count for category")
|
| 494 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
505 |
public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
|
| 495 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
506 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| Line 497... |
Line 508... |
| 497 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
|
508 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
|
| 498 |
|
509 |
|
| 499 |
return responseSender.ok(customRetailer.getAddress());
|
510 |
return responseSender.ok(customRetailer.getAddress());
|
| 500 |
|
511 |
|
| 501 |
}
|
512 |
}
|
| - |
|
513 |
@RequestMapping(value = "/store/address/defaultAddress/{addressId}/{customerId}", method = RequestMethod.POST)
|
| - |
|
514 |
@ApiImplicitParams({
|
| - |
|
515 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")
|
| - |
|
516 |
})
|
| - |
|
517 |
@ApiOperation(value = "Set default address for a store")
|
| - |
|
518 |
public ResponseEntity<?> setDefaultAddress(HttpServletRequest request,@PathVariable int addressId, @PathVariable int customerId) throws Exception {
|
| - |
|
519 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
520 |
CustomerAddress defaultAddress;
|
| - |
|
521 |
try {
|
| - |
|
522 |
defaultAddress = customerAddressRepository.selectById(addressId);
|
| - |
|
523 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
524 |
return responseSender.badRequest("Address not found.");
|
| - |
|
525 |
}
|
| - |
|
526 |
logger.info("CustomerID: {}", customerId);
|
| - |
|
527 |
List<CustomerAddress> customerAddresses = customerAddressRepository.selectByActiveCustomerId(customerId);
|
| - |
|
528 |
logger.info("customerAddresses: {}", customerAddresses);
|
| - |
|
529 |
for (CustomerAddress addr : customerAddresses) {
|
| - |
|
530 |
if (addr.getDefault()) {
|
| - |
|
531 |
addr.setDefault(false);
|
| - |
|
532 |
}
|
| - |
|
533 |
}
|
| - |
|
534 |
defaultAddress.setDefault(true);
|
| - |
|
535 |
return responseSender.ok("Default address updated successfully.");
|
| - |
|
536 |
}
|
| - |
|
537 |
|
| 502 |
|
538 |
|
| 503 |
@RequestMapping(value = "/store/address/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
539 |
@RequestMapping(value = "/store/address/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 504 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
540 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 505 |
@ApiOperation(value = "Get brand list and count for category")
|
541 |
@ApiOperation(value = "Get brand list and count for category")
|
| 506 |
public ResponseEntity<?> getStoresByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
|
542 |
public ResponseEntity<?> getStoresByPincode(HttpServletRequest request, @PathVariable String pincode) throws Exception {
|