Subversion Repositories SmartDukaan

Rev

Rev 34592 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34592 Rev 34637
Line 52... Line 52...
52
    @Autowired
52
    @Autowired
53
    private NotificationService notificationService;
53
    private NotificationService notificationService;
54
 
54
 
55
    public void processBids(ProfitMandiConstants.BID_CRON_ENUM type) throws Exception {
55
    public void processBids(ProfitMandiConstants.BID_CRON_ENUM type) throws Exception {
56
        List<Liquidation> liquidations;
56
        List<Liquidation> liquidations;
-
 
57
        boolean canRefund = true;
57
        List<Map<String, Object>> liquidationList = new ArrayList<>();
58
        List<Map<String, Object>> liquidationList = new ArrayList<>();
58
        if (type.equals(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY)){
59
        if (type.equals(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY)){
59
            liquidations = liquidationRepository.selectAllByEndDate(LocalDateTime.now().minusDays(1));
60
            liquidations = liquidationRepository.selectAllByEndDate(LocalDateTime.now().minusDays(1));
-
 
61
            canRefund = false;
60
        } else {
62
        } else {
61
            liquidations = liquidationRepository.selectAllByEndDate(LocalDateTime.now());
63
            liquidations = liquidationRepository.selectAllByEndDate(LocalDateTime.now());
62
        }
64
        }
63
        LOGGER.info("liquidations for {}: {}",type,liquidations);
65
        LOGGER.info("liquidations for {}: {}",type,liquidations);
64
 
66
 
Line 103... Line 105...
103
                                        LOGGER.info("generatePurchaseOrder if exception: ", exception);
105
                                        LOGGER.info("generatePurchaseOrder if exception: ", exception);
104
                                    }
106
                                    }
105
                                } else {
107
                                } else {
106
                                    try {
108
                                    try {
107
                                        bidStatus = bidService.cancelYesterdayProcessBid(bid);
109
                                        bidStatus = bidService.cancelYesterdayProcessBid(bid);
-
 
110
                                        if (canRefund || remainingQty < 1) {
-
 
111
                                            bidService.refundBidAmountToWallet(bid, bidStatus);
-
 
112
                                        }
108
                                    } catch (Exception exception) {
113
                                    } catch (Exception exception) {
109
                                        LOGGER.info("generatePurchaseOrder else exception: ", exception);
114
                                        LOGGER.info("generatePurchaseOrder else exception: ", exception);
110
                                    }
115
                                    }
111
                                }
116
                                }
112
                                bid.setStatus(bidStatus);
117
                                bid.setStatus(bidStatus);