| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.scheduled;
|
1 |
package com.smartdukaan.cron.scheduled;
|
| 2 |
|
2 |
|
| 3 |
import static java.util.stream.Collectors.groupingBy;
|
- |
|
| 4 |
import static java.util.stream.Collectors.mapping;
|
- |
|
| 5 |
|
- |
|
| 6 |
import java.io.FileOutputStream;
|
- |
|
| 7 |
import java.io.IOException;
|
- |
|
| 8 |
import java.io.ObjectOutputStream;
|
- |
|
| 9 |
import java.io.Serializable;
|
- |
|
| 10 |
import java.io.UnsupportedEncodingException;
|
- |
|
| 11 |
import java.math.BigDecimal;
|
- |
|
| 12 |
import java.math.RoundingMode;
|
- |
|
| 13 |
import java.nio.file.Files;
|
- |
|
| 14 |
import java.nio.file.Paths;
|
- |
|
| 15 |
import java.sql.Timestamp;
|
- |
|
| 16 |
import java.text.DecimalFormat;
|
- |
|
| 17 |
import java.time.Duration;
|
- |
|
| 18 |
import java.time.LocalDate;
|
- |
|
| 19 |
import java.time.LocalDateTime;
|
- |
|
| 20 |
import java.time.LocalTime;
|
- |
|
| 21 |
import java.time.Month;
|
- |
|
| 22 |
import java.time.YearMonth;
|
- |
|
| 23 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 24 |
import java.time.temporal.ChronoField;
|
- |
|
| 25 |
import java.time.temporal.ChronoUnit;
|
- |
|
| 26 |
import java.util.ArrayList;
|
- |
|
| 27 |
import java.util.Arrays;
|
- |
|
| 28 |
import java.util.Base64;
|
- |
|
| 29 |
import java.util.Collections;
|
- |
|
| 30 |
import java.util.Comparator;
|
- |
|
| 31 |
import java.util.HashMap;
|
- |
|
| 32 |
import java.util.HashSet;
|
- |
|
| 33 |
import java.util.LinkedHashMap;
|
- |
|
| 34 |
import java.util.List;
|
- |
|
| 35 |
import java.util.Map;
|
- |
|
| 36 |
import java.util.Map.Entry;
|
- |
|
| 37 |
import java.util.Objects;
|
- |
|
| 38 |
import java.util.Optional;
|
- |
|
| 39 |
import java.util.Set;
|
- |
|
| 40 |
import java.util.stream.Collectors;
|
- |
|
| 41 |
import java.util.stream.Stream;
|
- |
|
| 42 |
|
- |
|
| 43 |
import javax.mail.MessagingException;
|
- |
|
| 44 |
import javax.mail.internet.InternetAddress;
|
- |
|
| 45 |
import javax.mail.internet.MimeMessage;
|
- |
|
| 46 |
|
- |
|
| 47 |
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
|
- |
|
| 48 |
import com.spice.profitmandi.common.model.*;
|
- |
|
| 49 |
import com.spice.profitmandi.dao.entity.warehouse.*;
|
- |
|
| 50 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
- |
|
| 51 |
import com.spice.profitmandi.dao.enumuration.warehouse.WarehouseInvoiceStatus;
|
- |
|
| 52 |
import com.spice.profitmandi.dao.repository.warehouse.*;
|
- |
|
| 53 |
import com.spice.profitmandi.service.*;
|
- |
|
| 54 |
import com.spice.profitmandi.service.warehouse.PurchaseOrderService;
|
- |
|
| 55 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
- |
|
| 56 |
import org.apache.commons.lang.StringUtils;
|
- |
|
| 57 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
- |
|
| 58 |
import org.apache.http.client.methods.HttpPost;
|
- |
|
| 59 |
import org.apache.http.conn.HttpHostConnectException;
|
- |
|
| 60 |
import org.apache.http.entity.StringEntity;
|
- |
|
| 61 |
import org.apache.http.impl.client.CloseableHttpClient;
|
- |
|
| 62 |
import org.apache.http.impl.client.HttpClients;
|
- |
|
| 63 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 64 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 65 |
import org.hibernate.Session;
|
- |
|
| 66 |
import org.hibernate.SessionFactory;
|
- |
|
| 67 |
import org.hibernate.query.NativeQuery;
|
- |
|
| 68 |
import org.json.JSONArray;
|
- |
|
| 69 |
import org.json.JSONObject;
|
- |
|
| 70 |
import org.json.XML;
|
- |
|
| 71 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 72 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 73 |
import org.springframework.beans.factory.annotation.Value;
|
- |
|
| 74 |
import org.springframework.core.io.ByteArrayResource;
|
- |
|
| 75 |
import org.springframework.core.io.InputStreamSource;
|
- |
|
| 76 |
import org.springframework.mail.javamail.JavaMailSender;
|
- |
|
| 77 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
- |
|
| 78 |
import org.springframework.stereotype.Component;
|
- |
|
| 79 |
import org.springframework.transaction.annotation.Transactional;
|
- |
|
| 80 |
|
- |
|
| 81 |
import com.google.common.collect.Lists;
|
3 |
import com.google.common.collect.Lists;
|
| 82 |
import com.google.gson.Gson;
|
4 |
import com.google.gson.Gson;
|
| 83 |
import com.razorpay.Payment;
|
5 |
import com.razorpay.Payment;
|
| - |
|
6 |
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
|
| 84 |
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
|
7 |
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
|
| 85 |
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
|
8 |
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
|
| 86 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
9 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
| 87 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
10 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 88 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
11 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
| 89 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
12 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 90 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
13 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
14 |
import com.spice.profitmandi.common.model.*;
|
| 91 |
import com.spice.profitmandi.common.services.ReporticoService;
|
15 |
import com.spice.profitmandi.common.services.ReporticoService;
|
| 92 |
import com.spice.profitmandi.common.services.mandii.AccountStatusResponseOut;
|
16 |
import com.spice.profitmandi.common.services.mandii.AccountStatusResponseOut;
|
| 93 |
import com.spice.profitmandi.common.services.mandii.EligibilityStatusEnum;
|
17 |
import com.spice.profitmandi.common.services.mandii.EligibilityStatusEnum;
|
| 94 |
import com.spice.profitmandi.common.services.mandii.MandiiService;
|
18 |
import com.spice.profitmandi.common.services.mandii.MandiiService;
|
| 95 |
import com.spice.profitmandi.common.util.FileUtil;
|
19 |
import com.spice.profitmandi.common.util.FileUtil;
|
| Line 105... |
Line 29... |
| 105 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
29 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 106 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
30 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 107 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
31 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 108 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
32 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 109 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
33 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
| 110 |
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
|
- |
|
| 111 |
import com.spice.profitmandi.dao.entity.dtr.CreditStatus;
|
- |
|
| 112 |
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
|
- |
|
| 113 |
import com.spice.profitmandi.dao.entity.dtr.EmployeeAttendance;
|
- |
|
| 114 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
- |
|
| 115 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
- |
|
| 116 |
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
|
- |
|
| 117 |
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
|
- |
|
| 118 |
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
|
- |
|
| 119 |
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
|
- |
|
| 120 |
import com.spice.profitmandi.dao.entity.dtr.RetailerBlockBrands;
|
- |
|
| 121 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
34 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 122 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
- |
|
| 123 |
import com.spice.profitmandi.dao.entity.fofo.CurrentPartnerDailyInvestment;
|
- |
|
| 124 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
35 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
| 125 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
- |
|
| 126 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
- |
|
| 127 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
- |
|
| 128 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
- |
|
| 129 |
import com.spice.profitmandi.dao.entity.fofo.FofoPayment;
|
- |
|
| 130 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
- |
|
| 131 |
import com.spice.profitmandi.dao.entity.fofo.HygieneData;
|
- |
|
| 132 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 133 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyTarget;
|
- |
|
| 134 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 135 |
import com.spice.profitmandi.dao.entity.fofo.PartnerProblem;
|
- |
|
| 136 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
- |
|
| 137 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
- |
|
| 138 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
- |
|
| 139 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
36 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 140 |
import com.spice.profitmandi.dao.entity.fofo.RazorPay;
|
- |
|
| 141 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
- |
|
| 142 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
- |
|
| 143 |
import com.spice.profitmandi.dao.entity.inventory.PartnerAgeingModel;
|
- |
|
| 144 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
- |
|
| 145 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCIS;
|
37 |
import com.spice.profitmandi.dao.entity.inventory.*;
|
| 146 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
- |
|
| 147 |
import com.spice.profitmandi.dao.entity.inventory.VendorCatalogPricingLog;
|
- |
|
| 148 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
- |
|
| 149 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
38 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 150 |
import com.spice.profitmandi.dao.entity.transaction.LoanStatement;
|
- |
|
| 151 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
- |
|
| 152 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
- |
|
| 153 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
- |
|
| 154 |
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
|
- |
|
| 155 |
import com.spice.profitmandi.dao.entity.transaction.SanctionRequest;
|
- |
|
| 156 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
- |
|
| 157 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
- |
|
| 158 |
import com.spice.profitmandi.dao.entity.user.Address;
|
39 |
import com.spice.profitmandi.dao.entity.user.*;
|
| 159 |
import com.spice.profitmandi.dao.entity.user.Device;
|
40 |
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInvoiceItem;
|
| 160 |
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
|
41 |
import com.spice.profitmandi.dao.entity.warehouse.WarehouseSupplierInvoice;
|
| 161 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
- |
|
| 162 |
import com.spice.profitmandi.dao.entity.user.Refferal;
|
- |
|
| 163 |
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
|
42 |
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
|
| 164 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
43 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 165 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
44 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 166 |
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
|
45 |
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
|
| 167 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
46 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
| Line 169... |
Line 48... |
| 169 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
48 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 170 |
import com.spice.profitmandi.dao.enumuration.inventory.VendorCatalogPricingStatus;
|
49 |
import com.spice.profitmandi.dao.enumuration.inventory.VendorCatalogPricingStatus;
|
| 171 |
import com.spice.profitmandi.dao.enumuration.transaction.CreditRisk;
|
50 |
import com.spice.profitmandi.dao.enumuration.transaction.CreditRisk;
|
| 172 |
import com.spice.profitmandi.dao.enumuration.transaction.LoanReferenceType;
|
51 |
import com.spice.profitmandi.dao.enumuration.transaction.LoanReferenceType;
|
| 173 |
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
|
52 |
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
|
| 174 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
53 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 175 |
import com.spice.profitmandi.dao.model.RetailerFilterModel;
|
- |
|
| 176 |
import com.spice.profitmandi.dao.model.RetailerPeformanceFilterModel;
|
54 |
import com.spice.profitmandi.dao.enumuration.warehouse.WarehouseInvoiceStatus;
|
| 177 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
55 |
import com.spice.profitmandi.dao.model.*;
|
| 178 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
- |
|
| 179 |
import com.spice.profitmandi.dao.model.VendorCatalogPricingModel;
|
- |
|
| 180 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
56 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 181 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
|
57 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
|
| 182 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferItemRepository;
|
- |
|
| 183 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferRepository;
|
- |
|
| 184 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
- |
|
| 185 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
- |
|
| 186 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
58 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 187 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
- |
|
| 188 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
- |
|
| 189 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
- |
|
| 190 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
59 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 191 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
- |
|
| 192 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
- |
|
| 193 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
- |
|
| 194 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
- |
|
| 195 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
- |
|
| 196 |
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
|
- |
|
| 197 |
import com.spice.profitmandi.dao.repository.dtr.EmployeeAttendanceRepository;
|
- |
|
| 198 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
- |
|
| 199 |
import com.spice.profitmandi.dao.repository.dtr.FranchiseeActivityRepository;
|
- |
|
| 200 |
import com.spice.profitmandi.dao.repository.dtr.FranchiseeVisitRepository;
|
- |
|
| 201 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
- |
|
| 202 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
- |
|
| 203 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
60 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 204 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
- |
|
| 205 |
import com.spice.profitmandi.dao.repository.dtr.PartnerProblemRepository;
|
- |
|
| 206 |
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
|
- |
|
| 207 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderCreditWalletHistoryRepository;
|
- |
|
| 208 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
|
- |
|
| 209 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
- |
|
| 210 |
import com.spice.profitmandi.dao.repository.dtr.RefferalRepository;
|
- |
|
| 211 |
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
|
- |
|
| 212 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
- |
|
| 213 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
- |
|
| 214 |
import com.spice.profitmandi.dao.repository.dtr.UserCampaignRepository;
|
- |
|
| 215 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
- |
|
| 216 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
- |
|
| 217 |
import com.spice.profitmandi.dao.repository.fofo.CurrentPartnerDailyInvestmentRepository;
|
- |
|
| 218 |
import com.spice.profitmandi.dao.repository.fofo.CustomerAddressRepository;
|
- |
|
| 219 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
- |
|
| 220 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
- |
|
| 221 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
- |
|
| 222 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
- |
|
| 223 |
import com.spice.profitmandi.dao.repository.fofo.FofoPaymentRepository;
|
- |
|
| 224 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
- |
|
| 225 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 226 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyTargetRepository;
|
- |
|
| 227 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 228 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
- |
|
| 229 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
- |
|
| 230 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
- |
|
| 231 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
- |
|
| 232 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
- |
|
| 233 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
- |
|
| 234 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
- |
|
| 235 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
- |
|
| 236 |
import com.spice.profitmandi.dao.repository.fofo.RazorPayRepository;
|
61 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 237 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
- |
|
| 238 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
- |
|
| 239 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
- |
|
| 240 |
import com.spice.profitmandi.dao.repository.fofo.ServiceConfigRepository;
|
- |
|
| 241 |
import com.spice.profitmandi.dao.repository.inventory.BrandAgeingLimitRepository;
|
- |
|
| 242 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
- |
|
| 243 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
62 |
import com.spice.profitmandi.dao.repository.inventory.*;
|
| 244 |
import com.spice.profitmandi.dao.repository.inventory.VendorCatalogPricingLogRepository;
|
- |
|
| 245 |
import com.spice.profitmandi.dao.repository.inventory.VendorItemPricingRepository;
|
- |
|
| 246 |
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
|
- |
|
| 247 |
import com.spice.profitmandi.dao.repository.transaction.HdfcPaymentRepository;
|
- |
|
| 248 |
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
|
- |
|
| 249 |
import com.spice.profitmandi.dao.repository.transaction.LoanRepository;
|
63 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| 250 |
import com.spice.profitmandi.dao.repository.transaction.LoanStatementRepository;
|
- |
|
| 251 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
- |
|
| 252 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
- |
|
| 253 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
- |
|
| 254 |
import com.spice.profitmandi.dao.repository.transaction.SDCreditRequirementRepository;
|
- |
|
| 255 |
import com.spice.profitmandi.dao.repository.transaction.SanctionRequestRepository;
|
- |
|
| 256 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
- |
|
| 257 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
- |
|
| 258 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
- |
|
| 259 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
64 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 260 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
65 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| - |
|
66 |
import com.spice.profitmandi.dao.repository.warehouse.*;
|
| 261 |
import com.spice.profitmandi.dao.service.solr.FofoSolr;
|
67 |
import com.spice.profitmandi.dao.service.solr.FofoSolr;
|
| - |
|
68 |
import com.spice.profitmandi.service.*;
|
| 262 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
69 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
| 263 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
70 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
| 264 |
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
|
71 |
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
|
| 265 |
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
|
72 |
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
|
| 266 |
import com.spice.profitmandi.service.inventory.AgeingModel;
|
73 |
import com.spice.profitmandi.service.inventory.*;
|
| 267 |
import com.spice.profitmandi.service.inventory.AgeingService;
|
- |
|
| 268 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
- |
|
| 269 |
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
|
- |
|
| 270 |
import com.spice.profitmandi.service.inventory.VendorCatalogPricingService;
|
- |
|
| 271 |
import com.spice.profitmandi.service.offers.OfferService;
|
74 |
import com.spice.profitmandi.service.offers.OfferService;
|
| 272 |
import com.spice.profitmandi.service.order.OrderService;
|
75 |
import com.spice.profitmandi.service.order.OrderService;
|
| 273 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
76 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
| 274 |
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
|
77 |
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
|
| 275 |
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
|
78 |
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
|
| Line 278... |
Line 81... |
| 278 |
import com.spice.profitmandi.service.transaction.CreditNoteService;
|
81 |
import com.spice.profitmandi.service.transaction.CreditNoteService;
|
| 279 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
82 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 280 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
83 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 281 |
import com.spice.profitmandi.service.user.RetailerService;
|
84 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 282 |
import com.spice.profitmandi.service.wallet.WalletService;
|
85 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 283 |
|
- |
|
| - |
|
86 |
import com.spice.profitmandi.service.warehouse.PurchaseOrderService;
|
| 284 |
import in.shop2020.model.v1.order.OrderStatus;
|
87 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 285 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
88 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| 286 |
import okhttp3.OkHttpClient;
|
89 |
import okhttp3.OkHttpClient;
|
| 287 |
import okhttp3.Request;
|
90 |
import okhttp3.Request;
|
| 288 |
import okhttp3.Response;
|
91 |
import okhttp3.Response;
|
| - |
|
92 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| - |
|
93 |
import org.apache.commons.lang.StringUtils;
|
| - |
|
94 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
| - |
|
95 |
import org.apache.http.client.methods.HttpPost;
|
| - |
|
96 |
import org.apache.http.conn.HttpHostConnectException;
|
| - |
|
97 |
import org.apache.http.entity.StringEntity;
|
| - |
|
98 |
import org.apache.http.impl.client.CloseableHttpClient;
|
| - |
|
99 |
import org.apache.http.impl.client.HttpClients;
|
| - |
|
100 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
101 |
import org.apache.logging.log4j.Logger;
|
| - |
|
102 |
import org.apache.poi.ss.usermodel.CellType;
|
| - |
|
103 |
import org.apache.poi.xssf.usermodel.XSSFCell;
|
| - |
|
104 |
import org.apache.poi.xssf.usermodel.XSSFRow;
|
| - |
|
105 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
| - |
|
106 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
| - |
|
107 |
import org.hibernate.Session;
|
| - |
|
108 |
import org.hibernate.SessionFactory;
|
| - |
|
109 |
import org.hibernate.query.NativeQuery;
|
| - |
|
110 |
import org.json.JSONArray;
|
| - |
|
111 |
import org.json.JSONObject;
|
| - |
|
112 |
import org.json.XML;
|
| - |
|
113 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
114 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
115 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
116 |
import org.springframework.core.io.ByteArrayResource;
|
| - |
|
117 |
import org.springframework.core.io.InputStreamSource;
|
| - |
|
118 |
import org.springframework.mail.javamail.JavaMailSender;
|
| - |
|
119 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| - |
|
120 |
import org.springframework.stereotype.Component;
|
| - |
|
121 |
import org.springframework.transaction.annotation.Transactional;
|
| - |
|
122 |
|
| - |
|
123 |
import javax.mail.MessagingException;
|
| - |
|
124 |
import javax.mail.internet.InternetAddress;
|
| - |
|
125 |
import javax.mail.internet.MimeMessage;
|
| - |
|
126 |
import java.io.*;
|
| - |
|
127 |
import java.math.BigDecimal;
|
| - |
|
128 |
import java.math.RoundingMode;
|
| - |
|
129 |
import java.nio.file.Files;
|
| - |
|
130 |
import java.nio.file.Paths;
|
| - |
|
131 |
import java.sql.Timestamp;
|
| - |
|
132 |
import java.text.DecimalFormat;
|
| - |
|
133 |
import java.time.*;
|
| - |
|
134 |
import java.time.format.DateTimeFormatter;
|
| - |
|
135 |
import java.time.temporal.ChronoField;
|
| - |
|
136 |
import java.time.temporal.ChronoUnit;
|
| - |
|
137 |
import java.util.*;
|
| - |
|
138 |
import java.util.Map.Entry;
|
| - |
|
139 |
import java.util.stream.Collectors;
|
| - |
|
140 |
import java.util.stream.Stream;
|
| - |
|
141 |
|
| - |
|
142 |
import static java.util.stream.Collectors.groupingBy;
|
| - |
|
143 |
import static java.util.stream.Collectors.mapping;
|
| 289 |
|
144 |
|
| 290 |
|
145 |
|
| 291 |
@Component
|
146 |
@Component
|
| 292 |
@Transactional(rollbackFor = Throwable.class)
|
147 |
@Transactional(rollbackFor = Throwable.class)
|
| 293 |
public class ScheduledTasks {
|
148 |
public class ScheduledTasks {
|
| Line 966... |
Line 821... |
| 966 |
} finally {
|
821 |
} finally {
|
| 967 |
if (oos != null) {
|
822 |
if (oos != null) {
|
| 968 |
oos.close();
|
823 |
oos.close();
|
| 969 |
}
|
824 |
}
|
| 970 |
}
|
825 |
}
|
| 971 |
ReporticoCacheTable rct = reporticoCacheTableRepository.selectByTableName("partnerStat");
|
826 |
ReporticoCacheTable reporticoCacheTable = reporticoCacheTableRepository.selectByTableName("partnerStat");
|
| 972 |
if (rct == null) {
|
827 |
if (reporticoCacheTable == null) {
|
| 973 |
rct = new ReporticoCacheTable();
|
828 |
reporticoCacheTable = new ReporticoCacheTable();
|
| 974 |
rct.setTableName("partnerStat");
|
829 |
reporticoCacheTable.setTableName("partnerStat");
|
| 975 |
rct.setLastCreatedTimestamp(LocalDateTime.now());
|
830 |
reporticoCacheTable.setLastCreatedTimestamp(LocalDateTime.now());
|
| 976 |
reporticoCacheTableRepository.persist(rct);
|
831 |
reporticoCacheTableRepository.persist(reporticoCacheTable);
|
| 977 |
} else {
|
832 |
} else {
|
| 978 |
rct.setLastCreatedTimestamp(LocalDateTime.now());
|
833 |
reporticoCacheTable.setLastCreatedTimestamp(LocalDateTime.now());
|
| 979 |
}
|
834 |
}
|
| 980 |
}
|
835 |
}
|
| 981 |
|
836 |
|
| 982 |
public void processPriceDrop() throws Exception {
|
837 |
public void processPriceDrop() throws Exception {
|
| 983 |
List<PriceDrop> priceDrops = priceDropRepository.selectAllByDatesBetween(LocalDateTime.now(), LocalDateTime.now().minusYears(1));
|
838 |
List<PriceDrop> priceDrops = priceDropRepository.selectAllByDatesBetween(LocalDateTime.now(), LocalDateTime.now().minusYears(1));
|
| Line 1142... |
Line 997... |
| 1142 |
} catch (Throwable e) {
|
997 |
} catch (Throwable e) {
|
| 1143 |
throw new Exception(e);
|
998 |
throw new Exception(e);
|
| 1144 |
}
|
999 |
}
|
| 1145 |
}
|
1000 |
}
|
| 1146 |
|
1001 |
|
| - |
|
1002 |
private static String getCellString(XSSFCell xssfCell) {
|
| - |
|
1003 |
xssfCell.setCellType(CellType.STRING);
|
| - |
|
1004 |
return xssfCell.getStringCellValue();
|
| - |
|
1005 |
}
|
| - |
|
1006 |
|
| 1147 |
public void test() throws Exception {
|
1007 |
public void test() throws Exception {
|
| - |
|
1008 |
//Read xls
|
| - |
|
1009 |
FileInputStream fis = new FileInputStream(new File("/tmp/sample.xlsx"));
|
| - |
|
1010 |
//creating workbook instance that refers to .xls file
|
| - |
|
1011 |
XSSFWorkbook wb = new XSSFWorkbook(fis);
|
| - |
|
1012 |
//creating a Sheet object to retrieve the object
|
| - |
|
1013 |
XSSFSheet sheet = wb.getSheetAt(0);
|
| - |
|
1014 |
int rows = sheet.getLastRowNum();
|
| - |
|
1015 |
List<AddItemModel> addItemModels = new ArrayList<>();
|
| - |
|
1016 |
for (int rowNum = 1; rowNum < rows; rowNum++) {
|
| - |
|
1017 |
try {
|
| - |
|
1018 |
XSSFRow xssfRow = sheet.getRow(rowNum);
|
| - |
|
1019 |
AddItemModel addItemModel = new AddItemModel();
|
| - |
|
1020 |
addItemModel.setItemId(Integer.parseInt(getCellString(xssfRow.getCell(0))));
|
| - |
|
1021 |
addItemModel.setCatalogItemId((Integer.parseInt(getCellString(xssfRow.getCell(1)))));
|
| - |
|
1022 |
addItemModel.setTp((Integer.parseInt(getCellString(xssfRow.getCell(7)))));
|
| - |
|
1023 |
addItemModel.setSellingPrice((Integer.parseInt(getCellString(xssfRow.getCell(8)))));
|
| - |
|
1024 |
addItemModel.setMop((Integer.parseInt(getCellString(xssfRow.getCell(9)))));
|
| - |
|
1025 |
addItemModel.setMrp((Integer.parseInt(getCellString(xssfRow.getCell(10)))));
|
| - |
|
1026 |
addItemModels.add(addItemModel);
|
| - |
|
1027 |
} catch (RuntimeException re) {
|
| - |
|
1028 |
System.out.println("Could not parse rownum - " + rowNum);
|
| - |
|
1029 |
}
|
| - |
|
1030 |
}
|
| - |
|
1031 |
Map<Integer, List<AddItemModel>> catalogAddItemModelMap = addItemModels.stream().collect(Collectors.groupingBy(x -> x.getCatalogItemId()));
|
| 1148 |
try {
|
1032 |
try {
|
| - |
|
1033 |
for (Entry<Integer, List<AddItemModel>> catalogAddItemModelListEntry : catalogAddItemModelMap.entrySet()) {
|
| - |
|
1034 |
int newCatalogId = itemRepository.getNextEntity();
|
| - |
|
1035 |
List<AddItemModel> addItemModelList = catalogAddItemModelListEntry.getValue();
|
| - |
|
1036 |
for (AddItemModel addItemModel : addItemModelList) {
|
| - |
|
1037 |
Item item = itemRepository.selectById(addItemModel.getItemId());
|
| - |
|
1038 |
Item cloned = item.clone();
|
| - |
|
1039 |
cloned.setCatalogItemId(newCatalogId);
|
| - |
|
1040 |
cloned.setModelName(String.join(" ", cloned.getBrand(), cloned.getModelName() == null ? "" : cloned.getModelName()));
|
| - |
|
1041 |
cloned.setBrand("Almost New");
|
| - |
|
1042 |
cloned.setWarrantyPeriod(6);
|
| - |
|
1043 |
cloned.setUpdatedOn(LocalDateTime.now());
|
| - |
|
1044 |
cloned.setMrp((float) addItemModel.getMrp());
|
| - |
|
1045 |
cloned.setSellingPrice((float) addItemModel.getSellingPrice());
|
| - |
|
1046 |
itemRepository.persist(item);
|
| - |
|
1047 |
|
| - |
|
1048 |
TagListing tagListing = new TagListing();
|
| - |
|
1049 |
tagListing.setItemId(item.getId());
|
| - |
|
1050 |
tagListing.setSellingPrice(cloned.getSellingPrice());
|
| - |
|
1051 |
tagListing.setActive(true);
|
| - |
|
1052 |
tagListing.setCreatedTimestamp(LocalDateTime.now());
|
| - |
|
1053 |
tagListing.setTagId(4);
|
| - |
|
1054 |
tagListing.setMop((float) addItemModel.getMop());
|
| - |
|
1055 |
tagListing.setMrp((float) addItemModel.getMrp());
|
| - |
|
1056 |
tagListing.setStartDate(LocalDateTime.now());
|
| - |
|
1057 |
tagListingRepository.persist(tagListing);
|
| - |
|
1058 |
}
|
| - |
|
1059 |
}
|
| 1149 |
this.migrateDebitNote();
|
1060 |
//this.migrateDebitNote();
|
| 1150 |
//itelImeiActivationNewService.checkItelImeiActivationNew(LocalDate.now(), 15);
|
1061 |
//itelImeiActivationNewService.checkItelImeiActivationNew(LocalDate.now(), 15);
|
| 1151 |
} catch (Throwable e) {
|
1062 |
} catch (Throwable e) {
|
| 1152 |
throw new Exception(e);
|
1063 |
throw new Exception(e);
|
| 1153 |
}
|
1064 |
}
|
| 1154 |
|
1065 |
|
| Line 2759... |
Line 2670... |
| 2759 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
2670 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 2760 |
sendNotificationModel.setMessageType(MessageType.reminder);
|
2671 |
sendNotificationModel.setMessageType(MessageType.reminder);
|
| 2761 |
sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(lead.getAssignTo())));
|
2672 |
sendNotificationModel.setUserIds(Arrays.asList(authUserKeyMap.get(lead.getAssignTo())));
|
| 2762 |
System.out.println(sendNotificationModel);
|
2673 |
System.out.println(sendNotificationModel);
|
| 2763 |
notificationService.sendNotification(sendNotificationModel);
|
2674 |
notificationService.sendNotification(sendNotificationModel);
|
| 2764 |
AuthUser authUser = authRepository.selectById(lead.getAssignTo());
|
- |
|
| 2765 |
// notificationService.sendWhatsappMessage(notificationMessage, title,
|
- |
|
| 2766 |
// authUser.getMobileNumber());
|
- |
|
| 2767 |
}
|
2675 |
}
|
| 2768 |
}
|
2676 |
}
|
| 2769 |
|
2677 |
|
| 2770 |
@Autowired
|
2678 |
@Autowired
|
| 2771 |
AuthService authService;
|
2679 |
AuthService authService;
|
| Line 2794... |
Line 2702... |
| 2794 |
if (authMissedScheduledLeads.size() > 0) {
|
2702 |
if (authMissedScheduledLeads.size() > 0) {
|
| 2795 |
addMissedScheduledLeadsTable(sb, authMissedScheduledLeads, authUserMap);
|
2703 |
addMissedScheduledLeadsTable(sb, authMissedScheduledLeads, authUserMap);
|
| 2796 |
sb.append("</body></html>");
|
2704 |
sb.append("</body></html>");
|
| 2797 |
|
2705 |
|
| 2798 |
String subject = "Lead Updates Summary";
|
2706 |
String subject = "Lead Updates Summary";
|
| 2799 |
//TODO: Uncomment it later
|
- |
|
| 2800 |
// String[] email = Arrays.asList(authUser.getEmailId()).toArray(new String[1]);
|
2707 |
String[] email = Arrays.asList(authUser.getEmailId()).toArray(new String[1]);
|
| 2801 |
String[] email = Arrays.asList("amit.gupta@smartdukaan.com").toArray(new String[1]);
|
2708 |
//String[] email = Arrays.asList("amit.gupta@smartdukaan.com").toArray(new String[1]);
|
| 2802 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
2709 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
| 2803 |
break;
|
2710 |
//break;
|
| 2804 |
}
|
2711 |
}
|
| 2805 |
}
|
2712 |
}
|
| 2806 |
|
2713 |
|
| 2807 |
}
|
2714 |
}
|
| 2808 |
|
2715 |
|