| Line 40... |
Line 40... |
| 40 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
40 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
| 41 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
41 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| 42 |
import com.spice.profitmandi.service.integrations.bharti.model.PlanVariant;
|
42 |
import com.spice.profitmandi.service.integrations.bharti.model.PlanVariant;
|
| 43 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
43 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| 44 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
44 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
| - |
|
45 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 45 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
46 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 46 |
import com.spice.profitmandi.service.inventory.PurchaseReturnService;
|
47 |
import com.spice.profitmandi.service.inventory.PurchaseReturnService;
|
| 47 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
48 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
| 48 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
49 |
import com.spice.profitmandi.service.offers.ItemCriteria;
|
| 49 |
import com.spice.profitmandi.service.pricing.PricingService;
|
50 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| Line 107... |
Line 108... |
| 107 |
|
108 |
|
| 108 |
@Autowired
|
109 |
@Autowired
|
| 109 |
private InsuranceService insuranceService;
|
110 |
private InsuranceService insuranceService;
|
| 110 |
|
111 |
|
| 111 |
@Autowired
|
112 |
@Autowired
|
| - |
|
113 |
private PartnerInvestmentService partnerInvestmentService;
|
| - |
|
114 |
|
| - |
|
115 |
@Autowired
|
| 112 |
@Qualifier("fofoCurrentInventorySnapshotRepository")
|
116 |
@Qualifier("fofoCurrentInventorySnapshotRepository")
|
| 113 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
117 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 114 |
|
118 |
|
| 115 |
@Autowired
|
119 |
@Autowired
|
| 116 |
private InvoiceNumberGenerationSequenceRepository invoiceNumberGenerationSequenceRepository;
|
120 |
private InvoiceNumberGenerationSequenceRepository invoiceNumberGenerationSequenceRepository;
|
| Line 658... |
Line 662... |
| 658 |
CustomerAddress customerAddress = null;
|
662 |
CustomerAddress customerAddress = null;
|
| 659 |
if (customCustomer.getCustomerAddressId() != 0) {
|
663 |
if (customCustomer.getCustomerAddressId() != 0) {
|
| 660 |
customerAddress = customer.getCustomerAddress().stream().filter(x -> x.getId() == customCustomer.getCustomerAddressId()).findFirst().get();
|
664 |
customerAddress = customer.getCustomerAddress().stream().filter(x -> x.getId() == customCustomer.getCustomerAddressId()).findFirst().get();
|
| 661 |
}
|
665 |
}
|
| 662 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId, documentNumber, totalAmount, customCustomer.getCustomerAddressId(), createOrderRequest.getPoId());
|
666 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId, documentNumber, totalAmount, customCustomer.getCustomerAddressId(), createOrderRequest.getPoId());
|
| - |
|
667 |
partnerInvestmentService.evictInvestmentCache(fofoId);
|
| 663 |
|
668 |
|
| 664 |
this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
|
669 |
this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
|
| 665 |
|
670 |
|
| 666 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
671 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
| 667 |
|
672 |
|
| Line 2319... |
Line 2324... |
| 2319 |
for (CustomerReturnItem customerReturnItem : customerReturnItems) {
|
2324 |
for (CustomerReturnItem customerReturnItem : customerReturnItems) {
|
| 2320 |
purchaseReturnService.returnInventoryItem(fofoId, false, customerReturnItem.getInventoryItemId(), ReturnType.BAD);
|
2325 |
purchaseReturnService.returnInventoryItem(fofoId, false, customerReturnItem.getInventoryItemId(), ReturnType.BAD);
|
| 2321 |
}
|
2326 |
}
|
| 2322 |
// This should cancel the order
|
2327 |
// This should cancel the order
|
| 2323 |
fofoOrder.setCancelledTimestamp(LocalDateTime.now());
|
2328 |
fofoOrder.setCancelledTimestamp(LocalDateTime.now());
|
| - |
|
2329 |
partnerInvestmentService.evictInvestmentCache(fofoOrder.getFofoId());
|
| 2324 |
this.reverseScheme(fofoOrder);
|
2330 |
this.reverseScheme(fofoOrder);
|
| 2325 |
return creditNote;
|
2331 |
return creditNote;
|
| 2326 |
}
|
2332 |
}
|
| 2327 |
|
2333 |
|
| 2328 |
private CustomerCreditNote generateCreditNote(FofoOrder
|
2334 |
private CustomerCreditNote generateCreditNote(FofoOrder
|
| Line 2454... |
Line 2460... |
| 2454 |
for (String invoiceNumber : invoiceNumbers) {
|
2460 |
for (String invoiceNumber : invoiceNumbers) {
|
| 2455 |
// Cancel only when not cancelled
|
2461 |
// Cancel only when not cancelled
|
| 2456 |
FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
|
2462 |
FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
|
| 2457 |
if (fofoOrder.getCancelledTimestamp() == null) {
|
2463 |
if (fofoOrder.getCancelledTimestamp() == null) {
|
| 2458 |
fofoOrder.setCancelledTimestamp(LocalDateTime.now());
|
2464 |
fofoOrder.setCancelledTimestamp(LocalDateTime.now());
|
| - |
|
2465 |
partnerInvestmentService.evictInvestmentCache(fofoOrder.getFofoId());
|
| 2459 |
PaymentOptionTransaction paymentTransaction = new PaymentOptionTransaction();
|
2466 |
PaymentOptionTransaction paymentTransaction = new PaymentOptionTransaction();
|
| 2460 |
paymentTransaction.setAmount(-fofoOrder.getTotalAmount());
|
2467 |
paymentTransaction.setAmount(-fofoOrder.getTotalAmount());
|
| 2461 |
paymentTransaction.setFofoId(fofoOrder.getFofoId());
|
2468 |
paymentTransaction.setFofoId(fofoOrder.getFofoId());
|
| 2462 |
paymentTransaction.setReferenceId(fofoOrder.getId());
|
2469 |
paymentTransaction.setReferenceId(fofoOrder.getId());
|
| 2463 |
paymentTransaction.setReferenceType(PaymentOptionReferenceType.ORDER);
|
2470 |
paymentTransaction.setReferenceType(PaymentOptionReferenceType.ORDER);
|
| Line 2540... |
Line 2547... |
| 2540 |
// TODO Auto-generated method stub
|
2547 |
// TODO Auto-generated method stub
|
| 2541 |
return 0;
|
2548 |
return 0;
|
| 2542 |
}
|
2549 |
}
|
| 2543 |
|
2550 |
|
| 2544 |
@Override
|
2551 |
@Override
|
| 2545 |
public boolean notifyColorChange(int orderId, int itemId) throws ProfitMandiBusinessException {
|
2552 |
public boolean applyColorChange(int orderId, int itemId) throws ProfitMandiBusinessException {
|
| 2546 |
Order order = orderRepository.selectById(orderId);
|
2553 |
Order order = orderRepository.selectById(orderId);
|
| 2547 |
saholicInventoryService.reservationCountByColor(itemId, order);
|
2554 |
saholicInventoryService.reservationCountByColor(itemId, order);
|
| 2548 |
|
2555 |
|
| 2549 |
order.getLineItem().setItemId(itemId);
|
2556 |
order.getLineItem().setItemId(itemId);
|
| 2550 |
Item item = itemRepository.selectById(itemId);
|
2557 |
Item item = itemRepository.selectById(itemId);
|