Subversion Repositories SmartDukaan

Rev

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

Rev 32081 Rev 32084
Line 867... Line 867...
867
 
867
 
868
        System.out.println(ageingModelMap.size());
868
        System.out.println(ageingModelMap.size());
869
        List<PartnerAgeingModel> partnerAgeingModels = ageingService.getAllAgeingForTertiary();
869
        List<PartnerAgeingModel> partnerAgeingModels = ageingService.getAllAgeingForTertiary();
870
 
870
 
871
 
871
 
872
        org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream = FileUtil.getCSVByteStream(Arrays.asList("InventoryItemId", "Serial Number", "Item Id", "Brand", "Model Name", "ModelNumber",
872
        org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream = FileUtil.getCSVByteStream(Arrays.asList("InventoryItemId", "Serial Number", "Item Id", "Brand", "Model Name", "ModelNumber", "Color", "Exceed Days", "Last ScanType", "Supplier Name", "Current Warehouse", "First Warehouse", "Invoice Number", "Invoice Date"), ageingModelMap.values().stream().map(x -> Arrays.asList(x.getInventoryItemId(), x.getSerialNumber(), x.getItemId(), x.getBrand(), x.getModelName(), x.getModelNumber(), x.getColor(), x.getExceedDays(), x.getLastScanType(), x.getSupplierName(), x.getCurrentWarehouse(), x.getFirstWarehouse(), x.getInvoiceNumber(), FormattingUtils.formatDate(x.getInvoiceDate()))).collect(Collectors.toList()));
873
                        "Color", "Exceed Days", "Last ScanType", "Supplier Name", "Current Warehouse", "First Warehouse", "Invoice Number", "Invoice Date"),
-
 
874
                ageingModelMap.values().stream().map(x -> Arrays.asList(x.getInventoryItemId(), x.getSerialNumber(), x.getItemId(), x.getBrand(), x.getModelName(), x.getModelNumber(), x.getColor(),
-
 
875
                                x.getExceedDays(), x.getLastScanType(), x.getSupplierName(), x.getCurrentWarehouse(), x.getFirstWarehouse(), x.getInvoiceNumber(), FormattingUtils.formatDate(x.getInvoiceDate())))
-
 
876
                        .collect(Collectors.toList()));
-
 
877
 
873
 
878
        org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream2 = FileUtil.getCSVByteStream(Arrays.asList("InventoryItemId", "Serial Number", "Item Id", "Brand", "Model Name", "ModelNumber",
874
        org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream2 = FileUtil.getCSVByteStream(Arrays.asList("InventoryItemId", "Serial Number", "Item Id", "Brand", "Model Name", "ModelNumber", "Color", "Partner Id", "Partner Code", "Partner Name", "Activation Type", "City", "State", "Billing Date", "Exceed Days", "Max Ageing", "Activation Date"), partnerAgeingModels.stream().map(x -> Arrays.asList(x.getInventoryItemId(), x.getSerialNumber(), x.getItemId(), x.getBrand(), x.getModelName(), x.getModelNumber(), x.getColor(), x.getFofoId(), x.getFofoCode(), x.getFofoName(), x.getActivationType(), x.getFofoCity(), x.getFofoState(), FormattingUtils.formatDate(x.getBillingDate()), x.getExceedDays(), x.getMaxAgeingDays(), x.getActivationDate())).collect(Collectors.toList()));
879
                        "Color", "Partner Id", "Partner Code", "Partner Name", "Activation Type", "City", "State", "Billing Date", "Exceed Days", "Max Ageing", "Activation Date"),
-
 
880
                partnerAgeingModels.stream().map(x -> Arrays.asList(x.getInventoryItemId(), x.getSerialNumber(), x.getItemId(), x.getBrand(), x.getModelName(), x.getModelNumber(), x.getColor(),
-
 
881
                                x.getFofoId(), x.getFofoCode(), x.getFofoName(), x.getActivationType(), x.getFofoCity(), x.getFofoState(), FormattingUtils.formatDate(x.getBillingDate()), x.getExceedDays(), x.getMaxAgeingDays(), x.getActivationDate()))
-
 
882
                        .collect(Collectors.toList()));
-
 
883
        Utils.Attachment attachment1 = new Utils.Attachment("secondary-alert.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
875
        Utils.Attachment attachment1 = new Utils.Attachment("secondary-alert.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
884
        Utils.Attachment attachment2 = new Utils.Attachment("tertiary-alert.csv", new ByteArrayResource(byteArrayOutputStream2.toByteArray()));
876
        Utils.Attachment attachment2 = new Utils.Attachment("tertiary-alert.csv", new ByteArrayResource(byteArrayOutputStream2.toByteArray()));
885
 
877
 
886
        String mailSubject = "Stock ageing Alert";
878
        String mailSubject = "Stock ageing Alert";
887
        Utils.sendMailWithAttachments(mailSender, new String[]{"deena.nath@smartdukaan.com"}, null, mailSubject, "PFA", attachment1, attachment2);
879
        Utils.sendMailWithAttachments(mailSender, new String[]{"deena.nath@smartdukaan.com"}, null, mailSubject, "PFA", attachment1, attachment2);
Line 4042... Line 4034...
4042
        }
4034
        }
4043
 
4035
 
4044
    }
4036
    }
4045
 
4037
 
4046
    private String getMessageHygieneAlertForPartner(
4038
    private String getMessageHygieneAlertForPartner(
4047
            Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData) {
4039
                                                    Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData) {
4048
 
4040
 
4049
        Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
4041
        Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
4050
 
4042
 
4051
        LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
4043
        LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
4052
        LocalDateTime endDate = LocalDateTime.now();
4044
        LocalDateTime endDate = LocalDateTime.now();
Line 4323... Line 4315...
4323
            Item item = null;
4315
            Item item = null;
4324
            try {
4316
            try {
4325
                item = itemRepository.selectById(vendorItemPricing.getItemId());
4317
                item = itemRepository.selectById(vendorItemPricing.getItemId());
4326
            } catch (ProfitMandiBusinessException e) {
4318
            } catch (ProfitMandiBusinessException e) {
4327
                // TODO Auto-generated catch block
4319
                // TODO Auto-generated catch block
4328
               e.printStackTrace();
4320
                continue;
4329
            }
4321
            }
4330
            VendorCatalogPricingModel vendorCatalogPricingModel = new VendorCatalogPricingModel();
4322
            VendorCatalogPricingModel vendorCatalogPricingModel = new VendorCatalogPricingModel();
4331
            vendorCatalogPricingModel.setCatalogId(item.getCatalogItemId());
4323
            vendorCatalogPricingModel.setCatalogId(item.getCatalogItemId());
4332
            vendorCatalogPricingModel.setAuthId(13);
4324
            vendorCatalogPricingModel.setAuthId(13);
4333
 
4325
 
Line 4348... Line 4340...
4348
    }
4340
    }
4349
 
4341
 
4350
    public void approveVendorCatalogPricing() {
4342
    public void approveVendorCatalogPricing() {
4351
        List<VendorCatalogPricingLog> vendorCatalogPricingLogs = vendorCatalogPricingLogRepository.selectByStatus(VendorCatalogPricingStatus.PENDING);
4343
        List<VendorCatalogPricingLog> vendorCatalogPricingLogs = vendorCatalogPricingLogRepository.selectByStatus(VendorCatalogPricingStatus.PENDING);
4352
 
4344
 
-
 
4345
 
4353
        for (VendorCatalogPricingLog vendorCatalogPricingLog : vendorCatalogPricingLogs) {
4346
        for (VendorCatalogPricingLog vendorCatalogPricingLog : vendorCatalogPricingLogs) {
-
 
4347
            vendorCatalogPricingLog.setStatus(VendorCatalogPricingStatus.APPROVED);
-
 
4348
            vendorCatalogPricingLog.setUpdatedTimestamp(LocalDateTime.now());
-
 
4349
            vendorCatalogPricingLog.setApprovedBy(13);
-
 
4350
            vendorCatalogPricingLog.setApprovedTimestamp(LocalDateTime.now());
-
 
4351
            vendorCatalogPricingService.createVendorCatalogPricing(vendorCatalogPricingLog);
-
 
4352
 
-
 
4353
 
4354
            vendorCatalogPricingService.createVendorCatalogPricing(vendorCatalogPricingLog);
4354
            vendorCatalogPricingService.createVendorCatalogPricing(vendorCatalogPricingLog);
4355
        }
4355
        }
4356
 
4356
 
4357
    }
4357
    }
4358
 
4358