Subversion Repositories SmartDukaan

Rev

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

Rev 34252 Rev 34275
Line 32... Line 32...
32
import com.spice.profitmandi.dao.entity.dtr.*;
32
import com.spice.profitmandi.dao.entity.dtr.*;
33
import com.spice.profitmandi.dao.entity.fofo.*;
33
import com.spice.profitmandi.dao.entity.fofo.*;
34
import com.spice.profitmandi.dao.entity.inventory.*;
34
import com.spice.profitmandi.dao.entity.inventory.*;
35
import com.spice.profitmandi.dao.entity.logistics.AST;
35
import com.spice.profitmandi.dao.entity.logistics.AST;
36
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
36
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
37
import com.spice.profitmandi.dao.entity.onBoarding.LoiForm;
-
 
38
import com.spice.profitmandi.dao.entity.transaction.*;
37
import com.spice.profitmandi.dao.entity.transaction.*;
39
import com.spice.profitmandi.dao.entity.user.*;
38
import com.spice.profitmandi.dao.entity.user.*;
40
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
39
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
41
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
40
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
42
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
41
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
Line 47... Line 46...
47
import com.spice.profitmandi.dao.enumuration.fofo.PaymentStatus;
46
import com.spice.profitmandi.dao.enumuration.fofo.PaymentStatus;
48
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;
47
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;
49
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
48
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
50
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
49
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
51
import com.spice.profitmandi.dao.enumuration.inventory.VendorCatalogPricingStatus;
50
import com.spice.profitmandi.dao.enumuration.inventory.VendorCatalogPricingStatus;
52
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.LoiStatus;
-
 
53
import com.spice.profitmandi.dao.enumuration.transaction.CreditRisk;
51
import com.spice.profitmandi.dao.enumuration.transaction.*;
54
import com.spice.profitmandi.dao.enumuration.transaction.LoanReferenceType;
-
 
55
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
-
 
56
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
-
 
57
import com.spice.profitmandi.dao.model.*;
52
import com.spice.profitmandi.dao.model.*;
58
import com.spice.profitmandi.dao.model.purchaseSaleRatio.CatalogAgedModel;
-
 
59
import com.spice.profitmandi.dao.repository.GenericRepository;
53
import com.spice.profitmandi.dao.repository.GenericRepository;
60
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
54
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
61
import com.spice.profitmandi.dao.repository.auth.NonSdBuyingRepository;
55
import com.spice.profitmandi.dao.repository.auth.NonSdBuyingRepository;
62
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
56
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
63
import com.spice.profitmandi.dao.repository.catalog.*;
57
import com.spice.profitmandi.dao.repository.catalog.*;
Line 147... Line 141...
147
import java.text.DecimalFormat;
141
import java.text.DecimalFormat;
148
import java.time.*;
142
import java.time.*;
149
import java.time.format.DateTimeFormatter;
143
import java.time.format.DateTimeFormatter;
150
import java.time.temporal.ChronoField;
144
import java.time.temporal.ChronoField;
151
import java.time.temporal.ChronoUnit;
145
import java.time.temporal.ChronoUnit;
152
import java.time.temporal.WeekFields;
-
 
153
import java.util.*;
146
import java.util.*;
154
import java.util.Map.Entry;
147
import java.util.Map.Entry;
155
import java.util.stream.Collectors;
148
import java.util.stream.Collectors;
156
import java.util.stream.Stream;
149
import java.util.stream.Stream;
157
 
150
 
Line 1071... Line 1064...
1071
    @Autowired
1064
    @Autowired
1072
    StoreTimelineTatService storeTimelineTatService;
1065
    StoreTimelineTatService storeTimelineTatService;
1073
    @Autowired
1066
    @Autowired
1074
    PartnerDealerRepository partnerDealerRepository;
1067
    PartnerDealerRepository partnerDealerRepository;
1075
 
1068
 
-
 
1069
    @Autowired
-
 
1070
    PurSaleService purSaleService;
-
 
1071
 
1076
    public void test() throws Exception {
1072
    public void test() throws Exception {
1077
        System.out.println("test start");
1073
        System.out.println("test start");
-
 
1074
//        this.send10OrMoreOrderStockReport();
1078
        System.out.println("test end");
1075
        System.out.println("test end");
1079
 
1076
 
1080
    }
1077
    }
1081
 
1078
 
1082
    public void test4() throws Exception {
1079
    public void test4() throws Exception {
Line 1617... Line 1614...
1617
        }
1614
        }
1618
        return partnerIdSalesHeadersMap;
1615
        return partnerIdSalesHeadersMap;
1619
 
1616
 
1620
    }
1617
    }
1621
 
1618
 
1622
    public void persistRbmTodayTargets() throws Exception{
1619
    public void persistRbmTodayTargets() throws Exception {
1623
        rbmTargetService.setMovementWiseRbmTargets();
1620
        rbmTargetService.setMovementWiseRbmTargets();
1624
    }
1621
    }
1625
 
1622
 
1626
    public void persistRbmTodayAchievements() throws Exception{
1623
    public void persistRbmTodayAchievements() throws Exception {
1627
        rbmTargetService.setMovementWiseRbmAchievement();
1624
        rbmTargetService.setMovementWiseRbmAchievement();
1628
    }
1625
    }
1629
 
1626
 
1630
    public void sendPartnerInvestmentDetails() throws Exception {
1627
    public void sendPartnerInvestmentDetails() throws Exception {
1631
        this.sendPartnerInvestmentDetails(null);
1628
        this.sendPartnerInvestmentDetails(null);
Line 2581... Line 2578...
2581
                    httpPost.setHeader("Content-Type", "application/json");
2578
                    httpPost.setHeader("Content-Type", "application/json");
2582
 
2579
 
2583
                    StringEntity entity = new StringEntity(payload.toString());
2580
                    StringEntity entity = new StringEntity(payload.toString());
2584
                    httpPost.setEntity(entity);
2581
                    httpPost.setEntity(entity);
2585
                    CloseableHttpResponse response = client.execute(httpPost);
2582
                    CloseableHttpResponse response = client.execute(httpPost);
2586
                    LOGGER.info("google FCM status code: {}",response.getStatusLine().getStatusCode());
2583
                    LOGGER.info("google FCM status code: {}", response.getStatusLine().getStatusCode());
2587
                    String responseBody = new BufferedReader(new InputStreamReader(response.getEntity().getContent()))
2584
                    String responseBody = new BufferedReader(new InputStreamReader(response.getEntity().getContent()))
2588
                            .lines().collect(Collectors.joining("\n"));
2585
                            .lines().collect(Collectors.joining("\n"));
2589
                    if (response.getStatusLine().getStatusCode() == 200) {
2586
                    if (response.getStatusLine().getStatusCode() == 200) {
2590
                        pushNotification.setSentTimestamp(LocalDateTime.now());
2587
                        pushNotification.setSentTimestamp(LocalDateTime.now());
2591
                    } else {
2588
                    } else {
Line 2820... Line 2817...
2820
                fm.setPendingIndentQty(processingQty);
2817
                fm.setPendingIndentQty(processingQty);
2821
                fm.setShortageQty(shortageQty);
2818
                fm.setShortageQty(shortageQty);
2822
                fm.setPoAvailability(allColorPoAvailability);
2819
                fm.setPoAvailability(allColorPoAvailability);
2823
                fm.setDp(tagListing.getSellingPrice());
2820
                fm.setDp(tagListing.getSellingPrice());
2824
                fm.setWarehouseName(warehouseMap.get(customRetailer.getWarehouseId()));
2821
                fm.setWarehouseName(warehouseMap.get(customRetailer.getWarehouseId()));
2825
                if(partnerIdSalesHeadersMap.get(fofoId) != null){
2822
                if (partnerIdSalesHeadersMap.get(fofoId) != null) {
2826
                    fm.setStateManager(partnerIdSalesHeadersMap.get(fofoId).getRegionalManager());
2823
                    fm.setStateManager(partnerIdSalesHeadersMap.get(fofoId).getRegionalManager());
2827
                    fm.setTerritoryManager(partnerIdSalesHeadersMap.get(fofoId).getTerritoryManager());
2824
                    fm.setTerritoryManager(partnerIdSalesHeadersMap.get(fofoId).getTerritoryManager());
2828
                }else {
2825
                } else {
2829
                    LOGGER.info("else fofoId - {}",fofoId);
2826
                    LOGGER.info("else fofoId - {}", fofoId);
2830
                    fm.setStateManager("");
2827
                    fm.setStateManager("");
2831
                    fm.setTerritoryManager("");
2828
                    fm.setTerritoryManager("");
2832
                }
2829
                }
2833
 
2830
 
2834
                fm.setItemName(items.get(0).getBrand() + items.get(0).getModelNumber() + items.get(0).getModelName());
2831
                fm.setItemName(items.get(0).getBrand() + items.get(0).getModelNumber() + items.get(0).getModelName());
Line 2836... Line 2833...
2836
 
2833
 
2837
                focusedModelShortageList.add(fm);
2834
                focusedModelShortageList.add(fm);
2838
            }
2835
            }
2839
 
2836
 
2840
        }
2837
        }
2841
        LOGGER.info("focusedModelShortageReportMap {}",focusedModelShortageReportMap);
2838
        LOGGER.info("focusedModelShortageReportMap {}", focusedModelShortageReportMap);
2842
        if (!focusedModelShortageReportMap.isEmpty()) {
2839
        if (!focusedModelShortageReportMap.isEmpty()) {
2843
            String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2840
            String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2844
            Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
2841
            Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
2845
            Map<String, List<List<?>>> emailRowsMap = new HashMap<>();
2842
            Map<String, List<List<?>>> emailRowsMap = new HashMap<>();
2846
 
2843
 
Line 2869... Line 2866...
2869
                } catch (Exception e2) {
2866
                } catch (Exception e2) {
2870
                    e2.printStackTrace();
2867
                    e2.printStackTrace();
2871
                }
2868
                }
2872
                String[] sendToArray = new String[]{
2869
                String[] sendToArray = new String[]{
2873
 
2870
 
2874
                        entry.getKey(), "alok.divedi@smartdukaan.com","ranu.rajput@smartdukaan.com"
2871
                        entry.getKey(), "alok.divedi@smartdukaan.com", "ranu.rajput@smartdukaan.com"
2875
 
2872
 
2876
                };
2873
                };
2877
 
2874
 
2878
 
2875
 
2879
                try {
2876
                try {
Line 3710... Line 3707...
3710
 
3707
 
3711
    public void loanSettlement() throws Exception {
3708
    public void loanSettlement() throws Exception {
3712
        List<Loan> blockedLoans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() >= 365).collect(toList());
3709
        List<Loan> blockedLoans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() >= 365).collect(toList());
3713
        List<Loan> loans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() < 365).collect(toList());
3710
        List<Loan> loans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() < 365).collect(toList());
3714
        //Settle blocked loans only when normal loans are settled
3711
        //Settle blocked loans only when normal loans are settled
3715
            loans.addAll(blockedLoans);
3712
        loans.addAll(blockedLoans);
3716
            //TODO:Remove this code
3713
        //TODO:Remove this code
3717
            Loan specificLoan = loanRepository.selectByLoanId(20073);
3714
        Loan specificLoan = loanRepository.selectByLoanId(20073);
3718
            loans.add(0, specificLoan);
3715
        loans.add(0, specificLoan);
3719
            //TODO:Upto here
3716
        //TODO:Upto here
3720
            if (!loans.isEmpty()) {
3717
        if (!loans.isEmpty()) {
3721
 
-
 
3722
                for (Loan loan : loans) {
-
 
3723
                    double settledAmount = sdCreditService.settleLoan(loan);
-
 
3724
 
-
 
3725
                    List<SanctionRequest> sanctionRequests = sanctionRequestRepository.selectHoldSanctionByFofoId(loan.getFofoId());
-
 
3726
                    for (SanctionRequest sanctionRequest : sanctionRequests) {
-
 
3727
 
-
 
3728
                        List<Order> orders = orderRepository.selectAllByTransactionId(sanctionRequest.getTransactionId());
-
 
3729
                        if (orders.size() == 0) {
-
 
3730
                            LOGGER.info("Could not find orders - for Sanction Request {}", sanctionRequest);
-
 
3731
                            continue;
-
 
3732
                        }
-
 
3733
 
3718
 
3734
                        if (settledAmount >= sanctionRequest.getPendingAmount().doubleValue()) {
-
 
3735
                            settledAmount -= sanctionRequest.getPendingAmount().doubleValue();
-
 
3736
                            sanctionRequest.setPendingAmount(BigDecimal.valueOf(0));
-
 
3737
                            this.sendUnholdEmail(orders);
-
 
3738
                        } else {
3719
            for (Loan loan : loans) {
3739
                            double pendinAmount = sanctionRequest.getPendingAmount().doubleValue() - settledAmount;
-
 
3740
                            System.out.println("Pending Amount - " + pendinAmount);
3720
                double settledAmount = sdCreditService.settleLoan(loan);
3741
                            sanctionRequest.setPendingAmount(BigDecimal.valueOf(pendinAmount));
-
 
3742
                            break;
-
 
3743
 
3721
 
-
 
3722
                List<SanctionRequest> sanctionRequests = sanctionRequestRepository.selectHoldSanctionByFofoId(loan.getFofoId());
-
 
3723
                for (SanctionRequest sanctionRequest : sanctionRequests) {
-
 
3724
 
-
 
3725
                    List<Order> orders = orderRepository.selectAllByTransactionId(sanctionRequest.getTransactionId());
-
 
3726
                    if (orders.size() == 0) {
-
 
3727
                        LOGGER.info("Could not find orders - for Sanction Request {}", sanctionRequest);
-
 
3728
                        continue;
3744
                        }
3729
                    }
-
 
3730
 
-
 
3731
                    if (settledAmount >= sanctionRequest.getPendingAmount().doubleValue()) {
-
 
3732
                        settledAmount -= sanctionRequest.getPendingAmount().doubleValue();
-
 
3733
                        sanctionRequest.setPendingAmount(BigDecimal.valueOf(0));
-
 
3734
                        this.sendUnholdEmail(orders);
-
 
3735
                    } else {
-
 
3736
                        double pendinAmount = sanctionRequest.getPendingAmount().doubleValue() - settledAmount;
-
 
3737
                        System.out.println("Pending Amount - " + pendinAmount);
-
 
3738
                        sanctionRequest.setPendingAmount(BigDecimal.valueOf(pendinAmount));
-
 
3739
                        break;
3745
 
3740
 
3746
                    }
3741
                    }
3747
                }
-
 
3748
 
3742
 
-
 
3743
                }
3749
            }
3744
            }
3750
 
3745
 
-
 
3746
        }
3751
 
3747
 
3752
 
3748
 
3753
    }
3749
    }
3754
 
3750
 
3755
 
3751
 
Line 3870... Line 3866...
3870
            CreditRisk creditRisk = sdCreditService.getCurrentRisk(sdCreditRequirement, firstBillingDate);
3866
            CreditRisk creditRisk = sdCreditService.getCurrentRisk(sdCreditRequirement, firstBillingDate);
3871
 
3867
 
3872
            sdCreditRequirement.setRisk(creditRisk);
3868
            sdCreditRequirement.setRisk(creditRisk);
3873
 
3869
 
3874
            sdCreditRequirement.setSuggestedLimit(suggestedAmount);
3870
            sdCreditRequirement.setSuggestedLimit(suggestedAmount);
3875
            if(!sdCreditRequirement.isHardLimit()){
3871
            if (!sdCreditRequirement.isHardLimit()) {
3876
                sdCreditRequirement.setLimit(suggestedAmount);
3872
                sdCreditRequirement.setLimit(suggestedAmount);
3877
            }
3873
            }
3878
            BigDecimal utilizedLimit = new BigDecimal(sdCreditService.getUtilizationAmount(fofoId));
3874
            BigDecimal utilizedLimit = new BigDecimal(sdCreditService.getUtilizationAmount(fofoId));
3879
 
3875
 
3880
            BigDecimal availableLimit = sdCreditRequirement.getLimit().subtract(utilizedLimit);
3876
            BigDecimal availableLimit = sdCreditRequirement.getLimit().subtract(utilizedLimit);
Line 3951... Line 3947...
3951
 
3947
 
3952
            }
3948
            }
3953
 
3949
 
3954
        }
3950
        }
3955
        String messageText = this.getMessageForDueDateExtend(defaultLoans);
3951
        String messageText = this.getMessageForDueDateExtend(defaultLoans);
3956
        this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com","rahul.latwal@smartdukaan.com"}, messageText, null, subject);
3952
        this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com", "rahul.latwal@smartdukaan.com"}, messageText, null, subject);
3957
 
3953
 
3958
        for (Loan defaultLoan : defaultLoans) {
3954
        for (Loan defaultLoan : defaultLoans) {
3959
            List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
3955
            List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(defaultLoan.getId());
3960
 
3956
 
3961
            double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
3957
            double amount = loanStatements.stream().map(x -> x.getAmount()).collect(Collectors.summingDouble(x -> x.doubleValue()));
Line 4116... Line 4112...
4116
 
4112
 
4117
            }
4113
            }
4118
 
4114
 
4119
        }
4115
        }
4120
        String messageText = this.getMessageForDueDateCross(dueDateCrossLoans);
4116
        String messageText = this.getMessageForDueDateCross(dueDateCrossLoans);
4121
        this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com","rahul.latwal@smartdukaan.com"}, messageText, null, "Due Date Cross");
4117
        this.sendMailOfHtmlFormat(googleMailSender, new String[]{"puneet.wahi@smartdukaan.com", "rahul.latwal@smartdukaan.com"}, messageText, null, "Due Date Cross");
4122
 
4118
 
4123
 
4119
 
4124
        if (!dueDateCrossLoans.isEmpty()) {
4120
        if (!dueDateCrossLoans.isEmpty()) {
4125
            for (Loan loan : dueDateCrossLoans) {
4121
            for (Loan loan : dueDateCrossLoans) {
4126
 
4122
 
Line 5061... Line 5057...
5061
                // Check if an entry already exists in the FofoOpeningStock table
5057
                // Check if an entry already exists in the FofoOpeningStock table
5062
                FofoOpeningStock existingStock = fofoOpeningStockRepository.findByFofoIdAndCatalogId(fofoId, catalogId);
5058
                FofoOpeningStock existingStock = fofoOpeningStockRepository.findByFofoIdAndCatalogId(fofoId, catalogId);
5063
 
5059
 
5064
 
5060
 
5065
                if (existingStock != null) {
5061
                if (existingStock != null) {
5066
                    if(partnerCurrentQty < 1 && existingStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))){
5062
                    if (partnerCurrentQty < 1 && existingStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))) {
5067
                        fofoOpeningStockRepository.delete(existingStock);
5063
                        fofoOpeningStockRepository.delete(existingStock);
5068
                    }
5064
                    }
5069
                    if (existingStock.getOpeningQty() < partnerCurrentQty) {
5065
                    if (existingStock.getOpeningQty() < partnerCurrentQty) {
5070
                        existingStock.setOpeningQty(partnerCurrentQty);
5066
                        existingStock.setOpeningQty(partnerCurrentQty);
5071
                        existingStock.setCurrentQty(partnerCurrentQty);
5067
                        existingStock.setCurrentQty(partnerCurrentQty);
5072
                        existingStock.setOpeningDate(openingDate);
5068
                        existingStock.setOpeningDate(openingDate);
5073
                        LOGGER.info("if condition exist {}");
5069
                        LOGGER.info("if condition exist {}");
5074
                    }else if(existingStock.getCurrentQty() >= existingStock.getOpeningQty()){
5070
                    } else if (existingStock.getCurrentQty() >= existingStock.getOpeningQty()) {
5075
                            existingStock.setOpeningQty(existingStock.getCurrentQty());
5071
                        existingStock.setOpeningQty(existingStock.getCurrentQty());
5076
                            existingStock.setCurrentQty(partnerCurrentQty);
5072
                        existingStock.setCurrentQty(partnerCurrentQty);
5077
                            existingStock.setOpeningDate(LocalDate.now());
5073
                        existingStock.setOpeningDate(LocalDate.now());
5078
                    } else if (existingStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))) {
5074
                    } else if (existingStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))) {
5079
                        int averageQty = Math.round((existingStock.getCurrentQty() + existingStock.getOpeningQty()) / 2.0f);
5075
                        int averageQty = Math.round((existingStock.getCurrentQty() + existingStock.getOpeningQty()) / 2.0f);
5080
 
5076
 
5081
                        if (averageQty == 1 && existingStock.getOpeningQty() == 1 && existingStock.getCurrentQty() == 0) {
5077
                        if (averageQty == 1 && existingStock.getOpeningQty() == 1 && existingStock.getCurrentQty() == 0) {
5082
                            // Delete the existing stock entry from the table
5078
                            // Delete the existing stock entry from the table
Line 5087... Line 5083...
5087
                            existingStock.setOpeningQty(averageQty);
5083
                            existingStock.setOpeningQty(averageQty);
5088
                            existingStock.setCurrentQty(partnerCurrentQty);
5084
                            existingStock.setCurrentQty(partnerCurrentQty);
5089
                            existingStock.setOpeningDate(LocalDate.now());
5085
                            existingStock.setOpeningDate(LocalDate.now());
5090
                            LOGGER.info("Updated due to date being older than 7 days with average quantity: {}", averageQty);
5086
                            LOGGER.info("Updated due to date being older than 7 days with average quantity: {}", averageQty);
5091
                        }
5087
                        }
5092
                    }else {
5088
                    } else {
5093
                        existingStock.setCurrentQty(partnerCurrentQty);
5089
                        existingStock.setCurrentQty(partnerCurrentQty);
5094
                    }
5090
                    }
5095
                } else {
5091
                } else {
5096
                    LOGGER.info("else condition exist");
5092
                    LOGGER.info("else condition exist");
5097
                    FofoOpeningStock newStock = new FofoOpeningStock();
5093
                    FofoOpeningStock newStock = new FofoOpeningStock();
Line 5104... Line 5100...
5104
 
5100
 
5105
                }
5101
                }
5106
            }
5102
            }
5107
 
5103
 
5108
//            if stock is not available in snapshot but available in opening stock
5104
//            if stock is not available in snapshot but available in opening stock
5109
              List<FofoOpeningStock> fofoOpeningStockList = fofoOpeningStockRepository.selectAllByFofoId(fofoId);
5105
            List<FofoOpeningStock> fofoOpeningStockList = fofoOpeningStockRepository.selectAllByFofoId(fofoId);
5110
 
5106
 
5111
              for(FofoOpeningStock fofoOpeningStock : fofoOpeningStockList){
5107
            for (FofoOpeningStock fofoOpeningStock : fofoOpeningStockList) {
5112
 
5108
 
5113
                  if(!partnerStockList.stream().anyMatch(partnerStock -> partnerStock.getCatalogId() == fofoOpeningStock.getCatalogId())){
5109
                if (!partnerStockList.stream().anyMatch(partnerStock -> partnerStock.getCatalogId() == fofoOpeningStock.getCatalogId())) {
5114
                      if(fofoOpeningStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))){
5110
                    if (fofoOpeningStock.getOpeningDate().isBefore(LocalDate.now().minusDays(7))) {
5115
                          LOGGER.info("not match stock{}",fofoOpeningStock);
5111
                        LOGGER.info("not match stock{}", fofoOpeningStock);
5116
                          fofoOpeningStockRepository.delete(fofoOpeningStock);
5112
                        fofoOpeningStockRepository.delete(fofoOpeningStock);
5117
                      }else{
5113
                    } else {
5118
                          LOGGER.info("not match stock2{}",fofoOpeningStock);
5114
                        LOGGER.info("not match stock2{}", fofoOpeningStock);
5119
                          fofoOpeningStock.setCurrentQty(0);
5115
                        fofoOpeningStock.setCurrentQty(0);
5120
                      }
5116
                    }
5121
 
5117
 
5122
                  }
5118
                }
5123
              }
5119
            }
5124
 
5120
 
5125
        }
5121
        }
5126
    }
5122
    }
5127
 
5123
 
5128
 
5124
 
Line 5266... Line 5262...
5266
 
5262
 
5267
        }
5263
        }
5268
        sb.append("</table>");
5264
        sb.append("</table>");
5269
        sb.append("</body></html>");
5265
        sb.append("</body></html>");
5270
 
5266
 
5271
        List<String> sendTo = Arrays.asList("uday.singh@smartdukaan.com", "kuldeep.kumar@smartdukaan.com", "nishant.ohri@smartdukaan.com", "ritesh.chauhan1@smartdukaan.com","shobhit.tandon@smartdukaan.com","tarun.verma@smartdukaan.com","niranjan.kala@smartdukaan.com");
5267
        List<String> sendTo = Arrays.asList("uday.singh@smartdukaan.com", "kuldeep.kumar@smartdukaan.com", "nishant.ohri@smartdukaan.com", "ritesh.chauhan1@smartdukaan.com", "shobhit.tandon@smartdukaan.com", "tarun.verma@smartdukaan.com", "niranjan.kala@smartdukaan.com");
5272
 
5268
 
5273
 
5269
 
5274
        String[] email = sendTo.toArray(new String[sendTo.size()]);
5270
        String[] email = sendTo.toArray(new String[sendTo.size()]);
5275
 
5271
 
5276
        this.sendMailOfHtmlFormat(mailSender, email, sb.toString(), null, subject);
5272
        this.sendMailOfHtmlFormat(mailSender, email, sb.toString(), null, subject);
5277
    }
5273
    }
5278
 
5274
 
-
 
5275
    public void send10OrMoreOlderStockReport() throws Exception {
-
 
5276
       purSaleService.moreThen10DaysEgedStockReport();
5279
 
5277
 
5280
 
5278
    }
5281
 
5279
 
5282
}
5280
}
5283
// 2284"
5281
// 2284"
5284
5282