| Line 14... |
Line 14... |
| 14 |
import java.util.Random;
|
14 |
import java.util.Random;
|
| 15 |
import java.util.Set;
|
15 |
import java.util.Set;
|
| 16 |
import java.util.function.Function;
|
16 |
import java.util.function.Function;
|
| 17 |
import java.util.stream.Collectors;
|
17 |
import java.util.stream.Collectors;
|
| 18 |
|
18 |
|
| 19 |
import org.json.JSONObject;
|
- |
|
| 20 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 21 |
import org.apache.logging.log4j.LogManager;
|
19 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
20 |
import org.apache.logging.log4j.Logger;
|
| - |
|
21 |
import org.json.JSONObject;
|
| 22 |
import org.springframework.beans.factory.annotation.Autowired;
|
22 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23 |
import org.springframework.stereotype.Component;
|
23 |
import org.springframework.stereotype.Component;
|
| 24 |
|
24 |
|
| 25 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
25 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
| - |
|
26 |
import com.spice.profitmandi.common.enumuration.PurchaseReturnStatus;
|
| 26 |
import com.spice.profitmandi.common.enumuration.SearchType;
|
27 |
import com.spice.profitmandi.common.enumuration.SearchType;
|
| 27 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
28 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
29 |
import com.spice.profitmandi.common.model.BadReturnRequest;
|
| 28 |
import com.spice.profitmandi.common.model.CartFofo;
|
30 |
import com.spice.profitmandi.common.model.CartFofo;
|
| 29 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
31 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
| - |
|
32 |
import com.spice.profitmandi.common.model.CreditNotePdfModel;
|
| 30 |
import com.spice.profitmandi.common.model.CustomAddress;
|
33 |
import com.spice.profitmandi.common.model.CustomAddress;
|
| 31 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
34 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
| 32 |
import com.spice.profitmandi.common.model.CustomFofoOrderItem;
|
35 |
import com.spice.profitmandi.common.model.CustomFofoOrderItem;
|
| 33 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
36 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
| 34 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
37 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
| 35 |
import com.spice.profitmandi.common.model.CustomPaymentOption;
|
38 |
import com.spice.profitmandi.common.model.CustomPaymentOption;
|
| 36 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
39 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| - |
|
40 |
import com.spice.profitmandi.common.model.FoiBadReturnRequest;
|
| 37 |
import com.spice.profitmandi.common.model.GadgetCopsInsuranceModel;
|
41 |
import com.spice.profitmandi.common.model.GadgetCopsInsuranceModel;
|
| 38 |
import com.spice.profitmandi.common.model.GstRate;
|
42 |
import com.spice.profitmandi.common.model.GstRate;
|
| 39 |
import com.spice.profitmandi.common.model.ItemIdQuantityAvailability;
|
43 |
import com.spice.profitmandi.common.model.ItemIdQuantityAvailability;
|
| 40 |
import com.spice.profitmandi.common.model.PdfModel;
|
44 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 41 |
import com.spice.profitmandi.common.model.PriceModel;
|
45 |
import com.spice.profitmandi.common.model.PriceModel;
|
| Line 55... |
Line 59... |
| 55 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
59 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 56 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
60 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
| - |
|
64 |
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
69 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.InvoiceNumberGenerationSequence;
|
70 |
import com.spice.profitmandi.dao.entity.fofo.InvoiceNumberGenerationSequence;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingListing;
|
71 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingListing;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrder;
|
72 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrder;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrderItem;
|
73 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrderItem;
|
| - |
|
74 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
75 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 70 |
import com.spice.profitmandi.dao.entity.user.Address;
|
76 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 71 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
77 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
| 72 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
78 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
| 73 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
79 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| Line 1478... |
Line 1484... |
| 1478 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
1484 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
| 1479 |
this.setCustomerAddress(customerAddress, customCustomer.getAddress());
|
1485 |
this.setCustomerAddress(customerAddress, customCustomer.getAddress());
|
| 1480 |
customerAddressRepository.persist(customerAddress);
|
1486 |
customerAddressRepository.persist(customerAddress);
|
| 1481 |
}
|
1487 |
}
|
| 1482 |
|
1488 |
|
| - |
|
1489 |
@Override
|
| - |
|
1490 |
public void badReturn(int fofoId, FoiBadReturnRequest foiBadReturnRequest) throws ProfitMandiBusinessException{
|
| - |
|
1491 |
FofoOrderItem foi = fofoOrderItemRepository.selectById(foiBadReturnRequest.getFoiId());
|
| - |
|
1492 |
if(fofoOrderRepository.selectByOrderId(foi.getOrderId()).getFofoId()==fofoId) {
|
| - |
|
1493 |
throw new ProfitMandiBusinessException("Partner Auth", "", "Invalid Order");
|
| - |
|
1494 |
}
|
| - |
|
1495 |
for (BadReturnRequest badReturnRequest : foiBadReturnRequest.getBadReturnArr()) {
|
| - |
|
1496 |
badReturnRequest.getInventoryItemId();
|
| - |
|
1497 |
badReturnRequest.getRemarks();
|
| - |
|
1498 |
|
| - |
|
1499 |
}
|
| - |
|
1500 |
|
| - |
|
1501 |
}
|
| - |
|
1502 |
|
| - |
|
1503 |
/*private CreditNotePdfModel generateCreditNote(FofoOrder fofoOrder, List<InventoryItem> inventoryItems,
|
| - |
|
1504 |
CustomRetailer customRetailer, CustomCustomer customCustomer) throws Exception {
|
| - |
|
1505 |
|
| - |
|
1506 |
InvoiceNumberGenerationSequence sequence = invoiceNumberGenerationSequenceRepository
|
| - |
|
1507 |
.selectByFofoId(purchase.getFofoId());
|
| - |
|
1508 |
sequence.setReturnSequence(sequence.getReturnSequence() + 1);
|
| - |
|
1509 |
invoiceNumberGenerationSequenceRepository.persist(sequence);
|
| - |
|
1510 |
String debitNoteNumber = sequence.getPrefix() + "/" + sequence.getReturnSequence();
|
| - |
|
1511 |
|
| - |
|
1512 |
DebitNote debitNote = new DebitNote();
|
| - |
|
1513 |
debitNote.setDebitNoteNumber(debitNoteNumber);
|
| - |
|
1514 |
debitNote.setFofoId(purchase.getFofoId());
|
| - |
|
1515 |
debitNoteRepository.persist(debitNote);
|
| - |
|
1516 |
|
| - |
|
1517 |
for (InventoryItem inventoryItem : inventoryItems) {
|
| - |
|
1518 |
PurchaseReturnItem purchaseReturnItem = purchaseReturnItemRepository
|
| - |
|
1519 |
.selectByInventoryItemId(inventoryItem.getId());
|
| - |
|
1520 |
purchaseReturnItem.setStatus(PurchaseReturnStatus.DEBIT_NOTE_CREATED);
|
| - |
|
1521 |
purchaseReturnItem.setDebitNoteId(debitNote.getId());
|
| - |
|
1522 |
purchaseReturnItemRepository.persist(purchaseReturnItem);
|
| - |
|
1523 |
}
|
| - |
|
1524 |
this.returnInventoryItems(inventoryItems, debitNote);
|
| - |
|
1525 |
|
| - |
|
1526 |
return getDebitNotePdfModel(debitNote, inventoryItems);
|
| - |
|
1527 |
}*/
|
| - |
|
1528 |
|
| 1483 |
}
|
1529 |
}
|