Subversion Repositories SmartDukaan

Rev

Rev 37751 | Rev 37814 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37751 Rev 37812
Line 1749... Line 1749...
1749
    VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
1749
    VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
1750
 
1750
 
1751
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1751
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1752
//    }
1752
//    }
1753
 
1753
 
-
 
1754
    // TODO(amit.gupta): Samsung rebilling - recipients cannot open Admin Control > Manage PCM (menu 208 is Financial
-
 
1755
    //  Services L1/L2 only), the CSV omits the invoice and PCM dates the query already returns, and the body is just "PFA".
1754
    public void sendMailForSamsungRebilling() throws Exception {
1756
    public void sendMailForSamsungRebilling() throws Exception {
1755
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1757
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1756
        LOGGER.info("SamsungModels {}", samsungModels);
1758
        LOGGER.info("SamsungModels {}", samsungModels);
1757
        samsungModels = samsungModels.stream().sorted(Comparator.comparing(x -> x.getPcmDate() == null ? -1 : 1)).collect(Collectors.toList());
1759
        samsungModels = samsungModels.stream().sorted(Comparator.comparing(x -> x.getPcmDate() == null ? -1 : 1)).collect(Collectors.toList());
1758
        if (samsungModels.size() > 0) {
1760
        if (samsungModels.size() > 0) {
Line 1761... Line 1763...
1761
            for (BilledImeiModel billedImeiModel : samsungModels) {
1763
            for (BilledImeiModel billedImeiModel : samsungModels) {
1762
                List<Serializable> row = Arrays.asList(billedImeiModel.getFofoId(), billedImeiModel.getStoreCode(), billedImeiModel.getStoreName(), billedImeiModel.getStoreCity(), billedImeiModel.getBrand(), billedImeiModel.getModelName(), billedImeiModel.getModelNumber(), billedImeiModel.getColor(), billedImeiModel.getSerialNumber(), billedImeiModel.getPcmDate() == null ? "PCM date Missing" : "Rebill Imeis");
1764
                List<Serializable> row = Arrays.asList(billedImeiModel.getFofoId(), billedImeiModel.getStoreCode(), billedImeiModel.getStoreName(), billedImeiModel.getStoreCity(), billedImeiModel.getBrand(), billedImeiModel.getModelName(), billedImeiModel.getModelNumber(), billedImeiModel.getColor(), billedImeiModel.getSerialNumber(), billedImeiModel.getPcmDate() == null ? "PCM date Missing" : "Rebill Imeis");
1763
                rows.add(row);
1765
                rows.add(row);
1764
            }
1766
            }
1765
            ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
1767
            ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
1766
            String[] sendToArray = new String[]{"kamini.sharma@smartdukaan.com"};
1768
            String[] sendToArray = new String[]{"kamini.sharma@smartdukaan.com", "ritesh.chauhan1@smartdukaan.com"};
1767
            String fileName = "Imeis need Rebilling -" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
1769
            String fileName = "Imeis need Rebilling -" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
1768
            Utils.sendMailWithAttachment(googleMailSender, sendToArray, new String[]{"tarun.verma@smartdukaan.com"}, "Samsung Rebilling IMEI Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
1770
            Utils.sendMailWithAttachment(googleMailSender, sendToArray, new String[]{"tarun.verma@smartdukaan.com"}, "Samsung Rebilling IMEI Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
1769
        }
1771
        }
1770
    }
1772
    }
1771
 
1773