| Line 17... |
Line 17... |
| 17 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
17 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 18 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
18 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| 19 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
19 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 20 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
20 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 21 |
import com.spice.profitmandi.dao.enumuration.catalog.StockTransactionType;
|
21 |
import com.spice.profitmandi.dao.enumuration.catalog.StockTransactionType;
|
| 22 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
- |
|
| 23 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
22 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 24 |
import com.spice.profitmandi.dao.model.AmountModel;
|
23 |
import com.spice.profitmandi.dao.model.AmountModel;
|
| 25 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
24 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
| 26 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
25 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 27 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
26 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
27 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
28 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 30 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
29 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
30 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
31 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.warehouse.AgeingSummaryModel;
|
- |
|
| 34 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
32 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
|
| 35 |
import com.spice.profitmandi.service.NotificationService;
|
33 |
import com.spice.profitmandi.service.NotificationService;
|
| 36 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
34 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 37 |
import com.spice.profitmandi.service.inventory.AgeingService;
|
35 |
import com.spice.profitmandi.service.inventory.AgeingService;
|
| 38 |
import com.spice.profitmandi.service.inventory.PurchaseService;
|
36 |
import com.spice.profitmandi.service.inventory.PurchaseService;
|
| Line 58... |
Line 56... |
| 58 |
import javax.persistence.criteria.Root;
|
56 |
import javax.persistence.criteria.Root;
|
| 59 |
import java.text.MessageFormat;
|
57 |
import java.text.MessageFormat;
|
| 60 |
import java.time.LocalDate;
|
58 |
import java.time.LocalDate;
|
| 61 |
import java.time.LocalDateTime;
|
59 |
import java.time.LocalDateTime;
|
| 62 |
import java.time.LocalTime;
|
60 |
import java.time.LocalTime;
|
| 63 |
import java.time.YearMonth;
|
- |
|
| 64 |
import java.util.*;
|
61 |
import java.util.*;
|
| 65 |
import java.util.stream.Collectors;
|
62 |
import java.util.stream.Collectors;
|
| 66 |
|
63 |
|
| 67 |
@Component
|
64 |
@Component
|
| 68 |
public class SchemeServiceImpl implements SchemeService {
|
65 |
public class SchemeServiceImpl implements SchemeService {
|
| Line 435... |
Line 432... |
| 435 |
OfferPayoutRepository offerPayoutRepository;
|
432 |
OfferPayoutRepository offerPayoutRepository;
|
| 436 |
@Autowired
|
433 |
@Autowired
|
| 437 |
AgeingService ageingService;
|
434 |
AgeingService ageingService;
|
| 438 |
|
435 |
|
| 439 |
public void processSchemeIn(int purchaseId, int retailerId) throws ProfitMandiBusinessException {
|
436 |
public void processSchemeIn(int purchaseId, int retailerId) throws ProfitMandiBusinessException {
|
| 440 |
LOGGER.info("Processing scheme in for purchaseId - {}", purchaseId);
|
437 |
/*LOGGER.info("Processing scheme in for purchaseId - {}", purchaseId);
|
| 441 |
Purchase purchase = purchaseRepository.selectByIdAndFofoId(purchaseId, retailerId);
|
438 |
Purchase purchase = purchaseRepository.selectByIdAndFofoId(purchaseId, retailerId);
|
| 442 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnMonth(retailerId,
|
439 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnMonth(retailerId,
|
| 443 |
YearMonth.from(purchase.getCreateTimestamp()));
|
440 |
YearMonth.from(purchase.getCreateTimestamp()));
|
| 444 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByPurchaseId(purchaseId);
|
441 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByPurchaseId(purchaseId);
|
| 445 |
//Remove imeis from blocked imeis list
|
442 |
//Remove imeis from blocked imeis list
|
| Line 492... |
Line 489... |
| 492 |
retailerId, purchaseId, WalletReferenceType.SCHEME_IN, "Added for SCHEME IN against invoice "
|
489 |
retailerId, purchaseId, WalletReferenceType.SCHEME_IN, "Added for SCHEME IN against invoice "
|
| 493 |
+ purchase.getPurchaseReference() + " (total " + itemsCount + " pcs)",
|
490 |
+ purchase.getPurchaseReference() + " (total " + itemsCount + " pcs)",
|
| 494 |
totalCashback, purchase.getCreateTimestamp());
|
491 |
totalCashback, purchase.getCreateTimestamp());
|
| 495 |
LOGGER.info("Added Rs.{} for SCHEME IN against invoice {} total pcs({}) {}", totalCashback,
|
492 |
LOGGER.info("Added Rs.{} for SCHEME IN against invoice {} total pcs({}) {}", totalCashback,
|
| 496 |
purchase.getPurchaseReference(), itemsCount);
|
493 |
purchase.getPurchaseReference(), itemsCount);
|
| 497 |
}
|
494 |
}*/
|
| 498 |
|
495 |
|
| 499 |
}
|
496 |
}
|
| 500 |
|
497 |
|
| 501 |
|
498 |
|
| 502 |
// We are maintaining price drop after grn
|
499 |
// We are maintaining price drop after grn
|
| Line 684... |
Line 681... |
| 684 |
@Autowired
|
681 |
@Autowired
|
| 685 |
WarehouseInventoryItemRepository warehouseInventoryItemRepository;
|
682 |
WarehouseInventoryItemRepository warehouseInventoryItemRepository;
|
| 686 |
|
683 |
|
| 687 |
@Override
|
684 |
@Override
|
| 688 |
public float processSchemeOut(int fofoOrderId, int retailerId) throws ProfitMandiBusinessException {
|
685 |
public float processSchemeOut(int fofoOrderId, int retailerId) throws ProfitMandiBusinessException {
|
| 689 |
float totalCashback = 0;
|
686 |
/*float totalCashback = 0;
|
| 690 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(retailerId, fofoOrderId);
|
687 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(retailerId, fofoOrderId);
|
| 691 |
// Process only if order is not cancelled
|
688 |
// Process only if order is not cancelled
|
| 692 |
if (fofoOrder.getCancelledTimestamp() == null) {
|
689 |
if (fofoOrder.getCancelledTimestamp() == null) {
|
| 693 |
// PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(retailerId,
|
690 |
// PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(retailerId,
|
| 694 |
// fofoOrder.getCreateTimestamp().toLocalDate());
|
691 |
// fofoOrder.getCreateTimestamp().toLocalDate());
|
| Line 760... |
Line 757... |
| 760 |
+ fofoOrder.getInvoiceNumber() + ". Total " + count + " pc(s)",
|
757 |
+ fofoOrder.getInvoiceNumber() + ". Total " + count + " pc(s)",
|
| 761 |
totalCashback, fofoOrder.getCreateTimestamp());
|
758 |
totalCashback, fofoOrder.getCreateTimestamp());
|
| 762 |
fofoOrder.setCashback(totalCashback + fofoOrder.getCashback());
|
759 |
fofoOrder.setCashback(totalCashback + fofoOrder.getCashback());
|
| 763 |
}
|
760 |
}
|
| 764 |
}
|
761 |
}
|
| 765 |
return totalCashback;
|
762 |
return totalCashback;*/
|
| - |
|
763 |
return 0;
|
| 766 |
}
|
764 |
}
|
| 767 |
|
765 |
|
| 768 |
@Override
|
766 |
@Override
|
| 769 |
//Tax rate has been passed to 0 to ensure no tax deduction
|
767 |
//Tax rate has been passed to 0 to ensure no tax deduction
|
| 770 |
public float getSpecialSupportAmount(float supportAmount, PartnerType partnerType, LocalDate onDate,
|
768 |
public float getSpecialSupportAmount(float supportAmount, PartnerType partnerType, LocalDate onDate,
|