| Line 383... |
Line 383... |
| 383 |
retailer.setType(RetailerType.UNREGISTERED_SHOP);
|
383 |
retailer.setType(RetailerType.UNREGISTERED_SHOP);
|
| 384 |
}else{
|
384 |
}else{
|
| 385 |
retailer.setType(RetailerType.GSTIN);
|
385 |
retailer.setType(RetailerType.GSTIN);
|
| 386 |
}
|
386 |
}
|
| 387 |
if(updateRetailerRequest.getDocumentId() > 0){
|
387 |
if(updateRetailerRequest.getDocumentId() > 0){
|
| 388 |
if(retailer.getDocumentId() != null) {
|
388 |
if(retailer.getDocumentId() != null && retailer.getDocumentId() != updateRetailerRequest.getDocumentId()) {
|
| 389 |
documentRepository.deleteById(retailer.getDocumentId());
|
389 |
documentRepository.deleteById(retailer.getDocumentId());
|
| - |
|
390 |
retailer.setDocumentId(updateRetailerRequest.getDocumentId());
|
| - |
|
391 |
documentRepository.markDocumentAsPersisted(updateRetailerRequest.getDocumentId());
|
| 390 |
}
|
392 |
}
|
| 391 |
retailer.setDocumentId(updateRetailerRequest.getDocumentId());
|
- |
|
| 392 |
documentRepository.markDocumentAsPersisted(updateRetailerRequest.getDocumentId());
|
- |
|
| 393 |
}
|
393 |
}
|
| 394 |
retailerRepository.persist(retailer);
|
394 |
retailerRepository.persist(retailer);
|
| 395 |
return retailer;
|
395 |
return retailer;
|
| 396 |
}
|
396 |
}
|
| 397 |
|
397 |
|
| Line 529... |
Line 529... |
| 529 |
|
529 |
|
| 530 |
private void createOrUpdateShop(Shop shop, CustomShop customShop, int retailerId, Address sameAsRetailerAddressValue) throws ProfitMandiBusinessException{
|
530 |
private void createOrUpdateShop(Shop shop, CustomShop customShop, int retailerId, Address sameAsRetailerAddressValue) throws ProfitMandiBusinessException{
|
| 531 |
shop.setRetailerId(retailerId);
|
531 |
shop.setRetailerId(retailerId);
|
| 532 |
shop.setName(customShop.getName());
|
532 |
shop.setName(customShop.getName());
|
| 533 |
if(customShop.getDocumentId() > 0){
|
533 |
if(customShop.getDocumentId() > 0){
|
| 534 |
if(shop.getDocumentId() != null) {
|
534 |
if(shop.getDocumentId() != null && shop.getDocumentId() != customShop.getDocumentId()) {
|
| 535 |
documentRepository.deleteById(shop.getDocumentId());
|
535 |
documentRepository.deleteById(shop.getDocumentId());
|
| - |
|
536 |
shop.setDocumentId(customShop.getDocumentId());
|
| - |
|
537 |
documentRepository.markDocumentAsPersisted(customShop.getDocumentId());
|
| 536 |
}
|
538 |
}
|
| 537 |
shop.setDocumentId(customShop.getDocumentId());
|
- |
|
| 538 |
documentRepository.markDocumentAsPersisted(customShop.getDocumentId());
|
- |
|
| - |
|
539 |
|
| 539 |
}
|
540 |
}
|
| 540 |
if(shop.getAddressId() == null){
|
541 |
if(shop.getAddressId() == null){
|
| 541 |
Address address = null;
|
542 |
Address address = null;
|
| 542 |
if(customShop.isSameAsRetailerAddress()){
|
543 |
if(customShop.isSameAsRetailerAddress()){
|
| 543 |
address = sameAsRetailerAddressValue;
|
544 |
address = sameAsRetailerAddressValue;
|