| Line 102... |
Line 102... |
| 102 |
public void consolidatedBiddingMessage() throws Exception {
|
102 |
public void consolidatedBiddingMessage() throws Exception {
|
| 103 |
List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
|
103 |
List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
|
| 104 |
LOGGER.info("consolidatedBiddingMessage liquidations: {}",liquidations);
|
104 |
LOGGER.info("consolidatedBiddingMessage liquidations: {}",liquidations);
|
| 105 |
|
105 |
|
| 106 |
if (liquidations.size() > 0) {
|
106 |
if (liquidations.size() > 0) {
|
| 107 |
StringBuilder message = new StringBuilder("*Bidding Live Now!*\n" +
|
107 |
StringBuilder message = new StringBuilder("*Bidding Update!*\n" +
|
| 108 |
"Place your best bids and unlock unbeatable deals on top smartphone models!\n");
|
108 |
"Place your best bids and unlock unbeatable price on smartphones!\n");
|
| 109 |
//StringBuilder templateMessage = new StringBuilder("bidd_live");
|
109 |
//StringBuilder templateMessage = new StringBuilder("bidd_live");
|
| 110 |
for (Liquidation liquidation : liquidations) {
|
110 |
for (Liquidation liquidation : liquidations) {
|
| 111 |
List<Item> items = itemRepository.selectAllByCatalogItemId(liquidation.getCatalogId());
|
111 |
List<Item> items = itemRepository.selectAllByCatalogItemId(liquidation.getCatalogId());
|
| - |
|
112 |
List<Bid> bids = bidRepository.selectBidByLiquidationId(liquidation.getId());
|
| 112 |
if (items.size() > 0) {
|
113 |
if (items.size() > 0) {
|
| 113 |
long remainingQty = 0;
|
114 |
long remainingQty = 0;
|
| 114 |
for (Item item : items) {
|
115 |
for (Item item : items) {
|
| 115 |
List<SaholicCISTable> saholicCISTable = saholicCISTableRepository.selectAllByItemId(item.getId());
|
116 |
List<SaholicCISTable> saholicCISTable = saholicCISTableRepository.selectAllByItemId(item.getId());
|
| 116 |
remainingQty += saholicCISTable.stream().mapToInt(SaholicCISTable::getAvailability).sum();
|
117 |
remainingQty += saholicCISTable.stream().mapToInt(SaholicCISTable::getAvailability).sum();
|
| Line 121... |
Line 122... |
| 121 |
double mrp = tagListing.getMrp();
|
122 |
double mrp = tagListing.getMrp();
|
| 122 |
double discountPercentage = ((mrp - liquidation.getPrice()) / mrp) * 100;
|
123 |
double discountPercentage = ((mrp - liquidation.getPrice()) / mrp) * 100;
|
| 123 |
message.append("\n")
|
124 |
message.append("\n")
|
| 124 |
.append("*").append(items.get(0).getItemDescription())
|
125 |
.append("*").append(items.get(0).getItemDescription())
|
| 125 |
.append(" at ").append(Math.round(discountPercentage)).append("% Off*\n")
|
126 |
.append(" at ").append(Math.round(discountPercentage)).append("% Off*\n")
|
| 126 |
.append("Starting price: *").append(liquidation.getPrice()).append("*\n")
|
127 |
.append("Starting price: *").append(liquidation.getPrice()).append("*\n");
|
| 127 |
.append("Ending on: *")
|
128 |
if (bids.size() > 0) {
|
| - |
|
129 |
message.append("Top Bid: *").append(bids.get(0).getBiddingAmount()).append("*\n");
|
| - |
|
130 |
}
|
| 128 |
.append(StringUtils.toLocalDateTime(liquidation.getEndDate().toString())).append("*\n");
|
131 |
message.append("Ending on: *").append(StringUtils.toLocalDateTime(liquidation.getEndDate().toString())).append("*\n");
|
| 129 |
//templateMessage.append("|").append(items.get(0).getItemDescription()).append("|").append(liquidation.getPrice()).append("|").append(StringUtils.toLocalDateTime(liquidation.getEndDate().toString()));
|
132 |
//templateMessage.append("|").append(items.get(0).getItemDescription()).append("|").append(liquidation.getPrice()).append("|").append(StringUtils.toLocalDateTime(liquidation.getEndDate().toString()));
|
| 130 |
}
|
133 |
}
|
| 131 |
}
|
134 |
}
|
| 132 |
}
|
135 |
}
|
| 133 |
|
136 |
|