Subversion Repositories SmartDukaan

Rev

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

Rev 32439 Rev 32482
Line 4... Line 4...
4
import com.google.gson.Gson;
4
import com.google.gson.Gson;
5
import com.razorpay.Payment;
5
import com.razorpay.Payment;
6
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
6
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
7
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
7
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
8
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
8
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
-
 
9
import com.smartdukaan.cron.scheduled.runnables.PurchaseMigration;
9
import com.spice.profitmandi.common.enumuration.ActivationType;
10
import com.spice.profitmandi.common.enumuration.ActivationType;
10
import com.spice.profitmandi.common.enumuration.MessageType;
11
import com.spice.profitmandi.common.enumuration.MessageType;
11
import com.spice.profitmandi.common.enumuration.RechargeStatus;
12
import com.spice.profitmandi.common.enumuration.RechargeStatus;
12
import com.spice.profitmandi.common.enumuration.ReporticoProject;
13
import com.spice.profitmandi.common.enumuration.ReporticoProject;
13
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
14
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
Line 71... Line 72...
71
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
72
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
72
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
73
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
73
import com.spice.profitmandi.service.inventory.*;
74
import com.spice.profitmandi.service.inventory.*;
74
import com.spice.profitmandi.service.offers.OfferService;
75
import com.spice.profitmandi.service.offers.OfferService;
75
import com.spice.profitmandi.service.order.OrderService;
76
import com.spice.profitmandi.service.order.OrderService;
-
 
77
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
76
import com.spice.profitmandi.service.pricing.PriceDropService;
78
import com.spice.profitmandi.service.pricing.PriceDropService;
77
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
79
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
78
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
80
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
79
import com.spice.profitmandi.service.scheme.SchemeService;
81
import com.spice.profitmandi.service.scheme.SchemeService;
80
import com.spice.profitmandi.service.serviceConfig.ServiceConfigService;
82
import com.spice.profitmandi.service.serviceConfig.ServiceConfigService;
Line 153... Line 155...
153
 
155
 
154
    @Value("${oxigen.recharge.enquiry.url}")
156
    @Value("${oxigen.recharge.enquiry.url}")
155
    private String oxigenRechargeEnquiryUrl;
157
    private String oxigenRechargeEnquiryUrl;
156
 
158
 
157
    @Autowired
159
    @Autowired
-
 
160
    PurchaseMigration purchaseMigration;
-
 
161
 
-
 
162
    @Autowired
158
    private RegionRepository regionRepository;
163
    private RegionRepository regionRepository;
159
 
164
 
160
    @Autowired
165
    @Autowired
161
    private ServiceConfigService serviceConfigService;
166
    private ServiceConfigService serviceConfigService;
162
 
167
 
Line 996... Line 1001...
996
        } catch (Throwable e) {
1001
        } catch (Throwable e) {
997
            throw new Exception(e);
1002
            throw new Exception(e);
998
        }
1003
        }
999
    }
1004
    }
1000
 
1005
 
1001
    private static String getCellString(XSSFCell xssfCell) {
-
 
1002
        xssfCell.setCellType(CellType.STRING);
-
 
1003
        return xssfCell.getStringCellValue();
-
 
1004
    }
-
 
1005
 
-
 
1006
    public void test() throws Exception {
1006
    public void test() throws Exception {
1007
        //Read xls
-
 
1008
        FileInputStream fis = new FileInputStream(new File("/tmp/sample.xlsx"));
-
 
1009
        //creating workbook instance that refers to .xls file
-
 
1010
        XSSFWorkbook wb = new XSSFWorkbook(fis);
-
 
1011
        //creating a Sheet object to retrieve the object
-
 
1012
        XSSFSheet sheet = wb.getSheetAt(0);
-
 
1013
        int rows = sheet.getLastRowNum();
-
 
1014
        List<AddItemModel> addItemModels = new ArrayList<>();
-
 
1015
        for (int rowNum = 1; rowNum < rows; rowNum++) {
-
 
1016
            try {
-
 
1017
                XSSFRow xssfRow = sheet.getRow(rowNum);
-
 
1018
                AddItemModel addItemModel = new AddItemModel();
-
 
1019
                addItemModel.setItemId(Integer.parseInt(getCellString(xssfRow.getCell(0))));
-
 
1020
                addItemModel.setCatalogItemId((Integer.parseInt(getCellString(xssfRow.getCell(1)))));
-
 
1021
                addItemModel.setTp((Integer.parseInt(getCellString(xssfRow.getCell(7)))));
-
 
1022
                addItemModel.setSellingPrice((Integer.parseInt(getCellString(xssfRow.getCell(8)))));
-
 
1023
                addItemModel.setMop((Integer.parseInt(getCellString(xssfRow.getCell(9)))));
-
 
1024
                addItemModel.setMrp((Integer.parseInt(getCellString(xssfRow.getCell(10)))));
-
 
1025
                addItemModels.add(addItemModel);
-
 
1026
            } catch (RuntimeException re) {
-
 
1027
                System.out.println("Could not parse rownum - " + rowNum);
-
 
1028
            }
-
 
1029
        }
-
 
1030
        Map<Integer, List<AddItemModel>> catalogAddItemModelMap = addItemModels.stream().collect(Collectors.groupingBy(x -> x.getCatalogItemId()));
-
 
1031
        try {
-
 
1032
            for (Entry<Integer, List<AddItemModel>> catalogAddItemModelListEntry : catalogAddItemModelMap.entrySet()) {
-
 
1033
                int newCatalogId = itemRepository.getNextEntity();
-
 
1034
                List<AddItemModel> addItemModelList = catalogAddItemModelListEntry.getValue();
-
 
1035
                for (AddItemModel addItemModel : addItemModelList) {
-
 
1036
                    Item item = itemRepository.selectById(addItemModel.getItemId());
-
 
1037
                    Item clonedItem = item.clone();
-
 
1038
                    clonedItem.setCatalogItemId(newCatalogId);
-
 
1039
                    clonedItem.setModelName(String.join(" ", clonedItem.getBrand(), clonedItem.getModelName() == null ? "" : clonedItem.getModelName()));
-
 
1040
                    clonedItem.setBrand("Almost New");
-
 
1041
                    clonedItem.setWarrantyPeriod(6);
-
 
1042
                    clonedItem.setUpdatedOn(LocalDateTime.now());
-
 
1043
                    clonedItem.setMrp((float) addItemModel.getMrp());
-
 
1044
                    clonedItem.setSellingPrice((float) addItemModel.getSellingPrice());
-
 
1045
                    itemRepository.persist(clonedItem);
-
 
1046
 
-
 
1047
                    TagListing tagListing = new TagListing();
-
 
1048
                    tagListing.setItemId(clonedItem.getId());
-
 
1049
                    tagListing.setSellingPrice(clonedItem.getSellingPrice());
-
 
1050
                    tagListing.setActive(true);
-
 
1051
                    tagListing.setCreatedTimestamp(LocalDateTime.now());
-
 
1052
                    tagListing.setTagId(4);
-
 
1053
                    tagListing.setMop((float) addItemModel.getMop());
-
 
1054
                    tagListing.setMrp((float) addItemModel.getMrp());
-
 
1055
                    tagListing.setStartDate(LocalDateTime.now());
-
 
1056
                    tagListingRepository.persist(tagListing);
-
 
1057
                }
-
 
1058
            }
-
 
1059
            //this.migrateDebitNote();
-
 
1060
            //itelImeiActivationNewService.checkItelImeiActivationNew(LocalDate.now(), 15);
-
 
1061
        } catch (Throwable e) {
-
 
1062
            throw new Exception(e);
-
 
1063
        }
-
 
1064
 
1007
 
-
 
1008
 
-
 
1009
            purchaseMigration.migrateDebitNote();
1065
        //this.sendMailForSamsungRebilling();
1010
        //this.sendMailForSamsungRebilling();
1066
        /*List<PurchaseReturnItem> purchaseReturnItems = purchaseReturnItemRepository.selectPurchaseReturnByStatuses(Arrays.asList(PurchaseReturnStatus.DEBIT_NOTE_CREATED));
1011
        /*List<PurchaseReturnItem> purchaseReturnItems = purchaseReturnItemRepository.selectPurchaseReturnByStatuses(Arrays.asList(PurchaseReturnStatus.DEBIT_NOTE_CREATED));
1067
        Map<Integer, List<PurchaseReturnItem>> inventoryItemsMap = purchaseReturnItems.stream().collect(Collectors.groupingBy(x -> x.getDebitNoteId()));
1012
        Map<Integer, List<PurchaseReturnItem>> inventoryItemsMap = purchaseReturnItems.stream().collect(Collectors.groupingBy(x -> x.getDebitNoteId()));
1068
        for (Map.Entry<Integer, List<PurchaseReturnItem>> debitNotePurcahseReturnMap : inventoryItemsMap.entrySet()) {
1013
        for (Map.Entry<Integer, List<PurchaseReturnItem>> debitNotePurcahseReturnMap : inventoryItemsMap.entrySet()) {
1069
            List<InventoryItem> inventoryItems = inventoryItemRepository.selectAllByIds(debitNotePurcahseReturnMap.getValue().stream().map(x -> x.getInventoryItemId()).collect(Collectors.toList()));
1014
            List<InventoryItem> inventoryItems = inventoryItemRepository.selectAllByIds(debitNotePurcahseReturnMap.getValue().stream().map(x -> x.getInventoryItemId()).collect(Collectors.toList()));
Line 1086... Line 1031...
1086
    WarehouseSupplierInvoiceRepository warehouseSupplierInvoiceRepository;
1031
    WarehouseSupplierInvoiceRepository warehouseSupplierInvoiceRepository;
1087
 
1032
 
1088
    @Autowired
1033
    @Autowired
1089
    PurchaseOrderService purchaseOrderService;
1034
    PurchaseOrderService purchaseOrderService;
1090
 
1035
 
1091
    public void migrateDebitNote() {
-
 
1092
        //Delete all debit notes table and then run this
-
 
1093
        List<WarehouseInvoiceItem> warehouseInvoiceItems = warehouseInvoiceItemRepository.selectAll();
-
 
1094
        List<WarehouseSupplierInvoice> invoices = warehouseSupplierInvoiceRepository.selectAllByIds(warehouseInvoiceItems.stream().map(x -> x.getInvoiceId()).distinct().collect(Collectors.toList()));
-
 
1095
        invoices = invoices.stream().filter(x -> x.getStatus().equals(WarehouseInvoiceStatus.received)).collect(Collectors.toList());
-
 
1096
        invoices.stream().forEach(x -> {
-
 
1097
            GrnModel grnModel = new GrnModel();
-
 
1098
            grnModel.setInvoiceId(x.getId());
-
 
1099
            try {
1036
    @Autowired
1100
                purchaseOrderService.generateDebitNote(Arrays.asList(grnModel));
1037
    VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
1101
            } catch (Exception e) {
-
 
1102
                LOGGER.info("Could not create debit note for invoice - ", x.getInvoiceNumber());
-
 
1103
            }
-
 
1104
        });
-
 
1105
    }
-
 
1106
 
1038
 
1107
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1039
//    private void checkItelImeiActivationNew(LocalDate now, int i) {
1108
//    }
1040
//    }
1109
 
1041
 
1110
    @Autowired
1042
    @Autowired
Line 2139... Line 2071...
2139
            this.insruanceQty = insruanceQty;
2071
            this.insruanceQty = insruanceQty;
2140
        }
2072
        }
2141
 
2073
 
2142
    }
2074
    }
2143
 
2075
 
-
 
2076
    private void getStateWiseSales
2144
    private void getStateWiseSales(Map<Integer, SaleTargetReportModel> saleTargetReportModelMap, Map<Integer, FofoReportingModel> partnerSalesHeadersMap) throws Exception {
2077
            (Map<Integer, SaleTargetReportModel> saleTargetReportModelMap, Map<Integer, FofoReportingModel> partnerSalesHeadersMap) throws
-
 
2078
            Exception {
2145
        String timeString = "Today %s";
2079
        String timeString = "Today %s";
2146
        LocalDateTime now = LocalDateTime.now();
2080
        LocalDateTime now = LocalDateTime.now();
2147
 
2081
 
2148
        DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
2082
        DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
2149
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
2083
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
Line 2238... Line 2172...
2238
            }
2172
            }
2239
        }
2173
        }
2240
    }
2174
    }
2241
 
2175
 
2242
 
2176
 
2243
    private void sendMailOfHtmlFormat(JavaMailSender sender, String[] email, String body, String cc[], String subject) throws MessagingException, ProfitMandiBusinessException, IOException {
2177
    private void sendMailOfHtmlFormat(JavaMailSender sender, String[] email, String body, String cc[], String subject) throws
-
 
2178
            MessagingException, ProfitMandiBusinessException, IOException {
2244
        MimeMessage message = sender.createMimeMessage();
2179
        MimeMessage message = sender.createMimeMessage();
2245
        MimeMessageHelper helper = new MimeMessageHelper(message);
2180
        MimeMessageHelper helper = new MimeMessageHelper(message);
2246
        helper.setSubject(subject);
2181
        helper.setSubject(subject);
2247
        helper.setText(body, true);
2182
        helper.setText(body, true);
2248
        helper.setTo(email);
2183
        helper.setTo(email);
Line 2702... Line 2637...
2702
            }
2637
            }
2703
        }
2638
        }
2704
 
2639
 
2705
    }
2640
    }
2706
 
2641
 
-
 
2642
    private void addMissedScheduledLeadsTable(StringBuilder
2707
    private void addMissedScheduledLeadsTable(StringBuilder sb, List<Lead> missedScheduleLeads, Map<Integer, AuthUser> authUserMap) {
2643
                                                      sb, List<Lead> missedScheduleLeads, Map<Integer, AuthUser> authUserMap) {
2708
        sb.append("<h3>Leads That Missed the schedule</h3>");
2644
        sb.append("<h3>Leads That Missed the schedule</h3>");
2709
        sb.append("<table style='border:1px solid black' cellspacing='0'>").append("<tr>").append("<th style='border:1px solid black;padding: 5px'>").append("Lead Id").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Lead Name").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Mobile No").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("City").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("State").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Created On").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Assigned To").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Scheduled On").append("</th>").append("</tr>");
2645
        sb.append("<table style='border:1px solid black' cellspacing='0'>").append("<tr>").append("<th style='border:1px solid black;padding: 5px'>").append("Lead Id").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Lead Name").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Mobile No").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("City").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("State").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Created On").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Assigned To").append("</th>").append("<th style='border:1px solid black;padding: 5px'>").append("Scheduled On").append("</th>").append("</tr>");
2710
        for (Lead lead : missedScheduleLeads) {
2646
        for (Lead lead : missedScheduleLeads) {
2711
            sb.append("<tr style='background-color:").append(lead.getColor()).append("'>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getId()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getFullName()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getLeadMobile()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getCity()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getState()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(FormattingUtils.formatDate(lead.getCreatedTimestamp())).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(
2647
            sb.append("<tr style='background-color:").append(lead.getColor()).append("'>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getId()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getFullName()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getLeadMobile()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getCity()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(lead.getState()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(FormattingUtils.formatDate(lead.getCreatedTimestamp())).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(
2712
                    authUserMap.containsKey(lead.getAssignTo()) ? authUserMap.get(lead.getAssignTo()).getFullName() : lead.getAssignTo()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(FormattingUtils.formatDate(lead.getScheduledTimestamp())).append("</td>").append("</tr>");
2648
                    authUserMap.containsKey(lead.getAssignTo()) ? authUserMap.get(lead.getAssignTo()).getFullName() : lead.getAssignTo()).append("</td>").append("<td style='border:1px solid black;padding: 5px'>").append(FormattingUtils.formatDate(lead.getScheduledTimestamp())).append("</td>").append("</tr>");
Line 2808... Line 2744...
2808
        sb.append("</tbody></table></body></html>");
2744
        sb.append("</tbody></table></body></html>");
2809
 
2745
 
2810
        return sb.toString();
2746
        return sb.toString();
2811
    }
2747
    }
2812
 
2748
 
2813
    private String getMessageForUncontacblePartner(List<PartnerCollectionRemark> pcrs) throws ProfitMandiBusinessException {
2749
    private String getMessageForUncontacblePartner(List<PartnerCollectionRemark> pcrs) throws
-
 
2750
            ProfitMandiBusinessException {
2814
        StringBuilder sb = new StringBuilder();
2751
        StringBuilder sb = new StringBuilder();
2815
        sb.append("<html><body><p>Alert</p><p>Not Responding Partner:-</p>" + "<br/><table style='border:1px solid black ;padding: 5px';>");
2752
        sb.append("<html><body><p>Alert</p><p>Not Responding Partner:-</p>" + "<br/><table style='border:1px solid black ;padding: 5px';>");
2816
        sb.append("<tbody>\n" + "	    				<tr>\n" + "	    					<th style='border:1px solid black;padding: 5px'>PartnerName</th>\n" + "	    					<th style='border:1px solid black;padding: 5px'>from</th>\n"
2753
        sb.append("<tbody>\n" + "	    				<tr>\n" + "	    					<th style='border:1px solid black;padding: 5px'>PartnerName</th>\n" + "	    					<th style='border:1px solid black;padding: 5px'>from</th>\n"
2817
 
2754
 
2818
                + "	    				</tr>");
2755
                + "	    				</tr>");
Line 3074... Line 3011...
3074
            e.printStackTrace();
3011
            e.printStackTrace();
3075
        }
3012
        }
3076
 
3013
 
3077
    }
3014
    }
3078
 
3015
 
3079
    public void selectFinServiceFollowUpDateByCurrDate(LocalDate currentDate) throws MessagingException, ProfitMandiBusinessException, IOException {
3016
    public void selectFinServiceFollowUpDateByCurrDate(LocalDate currentDate) throws
-
 
3017
            MessagingException, ProfitMandiBusinessException, IOException {
3080
        LOGGER.info("selectfinServiceFollow - {}", "selectfinServiceFollowUpDateByCurrDate");
3018
        LOGGER.info("selectfinServiceFollow - {}", "selectfinServiceFollowUpDateByCurrDate");
3081
 
3019
 
3082
        serviceConfigService.selectFinServicePartnerfollowUpDateByCurrentDate(currentDate);
3020
        serviceConfigService.selectFinServicePartnerfollowUpDateByCurrentDate(currentDate);
3083
 
3021
 
3084
    }
3022
    }
Line 3359... Line 3297...
3359
    }
3297
    }
3360
 
3298
 
3361
    @Autowired
3299
    @Autowired
3362
    private PartnerCollectionRemarkRepository partnerCollectionRemarkRepository;
3300
    private PartnerCollectionRemarkRepository partnerCollectionRemarkRepository;
3363
 
3301
 
-
 
3302
    public void reviewUncontactablePartner() throws
3364
    public void reviewUncontactablePartner() throws ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
3303
            ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
3365
 
3304
 
3366
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
3305
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
3367
 
3306
 
3368
        List<Integer> pcrms = partnerCollectionRemarkRepository.selectMaxRemarkId(new ArrayList<>(customRetailerMap.keySet()));
3307
        List<Integer> pcrms = partnerCollectionRemarkRepository.selectMaxRemarkId(new ArrayList<>(customRetailerMap.keySet()));
3369
 
3308
 
Line 3477... Line 3416...
3477
     * public void getCCAvenuePendingOrderStatus(int pendingOrderId) { PendingOrder
3416
     * public void getCCAvenuePendingOrderStatus(int pendingOrderId) { PendingOrder
3478
     * pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
3417
     * pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
3479
     * ccAvenuePaymentService.getPaymentStatusMap(pendingOrder); }
3418
     * ccAvenuePaymentService.getPaymentStatusMap(pendingOrder); }
3480
     */
3419
     */
3481
 
3420
 
3482
    private void calculateInterest(Loan loan, Map<LoanReferenceType, Double> loanStatusAmount, int loanStatementId) throws ProfitMandiBusinessException {
3421
    private void calculateInterest(Loan loan, Map<LoanReferenceType, Double> loanStatusAmount,
-
 
3422
                                   int loanStatementId) throws ProfitMandiBusinessException {
3483
        LoanStatement loanStatement = loanStatementRepository.selectById(loanStatementId);
3423
        LoanStatement loanStatement = loanStatementRepository.selectById(loanStatementId);
3484
 
3424
 
3485
        if (loanStatement.getLoanId() == loan.getId()) {
3425
        if (loanStatement.getLoanId() == loan.getId()) {
3486
 
3426
 
3487
            sdCreditService.addInterest(loanStatement.getCreatedAt().toLocalDate(), LocalDate.now(), loan, loanStatusAmount);
3427
            sdCreditService.addInterest(loanStatement.getCreatedAt().toLocalDate(), LocalDate.now(), loan, loanStatusAmount);
Line 3650... Line 3590...
3650
        Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
3590
        Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
3651
 
3591
 
3652
 
3592
 
3653
    }
3593
    }
3654
 
3594
 
3655
    private void settledLoanStatement(LoanReferenceType loanReferneceType, BigDecimal amount, int fofoId, int loanId, String description, LocalDateTime now) {
3595
    private void settledLoanStatement(LoanReferenceType loanReferneceType, BigDecimal amount, int fofoId,
-
 
3596
                                      int loanId, String description, LocalDateTime now) {
3656
 
3597
 
3657
        sdCreditService.createLoanStatement(loanReferneceType, amount.abs(), fofoId, loanId, description, LocalDateTime.now());
3598
        sdCreditService.createLoanStatement(loanReferneceType, amount.abs(), fofoId, loanId, description, LocalDateTime.now());
3658
 
3599
 
3659
    }
3600
    }
3660
 
3601
 
3661
    private void createUserWalletHistory(int walletId, int userId, WalletReferenceType referenceType, int loanId, double interestAmount) {
3602
    private void createUserWalletHistory(int walletId, int userId, WalletReferenceType referenceType, int loanId,
-
 
3603
                                         double interestAmount) {
3662
        UserWalletHistory uwh = new UserWalletHistory();
3604
        UserWalletHistory uwh = new UserWalletHistory();
3663
        uwh.setWalletId(walletId);
3605
        uwh.setWalletId(walletId);
3664
        uwh.setFofoId(userId);
3606
        uwh.setFofoId(userId);
3665
        uwh.setBusinessTimestamp(LocalDateTime.now());
3607
        uwh.setBusinessTimestamp(LocalDateTime.now());
3666
        uwh.setReferenceType(referenceType);
3608
        uwh.setReferenceType(referenceType);
Line 3804... Line 3746...
3804
            this.sendDefaultLoanAlert(defaultLoans);
3746
            this.sendDefaultLoanAlert(defaultLoans);
3805
        }
3747
        }
3806
 
3748
 
3807
    }
3749
    }
3808
 
3750
 
-
 
3751
    public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws
3809
    public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws ProfitMandiBusinessException, MessagingException, IOException {
3752
            ProfitMandiBusinessException, MessagingException, IOException {
3810
        String subject = "Default Partners";
3753
        String subject = "Default Partners";
3811
 
3754
 
3812
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
3755
        List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
3813
 
3756
 
3814
        for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
3757
        for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
Line 4189... Line 4132...
4189
        }
4132
        }
4190
 
4133
 
4191
    }
4134
    }
4192
 
4135
 
4193
    private String getMessageHygieneAlertForPartner(
4136
    private String getMessageHygieneAlertForPartner(
4194
                                                    Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData) {
4137
            Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData) {
4195
 
4138
 
4196
        Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
4139
        Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
4197
 
4140
 
4198
        LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
4141
        LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
4199
        LocalDateTime endDate = LocalDateTime.now();
4142
        LocalDateTime endDate = LocalDateTime.now();
Line 4449... Line 4392...
4449
    }
4392
    }
4450
 
4393
 
4451
    @Autowired
4394
    @Autowired
4452
    private VendorItemPricingRepository vendorItemPricingRepository;
4395
    private VendorItemPricingRepository vendorItemPricingRepository;
4453
 
4396
 
4454
    @Autowired
-
 
4455
    private VendorCatalogPricingLogRepository vendorCatalogPricingLogRepository;
-
 
4456
 
-
 
4457
 
4397
 
4458
    @Autowired
4398
    @Autowired
4459
    private VendorCatalogPricingService vendorCatalogPricingService;
4399
    private VendorCatalogPricingService vendorCatalogPricingService;
4460
 
4400
 
4461
 
4401