| Line 184... |
Line 184... |
| 184 |
if(!StringUtils.isValidMobile(customCustomer.getMobileNumber())){
|
184 |
if(!StringUtils.isValidMobile(customCustomer.getMobileNumber())){
|
| 185 |
LOGGER.error("invalid customer mobileNumber {} ", customCustomer.getMobileNumber());
|
185 |
LOGGER.error("invalid customer mobileNumber {} ", customCustomer.getMobileNumber());
|
| 186 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.MOBILE_NUMBER, customCustomer.getMobileNumber(), "VE_1071");
|
186 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.MOBILE_NUMBER, customCustomer.getMobileNumber(), "VE_1071");
|
| 187 |
}
|
187 |
}
|
| 188 |
|
188 |
|
| 189 |
if(StringUtils.isValidGstNumber(customCustomer.getGstNumber())) {
|
189 |
if(!StringUtils.isValidGstNumber(customCustomer.getGstNumber())) {
|
| 190 |
LOGGER.error("invalid customer gstNumber {} ", customCustomer.getGstNumber());
|
190 |
LOGGER.error("invalid customer gstNumber {} ", customCustomer.getGstNumber());
|
| 191 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.CUSTOMER_GST_NUMBER, customCustomer.getGstNumber(), "VE_1072");
|
191 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.CUSTOMER_GST_NUMBER, customCustomer.getGstNumber(), "VE_1072");
|
| 192 |
}
|
192 |
}
|
| 193 |
|
193 |
|
| 194 |
Map<Integer, Integer> itemIdQuantity = new HashMap<>(); //this is for error
|
194 |
Map<Integer, Integer> itemIdQuantity = new HashMap<>(); //this is for error
|
| Line 481... |
Line 481... |
| 481 |
List<String> tncs = new ArrayList<>();
|
481 |
List<String> tncs = new ArrayList<>();
|
| 482 |
tncs.add("I agree that goods received are in good working condition");
|
482 |
tncs.add("I agree that goods received are in good working condition");
|
| 483 |
tncs.add("Goods once sold cannot be exchanged or taken back");
|
483 |
tncs.add("Goods once sold cannot be exchanged or taken back");
|
| 484 |
tncs.add("Warranty for the goods received by me is the responsibility of the manufacturer only.");
|
484 |
tncs.add("Warranty for the goods received by me is the responsibility of the manufacturer only.");
|
| 485 |
if(pdfModel.getInsurancePolicies() != null && pdfModel.getInsurancePolicies().size() > 0) {
|
485 |
if(pdfModel.getInsurancePolicies() != null && pdfModel.getInsurancePolicies().size() > 0) {
|
| 486 |
tncs.add("Damage protection provided is the responisibility of Protection Provider only");
|
486 |
tncs.add("Damage protection provided is the responisibility of Protection Provider only");
|
| 487 |
}
|
487 |
}
|
| 488 |
pdfModel.setTncs(tncs);
|
488 |
pdfModel.setTncs(tncs);
|
| 489 |
Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
|
489 |
Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
|
| 490 |
CustomCustomer customCustomer = new CustomCustomer();
|
490 |
CustomCustomer customCustomer = new CustomCustomer();
|
| 491 |
customCustomer.setFirstName(customer.getFirstName());
|
491 |
customCustomer.setFirstName(customer.getFirstName());
|
| 492 |
customCustomer.setLastName(customer.getLastName());
|
492 |
customCustomer.setLastName(customer.getLastName());
|
| 493 |
customCustomer.setEmailId(customer.getEmailId());
|
493 |
customCustomer.setEmailId(customer.getEmailId());
|
| 494 |
customCustomer.setMobileNumber(customer.getMobileNumber());
|
494 |
customCustomer.setMobileNumber(customer.getMobileNumber());
|
| - |
|
495 |
customCustomer.setGstNumber(fofoOrder.getCustomerGstNumber());
|
| 495 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
496 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
| 496 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
497 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
| 497 |
pdfModel.setCustomer(customCustomer);
|
498 |
pdfModel.setCustomer(customCustomer);
|
| 498 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
499 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
| 499 |
pdfModel.setTotalAmount(fofoOrder.getTotalAmount());
|
500 |
pdfModel.setTotalAmount(fofoOrder.getTotalAmount());
|
| Line 702... |
Line 703... |
| 702 |
return map;
|
703 |
return map;
|
| 703 |
}
|
704 |
}
|
| 704 |
|
705 |
|
| 705 |
private String getFofoStoreCode(int fofoId) throws ProfitMandiBusinessException{
|
706 |
private String getFofoStoreCode(int fofoId) throws ProfitMandiBusinessException{
|
| 706 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
707 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 707 |
return fofoStore.getCode().substring(0, 3);
|
708 |
return fofoStore.getCode();
|
| 708 |
}
|
709 |
}
|
| 709 |
|
710 |
|
| 710 |
|
711 |
|
| 711 |
private CustomerAddress createCustomerAddress(CustomAddress customAddress, int customerId){
|
712 |
private CustomerAddress createCustomerAddress(CustomAddress customAddress, int customerId){
|
| 712 |
CustomerAddress customerAddress = null;
|
713 |
CustomerAddress customerAddress = null;
|
| Line 974... |
Line 975... |
| 974 |
private FofoOrder createAndGetFofoOrder(int customerId, String customerGstNumber, int fofoId, InvoiceNumberGenerationSequence invoiceNumberGenerationSequence, float totalAmount, int customerAddressId){
|
975 |
private FofoOrder createAndGetFofoOrder(int customerId, String customerGstNumber, int fofoId, InvoiceNumberGenerationSequence invoiceNumberGenerationSequence, float totalAmount, int customerAddressId){
|
| 975 |
FofoOrder fofoOrder = new FofoOrder();
|
976 |
FofoOrder fofoOrder = new FofoOrder();
|
| 976 |
fofoOrder.setCustomerGstNumber(customerGstNumber);
|
977 |
fofoOrder.setCustomerGstNumber(customerGstNumber);
|
| 977 |
fofoOrder.setCustomerId(customerId);
|
978 |
fofoOrder.setCustomerId(customerId);
|
| 978 |
fofoOrder.setFofoId(fofoId);
|
979 |
fofoOrder.setFofoId(fofoId);
|
| 979 |
fofoOrder.setInvoiceNumber(invoiceNumberGenerationSequence.getPrefix() + invoiceNumberGenerationSequence.getSequence());
|
980 |
fofoOrder.setInvoiceNumber(invoiceNumberGenerationSequence.getPrefix() + "/" + invoiceNumberGenerationSequence.getSequence());
|
| 980 |
fofoOrder.setTotalAmount(totalAmount);
|
981 |
fofoOrder.setTotalAmount(totalAmount);
|
| 981 |
fofoOrder.setCustomerAddressId(customerAddressId);
|
982 |
fofoOrder.setCustomerAddressId(customerAddressId);
|
| 982 |
fofoOrderRepository.persist(fofoOrder);
|
983 |
fofoOrderRepository.persist(fofoOrder);
|
| 983 |
return fofoOrder;
|
984 |
return fofoOrder;
|
| 984 |
}
|
985 |
}
|
| Line 1005... |
Line 1006... |
| 1005 |
invoiceNumberGenerationSequence = invoiceNumberGenerationSequenceRepository.selectByFofoId(fofoId);
|
1006 |
invoiceNumberGenerationSequence = invoiceNumberGenerationSequenceRepository.selectByFofoId(fofoId);
|
| 1006 |
invoiceNumberGenerationSequence.setSequence(invoiceNumberGenerationSequence.getSequence() + 1);
|
1007 |
invoiceNumberGenerationSequence.setSequence(invoiceNumberGenerationSequence.getSequence() + 1);
|
| 1007 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
1008 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| 1008 |
invoiceNumberGenerationSequence = new InvoiceNumberGenerationSequence();
|
1009 |
invoiceNumberGenerationSequence = new InvoiceNumberGenerationSequence();
|
| 1009 |
invoiceNumberGenerationSequence.setFofoId(fofoId);
|
1010 |
invoiceNumberGenerationSequence.setFofoId(fofoId);
|
| 1010 |
invoiceNumberGenerationSequence.setPrefix(fofoStoreCode + "-");
|
1011 |
invoiceNumberGenerationSequence.setPrefix(fofoStoreCode);
|
| 1011 |
invoiceNumberGenerationSequence.setSequence(1);
|
1012 |
invoiceNumberGenerationSequence.setSequence(1);
|
| 1012 |
}
|
1013 |
}
|
| 1013 |
invoiceNumberGenerationSequenceRepository.persist(invoiceNumberGenerationSequence);
|
1014 |
invoiceNumberGenerationSequenceRepository.persist(invoiceNumberGenerationSequence);
|
| 1014 |
return invoiceNumberGenerationSequence;
|
1015 |
return invoiceNumberGenerationSequence;
|
| 1015 |
}
|
1016 |
}
|