Subversion Repositories SmartDukaan

Rev

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

Rev 37569 Rev 37602
Line 128... Line 128...
128
import org.apache.http.entity.StringEntity;
128
import org.apache.http.entity.StringEntity;
129
import org.apache.http.impl.client.CloseableHttpClient;
129
import org.apache.http.impl.client.CloseableHttpClient;
130
import com.spice.profitmandi.common.web.client.HttpClientFactory;
130
import com.spice.profitmandi.common.web.client.HttpClientFactory;
131
import org.apache.logging.log4j.LogManager;
131
import org.apache.logging.log4j.LogManager;
132
import org.apache.logging.log4j.Logger;
132
import org.apache.logging.log4j.Logger;
133
import org.hibernate.SessionFactory;
-
 
134
import org.json.JSONObject;
133
import org.json.JSONObject;
135
import org.springframework.beans.factory.annotation.Autowired;
134
import org.springframework.beans.factory.annotation.Autowired;
136
import org.springframework.beans.factory.annotation.Qualifier;
135
import org.springframework.beans.factory.annotation.Qualifier;
137
import org.springframework.beans.factory.annotation.Value;
136
import org.springframework.beans.factory.annotation.Value;
138
import org.springframework.core.io.ByteArrayResource;
137
import org.springframework.core.io.ByteArrayResource;
Line 1785... Line 1784...
1785
    VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
1784
    VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
1786
 
1785
 
1787
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1786
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1788
//    }
1787
//    }
1789
 
1788
 
1790
    @Autowired
-
 
1791
    SessionFactory sessionFactory;
-
 
1792
 
1789
 
1793
 
1790
 
1794
    public void sendMailForSamsungRebilling() throws Exception {
1791
    public void sendMailForSamsungRebilling() throws Exception {
1795
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1792
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1796
        LOGGER.info("SamsungModels {}", samsungModels);
1793
        LOGGER.info("SamsungModels {}", samsungModels);
Line 5555... Line 5552...
5555
                body,
5552
                body,
5556
                "ScheduledTasks.sendUpdateMobileBrandMarketShareQuaterlyMail"
5553
                "ScheduledTasks.sendUpdateMobileBrandMarketShareQuaterlyMail"
5557
        );
5554
        );
5558
    }
5555
    }
5559
 
5556
 
5560
 
-
 
5561
    @Scheduled(fixedRate = 1800000)
-
 
5562
    public void refreshSnapshotAgeing() {
-
 
5563
        try {
-
 
5564
            sessionFactory.getCurrentSession().createNativeQuery(
-
 
5565
                    "UPDATE inventory.currentinventorysnapshot cis " +
-
 
5566
                    "JOIN ( " +
-
 
5567
                    "    SELECT itemId, currentWarehouseId, " +
-
 
5568
                    "           MIN(rootInvoiceDate) AS oldest, " +
-
 
5569
                    "           MAX(rootInvoiceDate) AS newest " +
-
 
5570
                    "    FROM warehouse.inventoryItem " +
-
 
5571
                    "    WHERE currentQuantity > 0 AND rootInvoiceDate IS NOT NULL " +
-
 
5572
                    "    GROUP BY itemId, currentWarehouseId " +
-
 
5573
                    ") agg ON agg.itemId = cis.item_id AND agg.currentWarehouseId = cis.warehouse_id " +
-
 
5574
                    "SET cis.oldest_invoice_date = agg.oldest, " +
-
 
5575
                    "    cis.newest_invoice_date = agg.newest"
-
 
5576
            ).executeUpdate();
-
 
5577
            LOGGER.info("Snapshot ageing refreshed");
-
 
5578
        } catch (Exception e) {
-
 
5579
            LOGGER.error("Error refreshing snapshot ageing", e);
-
 
5580
        }
-
 
5581
    }
-
 
5582
 
-
 
5583
}
5557
}
5584
// 2284"
5558
// 2284"
5585
5559