Subversion Repositories SmartDukaan

Rev

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

Rev 36973 Rev 36975
Line 698... Line 698...
698
 
698
 
699
 
699
 
700
 
700
 
701
    public void generateBiReportExcel() throws Exception {
701
    public void generateBiReportExcel() throws Exception {
702
 
702
 
-
 
703
        long __biReportStartMs = System.currentTimeMillis();
-
 
704
        LOGGER.info("[BI_REPORT] START batch-optimized generateBiReportExcel at {}", LocalDateTime.now());
-
 
705
 
703
        LocalDateTime startOfToday;
706
        LocalDateTime startOfToday;
704
        LocalDateTime previousDay;
707
        LocalDateTime previousDay;
705
 
708
 
706
        if (LocalDate.now().getDayOfMonth() == 1) {
709
        if (LocalDate.now().getDayOfMonth() == 1) {
707
            startOfToday = LocalDate.now().minusDays(1).atStartOfDay();
710
            startOfToday = LocalDate.now().minusDays(1).atStartOfDay();
Line 910... Line 913...
910
 
913
 
911
        // DRR precomputation — the two dates we ever call with
914
        // DRR precomputation — the two dates we ever call with
912
        long day1RemainingDays = rbmTargetService.getRemainingDaysInMonth(currentMonth.atDay(1));
915
        long day1RemainingDays = rbmTargetService.getRemainingDaysInMonth(currentMonth.atDay(1));
913
        long todayRemainingDays = rbmTargetService.getRemainingDaysInMonth(startOfToday.toLocalDate());
916
        long todayRemainingDays = rbmTargetService.getRemainingDaysInMonth(startOfToday.toLocalDate());
914
 
917
 
-
 
918
        LOGGER.info("[BI_REPORT] batch pre-fetch complete in {}ms; retailers={}, entering per-fofo loop",
-
 
919
                System.currentTimeMillis() - __biReportStartMs, retailerIds.size());
-
 
920
        long __biReportLoopStartMs = System.currentTimeMillis();
-
 
921
 
915
        Map<Integer , String> assessmentMap = new HashMap<>();
922
        Map<Integer , String> assessmentMap = new HashMap<>();
916
        Map<Integer , String> zeroBillingMap = new HashMap<>();
923
        Map<Integer , String> zeroBillingMap = new HashMap<>();
917
        Map<Integer , Float> billingNeededMap = new HashMap<>();
924
        Map<Integer , Float> billingNeededMap = new HashMap<>();
918
        Map<Integer , Integer> countAMap = new HashMap<>();
925
        Map<Integer , Integer> countAMap = new HashMap<>();
919
        Map<Integer , BIRetailerModel> biRetailerModelMap = new HashMap<>();
926
        Map<Integer , BIRetailerModel> biRetailerModelMap = new HashMap<>();
Line 1157... Line 1164...
1157
            billingNeededMap.put(fofoId, drrPercentDisplay >= 110 && todayRequiredDrr > 0 ? (float) todayRequiredDrr : 0f);
1164
            billingNeededMap.put(fofoId, drrPercentDisplay >= 110 && todayRequiredDrr > 0 ? (float) todayRequiredDrr : 0f);
1158
            countAMap.put(fofoId, (defaultLoanAmount > 0 || investmentLevel <= 75 || currentMonthNetSecondary <= 100000 || drrPercentDisplay >= 110) ? 1 : 0);
1165
            countAMap.put(fofoId, (defaultLoanAmount > 0 || investmentLevel <= 75 || currentMonthNetSecondary <= 100000 || drrPercentDisplay >= 110) ? 1 : 0);
1159
        }
1166
        }
1160
 
1167
 
1161
        LOGGER.info("Total BI Retailers processed: {}", biRetailerModelMap.size());
1168
        LOGGER.info("Total BI Retailers processed: {}", biRetailerModelMap.size());
-
 
1169
        LOGGER.info("[BI_REPORT] per-fofo loop finished in {}ms",
-
 
1170
                System.currentTimeMillis() - __biReportLoopStartMs);
1162
 
1171
 
1163
        //generate excel and sent to mail
1172
        //generate excel and sent to mail
1164
        List<List<String>> headerGroup = new ArrayList<>();
1173
        List<List<String>> headerGroup = new ArrayList<>();
1165
 
1174
 
1166
        List<String> headers1 = Arrays.asList(
1175
        List<String> headers1 = Arrays.asList(
Line 1386... Line 1395...
1386
                        "deena.nath@smartdukaan.com",
1395
                        "deena.nath@smartdukaan.com",
1387
                        "santosh.giri@smartdukaan.com"
1396
                        "santosh.giri@smartdukaan.com"
1388
                }
1397
                }
1389
        );
1398
        );
1390
 
1399
 
-
 
1400
        LOGGER.info("[BI_REPORT] DONE batch-optimized generateBiReportExcel; totalMs={}, retailers={}, rows={}",
-
 
1401
                System.currentTimeMillis() - __biReportStartMs, retailerIds.size(), rows.size());
-
 
1402
 
1391
 
1403
 
1392
    }
1404
    }
1393
 
1405
 
1394
    private  void sendMailToUser(List<List<String>> headerGroup,List<List<?>> rows, String[] sendToArray ) throws Exception {
1406
    private  void sendMailToUser(List<List<String>> headerGroup,List<List<?>> rows, String[] sendToArray ) throws Exception {
1395
        // Send to email
1407
        // Send to email