| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.order;
|
1 |
package com.spice.profitmandi.service.order;
|
| 2 |
|
2 |
|
| 3 |
import java.io.ByteArrayInputStream;
|
- |
|
| 4 |
import java.io.InputStream;
|
- |
|
| 5 |
import java.time.LocalDate;
|
- |
|
| 6 |
import java.time.LocalDateTime;
|
- |
|
| 7 |
import java.time.LocalTime;
|
- |
|
| 8 |
import java.util.AbstractMap.SimpleEntry;
|
- |
|
| 9 |
import java.util.ArrayList;
|
- |
|
| 10 |
import java.util.Arrays;
|
- |
|
| 11 |
import java.util.HashMap;
|
- |
|
| 12 |
import java.util.HashSet;
|
- |
|
| 13 |
import java.util.Iterator;
|
- |
|
| 14 |
import java.util.List;
|
- |
|
| 15 |
import java.util.Map;
|
- |
|
| 16 |
import java.util.Optional;
|
- |
|
| 17 |
import java.util.Random;
|
- |
|
| 18 |
import java.util.Set;
|
- |
|
| 19 |
import java.util.function.Function;
|
- |
|
| 20 |
import java.util.stream.Collectors;
|
- |
|
| 21 |
|
- |
|
| 22 |
import javax.persistence.criteria.CriteriaBuilder;
|
- |
|
| 23 |
import javax.persistence.criteria.CriteriaQuery;
|
- |
|
| 24 |
import javax.persistence.criteria.Predicate;
|
- |
|
| 25 |
import javax.persistence.criteria.Root;
|
- |
|
| 26 |
|
- |
|
| 27 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 28 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 29 |
import org.hibernate.Session;
|
- |
|
| 30 |
import org.hibernate.SessionFactory;
|
- |
|
| 31 |
import org.json.JSONObject;
|
- |
|
| 32 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 33 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 34 |
import org.springframework.beans.factory.annotation.Value;
|
- |
|
| 35 |
import org.springframework.cache.annotation.Cacheable;
|
- |
|
| 36 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 37 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 38 |
import org.springframework.http.HttpStatus;
|
- |
|
| 39 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 40 |
import org.springframework.stereotype.Component;
|
- |
|
| 41 |
|
- |
|
| 42 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
3 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 43 |
import com.spice.profitmandi.common.enumuration.SearchType;
|
4 |
import com.spice.profitmandi.common.enumuration.SearchType;
|
| 44 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 45 |
import com.spice.profitmandi.common.model.BadReturnRequest;
|
- |
|
| 46 |
import com.spice.profitmandi.common.model.CartFofo;
|
- |
|
| 47 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
- |
|
| 48 |
import com.spice.profitmandi.common.model.CreditNotePdfModel;
|
- |
|
| 49 |
import com.spice.profitmandi.common.model.CustomAddress;
|
- |
|
| 50 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
- |
|
| 51 |
import com.spice.profitmandi.common.model.CustomFofoOrderItem;
|
- |
|
| 52 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
- |
|
| 53 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
- |
|
| 54 |
import com.spice.profitmandi.common.model.CustomPaymentOption;
|
- |
|
| 55 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
- |
|
| 56 |
import com.spice.profitmandi.common.model.FoiBadReturnRequest;
|
- |
|
| 57 |
import com.spice.profitmandi.common.model.GstRate;
|
6 |
import com.spice.profitmandi.common.model.*;
|
| 58 |
import com.spice.profitmandi.common.model.InsuranceModel;
|
- |
|
| 59 |
import com.spice.profitmandi.common.model.ItemIdQuantityAvailability;
|
- |
|
| 60 |
import com.spice.profitmandi.common.model.PdfModel;
|
- |
|
| 61 |
import com.spice.profitmandi.common.model.PriceModel;
|
- |
|
| 62 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 63 |
import com.spice.profitmandi.common.model.Quantity;
|
- |
|
| 64 |
import com.spice.profitmandi.common.model.SerialNumberDetail;
|
- |
|
| 65 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
7 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 66 |
import com.spice.profitmandi.common.util.StringUtils;
|
8 |
import com.spice.profitmandi.common.util.StringUtils;
|
| 67 |
import com.spice.profitmandi.common.util.Utils;
|
9 |
import com.spice.profitmandi.common.util.Utils;
|
| 68 |
import com.spice.profitmandi.common.web.client.RestClient;
|
10 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 69 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
11 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 70 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
12 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 71 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
- |
|
| 72 |
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
|
- |
|
| 73 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
- |
|
| 74 |
import com.spice.profitmandi.dao.entity.dtr.ScratchOffer;
|
- |
|
| 75 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
13 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
| 76 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
- |
|
| 77 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
14 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 78 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
- |
|
| 79 |
import com.spice.profitmandi.dao.entity.fofo.CustomerCreditNote;
|
- |
|
| 80 |
import com.spice.profitmandi.dao.entity.fofo.CustomerReturnItem;
|
- |
|
| 81 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
- |
|
| 82 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
- |
|
| 84 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
- |
|
| 85 |
import com.spice.profitmandi.dao.entity.fofo.HygieneData;
|
- |
|
| 86 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 87 |
import com.spice.profitmandi.dao.entity.fofo.InvoiceNumberGenerationSequence;
|
- |
|
| 88 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
- |
|
| 89 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
- |
|
| 90 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
- |
|
| 91 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.entity.inventory.State;
|
15 |
import com.spice.profitmandi.dao.entity.inventory.State;
|
| 93 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
16 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 94 |
import com.spice.profitmandi.dao.entity.user.Address;
|
17 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 95 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
18 |
import com.spice.profitmandi.dao.entity.user.Counter;
|
| 96 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
19 |
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
|
| Line 103... |
Line 26... |
| 103 |
import com.spice.profitmandi.dao.enumuration.inventory.ScratchedGift;
|
26 |
import com.spice.profitmandi.dao.enumuration.inventory.ScratchedGift;
|
| 104 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
27 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 105 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
28 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 106 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
29 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
30 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
- |
|
| 109 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
- |
|
| 110 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
- |
|
| 111 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 112 |
import com.spice.profitmandi.dao.repository.dtr.PaymentOptionTransactionRepository;
|
- |
|
| 113 |
import com.spice.profitmandi.dao.repository.dtr.PolicyNumberGenerationSequenceRepository;
|
- |
|
| 114 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
- |
|
| 115 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
- |
|
| 116 |
import com.spice.profitmandi.dao.repository.dtr.ScratchOfferRepository;
|
- |
|
| 117 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
- |
|
| 118 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 119 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
- |
|
| 120 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
- |
|
| 121 |
import com.spice.profitmandi.dao.repository.fofo.CustomerCreditNoteRepository;
|
- |
|
| 122 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
- |
|
| 123 |
import com.spice.profitmandi.dao.repository.fofo.CustomerReturnItemRepository;
|
- |
|
| 124 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
- |
|
| 125 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
- |
|
| 126 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
- |
|
| 127 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
- |
|
| 128 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 129 |
import com.spice.profitmandi.dao.repository.fofo.InvoiceNumberGenerationSequenceRepository;
|
- |
|
| 130 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
- |
|
| 131 |
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
|
- |
|
| 132 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
- |
|
| 133 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
- |
|
| 134 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
- |
|
| 135 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
- |
|
| 136 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
33 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| 137 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
34 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 138 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
35 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 139 |
import com.spice.profitmandi.dao.repository.user.CounterRepository;
|
36 |
import com.spice.profitmandi.dao.repository.user.CounterRepository;
|
| 140 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
|
37 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
|
| Line 146... |
Line 43... |
| 146 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
43 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
| 147 |
import com.spice.profitmandi.service.pricing.PricingService;
|
44 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 148 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
45 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 149 |
import com.spice.profitmandi.service.user.RetailerService;
|
46 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 150 |
import com.spice.profitmandi.service.wallet.WalletService;
|
47 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| - |
|
48 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
49 |
import org.apache.logging.log4j.Logger;
|
| - |
|
50 |
import org.hibernate.Session;
|
| - |
|
51 |
import org.hibernate.SessionFactory;
|
| - |
|
52 |
import org.json.JSONObject;
|
| - |
|
53 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
54 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
55 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
56 |
import org.springframework.cache.annotation.Cacheable;
|
| - |
|
57 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
58 |
import org.springframework.http.HttpHeaders;
|
| - |
|
59 |
import org.springframework.http.HttpStatus;
|
| - |
|
60 |
import org.springframework.http.ResponseEntity;
|
| - |
|
61 |
import org.springframework.stereotype.Component;
|
| - |
|
62 |
|
| - |
|
63 |
import javax.persistence.criteria.CriteriaBuilder;
|
| - |
|
64 |
import javax.persistence.criteria.CriteriaQuery;
|
| - |
|
65 |
import javax.persistence.criteria.Predicate;
|
| - |
|
66 |
import javax.persistence.criteria.Root;
|
| - |
|
67 |
import java.io.ByteArrayInputStream;
|
| - |
|
68 |
import java.io.InputStream;
|
| - |
|
69 |
import java.time.LocalDate;
|
| - |
|
70 |
import java.time.LocalDateTime;
|
| - |
|
71 |
import java.time.LocalTime;
|
| - |
|
72 |
import java.util.AbstractMap.SimpleEntry;
|
| - |
|
73 |
import java.util.*;
|
| - |
|
74 |
import java.util.function.Function;
|
| - |
|
75 |
import java.util.stream.Collectors;
|
| 151 |
|
76 |
|
| 152 |
@Component
|
77 |
@Component
|
| 153 |
public class OrderServiceImpl implements OrderService {
|
78 |
public class OrderServiceImpl implements OrderService {
|
| 154 |
|
79 |
|
| 155 |
private static final Logger LOGGER = LogManager.getLogger(OrderServiceImpl.class);
|
80 |
private static final Logger LOGGER = LogManager.getLogger(OrderServiceImpl.class);
|
| Line 723... |
Line 648... |
| 723 |
}
|
648 |
}
|
| 724 |
return serialNumbers;
|
649 |
return serialNumbers;
|
| 725 |
}
|
650 |
}
|
| 726 |
|
651 |
|
| 727 |
@Override
|
652 |
@Override
|
| 728 |
public PdfModel getInvoicePdfModel(int orderId) throws ProfitMandiBusinessException {
|
653 |
public InvoicePdfModel getInvoicePdfModel(int orderId) throws ProfitMandiBusinessException {
|
| 729 |
FofoOrder fofoOrder = fofoOrderRepository.selectByOrderId(orderId);
|
654 |
FofoOrder fofoOrder = fofoOrderRepository.selectByOrderId(orderId);
|
| 730 |
return this.getInvoicePdfModel(fofoOrder);
|
655 |
return this.getInvoicePdfModel(fofoOrder);
|
| 731 |
}
|
656 |
}
|
| 732 |
|
657 |
|
| 733 |
@Override
|
658 |
@Override
|
| 734 |
@Cacheable(value = "order.dummymodel", cacheManager = "oneDayCacheManager")
|
659 |
@Cacheable(value = "order.dummymodel", cacheManager = "oneDayCacheManager")
|
| 735 |
public PdfModel getDummyPdfModel(String serialNumber) throws ProfitMandiBusinessException {
|
660 |
public InvoicePdfModel getDummyPdfModel(String serialNumber) throws ProfitMandiBusinessException {
|
| 736 |
List<WarehouseInventoryItem> warehouseInventoryItems = warehouseInventoryItemRepository
|
661 |
List<WarehouseInventoryItem> warehouseInventoryItems = warehouseInventoryItemRepository
|
| 737 |
.selectWarehouseInventoryItemBySerailNumbers(Arrays.asList(serialNumber));
|
662 |
.selectWarehouseInventoryItemBySerailNumbers(Arrays.asList(serialNumber));
|
| 738 |
if (warehouseInventoryItems.size() > 0) {
|
663 |
if (warehouseInventoryItems.size() > 0) {
|
| 739 |
WarehouseInventoryItem warehouseInventoryItem = warehouseInventoryItems.get(0);
|
664 |
WarehouseInventoryItem warehouseInventoryItem = warehouseInventoryItems.get(0);
|
| 740 |
int currentQuantity = warehouseInventoryItems.get(0).getCurrentQuantity();
|
665 |
int currentQuantity = warehouseInventoryItems.get(0).getCurrentQuantity();
|
| Line 764... |
Line 689... |
| 764 |
} catch (Exception e) {
|
689 |
} catch (Exception e) {
|
| 765 |
int itemId = warehouseInventoryItem.getItemId();
|
690 |
int itemId = warehouseInventoryItem.getItemId();
|
| 766 |
if (serialNumberOrderIdMap.containsKey(serialNumber)) {
|
691 |
if (serialNumberOrderIdMap.containsKey(serialNumber)) {
|
| 767 |
FofoOrder fofoOrder = fofoOrderRepository
|
692 |
FofoOrder fofoOrder = fofoOrderRepository
|
| 768 |
.selectByOrderId(serialNumberOrderIdMap.get(serialNumber));
|
693 |
.selectByOrderId(serialNumberOrderIdMap.get(serialNumber));
|
| 769 |
PdfModel pdfModel = this.getInvoicePdfModel(fofoOrder.getId());
|
694 |
InvoicePdfModel pdfModel = this.getInvoicePdfModel(fofoOrder.getId());
|
| 770 |
this.modifyDummyModel(fofoOrder, pdfModel, itemId, serialNumber);
|
695 |
this.modifyDummyModel(fofoOrder, pdfModel, itemId, serialNumber);
|
| 771 |
return pdfModel;
|
696 |
return pdfModel;
|
| 772 |
}
|
697 |
}
|
| 773 |
// Map this serialNumber for dummy billing
|
698 |
// Map this serialNumber for dummy billing
|
| 774 |
LocalDateTime grnDate = warehouseInventoryItem.getCreated();
|
699 |
LocalDateTime grnDate = warehouseInventoryItem.getCreated();
|
| Line 787... |
Line 712... |
| 787 |
FofoOrder fofoOrder2 = fofoOrderRepository.selectFirstOrderAfterDate(saleDate, offset2);
|
712 |
FofoOrder fofoOrder2 = fofoOrderRepository.selectFirstOrderAfterDate(saleDate, offset2);
|
| 788 |
if (fofoOrder2 != null) {
|
713 |
if (fofoOrder2 != null) {
|
| 789 |
fofoOrder = fofoOrder2;
|
714 |
fofoOrder = fofoOrder2;
|
| 790 |
}
|
715 |
}
|
| 791 |
}
|
716 |
}
|
| 792 |
PdfModel pdfModel = this.getInvoicePdfModel(fofoOrder.getId());
|
717 |
InvoicePdfModel pdfModel = this.getInvoicePdfModel(fofoOrder.getId());
|
| 793 |
orderIdsConsumed.add(fofoOrder.getId());
|
718 |
orderIdsConsumed.add(fofoOrder.getId());
|
| 794 |
this.modifyDummyModel(fofoOrder, pdfModel, itemId, serialNumber);
|
719 |
this.modifyDummyModel(fofoOrder, pdfModel, itemId, serialNumber);
|
| 795 |
return pdfModel;
|
720 |
return pdfModel;
|
| 796 |
|
721 |
|
| 797 |
}
|
722 |
}
|
| Line 800... |
Line 725... |
| 800 |
throw new ProfitMandiBusinessException("Serial Number", serialNumber,
|
725 |
throw new ProfitMandiBusinessException("Serial Number", serialNumber,
|
| 801 |
"Serial Number does not exist in our warehouse");
|
726 |
"Serial Number does not exist in our warehouse");
|
| 802 |
}
|
727 |
}
|
| 803 |
}
|
728 |
}
|
| 804 |
|
729 |
|
| 805 |
void modifyDummyModel(FofoOrder fofoOrder, PdfModel pdfModel, int itemId, String serialNumber)
|
730 |
void modifyDummyModel(FofoOrder fofoOrder, InvoicePdfModel pdfModel, int itemId, String serialNumber)
|
| 806 |
throws ProfitMandiBusinessException {
|
731 |
throws ProfitMandiBusinessException {
|
| 807 |
|
732 |
|
| 808 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoOrder.getFofoId());
|
733 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoOrder.getFofoId());
|
| 809 |
|
734 |
|
| 810 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|
735 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|
| Line 865... |
Line 790... |
| 865 |
pdfModel.setTotalAmount(paymentOption.getAmount());
|
790 |
pdfModel.setTotalAmount(paymentOption.getAmount());
|
| 866 |
pdfModel.setOrderItems(customerFofoOrderItems);
|
791 |
pdfModel.setOrderItems(customerFofoOrderItems);
|
| 867 |
|
792 |
|
| 868 |
}
|
793 |
}
|
| 869 |
|
794 |
|
| 870 |
private PdfModel getInvoicePdfModel(FofoOrder fofoOrder) throws ProfitMandiBusinessException {
|
795 |
private InvoicePdfModel getInvoicePdfModel(FofoOrder fofoOrder) throws ProfitMandiBusinessException {
|
| 871 |
|
796 |
|
| 872 |
List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
|
797 |
List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
|
| 873 |
.selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.ORDER);
|
798 |
.selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.ORDER);
|
| 874 |
|
799 |
|
| 875 |
List<CustomPaymentOption> paymentOptions = new ArrayList<>();
|
800 |
List<CustomPaymentOption> paymentOptions = new ArrayList<>();
|
| 876 |
|
801 |
|
| 877 |
PdfModel pdfModel = new PdfModel();
|
802 |
InvoicePdfModel pdfModel = new InvoicePdfModel();
|
| 878 |
for (PaymentOptionTransaction paymentOptionTransaction : paymentOptionTransactions) {
|
803 |
for (PaymentOptionTransaction paymentOptionTransaction : paymentOptionTransactions) {
|
| 879 |
CustomPaymentOption cpi = new CustomPaymentOption();
|
804 |
CustomPaymentOption cpi = new CustomPaymentOption();
|
| 880 |
cpi.setAmount(paymentOptionTransaction.getAmount());
|
805 |
cpi.setAmount(paymentOptionTransaction.getAmount());
|
| 881 |
cpi.setPaymentOption(
|
806 |
cpi.setPaymentOption(
|
| 882 |
paymentOptionRepository.selectById(paymentOptionTransaction.getPaymentOptionId()).getName());
|
807 |
paymentOptionRepository.selectById(paymentOptionTransaction.getPaymentOptionId()).getName());
|
| Line 1006... |
Line 931... |
| 1006 |
pdfModel.setTncs(tncs);
|
931 |
pdfModel.setTncs(tncs);
|
| 1007 |
return pdfModel;
|
932 |
return pdfModel;
|
| 1008 |
|
933 |
|
| 1009 |
}
|
934 |
}
|
| 1010 |
|
935 |
|
| 1011 |
private PdfModel getInsuranceInvoicePdfModel(FofoOrder fofoOrder) throws ProfitMandiBusinessException {
|
936 |
private InvoicePdfModel getInsuranceInvoicePdfModel(FofoOrder fofoOrder) throws ProfitMandiBusinessException {
|
| 1012 |
|
937 |
|
| 1013 |
List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
|
938 |
List<PaymentOptionTransaction> paymentOptionTransactions = paymentOptionTransactionRepository
|
| 1014 |
.selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.INSURANCE);
|
939 |
.selectByReferenceIdAndType(fofoOrder.getId(), PaymentOptionReferenceType.INSURANCE);
|
| 1015 |
|
940 |
|
| 1016 |
List<CustomPaymentOption> paymentOptions = new ArrayList<>();
|
941 |
List<CustomPaymentOption> paymentOptions = new ArrayList<>();
|
| 1017 |
|
942 |
|
| 1018 |
PdfModel pdfModel = new PdfModel();
|
943 |
InvoicePdfModel pdfModel = new InvoicePdfModel();
|
| 1019 |
for (PaymentOptionTransaction paymentOptionTransaction : paymentOptionTransactions) {
|
944 |
for (PaymentOptionTransaction paymentOptionTransaction : paymentOptionTransactions) {
|
| 1020 |
CustomPaymentOption cpi = new CustomPaymentOption();
|
945 |
CustomPaymentOption cpi = new CustomPaymentOption();
|
| 1021 |
cpi.setAmount(paymentOptionTransaction.getAmount());
|
946 |
cpi.setAmount(paymentOptionTransaction.getAmount());
|
| 1022 |
cpi.setPaymentOption(
|
947 |
cpi.setPaymentOption(
|
| 1023 |
paymentOptionRepository.selectById(paymentOptionTransaction.getPaymentOptionId()).getName());
|
948 |
paymentOptionRepository.selectById(paymentOptionTransaction.getPaymentOptionId()).getName());
|
| Line 1125... |
Line 1050... |
| 1125 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
1050 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
| 1126 |
return customCustomer;
|
1051 |
return customCustomer;
|
| 1127 |
}
|
1052 |
}
|
| 1128 |
|
1053 |
|
| 1129 |
@Override
|
1054 |
@Override
|
| 1130 |
public PdfModel getInvoicePdfModel(int fofoId, int orderId) throws ProfitMandiBusinessException {
|
1055 |
public InvoicePdfModel getInvoicePdfModel(int fofoId, int orderId) throws ProfitMandiBusinessException {
|
| 1131 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoId, orderId);
|
1056 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoId, orderId);
|
| 1132 |
return this.getInvoicePdfModel(fofoOrder);
|
1057 |
return this.getInvoicePdfModel(fofoOrder);
|
| 1133 |
}
|
1058 |
}
|
| 1134 |
|
1059 |
|
| 1135 |
@Override
|
1060 |
@Override
|
| 1136 |
public PdfModel getInsuranceInvoicePdfModel(int fofoId, int orderId) throws ProfitMandiBusinessException {
|
1061 |
public InvoicePdfModel getInsuranceInvoicePdfModel(int fofoId, int orderId) throws ProfitMandiBusinessException {
|
| 1137 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoId, orderId);
|
1062 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoId, orderId);
|
| 1138 |
return this.getInsuranceInvoicePdfModel(fofoOrder);
|
1063 |
return this.getInsuranceInvoicePdfModel(fofoOrder);
|
| 1139 |
}
|
1064 |
}
|
| 1140 |
|
1065 |
|
| 1141 |
public String getBillingAddress(CustomerAddress customerAddress) {
|
1066 |
public String getBillingAddress(CustomerAddress customerAddress) {
|
| Line 1923... |
Line 1848... |
| 1923 |
customFofoOrderItem.setSgstAmount(sgstAmount);
|
1848 |
customFofoOrderItem.setSgstAmount(sgstAmount);
|
| 1924 |
customFofoOrderItem.setHsnCode(fofoOrderItem.getHsnCode());
|
1849 |
customFofoOrderItem.setHsnCode(fofoOrderItem.getHsnCode());
|
| 1925 |
customFofoOrderItem.setOrderId(1);
|
1850 |
customFofoOrderItem.setOrderId(1);
|
| 1926 |
customerFofoOrderItems.add(customFofoOrderItem);
|
1851 |
customerFofoOrderItems.add(customFofoOrderItem);
|
| 1927 |
|
1852 |
|
| 1928 |
PdfModel pdfModel = new PdfModel();
|
1853 |
InvoicePdfModel pdfModel = new InvoicePdfModel();
|
| 1929 |
pdfModel.setAuther("NSSPL");
|
1854 |
pdfModel.setAuther("NSSPL");
|
| 1930 |
pdfModel.setCustomer(customCustomer);
|
1855 |
pdfModel.setCustomer(customCustomer);
|
| 1931 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
1856 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
| 1932 |
pdfModel.setInvoiceDate(FormattingUtils.formatDate(fofoOrder.getCreateTimestamp()));
|
1857 |
pdfModel.setInvoiceDate(FormattingUtils.formatDate(fofoOrder.getCreateTimestamp()));
|
| 1933 |
pdfModel.setTitle("Credit Note");
|
1858 |
pdfModel.setTitle("Credit Note");
|