| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.dao.service;
|
1 |
package com.spice.profitmandi.dao.service;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.common.model.BulkOrderModel;
|
3 |
import com.spice.profitmandi.common.model.BulkOrderModel;
|
| 4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
4 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 5 |
import com.spice.profitmandi.dao.cart.CartService;
|
- |
|
| 6 |
import com.spice.profitmandi.dao.entity.catalog.Bid;
|
5 |
import com.spice.profitmandi.dao.entity.catalog.Bid;
|
| 7 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
6 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 8 |
import com.spice.profitmandi.dao.entity.catalog.Liquidation;
|
7 |
import com.spice.profitmandi.dao.entity.catalog.Liquidation;
|
| 9 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
8 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 10 |
import com.spice.profitmandi.dao.model.CartItem;
|
- |
|
| 11 |
import com.spice.profitmandi.dao.model.UserCart;
|
- |
|
| 12 |
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
|
9 |
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
|
| 13 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
10 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 14 |
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
|
11 |
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
|
| 15 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
- |
|
| 16 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
12 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
| 17 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
13 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
| 18 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
- |
|
| 19 |
import com.spice.profitmandi.service.wallet.CommonPaymentService;
|
- |
|
| 20 |
import com.spice.profitmandi.service.wallet.WalletService;
|
- |
|
| 21 |
import org.apache.logging.log4j.LogManager;
|
14 |
import org.apache.logging.log4j.LogManager;
|
| 22 |
import org.apache.logging.log4j.Logger;
|
15 |
import org.apache.logging.log4j.Logger;
|
| 23 |
import org.springframework.beans.factory.annotation.Autowired;
|
16 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 24 |
import org.springframework.stereotype.Component;
|
17 |
import org.springframework.stereotype.Component;
|
| 25 |
|
18 |
|
| 26 |
import java.time.LocalDateTime;
|
19 |
import java.time.LocalDateTime;
|
| - |
|
20 |
import java.time.format.DateTimeFormatter;
|
| 27 |
import java.util.ArrayList;
|
21 |
import java.util.ArrayList;
|
| 28 |
import java.util.Arrays;
|
22 |
import java.util.Arrays;
|
| 29 |
import java.util.List;
|
23 |
import java.util.List;
|
| 30 |
|
24 |
|
| 31 |
@Component
|
25 |
@Component
|
| Line 46... |
Line 40... |
| 46 |
|
40 |
|
| 47 |
@Autowired
|
41 |
@Autowired
|
| 48 |
SaholicCISTableRepository saholicCISTableRepository;
|
42 |
SaholicCISTableRepository saholicCISTableRepository;
|
| 49 |
|
43 |
|
| 50 |
@Autowired
|
44 |
@Autowired
|
| 51 |
WalletService walletService;
|
- |
|
| 52 |
|
- |
|
| 53 |
@Autowired
|
- |
|
| 54 |
private BulkOrderService bulkOrderService;
|
45 |
private BulkOrderService bulkOrderService;
|
| 55 |
|
46 |
|
| 56 |
public void processBids(ProfitMandiConstants.BID_CRON_ENUM type) throws Exception {
|
47 |
public void processBids(ProfitMandiConstants.BID_CRON_ENUM type) throws Exception {
|
| 57 |
List<Liquidation> liquidations;
|
48 |
List<Liquidation> liquidations;
|
| 58 |
if (type.equals(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY)){
|
49 |
if (type.equals(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY)){
|
| Line 87... |
Line 78... |
| 87 |
bulkOrderModels.add(bulkOrderModel);
|
78 |
bulkOrderModels.add(bulkOrderModel);
|
| 88 |
|
79 |
|
| 89 |
bulkOrderService.generatePurchaseOrder(bulkOrderModels, bid.getFofoId(), ProfitMandiConstants.PO_TYPE.AUTO, type);
|
80 |
bulkOrderService.generatePurchaseOrder(bulkOrderModels, bid.getFofoId(), ProfitMandiConstants.PO_TYPE.AUTO, type);
|
| 90 |
remainingQty -= bid.getQuantity();
|
81 |
remainingQty -= bid.getQuantity();
|
| 91 |
} else {
|
82 |
} else {
|
| 92 |
bidService.cancelYesterdayProcessBid(bid.getId());
|
83 |
bidService.cancelYesterdayProcessBid(bid);
|
| 93 |
}
|
84 |
}
|
| 94 |
}
|
85 |
}
|
| - |
|
86 |
if (remainingQty <= 0) bidService.sendSummaryMailToUserAndManagers(liquidation.getCreatedBy(), bids, liquidation);
|
| 95 |
liquidation.setQuantity((int) remainingQty);
|
87 |
liquidation.setQuantity((int) remainingQty);
|
| 96 |
liquidation.setStatus(ProfitMandiConstants.LIQUIDATION_ENUM.CLOSED);
|
88 |
liquidation.setStatus(ProfitMandiConstants.LIQUIDATION_ENUM.CLOSED);
|
| 97 |
}
|
89 |
}
|
| 98 |
}
|
90 |
}
|
| 99 |
}
|
91 |
}
|