| 23755 |
amit.gupta |
1 |
package com.smartdukaan.cron;
|
| 23723 |
amit.gupta |
2 |
|
| 32782 |
raveendra. |
3 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
| 37613 |
amit |
4 |
import com.smartdukaan.cron.migrations.InternalGrnTask;
|
| 32782 |
raveendra. |
5 |
import com.smartdukaan.cron.scheduled.*;
|
|
|
6 |
import com.smartdukaan.cron.scheduled.b2b.Listing;
|
| 36745 |
ranu |
7 |
import com.smartdukaan.cron.scheduled.beatmiss.BeatMissDetectorRunner;
|
| 32782 |
raveendra. |
8 |
import com.smartdukaan.cron.scheduled.leadsync.LeadSyncRunner;
|
| 32831 |
amit.gupta |
9 |
import com.smartdukaan.cron.scheduled.ordertracking.OrderTrackingService;
|
| 33274 |
amit.gupta |
10 |
import com.smartdukaan.cron.scheduled.purchaseorder.POScheduler;
|
| 34860 |
ranu |
11 |
import com.smartdukaan.cron.scheduled.razorpay.FetchPartnersDisbursementTask;
|
| 36058 |
ranu |
12 |
import com.smartdukaan.cron.scheduled.knowlarity.KnowlarityCallMonitorScheduler;
|
|
|
13 |
import com.spice.profitmandi.common.model.InvoicePdfModel;
|
| 34443 |
vikas.jang |
14 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 32782 |
raveendra. |
15 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
|
|
16 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
|
|
17 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 36035 |
amit |
18 |
import com.spice.profitmandi.dao.service.shopify.ShopifyProductSyncService;
|
| 32782 |
raveendra. |
19 |
import com.spice.profitmandi.dao.util.ContentPojoPopulator;
|
| 37499 |
ranu |
20 |
import com.spice.profitmandi.service.NotificationService;
|
|
|
21 |
import com.spice.profitmandi.service.integrations.icicilombard.IciciLombardService;
|
|
|
22 |
import com.spice.profitmandi.service.integrations.icicilombard.model.LastTransactionsResponseModel;
|
| 32782 |
raveendra. |
23 |
import com.spice.profitmandi.service.integrations.samsung.upgradeoffer.UpgradeOfferService;
|
| 36063 |
ranu |
24 |
import com.spice.profitmandi.service.mail.MailOutboxService;
|
| 23723 |
amit.gupta |
25 |
import org.apache.logging.log4j.LogManager;
|
|
|
26 |
import org.apache.logging.log4j.Logger;
|
| 28389 |
amit.gupta |
27 |
import org.apache.velocity.app.VelocityEngine;
|
|
|
28 |
import org.apache.velocity.exception.VelocityException;
|
| 23898 |
amit.gupta |
29 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
30 |
import org.springframework.boot.ApplicationArguments;
|
|
|
31 |
import org.springframework.boot.ApplicationRunner;
|
| 23723 |
amit.gupta |
32 |
import org.springframework.boot.WebApplicationType;
|
|
|
33 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
34 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
35 |
import org.springframework.context.annotation.Bean;
|
|
|
36 |
import org.springframework.context.annotation.ComponentScan;
|
| 37631 |
amit |
37 |
import org.springframework.context.annotation.Lazy;
|
| 34554 |
tejus.loha |
38 |
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
| 23935 |
amit.gupta |
39 |
import org.springframework.context.annotation.Primary;
|
| 23723 |
amit.gupta |
40 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
|
|
41 |
import org.springframework.core.io.ClassPathResource;
|
| 35393 |
amit |
42 |
import org.springframework.core.io.Resource;
|
| 23906 |
amit.gupta |
43 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 37453 |
amit |
44 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
| 37631 |
amit |
45 |
import com.spice.profitmandi.common.services.MailRecipientFilter;
|
|
|
46 |
import com.spice.profitmandi.common.services.RecipientFilteringMailSender;
|
| 23906 |
amit.gupta |
47 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 28389 |
amit.gupta |
48 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
| 23723 |
amit.gupta |
49 |
|
| 32782 |
raveendra. |
50 |
import java.io.FileInputStream;
|
|
|
51 |
import java.io.IOException;
|
|
|
52 |
import java.time.LocalDate;
|
| 37058 |
amit |
53 |
import java.time.LocalDateTime;
|
| 32782 |
raveendra. |
54 |
import java.time.YearMonth;
|
|
|
55 |
import java.util.ArrayList;
|
|
|
56 |
import java.util.Arrays;
|
|
|
57 |
import java.util.List;
|
|
|
58 |
import java.util.Properties;
|
|
|
59 |
import java.util.stream.Collectors;
|
| 23724 |
amit.gupta |
60 |
|
| 23723 |
amit.gupta |
61 |
@SpringBootApplication
|
| 34554 |
tejus.loha |
62 |
@EnableAspectJAutoProxy
|
| 23755 |
amit.gupta |
63 |
@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")
|
| 24122 |
govind |
64 |
public class Application implements ApplicationRunner {
|
|
|
65 |
|
| 31753 |
tejbeer |
66 |
private static final Logger LOGGER = LogManager.getLogger(Application.class);
|
| 24122 |
govind |
67 |
|
| 31753 |
tejbeer |
68 |
@Autowired
|
|
|
69 |
LeadSyncRunner leadSyncRunner;
|
| 30120 |
amit.gupta |
70 |
|
| 31753 |
tejbeer |
71 |
@Autowired
|
|
|
72 |
StandAlone standAlone;
|
| 30209 |
amit.gupta |
73 |
|
| 31753 |
tejbeer |
74 |
@Autowired
|
|
|
75 |
UpgradeOfferService upgradeOfferService;
|
| 27392 |
amit.gupta |
76 |
|
| 31753 |
tejbeer |
77 |
@Autowired
|
|
|
78 |
private TicketRelatedScheduledTask ticketRelatedScheduledTask;
|
| 28368 |
tejbeer |
79 |
|
| 31753 |
tejbeer |
80 |
@Autowired
|
|
|
81 |
private OnBoardingRelatedSchelduleTask onBoardingRelatedSchelduleTask;
|
| 28921 |
tejbeer |
82 |
|
| 31753 |
tejbeer |
83 |
@Autowired
|
|
|
84 |
private InvestmentRelatedTasks investmentRelatedTasks;
|
| 27392 |
amit.gupta |
85 |
|
| 31753 |
tejbeer |
86 |
@Autowired
|
|
|
87 |
private CsService csService;
|
| 29814 |
tejbeer |
88 |
|
| 31753 |
tejbeer |
89 |
@Autowired
|
|
|
90 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| 24603 |
amit.gupta |
91 |
|
| 31753 |
tejbeer |
92 |
@Autowired
|
|
|
93 |
private ContentPojoPopulator contentPojoPopulator;
|
| 29361 |
tejbeer |
94 |
|
| 31753 |
tejbeer |
95 |
@Autowired
|
|
|
96 |
private Listing listing;
|
| 24122 |
govind |
97 |
|
| 32831 |
amit.gupta |
98 |
@Autowired
|
|
|
99 |
OrderTrackingService orderTrackingService;
|
|
|
100 |
|
| 36306 |
amit |
101 |
@Autowired
|
|
|
102 |
BatchScheduledTasks batchScheduledTasks;
|
|
|
103 |
|
| 36745 |
ranu |
104 |
@Autowired
|
|
|
105 |
private BeatMissDetectorRunner beatMissDetectorRunner;
|
|
|
106 |
|
| 37499 |
ranu |
107 |
@Autowired
|
|
|
108 |
private IciciLombardService iciciLombardService;
|
|
|
109 |
|
| 31753 |
tejbeer |
110 |
public static void main(String[] args) throws Throwable {
|
|
|
111 |
try {
|
| 35803 |
amit |
112 |
WebApplicationType webType = WebApplicationType.SERVLET;
|
|
|
113 |
for (String arg : args) {
|
|
|
114 |
if (arg.contains("spring.main.web-application-type=none")) {
|
|
|
115 |
webType = WebApplicationType.NONE;
|
|
|
116 |
break;
|
|
|
117 |
}
|
|
|
118 |
}
|
|
|
119 |
new SpringApplicationBuilder(Application.class)
|
|
|
120 |
.web(webType)
|
|
|
121 |
.run(args);
|
| 31753 |
tejbeer |
122 |
} catch (Throwable t) {
|
|
|
123 |
t.printStackTrace();
|
|
|
124 |
}
|
|
|
125 |
}
|
| 28389 |
amit.gupta |
126 |
|
| 31753 |
tejbeer |
127 |
@Bean
|
|
|
128 |
public static PropertySourcesPlaceholderConfigurer propertyConfigurer1() {
|
|
|
129 |
LOGGER.info("Called Configuration");
|
|
|
130 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
| 35393 |
amit |
131 |
|
| 35832 |
amit |
132 |
String activeProfile;
|
|
|
133 |
Properties properties = new Properties();
|
|
|
134 |
try {
|
|
|
135 |
properties.load(Application.class.getClassLoader().getResourceAsStream("META-INF/env.property"));
|
|
|
136 |
} catch (IOException e) {
|
|
|
137 |
LOGGER.error("Error reading env.property, defaulting to dev: " + e);
|
|
|
138 |
properties.put("profile", "dev");
|
|
|
139 |
}
|
|
|
140 |
activeProfile = (String) properties.get("profile");
|
| 35393 |
amit |
141 |
|
| 35832 |
amit |
142 |
Resource appResource;
|
|
|
143 |
Resource sharedResource;
|
|
|
144 |
|
|
|
145 |
if ("prod".equals(activeProfile)) {
|
|
|
146 |
appResource = new ClassPathResource("/META-INF/prod.properties");
|
|
|
147 |
sharedResource = new ClassPathResource("/shared-prod.properties");
|
|
|
148 |
} else if ("staging".equals(activeProfile)) {
|
|
|
149 |
appResource = new ClassPathResource("/META-INF/staging.properties");
|
|
|
150 |
sharedResource = new ClassPathResource("/shared-staging.properties");
|
|
|
151 |
} else {
|
|
|
152 |
appResource = new ClassPathResource("/META-INF/dev.properties");
|
|
|
153 |
sharedResource = new ClassPathResource("/shared-dev.properties");
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
LOGGER.info("Cron loading profile: " + activeProfile);
|
|
|
157 |
propertySourcesPlaceholderConfigurer.setLocations(sharedResource, appResource);
|
| 35393 |
amit |
158 |
propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
|
|
|
159 |
|
| 31753 |
tejbeer |
160 |
return propertySourcesPlaceholderConfigurer;
|
|
|
161 |
}
|
| 28389 |
amit.gupta |
162 |
|
| 31753 |
tejbeer |
163 |
@Bean(name = "veloctyEngine")
|
|
|
164 |
public VelocityEngine velocityEngine() throws VelocityException, IOException {
|
|
|
165 |
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
|
| 28389 |
amit.gupta |
166 |
|
| 31753 |
tejbeer |
167 |
Properties velocityProperties = new Properties();
|
|
|
168 |
velocityProperties.put("resource.loader", "class");
|
|
|
169 |
velocityProperties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
|
|
170 |
velocityProperties.put("file.resource.loader.cache", true);
|
|
|
171 |
velocityProperties.put("file.resource.loader.unicode", true);
|
|
|
172 |
velocityProperties.put("input.encoding", "UTF-8");
|
|
|
173 |
velocityProperties.put("output.encoding", "UTF-8");
|
|
|
174 |
velocityProperties.put("response.encoding", "UTF-8");
|
|
|
175 |
velocityProperties.put("overrideLogging", true);
|
| 28389 |
amit.gupta |
176 |
|
| 31753 |
tejbeer |
177 |
// velocityProperties.put("file.resource.loader.path", ".");
|
| 28389 |
amit.gupta |
178 |
|
| 31753 |
tejbeer |
179 |
factory.setVelocityProperties(velocityProperties);
|
| 28389 |
amit.gupta |
180 |
|
| 31753 |
tejbeer |
181 |
return factory.createVelocityEngine();
|
| 23723 |
amit.gupta |
182 |
|
| 31753 |
tejbeer |
183 |
}
|
| 24122 |
govind |
184 |
|
| 37474 |
amit |
185 |
/**
|
|
|
186 |
* The default sender. Authenticates as sdtech@smartdukaan.com and rewrites
|
|
|
187 |
* every From to that identity — Workspace binds an authenticated session to
|
|
|
188 |
* one address and rejects any other with
|
|
|
189 |
* "535 Authorization failed: Authenticated user is not authorized to send mail".
|
|
|
190 |
*
|
|
|
191 |
* Also answers to "mailSender" so the many unqualified JavaMailSender
|
|
|
192 |
* injections resolve here rather than needing to be touched.
|
|
|
193 |
*/
|
| 37479 |
amit |
194 |
@Bean(name = "googleMailSender")
|
| 37631 |
amit |
195 |
public JavaMailSender googleMailSender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
|
|
196 |
AuthenticatedIdentityMailSender mailSender = new AuthenticatedIdentityMailSender();
|
|
|
197 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 34612 |
ranu |
198 |
mailSender.setHost("smtp.gmail.com");
|
|
|
199 |
mailSender.setPort(465);
|
|
|
200 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
| 37369 |
amit |
201 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
| 34612 |
ranu |
202 |
|
|
|
203 |
Properties props = mailSender.getJavaMailProperties();
|
|
|
204 |
props.put("mail.smtp.auth", "true");
|
|
|
205 |
props.put("mail.smtp.ssl.enable", "true");
|
|
|
206 |
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
|
|
|
207 |
props.put("mail.smtp.socketFactory.port", "465");
|
|
|
208 |
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
| 37368 |
amit |
209 |
props.put("mail.smtp.connectiontimeout", "30000");
|
|
|
210 |
props.put("mail.smtp.timeout", "120000");
|
|
|
211 |
props.put("mail.smtp.writetimeout", "120000");
|
| 34612 |
ranu |
212 |
|
|
|
213 |
return mailSender;
|
|
|
214 |
}
|
|
|
215 |
|
| 37479 |
amit |
216 |
/**
|
|
|
217 |
* The default sender.
|
|
|
218 |
*
|
|
|
219 |
* Verified working 2026-08-31: MAIL FROM:<noreply@smartdukaan.com> returns 250
|
|
|
220 |
* over IPv4. It does not authenticate -- Workspace authorises it by allowlisted
|
|
|
221 |
* source IP -- so it may legitimately send as noreply@.
|
|
|
222 |
*
|
| 37480 |
amit |
223 |
* googleMailSender is the alternative and its credentials are valid -- verified
|
|
|
224 |
* 2026-08-31, AUTH OK on both 465 and 587. Use it by qualifier where a message
|
|
|
225 |
* must come from the authenticated identity rather than noreply@.
|
| 37479 |
amit |
226 |
*
|
| 37480 |
amit |
227 |
* SMTP on this host works over IPv4 only, and that is not specific to the relay:
|
|
|
228 |
* over IPv6 the relay answers "550 5.7.1 Invalid credentials for relay" and
|
|
|
229 |
* smtp.gmail.com rejects a valid app password with "535 5.7.8 Username and
|
|
|
230 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
|
|
231 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
| 37479 |
amit |
232 |
*/
|
|
|
233 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
|
|
234 |
@Primary
|
| 37631 |
amit |
235 |
public JavaMailSender getGmailRelaySender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
|
|
236 |
RecipientFilteringMailSender mailSender = new RecipientFilteringMailSender();
|
|
|
237 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 36248 |
amit |
238 |
mailSender.setHost("smtp-relay.gmail.com");
|
|
|
239 |
mailSender.setPort(587);
|
|
|
240 |
|
|
|
241 |
Properties props = mailSender.getJavaMailProperties();
|
|
|
242 |
props.put("mail.smtp.starttls.enable", "true");
|
|
|
243 |
props.put("mail.smtp.auth", "false");
|
|
|
244 |
props.put("mail.smtp.localhost", "smartdukaan.com");
|
|
|
245 |
props.put("mail.smtp.ssl.protocols", "TLSv1.2");
|
|
|
246 |
props.put("mail.smtp.ssl.trust", "smtp-relay.gmail.com");
|
|
|
247 |
props.put("mail.transport.protocol", "smtp");
|
| 37368 |
amit |
248 |
props.put("mail.smtp.connectiontimeout", "30000");
|
|
|
249 |
props.put("mail.smtp.timeout", "120000");
|
|
|
250 |
props.put("mail.smtp.writetimeout", "120000");
|
| 36248 |
amit |
251 |
|
|
|
252 |
return mailSender;
|
|
|
253 |
}
|
|
|
254 |
|
| 31753 |
tejbeer |
255 |
@Autowired
|
|
|
256 |
private RunOnceTasks runOnceTasks;
|
| 24122 |
govind |
257 |
|
| 31753 |
tejbeer |
258 |
@Autowired
|
| 37613 |
amit |
259 |
private InternalGrnTask internalGrnTask;
|
|
|
260 |
|
|
|
261 |
@Autowired
|
| 31753 |
tejbeer |
262 |
private ScheduledTasks scheduledTasks;
|
| 30335 |
amit.gupta |
263 |
|
| 31753 |
tejbeer |
264 |
@Autowired
|
| 34306 |
ranu |
265 |
private ScheduledTasksTest scheduledTasksTest;
|
|
|
266 |
|
|
|
267 |
@Autowired
|
| 34860 |
ranu |
268 |
private FetchPartnersDisbursementTask fetchPartnersDisbursementTask;
|
|
|
269 |
|
|
|
270 |
@Autowired
|
| 31753 |
tejbeer |
271 |
private Reconciliation reconciliation;
|
| 30309 |
amit.gupta |
272 |
|
| 31753 |
tejbeer |
273 |
@Autowired
|
| 36511 |
amit |
274 |
private WarehouseStockReconciliation warehouseStockReconciliation;
|
|
|
275 |
|
|
|
276 |
@Autowired
|
| 37159 |
amit |
277 |
private PartnerIdentityIntegrityMonitor partnerIdentityIntegrityMonitor;
|
|
|
278 |
|
|
|
279 |
@Autowired
|
| 35250 |
amit |
280 |
private Migrations migrations;
|
|
|
281 |
|
|
|
282 |
@Autowired
|
| 31753 |
tejbeer |
283 |
CaptchaService captchaService;
|
| 28921 |
tejbeer |
284 |
|
| 33274 |
amit.gupta |
285 |
@Autowired
|
|
|
286 |
POScheduler poScheduler;
|
| 32878 |
amit.gupta |
287 |
|
| 35929 |
vikas |
288 |
@Autowired
|
|
|
289 |
ShopifyProductSyncService shopifyProductSyncService;
|
| 33274 |
amit.gupta |
290 |
|
| 36058 |
ranu |
291 |
@Autowired
|
|
|
292 |
KnowlarityCallMonitorScheduler knowlarityCallMonitorScheduler;
|
| 35929 |
vikas |
293 |
|
| 36063 |
ranu |
294 |
@Autowired
|
|
|
295 |
MailOutboxService mailOutboxService;
|
|
|
296 |
|
| 37499 |
ranu |
297 |
@Autowired
|
|
|
298 |
NotificationService notificationService;
|
|
|
299 |
|
| 31753 |
tejbeer |
300 |
@Override
|
|
|
301 |
public void run(ApplicationArguments args) throws Exception {
|
| 32008 |
amit.gupta |
302 |
//scheduledTasks.test();
|
|
|
303 |
//System.exit();
|
| 31753 |
tejbeer |
304 |
LOGGER.info("Called run method");
|
| 36058 |
ranu |
305 |
|
|
|
306 |
// Knowlarity Call Monitor - Manual trigger (if 10 AM scheduled start was missed)
|
|
|
307 |
// This just starts the monitor; scheduled healthCheck and stopMonitoring will still work
|
|
|
308 |
if (args.containsOption("startKnowlarityMonitor")) {
|
|
|
309 |
LOGGER.info("Starting Knowlarity Call Monitor manually...");
|
|
|
310 |
knowlarityCallMonitorScheduler.startMonitoring();
|
|
|
311 |
LOGGER.info("Knowlarity Call Monitor started. Scheduled tasks will handle health checks and 10 PM stop.");
|
|
|
312 |
// No sleep needed - Spring scheduler keeps app running and handles 10 PM stop
|
|
|
313 |
}
|
| 36545 |
ranu |
314 |
if (args.containsOption("trackingReport")) {
|
|
|
315 |
runOnceTasks.dailyTrackingReport();
|
|
|
316 |
}
|
| 37687 |
ranu |
317 |
/* if (args.containsOption("poStockApprovalDailyDigest")) {
|
| 37686 |
ranu |
318 |
runOnceTasks.poStockApprovalDailyDigest();
|
| 37687 |
ranu |
319 |
}*/
|
| 37686 |
ranu |
320 |
// --rbmRankingForMonth [--month=YYYY-MM]
|
|
|
321 |
// Read-only probe: prints the composite RBM ranking for the given month
|
|
|
322 |
// (default: previous month) to log. No email, no DB writes.
|
|
|
323 |
if (args.containsOption("rbmRankingForMonth")) {
|
|
|
324 |
java.time.YearMonth month = java.time.YearMonth.now().minusMonths(1);
|
|
|
325 |
if (args.containsOption("month")) {
|
|
|
326 |
try {
|
|
|
327 |
month = java.time.YearMonth.parse(args.getOptionValues("month").get(0));
|
|
|
328 |
} catch (Exception e) {
|
|
|
329 |
LOGGER.error("Invalid --month value; expected YYYY-MM: {}", e.getMessage());
|
|
|
330 |
System.exit(1);
|
|
|
331 |
}
|
|
|
332 |
}
|
|
|
333 |
runOnceTasks.printRbmRankingForMonth(month);
|
|
|
334 |
System.exit(0);
|
|
|
335 |
}
|
| 36058 |
ranu |
336 |
if (args.containsOption("stopKnowlarityMonitor")) {
|
|
|
337 |
LOGGER.info("Stopping Knowlarity Call Monitor...");
|
|
|
338 |
knowlarityCallMonitorScheduler.stopMonitoring();
|
|
|
339 |
}
|
| 36115 |
ranu |
340 |
// Knowlarity - Request fresh snapshot manually (when status not updating)
|
|
|
341 |
if (args.containsOption("refreshKnowlaritySnapshot")) {
|
|
|
342 |
LOGGER.info("Requesting Knowlarity snapshot manually...");
|
|
|
343 |
knowlarityCallMonitorScheduler.healthCheck();
|
|
|
344 |
LOGGER.info("Knowlarity snapshot requested.");
|
|
|
345 |
System.exit(0);
|
|
|
346 |
}
|
| 36058 |
ranu |
347 |
|
| 33260 |
amit.gupta |
348 |
if (args.containsOption("removePartialBillingForTransaction")) {
|
|
|
349 |
if (args.containsOption("trId")) {
|
| 33051 |
amit.gupta |
350 |
int transactionId = Integer.parseInt(args.getOptionValues("trId").get(0));
|
| 33054 |
amit.gupta |
351 |
scheduledTasks.removePartialBillingForTransaction(transactionId);
|
| 33051 |
amit.gupta |
352 |
}
|
|
|
353 |
System.exit(0);
|
|
|
354 |
}
|
| 34523 |
ranu |
355 |
if (args.containsOption("createOpeningStockPartyWise")) {
|
|
|
356 |
scheduledTasks.createOpeningStockPartyWise();
|
|
|
357 |
System.exit(0);
|
|
|
358 |
}
|
| 31753 |
tejbeer |
359 |
if (args.containsOption("tc")) {
|
|
|
360 |
System.out.println("Toffee service called");
|
|
|
361 |
scheduledTasks.toffeeRollback();
|
|
|
362 |
System.exit(0);
|
|
|
363 |
}
|
|
|
364 |
if (args.containsOption("bag")) {
|
|
|
365 |
System.out.println("Bag service called");
|
|
|
366 |
runOnceTasks.testBag();
|
|
|
367 |
System.exit(0);
|
|
|
368 |
}
|
| 29814 |
tejbeer |
369 |
|
| 31753 |
tejbeer |
370 |
if (args.containsOption("rw")) {
|
|
|
371 |
System.out.println("Reverse wallet");
|
|
|
372 |
scheduledTasks.reverseWallet();
|
|
|
373 |
System.exit(0);
|
|
|
374 |
}
|
|
|
375 |
if (args.containsOption("sendIndentTertiary")) {
|
|
|
376 |
System.out.println("sendIndentTertiary");
|
|
|
377 |
scheduledTasks.sendIndentTertiary();
|
|
|
378 |
System.exit(0);
|
|
|
379 |
}
|
|
|
380 |
if (args.containsOption("checkPartnerActiveStore")) {
|
|
|
381 |
System.out.println("checkPartnerActiveStore");
|
|
|
382 |
scheduledTasks.checkPartnerActiveStore();
|
|
|
383 |
System.exit(0);
|
|
|
384 |
}
|
| 37172 |
amit |
385 |
if (args.containsOption("updatePjpAgendaInstances")) {
|
|
|
386 |
System.out.println("updatePjpAgendaInstances");
|
|
|
387 |
scheduledTasks.updatePjpAgendaInstances();
|
|
|
388 |
System.exit(0);
|
|
|
389 |
}
|
| 37040 |
ranu |
390 |
if (args.containsOption("updatePartnerActivationTypeByMonthlySale")) {
|
|
|
391 |
System.out.println("updatePartnerActivationTypeByMonthlySale");
|
|
|
392 |
scheduledTasks.updatePartnerActivationTypeByMonthlySale();
|
|
|
393 |
System.exit(0);
|
|
|
394 |
}
|
| 29800 |
manish |
395 |
|
| 31753 |
tejbeer |
396 |
if (args.containsOption("selectFinServiceFollowUpDateByCurrDate")) {
|
|
|
397 |
System.out.println("selectfinServiceFollowUpDateByCurrDate");
|
| 28368 |
tejbeer |
398 |
|
| 31753 |
tejbeer |
399 |
scheduledTasks.selectFinServiceFollowUpDateByCurrDate(LocalDate.now());
|
|
|
400 |
System.exit(0);
|
|
|
401 |
}
|
| 25073 |
amit.gupta |
402 |
|
| 31753 |
tejbeer |
403 |
if (args.containsOption("addHdfcPayment")) {
|
|
|
404 |
runOnceTasks.addPayment();
|
|
|
405 |
System.exit(0);
|
|
|
406 |
}
|
| 35250 |
amit |
407 |
if (args.containsOption("migrateOriginalInventoryItemId")) {
|
|
|
408 |
int batchSize = 10_000;
|
|
|
409 |
if (args.containsOption("batchSize")) {
|
|
|
410 |
try {
|
|
|
411 |
batchSize = Integer.parseInt(args.getOptionValues("batchSize").get(0));
|
|
|
412 |
} catch (Exception e) {
|
|
|
413 |
LOGGER.warn("Invalid batchSize provided, defaulting to {}", batchSize);
|
|
|
414 |
}
|
|
|
415 |
}
|
|
|
416 |
LOGGER.info("Starting migration for warehouse.inventoryItem.originalInventoryItemId with batchSize={}", batchSize);
|
| 37602 |
amit |
417 |
migrations.migrateWarehouseOriginalInventoryItemId(batchSize);
|
| 35250 |
amit |
418 |
LOGGER.info("Migration completed.");
|
|
|
419 |
System.exit(0);
|
|
|
420 |
}
|
| 37613 |
amit |
421 |
if (args.containsOption("autoGrnInternal")) {
|
|
|
422 |
if (!args.containsOption("invoices") || !args.containsOption("email")) {
|
|
|
423 |
LOGGER.error("autoGrnInternal needs --invoices=A,B and --email=<operator>");
|
|
|
424 |
System.exit(1);
|
|
|
425 |
}
|
|
|
426 |
List<String> invoiceNumbers = new ArrayList<>();
|
|
|
427 |
for (String value : args.getOptionValues("invoices")) {
|
|
|
428 |
for (String invoiceNumber : value.split(",")) {
|
|
|
429 |
if (!invoiceNumber.trim().isEmpty()) {
|
|
|
430 |
invoiceNumbers.add(invoiceNumber.trim());
|
|
|
431 |
}
|
|
|
432 |
}
|
|
|
433 |
}
|
|
|
434 |
String operatorEmail = args.getOptionValues("email").get(0);
|
|
|
435 |
boolean dryRun = args.containsOption("dryRun");
|
|
|
436 |
internalGrnTask.grnInternalInvoices(invoiceNumbers, operatorEmail, dryRun);
|
|
|
437 |
System.exit(0);
|
|
|
438 |
}
|
| 37617 |
amit |
439 |
if (args.containsOption("reverseGrnInternal")) {
|
|
|
440 |
if (!args.containsOption("invoices")) {
|
|
|
441 |
LOGGER.error("reverseGrnInternal needs --invoices=A,B");
|
|
|
442 |
System.exit(1);
|
|
|
443 |
}
|
|
|
444 |
List<String> invoiceNumbers = new ArrayList<>();
|
|
|
445 |
for (String value : args.getOptionValues("invoices")) {
|
|
|
446 |
for (String invoiceNumber : value.split(",")) {
|
|
|
447 |
if (!invoiceNumber.trim().isEmpty()) {
|
|
|
448 |
invoiceNumbers.add(invoiceNumber.trim());
|
|
|
449 |
}
|
|
|
450 |
}
|
|
|
451 |
}
|
|
|
452 |
internalGrnTask.reverseInternalInvoices(invoiceNumbers, args.containsOption("dryRun"));
|
|
|
453 |
System.exit(0);
|
|
|
454 |
}
|
| 31753 |
tejbeer |
455 |
if (args.containsOption("processSchemeOut")) {
|
|
|
456 |
System.out.println("Process schemeOut");
|
|
|
457 |
int orderId = Integer.parseInt(args.getOptionValues("orderid").get(0));
|
|
|
458 |
int fofoId = Integer.parseInt(args.getOptionValues("fofoid").get(0));
|
|
|
459 |
runOnceTasks.processSchemeOut(fofoId, orderId);
|
|
|
460 |
System.exit(0);
|
|
|
461 |
}
|
|
|
462 |
if (args.containsOption("at")) {
|
|
|
463 |
System.out.println("Toffee service called");
|
|
|
464 |
ticketRelatedScheduledTask.alertforTicket();
|
|
|
465 |
System.exit(0);
|
|
|
466 |
}
|
|
|
467 |
if (args.containsOption("et")) {
|
|
|
468 |
ticketRelatedScheduledTask.escalateTicket();
|
|
|
469 |
;
|
|
|
470 |
System.exit(0);
|
|
|
471 |
}
|
| 37499 |
ranu |
472 |
if (args.containsOption("iciciBalance")) {
|
|
|
473 |
System.out.println("Fetching ICICI CD balance manually");
|
|
|
474 |
try {
|
|
|
475 |
LastTransactionsResponseModel response = iciciLombardService.getLastTwentyFiveTransactions(null);
|
|
|
476 |
System.out.println("Response: " + response);
|
|
|
477 |
if (response != null
|
|
|
478 |
&& response.getTransactionsDetails() != null
|
|
|
479 |
&& !response.getTransactionsDetails().isEmpty()) {
|
|
|
480 |
LastTransactionsResponseModel.TransactionDetail latest = response.getTransactionsDetails().get(0);
|
|
|
481 |
System.out.println("Current available balance = " + latest.getAvailableBalance()
|
|
|
482 |
+ " (as of " + latest.getEffectiveDate() + " — status: " + latest.getStatus() + ")");
|
|
|
483 |
System.out.println("Last 25 transactions:");
|
|
|
484 |
response.getTransactionsDetails().forEach(t -> System.out.println(" " + t));
|
|
|
485 |
}
|
|
|
486 |
} catch (Exception e) {
|
|
|
487 |
e.printStackTrace();
|
|
|
488 |
}
|
|
|
489 |
System.exit(0);
|
|
|
490 |
}
|
| 31753 |
tejbeer |
491 |
if (args.containsOption("sr")) {
|
|
|
492 |
List<String> schemeIds = args.getOptionValues("schemeId");
|
|
|
493 |
System.out.println(schemeIds);
|
|
|
494 |
scheduledTasks.schemeRollback(schemeIds);
|
|
|
495 |
System.exit(0);
|
|
|
496 |
}
|
|
|
497 |
if (args.containsOption("processActivation")) {
|
|
|
498 |
scheduledTasks.processActivation();
|
|
|
499 |
System.exit(0);
|
|
|
500 |
}
|
| 25721 |
tejbeer |
501 |
|
| 31753 |
tejbeer |
502 |
if (args.containsOption("checkRazorPayPaymentStatus")) {
|
|
|
503 |
scheduledTasks.checkRazorPayPaymentStatus();
|
|
|
504 |
System.exit(0);
|
|
|
505 |
}
|
|
|
506 |
if (args.containsOption("grouping")) {
|
|
|
507 |
scheduledTasks.grouping();
|
|
|
508 |
System.exit(0);
|
|
|
509 |
}
|
|
|
510 |
if (args.containsOption("fixWallet")) {
|
|
|
511 |
runOnceTasks.fixWallet();
|
|
|
512 |
System.exit(0);
|
|
|
513 |
}
|
| 36511 |
amit |
514 |
if (args.containsOption("reconcileInventorySnapshot")) {
|
|
|
515 |
warehouseStockReconciliation.reconcile();
|
|
|
516 |
System.exit(0);
|
|
|
517 |
}
|
| 37159 |
amit |
518 |
if (args.containsOption("partnerIdentityIntegrityMonitor")) {
|
|
|
519 |
partnerIdentityIntegrityMonitor.monitor();
|
|
|
520 |
System.exit(0);
|
|
|
521 |
}
|
| 31753 |
tejbeer |
522 |
if (args.containsOption("reconcileExpiredFixedSchemes")) {
|
|
|
523 |
reconciliation.reconcileExpiredFixedSchemes();
|
|
|
524 |
System.exit(0);
|
|
|
525 |
}
|
|
|
526 |
if (args.containsOption("dailyReconciliation")) {
|
|
|
527 |
if (args.containsOption("date")) {
|
|
|
528 |
LocalDate date = LocalDate.parse(args.getOptionValues("date").get(0));
|
|
|
529 |
reconciliation.dailyReconciliation(date);
|
|
|
530 |
} else {
|
|
|
531 |
reconciliation.dailyReconciliation(LocalDate.now().minusDays(1));
|
|
|
532 |
}
|
|
|
533 |
System.exit(0);
|
|
|
534 |
}
|
|
|
535 |
/*
|
|
|
536 |
* if (args.containsOption("test")) { schemeService.processSchemeIn(9243,
|
|
|
537 |
* 175138102); throw new Exception(); }
|
|
|
538 |
*/
|
| 28921 |
tejbeer |
539 |
|
| 31753 |
tejbeer |
540 |
if (args.containsOption("sendNotification")) {
|
|
|
541 |
scheduledTasks.sendNotification();
|
|
|
542 |
System.exit(0);
|
|
|
543 |
}
|
| 26291 |
tejbeer |
544 |
|
| 36063 |
ranu |
545 |
if (args.containsOption("processPendingMails")) {
|
|
|
546 |
System.out.println("Processing pending mails...");
|
|
|
547 |
mailOutboxService.processPendingMails();
|
|
|
548 |
System.exit(0);
|
|
|
549 |
}
|
|
|
550 |
|
| 37499 |
ranu |
551 |
// Dispatch any notification_schedule rows whose scheduled_timestamp <= now.
|
|
|
552 |
// Same code path as the hourly cron in NotificationDispatchScheduler, but callable
|
|
|
553 |
// on demand from dev / staging where the isProd gate normally blocks the cron.
|
|
|
554 |
// Usage: --dispatchScheduledNotifications [--batch=200]
|
| 37510 |
ranu |
555 |
if (args.containsOption("dispatchScheduledNotifications")) {
|
| 37499 |
ranu |
556 |
int batch = 200;
|
|
|
557 |
if (args.containsOption("batch")) {
|
|
|
558 |
try { batch = Integer.parseInt(args.getOptionValues("batch").get(0)); }
|
|
|
559 |
catch (Exception ignored) { }
|
|
|
560 |
}
|
|
|
561 |
System.out.println("Dispatching due scheduled notifications (batch=" + batch + ")...");
|
|
|
562 |
int attempted = notificationService.dispatchDueScheduled(batch);
|
|
|
563 |
System.out.println("Attempted: " + attempted + " row(s)");
|
|
|
564 |
System.exit(0);
|
| 37510 |
ranu |
565 |
}
|
| 37499 |
ranu |
566 |
|
| 31753 |
tejbeer |
567 |
if (args.containsOption("ticketClosed")) {
|
| 35568 |
amit |
568 |
// Redirected to TicketRelatedScheduledTask which handles auto-close as part of escalateTicket
|
|
|
569 |
ticketRelatedScheduledTask.escalateTicket();
|
| 31753 |
tejbeer |
570 |
System.exit(0);
|
|
|
571 |
}
|
| 28207 |
tejbeer |
572 |
|
| 31753 |
tejbeer |
573 |
if (args.containsOption("getVendorWarehouses")) {
|
|
|
574 |
int warehouseId = Integer.parseInt(args.getOptionValues("warehouseId").get(0));
|
|
|
575 |
scheduledTasks.getVendorWarehouses(warehouseId);
|
|
|
576 |
System.exit(0);
|
|
|
577 |
}
|
| 29776 |
tejbeer |
578 |
|
| 31753 |
tejbeer |
579 |
if (args.containsOption("checkfocusedModelInPartnerStock")) {
|
| 34344 |
amit.gupta |
580 |
try {
|
|
|
581 |
scheduledTasks.checkfocusedModelInPartnerStock();
|
|
|
582 |
} finally {
|
|
|
583 |
System.exit(0);
|
|
|
584 |
}
|
| 31753 |
tejbeer |
585 |
}
|
| 29451 |
manish |
586 |
|
| 31753 |
tejbeer |
587 |
if (args.containsOption("checkImeiActivation")) {
|
|
|
588 |
scheduledTasks.checkImeiActivation();
|
|
|
589 |
System.exit(0);
|
|
|
590 |
}
|
| 29776 |
tejbeer |
591 |
|
| 31753 |
tejbeer |
592 |
if (args.containsOption("partnerProblemAlert")) {
|
|
|
593 |
scheduledTasks.partnerProblemAlert();
|
|
|
594 |
System.exit(0);
|
|
|
595 |
}
|
|
|
596 |
if (args.containsOption("notify")) {
|
|
|
597 |
if (args.containsOption("fofoId")) {
|
|
|
598 |
int fofoId = Integer.parseInt(args.getOptionValues("fofoId").get(0));
|
|
|
599 |
scheduledTasks.sendDailySalesNotificationToPartner(fofoId);
|
|
|
600 |
}
|
|
|
601 |
System.exit(0);
|
|
|
602 |
}
|
|
|
603 |
if (args.containsOption("findMismatchesInIndent")) {
|
|
|
604 |
runOnceTasks.findMismatchesInIndent();
|
|
|
605 |
System.exit(0);
|
|
|
606 |
}
|
| 29035 |
tejbeer |
607 |
|
| 31753 |
tejbeer |
608 |
if (args.containsOption("onboardingEventDelays")) {
|
|
|
609 |
onBoardingRelatedSchelduleTask.onboardingEventDelays();
|
|
|
610 |
System.exit(0);
|
|
|
611 |
}
|
| 28982 |
tejbeer |
612 |
|
| 31753 |
tejbeer |
613 |
if (args.containsOption("onBoardingCompleteEventEmail")) {
|
|
|
614 |
onBoardingRelatedSchelduleTask.onBoardingCompleteEventEmail();
|
|
|
615 |
System.exit(0);
|
|
|
616 |
}
|
| 28921 |
tejbeer |
617 |
|
| 31753 |
tejbeer |
618 |
if (args.containsOption("onBoardingDocumentsPending")) {
|
|
|
619 |
onBoardingRelatedSchelduleTask.onBoardingDocumentsPending();
|
|
|
620 |
System.exit(0);
|
|
|
621 |
}
|
|
|
622 |
if (args.containsOption("onBoardingMigration")) {
|
|
|
623 |
onBoardingRelatedSchelduleTask.onBoardingMigration();
|
|
|
624 |
System.exit(0);
|
|
|
625 |
}
|
| 28921 |
tejbeer |
626 |
|
| 33859 |
tejus.loha |
627 |
// if (args.containsOption("advancePaymentPendingAlert")) {
|
|
|
628 |
// onBoardingRelatedSchelduleTask.advancePaymentPendingAlert();
|
|
|
629 |
// System.exit(0);
|
|
|
630 |
// }
|
| 28963 |
tejbeer |
631 |
|
| 31753 |
tejbeer |
632 |
if (args.containsOption("fullPaymentPendingAlert")) {
|
|
|
633 |
onBoardingRelatedSchelduleTask.fullPaymentPendingAlert();
|
|
|
634 |
System.exit(0);
|
|
|
635 |
}
|
| 29308 |
tejbeer |
636 |
|
| 33859 |
tejus.loha |
637 |
// if (args.containsOption("advancePaymentPendinglegalAlert")) {
|
|
|
638 |
// onBoardingRelatedSchelduleTask.advancePaymentPendinglegalAlert();
|
|
|
639 |
// System.exit(0);
|
|
|
640 |
// }
|
| 31117 |
tejbeer |
641 |
|
| 31753 |
tejbeer |
642 |
if (args.containsOption("markDelhiveryOrderDelivered")) {
|
| 32831 |
amit.gupta |
643 |
orderTrackingService.markDelhiveryOrderDelivered();
|
| 31753 |
tejbeer |
644 |
System.exit(0);
|
|
|
645 |
}
|
| 32831 |
amit.gupta |
646 |
|
| 31753 |
tejbeer |
647 |
if (args.containsOption("markBlueDartOrderDelivered")) {
|
| 32794 |
raveendra. |
648 |
System.out.println("Marking BlueDart Order Delivered...");
|
| 32831 |
amit.gupta |
649 |
orderTrackingService.markBlueDartOrderDelivered();
|
| 31753 |
tejbeer |
650 |
System.exit(0);
|
|
|
651 |
}
|
|
|
652 |
if (args.containsOption("mergingdata")) {
|
|
|
653 |
onBoardingRelatedSchelduleTask.mergingdata();
|
|
|
654 |
System.exit(0);
|
|
|
655 |
}
|
|
|
656 |
if (args.containsOption("brandingAlert")) {
|
|
|
657 |
onBoardingRelatedSchelduleTask.brandingAlert();
|
|
|
658 |
System.exit(0);
|
|
|
659 |
}
|
| 31089 |
amit.gupta |
660 |
|
| 33859 |
tejus.loha |
661 |
// if (args.containsOption("storeTimelinePromoterPending")) {
|
|
|
662 |
// onBoardingRelatedSchelduleTask.storeTimelinePromoterPending();
|
|
|
663 |
// System.exit(0);
|
|
|
664 |
// }
|
| 31249 |
tejbeer |
665 |
|
| 31753 |
tejbeer |
666 |
if (args.containsOption("ppl")) {
|
|
|
667 |
runOnceTasks.printPendingLeads();
|
|
|
668 |
System.exit(0);
|
|
|
669 |
}
|
| 31249 |
tejbeer |
670 |
|
| 31753 |
tejbeer |
671 |
if (args.containsOption("notifyAll")) {
|
|
|
672 |
scheduledTasks.sendDailySalesNotificationToPartner(null);
|
|
|
673 |
System.exit(0);
|
|
|
674 |
}
|
| 31249 |
tejbeer |
675 |
|
| 31753 |
tejbeer |
676 |
if (args.containsOption("monthlyTargetForInternalTeam")) {
|
|
|
677 |
scheduledTasks.monthlyTargetForInternalTeam();
|
|
|
678 |
System.exit(0);
|
|
|
679 |
}
|
| 31249 |
tejbeer |
680 |
|
| 31753 |
tejbeer |
681 |
if (args.containsOption("monthlyTargetForPartner")) {
|
|
|
682 |
scheduledTasks.monthlyTargetForPartner();
|
|
|
683 |
System.exit(0);
|
|
|
684 |
}
|
| 33444 |
ranu |
685 |
if (args.containsOption("findAllLiveDemoBrandItemsByBillingDate")) {
|
|
|
686 |
scheduledTasks.findAllLiveDemoBrandItemsByBillingDate();
|
|
|
687 |
System.exit(0);
|
|
|
688 |
}
|
| 33464 |
ranu |
689 |
if (args.containsOption("findTodayPocoBillingItems")) {
|
|
|
690 |
scheduledTasks.findTodayPocoBillingItems();
|
|
|
691 |
System.exit(0);
|
|
|
692 |
}
|
| 28921 |
tejbeer |
693 |
|
| 31753 |
tejbeer |
694 |
if (args.containsOption("hygineAlertForPartner")) {
|
|
|
695 |
scheduledTasks.hygineAlertForPartner();
|
|
|
696 |
System.exit(0);
|
|
|
697 |
}
|
| 28921 |
tejbeer |
698 |
|
| 31753 |
tejbeer |
699 |
if (args.containsOption("hygineAlertForInternalTeam")) {
|
|
|
700 |
scheduledTasks.hygineAlertForInternalTeam();
|
|
|
701 |
System.exit(0);
|
|
|
702 |
}
|
|
|
703 |
|
| 32214 |
jai.hind |
704 |
if (args.containsOption("checkItelImeiActivationNew")) {
|
|
|
705 |
scheduledTasks.checkItelImeiActivationNew(LocalDate.now(), 15);
|
|
|
706 |
System.exit(0);
|
|
|
707 |
}
|
| 37479 |
amit |
708 |
// One tick's worth (50 imeis), not a full pass -- the backlog is cleared by the
|
|
|
709 |
// scheduled 5-minute ticks. Useful for checking the endpoint by hand.
|
|
|
710 |
if (args.containsOption("checkCarlcareImeiActivation")) {
|
|
|
711 |
scheduledTasks.checkCarlcareImeiActivation();
|
|
|
712 |
System.exit(0);
|
|
|
713 |
}
|
| 31753 |
tejbeer |
714 |
if (args.containsOption("once")) {
|
| 33274 |
amit.gupta |
715 |
|
|
|
716 |
if (args.containsOption("autoClosePurchaseOrders")) {
|
|
|
717 |
poScheduler.autoClosePurchaseOrders();
|
|
|
718 |
}
|
| 31753 |
tejbeer |
719 |
if (args.containsOption("cancelOnceAssist")) {
|
|
|
720 |
if (args.containsOption("invoiceNumber")) {
|
|
|
721 |
String oneAssistInvoiceNumber = args.getOptionValues("invoiceNumber").get(0);
|
|
|
722 |
runOnceTasks.cancelOnceAssist(oneAssistInvoiceNumber);
|
|
|
723 |
}
|
|
|
724 |
|
| 35266 |
ranu |
725 |
|
| 31753 |
tejbeer |
726 |
}
|
| 34208 |
ranu |
727 |
if (args.containsOption("cancelOnceAssist")) {
|
|
|
728 |
if (args.containsOption("MemberShipNumber")) {
|
|
|
729 |
String applicationNo = args.getOptionValues("applicationNo").get(0);
|
|
|
730 |
String membershipId = args.getOptionValues("membershipId").get(0);
|
|
|
731 |
runOnceTasks.cancelOnceAssistByMemberShipNumber(applicationNo, membershipId);
|
|
|
732 |
}
|
|
|
733 |
|
|
|
734 |
}
|
| 33260 |
amit.gupta |
735 |
if (args.containsOption("changeFulfillmentWarehouse")) {
|
|
|
736 |
if (args.containsOption("orderId") && args.containsOption("whId")) {
|
| 35277 |
amit |
737 |
List<Integer> orderIds = Arrays.stream(args.getOptionValues("orderId").get(0).split(","))
|
|
|
738 |
.map(String::trim)
|
|
|
739 |
.map(Integer::parseInt)
|
|
|
740 |
.collect(Collectors.toList());
|
|
|
741 |
|
| 35276 |
amit |
742 |
int warehouseId = Integer.parseInt(args.getOptionValues("whId").get(0));
|
|
|
743 |
for (Integer orderId : orderIds) {
|
|
|
744 |
runOnceTasks.changeFulfillmentWarehouse(orderId, warehouseId);
|
|
|
745 |
}
|
| 33260 |
amit.gupta |
746 |
}
|
|
|
747 |
System.exit(0);
|
|
|
748 |
}
|
| 31753 |
tejbeer |
749 |
if (args.containsOption("1")) {
|
|
|
750 |
if (args.containsOption("test")) {
|
| 31618 |
amit.gupta |
751 |
//scheduledTasks.sendPartnerInvestmentDetails(args.getOptionValues("email"));
|
| 31753 |
tejbeer |
752 |
System.out.println("Calling test method");
|
| 36003 |
aman |
753 |
try {
|
|
|
754 |
scheduledTasks.test();
|
|
|
755 |
} catch (Throwable e) {
|
|
|
756 |
throw new RuntimeException(e);
|
|
|
757 |
}
|
| 35165 |
amit |
758 |
System.exit(0);
|
| 32083 |
tejbeer |
759 |
|
|
|
760 |
if (args.containsOption("approveVendorCatalogPricing")) {
|
|
|
761 |
scheduledTasks.approveVendorCatalogPricing();
|
|
|
762 |
System.exit(0);
|
|
|
763 |
}
|
| 32080 |
tejbeer |
764 |
} else if (args.containsOption("test1")) {
|
| 32008 |
amit.gupta |
765 |
scheduledTasks.test1();
|
| 34845 |
ranu |
766 |
} else if (args.containsOption("scheduleTaskTest1")) {
|
|
|
767 |
|
|
|
768 |
scheduledTasksTest.test();
|
|
|
769 |
}else if (args.containsOption("generateBiReport")) {
|
|
|
770 |
scheduledTasksTest.generateBiReport();
|
| 34945 |
ranu |
771 |
}else if (args.containsOption("abmSendertest")) {
|
| 34946 |
ranu |
772 |
runOnceTasks.setAbmReportSender();
|
| 35788 |
vikas |
773 |
}else if (args.containsOption("syncProductsToShopify")) {
|
| 36058 |
ranu |
774 |
shopifyProductSyncService.syncByWarehouse(ProfitMandiConstants.WAREHOUSE_NAME_MAP.get("UP-WEST/NOIDA"));
|
| 34321 |
ranu |
775 |
}
|
| 34860 |
ranu |
776 |
else if (args.containsOption("fetchPartnerDisburseMentTask")) {
|
|
|
777 |
if(args.containsOption("fetchDisbursements")){
|
|
|
778 |
fetchPartnersDisbursementTask.fetchDisbursementsTest();
|
|
|
779 |
}
|
|
|
780 |
else if(args.containsOption("creditAmountTest")){
|
|
|
781 |
fetchPartnersDisbursementTask.creditAmountTest();
|
|
|
782 |
}
|
|
|
783 |
else if(args.containsOption("createContactsAndFundsForFranchiseeTest")){
|
|
|
784 |
fetchPartnersDisbursementTask.createContactsAndFundsForFranchiseeTest();
|
|
|
785 |
}
|
|
|
786 |
else if(args.containsOption("rabbitTransactionProducertest")){
|
|
|
787 |
fetchPartnersDisbursementTask.rabbitTransactionProducertest();
|
|
|
788 |
}
|
| 34879 |
ranu |
789 |
else if(args.containsOption("sendingDisbursementMail")){
|
|
|
790 |
fetchPartnersDisbursementTask.sendingDisbursementMail();
|
|
|
791 |
}
|
| 34860 |
ranu |
792 |
else {
|
|
|
793 |
fetchPartnersDisbursementTask.test();
|
|
|
794 |
}
|
|
|
795 |
}
|
| 34845 |
ranu |
796 |
else if (args.containsOption("testNew1")) {
|
| 34307 |
ranu |
797 |
List<String> loanIdArgs = args.getOptionValues("loanIds"); // ["34833,36536,37151"]
|
|
|
798 |
List<Integer> loanIds = new ArrayList<>();
|
|
|
799 |
|
|
|
800 |
if (loanIdArgs != null && !loanIdArgs.isEmpty()) {
|
|
|
801 |
String csv = loanIdArgs.get(0);
|
|
|
802 |
loanIds = Arrays.stream(csv.split(","))
|
|
|
803 |
.map(String::trim)
|
|
|
804 |
.map(Integer::parseInt)
|
|
|
805 |
.collect(Collectors.toList());
|
|
|
806 |
}
|
| 34321 |
ranu |
807 |
scheduledTasksTest.findLoanTransactionMapingAccordingLoan(loanIds);
|
| 34309 |
ranu |
808 |
} else if (args.containsOption("testNew2")) {
|
| 34308 |
ranu |
809 |
if (args.containsOption("createLoan")) {
|
|
|
810 |
// Extract each parameter
|
|
|
811 |
int transactionId = 0;
|
|
|
812 |
double invoiceAmount = 0.0;
|
|
|
813 |
String invoiceNumber = "";
|
|
|
814 |
|
|
|
815 |
if (args.containsOption("transactionId")) {
|
|
|
816 |
transactionId = Integer.parseInt(args.getOptionValues("transactionId").get(0));
|
|
|
817 |
}
|
|
|
818 |
|
|
|
819 |
if (args.containsOption("invoiceAmount")) {
|
|
|
820 |
invoiceAmount = Double.parseDouble(args.getOptionValues("invoiceAmount").get(0));
|
|
|
821 |
}
|
|
|
822 |
|
|
|
823 |
if (args.containsOption("invoiceNumber")) {
|
|
|
824 |
invoiceNumber = args.getOptionValues("invoiceNumber").get(0);
|
|
|
825 |
}
|
|
|
826 |
|
|
|
827 |
// Call your method
|
|
|
828 |
scheduledTasksTest.createLoanForBillingByTransactionIdAndInvoiceNumber(transactionId, invoiceAmount, invoiceNumber);
|
|
|
829 |
}
|
|
|
830 |
|
| 32482 |
amit.gupta |
831 |
} else {
|
| 31753 |
tejbeer |
832 |
System.out.println("Called sendPartnerInvestmentDetails");
|
|
|
833 |
scheduledTasks.sendPartnerInvestmentDetails();
|
|
|
834 |
}
|
|
|
835 |
System.exit(0);
|
|
|
836 |
}
|
|
|
837 |
if (args.containsOption("2")) {
|
|
|
838 |
if (args.containsOption("test")) {
|
|
|
839 |
String[] emails = new String[args.getOptionValues("email").size()];
|
|
|
840 |
scheduledTasks.sendAgeingReport(args.getOptionValues("email").toArray(emails));
|
|
|
841 |
} else {
|
|
|
842 |
scheduledTasks.sendAgeingReport();
|
|
|
843 |
}
|
|
|
844 |
System.exit(0);
|
|
|
845 |
}
|
| 33457 |
amit.gupta |
846 |
|
| 31753 |
tejbeer |
847 |
if (args.containsOption("cancelOrder")) {
|
|
|
848 |
List<String> invoiceNumbers = args.getOptionValues("invoiceNumber");
|
|
|
849 |
runOnceTasks.cancelOrder(invoiceNumbers);
|
|
|
850 |
}
|
| 36554 |
amit |
851 |
if (args.containsOption("postCreditNoteForDuplicateInvoice")) {
|
|
|
852 |
String duplicateInvoice = args.getOptionValues("duplicateInvoice").get(0);
|
|
|
853 |
String activeInvoice = args.getOptionValues("activeInvoice").get(0);
|
|
|
854 |
runOnceTasks.postCreditNoteForDuplicateInvoice(duplicateInvoice, activeInvoice);
|
|
|
855 |
}
|
| 31753 |
tejbeer |
856 |
if (args.containsOption("migratePurchase")) {
|
|
|
857 |
runOnceTasks.migratePurchase();
|
|
|
858 |
}
|
|
|
859 |
if (args.containsOption("migratepd")) {
|
|
|
860 |
scheduledTasks.moveImeisToPriceDropImeis();
|
|
|
861 |
}
|
|
|
862 |
if (args.containsOption("walletmismatch")) {
|
|
|
863 |
scheduledTasks.walletmismatch();
|
|
|
864 |
}
|
|
|
865 |
if (args.containsOption("schemewalletmismatch")) {
|
|
|
866 |
scheduledTasks.schemewalletmismatch();
|
|
|
867 |
}
|
|
|
868 |
if (args.containsOption("gst")) {
|
|
|
869 |
scheduledTasks.gst();
|
|
|
870 |
}
|
|
|
871 |
if (args.containsOption("mailDashboardScreenshots")) {
|
|
|
872 |
runOnceTasks.mailDashboardScreenshots();
|
|
|
873 |
}
|
|
|
874 |
if (args.containsOption("notifyLead")) {
|
|
|
875 |
scheduledTasks.notifyLead();
|
|
|
876 |
scheduledTasks.notifyVisits();
|
|
|
877 |
}
|
|
|
878 |
if (args.containsOption("fixgrn")) {
|
|
|
879 |
runOnceTasks.fixGrn();
|
|
|
880 |
}
|
|
|
881 |
if (args.containsOption("pbfix")) {
|
|
|
882 |
runOnceTasks.pbfix();
|
|
|
883 |
}
|
|
|
884 |
if (args.containsOption("mongom")) {
|
|
|
885 |
runOnceTasks.mongom();
|
|
|
886 |
}
|
|
|
887 |
if (args.containsOption("processPd")) {
|
|
|
888 |
int priceDropId = Integer.parseInt(args.getOptionValues("processPd").get(0));
|
|
|
889 |
runOnceTasks.processPd(priceDropId);
|
|
|
890 |
}
|
|
|
891 |
if (args.containsOption("fixdupimeigrn")) {
|
|
|
892 |
runOnceTasks.fixDupGrns();
|
|
|
893 |
}
|
|
|
894 |
if (args.containsOption("cancel")) {
|
| 36053 |
amit |
895 |
boolean recreatePri = args.containsOption("recreatePri");
|
|
|
896 |
runOnceTasks.cancelDn(args.getOptionValues("dn").get(0), recreatePri);
|
| 31753 |
tejbeer |
897 |
}
|
|
|
898 |
if (args.containsOption("fixScheme")) {
|
|
|
899 |
runOnceTasks.fixScheme();
|
|
|
900 |
}
|
|
|
901 |
if (args.containsOption("syncLeads")) {
|
|
|
902 |
leadSyncRunner.syncLeads();
|
|
|
903 |
}
|
|
|
904 |
if (args.containsOption("testCs")) {
|
|
|
905 |
int category = Integer.parseInt(args.getOptionValues("category").get(0));
|
|
|
906 |
EscalationType escalationType = EscalationType.valueOf(args.getOptionValues("escalation").get(0));
|
|
|
907 |
int fofoId = Integer.parseInt(args.getOptionValues("fofoid").get(0));
|
|
|
908 |
csService.getAuthUserId(category, escalationType, fofoId);
|
|
|
909 |
}
|
|
|
910 |
if (args.containsOption("duporder")) {
|
|
|
911 |
runOnceTasks.removeDuplicateOrders();
|
|
|
912 |
}
|
|
|
913 |
if (args.containsOption("createDummyInvoices")) {
|
|
|
914 |
runOnceTasks.createDummyInvoices();
|
|
|
915 |
}
|
| 28921 |
tejbeer |
916 |
|
| 31753 |
tejbeer |
917 |
if (args.containsOption("createGeofence")) {
|
|
|
918 |
runOnceTasks.createGeofence();
|
|
|
919 |
}
|
|
|
920 |
if (args.containsOption("getAllGeofences")) {
|
|
|
921 |
runOnceTasks.getAllGeofences();
|
|
|
922 |
}
|
|
|
923 |
if (args.containsOption("payMonthlyInvestment")) {
|
|
|
924 |
investmentRelatedTasks.payMonthlyInvestment();
|
|
|
925 |
}
|
|
|
926 |
if (args.containsOption("evaluateActualInvestmentPayout")) {
|
|
|
927 |
investmentRelatedTasks.evaluateActualInvestmentPayout();
|
|
|
928 |
}
|
|
|
929 |
if (args.containsOption("deleteGeofences")) {
|
|
|
930 |
List<String> geofenceIds = args.getOptionValues("geofenceId");
|
|
|
931 |
runOnceTasks.deleteGeofences(geofenceIds);
|
|
|
932 |
}
|
|
|
933 |
if (args.containsOption("createOffers")) {
|
|
|
934 |
if (args.containsOption("fileName")) {
|
|
|
935 |
String fileName = args.getOptionValues("fileName").get(0);
|
|
|
936 |
FileInputStream stream = new FileInputStream(fileName);
|
|
|
937 |
runOnceTasks.createOffers(stream);
|
|
|
938 |
}
|
|
|
939 |
}
|
|
|
940 |
if (args.containsOption("schemeout")) {
|
|
|
941 |
if (args.containsOption("invoices")) {
|
|
|
942 |
String invoicesString = args.getOptionValues("invoices").get(0);
|
|
|
943 |
List<String> invoices = Arrays.asList(invoicesString.split(","));
|
|
|
944 |
scheduledTasks.processSchemeOut(invoices);
|
|
|
945 |
}
|
|
|
946 |
}
|
|
|
947 |
if (args.containsOption("schemein")) {
|
|
|
948 |
if (args.containsOption("invoices")) {
|
|
|
949 |
String invoicesString = args.getOptionValues("invoices").get(0);
|
|
|
950 |
List<String> invoices = Arrays.asList(invoicesString.split(","));
|
|
|
951 |
scheduledTasks.processSchemeIn(invoices);
|
|
|
952 |
}
|
|
|
953 |
}
|
| 28921 |
tejbeer |
954 |
|
| 31753 |
tejbeer |
955 |
if (args.containsOption("fixScans")) {
|
|
|
956 |
runOnceTasks.fixScans();
|
|
|
957 |
}
|
|
|
958 |
if (args.containsOption("fixPrebookingOrderGrn")) {
|
|
|
959 |
runOnceTasks.genericCreateCurrentInventorySnapshot();
|
|
|
960 |
}
|
|
|
961 |
if (args.containsOption("fixOurSerialized")) {
|
|
|
962 |
if (args.containsOption("orderIds")) {
|
|
|
963 |
String orderIdsString = args.getOptionValues("orderIds").get(0);
|
|
|
964 |
List<Integer> orderIds = Arrays.asList(orderIdsString.split(",")).stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
|
|
|
965 |
// runOnceTasks.fixOurSerialized(orderIds);
|
|
|
966 |
}
|
|
|
967 |
}
|
| 29776 |
tejbeer |
968 |
|
| 31753 |
tejbeer |
969 |
if (args.containsOption("reverseMaa")) {
|
|
|
970 |
runOnceTasks.reverseMaa();
|
|
|
971 |
}
|
| 29776 |
tejbeer |
972 |
|
| 31753 |
tejbeer |
973 |
if (args.containsOption("fixOffer")) {
|
|
|
974 |
runOnceTasks.fixOffer();
|
|
|
975 |
}
|
| 29794 |
tejbeer |
976 |
|
| 31753 |
tejbeer |
977 |
if (args.containsOption("opporeno")) {
|
|
|
978 |
runOnceTasks.opporeno();
|
|
|
979 |
}
|
| 30309 |
amit.gupta |
980 |
|
| 31753 |
tejbeer |
981 |
if (args.containsOption("fixorders")) {
|
|
|
982 |
runOnceTasks.fixOrders();
|
|
|
983 |
}
|
|
|
984 |
if (args.containsOption("fixreservations")) {
|
|
|
985 |
runOnceTasks.fixReservations();
|
|
|
986 |
}
|
|
|
987 |
if (args.containsOption("addinvestment")) {
|
|
|
988 |
runOnceTasks.addInvestment();
|
|
|
989 |
}
|
|
|
990 |
if (args.containsOption("brandregion")) {
|
|
|
991 |
runOnceTasks.brandRegion();
|
|
|
992 |
}
|
|
|
993 |
if (args.containsOption("rollOutUpgardedMargins")) {
|
| 35520 |
amit |
994 |
scheduledTasks.rollOutUpgardedMargins(Arrays.asList(175140172, 175140189));
|
| 31753 |
tejbeer |
995 |
}
|
| 34029 |
ranu |
996 |
if (args.containsOption("pushRbmTargets")) {
|
|
|
997 |
scheduledTasks.persistRbmTodayTargets();
|
|
|
998 |
}
|
| 37499 |
ranu |
999 |
if (args.containsOption("pushSalesTargets")) {
|
|
|
1000 |
// Run this AFTER pushRbmTargets so today's RBM snapshots exist to roll up.
|
|
|
1001 |
scheduledTasks.persistSalesTodayTargets();
|
|
|
1002 |
}
|
|
|
1003 |
if (args.containsOption("pushSalesTargetsForDate")) {
|
|
|
1004 |
// Backfill / seed for a specific date, e.g. --pushSalesTargetsForDate=2026-08-25
|
|
|
1005 |
LocalDate d = LocalDate.parse(args.getOptionValues("pushSalesTargetsForDate").get(0));
|
|
|
1006 |
scheduledTasks.persistSalesTargetsForDate(d);
|
|
|
1007 |
}
|
|
|
1008 |
if (args.containsOption("pushSalesAchievements")) {
|
|
|
1009 |
// Daily Sales achievement snapshot (audit/history). Independent
|
|
|
1010 |
// of pushSalesTargets — can run any time after orders settle.
|
|
|
1011 |
scheduledTasks.persistSalesTodayAchievements();
|
|
|
1012 |
}
|
|
|
1013 |
if (args.containsOption("pushSalesAchievementsForDate")) {
|
|
|
1014 |
// Backfill / seed for a specific date, e.g. --pushSalesAchievementsForDate=2026-08-25
|
|
|
1015 |
LocalDate d = LocalDate.parse(args.getOptionValues("pushSalesAchievementsForDate").get(0));
|
|
|
1016 |
scheduledTasks.persistSalesAchievementsForDate(d);
|
|
|
1017 |
}
|
| 31753 |
tejbeer |
1018 |
if (args.containsOption("rollOutUpgardedMarginsNextMonth")) {
|
| 35524 |
amit |
1019 |
System.out.println("In rollOutUpgardedMarginsNextMonth");
|
| 35532 |
amit |
1020 |
scheduledTasks.rollOutUpgardedMarginsNextMonth(Arrays.asList(175140172, 175140189, 175138897));
|
| 31753 |
tejbeer |
1021 |
}
|
|
|
1022 |
if (args.containsOption("checkCancellationMargin")) {
|
|
|
1023 |
scheduledTasks.checkCancellationMargin();
|
|
|
1024 |
}
|
|
|
1025 |
if (args.containsOption("reviewUncontactablePartner")) {
|
|
|
1026 |
scheduledTasks.reviewUncontactablePartner();
|
|
|
1027 |
}
|
| 33078 |
ranu |
1028 |
if (args.containsOption("reviewNonSdBuyingBrand")) {
|
|
|
1029 |
scheduledTasks.reviewNonSdBuyingBrand();
|
|
|
1030 |
}
|
| 31753 |
tejbeer |
1031 |
if (args.containsOption("sendWelcomeEmail")) {
|
|
|
1032 |
onBoardingRelatedSchelduleTask.sendWelcomeEmail();
|
|
|
1033 |
}
|
| 29814 |
tejbeer |
1034 |
|
| 31753 |
tejbeer |
1035 |
if (args.containsOption("partnerOnboardingLegalMigration")) {
|
|
|
1036 |
onBoardingRelatedSchelduleTask.partnerOnboardingLegalMigration();
|
|
|
1037 |
}
|
| 31031 |
amit.gupta |
1038 |
|
| 33526 |
amit.gupta |
1039 |
if(args.containsOption("moveOrders")) {
|
|
|
1040 |
runOnceTasks.moveOrders();
|
|
|
1041 |
}
|
|
|
1042 |
|
| 31753 |
tejbeer |
1043 |
if (args.containsOption("addKycLegalMigration")) {
|
|
|
1044 |
onBoardingRelatedSchelduleTask.addKycLegalMigration();
|
|
|
1045 |
}
|
| 29776 |
tejbeer |
1046 |
|
|
|
1047 |
|
| 31753 |
tejbeer |
1048 |
if (args.containsOption("pushDataToSolr")) {
|
|
|
1049 |
listing.pushDataToSolr();
|
|
|
1050 |
}
|
| 30120 |
amit.gupta |
1051 |
|
| 37567 |
amit |
1052 |
// Manual run of the daily 05:30 delist. Honours the same
|
|
|
1053 |
// catalog.autoDelist.enabled flag as the scheduled path.
|
|
|
1054 |
if (args.containsOption("delistDeadListings")) {
|
|
|
1055 |
listing.scheduledDelistDeadListings();
|
|
|
1056 |
}
|
|
|
1057 |
|
| 31753 |
tejbeer |
1058 |
if (args.containsOption("testGstPro")) {
|
|
|
1059 |
System.out.println("TestGstProc called");
|
|
|
1060 |
try {
|
|
|
1061 |
runOnceTasks.updateIrnsToInvoices();
|
|
|
1062 |
} catch (Exception e) {
|
|
|
1063 |
e.printStackTrace();
|
|
|
1064 |
}
|
|
|
1065 |
}
|
| 29308 |
tejbeer |
1066 |
|
| 37058 |
amit |
1067 |
if (args.containsOption("regenerateBilledInvoices")) {
|
|
|
1068 |
if (args.containsOption("fromTime") && args.containsOption("toTime")) {
|
|
|
1069 |
LocalDateTime fromTime = LocalDateTime.parse(args.getOptionValues("fromTime").get(0));
|
|
|
1070 |
LocalDateTime toTime = LocalDateTime.parse(args.getOptionValues("toTime").get(0));
|
|
|
1071 |
runOnceTasks.regenerateBilledInvoices(fromTime, toTime);
|
|
|
1072 |
} else {
|
|
|
1073 |
System.out.println("regenerateBilledInvoices requires --fromTime and --toTime (ISO, e.g. 2026-06-01T00:00:00)");
|
|
|
1074 |
}
|
|
|
1075 |
System.exit(0);
|
|
|
1076 |
}
|
|
|
1077 |
|
| 31753 |
tejbeer |
1078 |
if (args.containsOption("reverseSchemeCancelInvoice")) {
|
|
|
1079 |
if (args.containsOption("invoice")) {
|
|
|
1080 |
String invoice = args.getOptionValues("invoice").get(0);
|
|
|
1081 |
runOnceTasks.reverseSchemes(invoice);
|
|
|
1082 |
}
|
|
|
1083 |
}
|
| 29863 |
tejbeer |
1084 |
|
| 31753 |
tejbeer |
1085 |
if (args.containsOption("reverseInvalidActivation")) {
|
|
|
1086 |
if (args.containsOption("inventoryids")) {
|
|
|
1087 |
String inventoryItemIdsString = args.getOptionValues("inventoryids").get(0);
|
|
|
1088 |
List<Integer> inventoryItemIds = new ArrayList<>();
|
|
|
1089 |
for (String inventoryItemIdString : inventoryItemIdsString.split(",")) {
|
|
|
1090 |
int inventoryItemId = Integer.parseInt(inventoryItemIdString.trim());
|
|
|
1091 |
inventoryItemIds.add(inventoryItemId);
|
|
|
1092 |
}
|
|
|
1093 |
runOnceTasks.reverseInvalidActivation(inventoryItemIds);
|
|
|
1094 |
}
|
|
|
1095 |
}
|
| 29863 |
tejbeer |
1096 |
|
| 31753 |
tejbeer |
1097 |
if (args.containsOption("runme")) {
|
|
|
1098 |
runOnceTasks.runMe();
|
|
|
1099 |
}
|
|
|
1100 |
if (args.containsOption("" + "")) {
|
|
|
1101 |
upgradeOfferService.authenticateUser();
|
|
|
1102 |
}
|
| 37472 |
amit |
1103 |
// Oppo and realme are one pass now, so one option drives both. Note this
|
|
|
1104 |
// runs the FULL daily pass -- everything due today, not a 25-imei sample.
|
|
|
1105 |
if (args.containsOption("checkBrowserImeiActivation")) {
|
|
|
1106 |
standAlone.checkBrowserImeiActivation();
|
| 31753 |
tejbeer |
1107 |
}
|
| 30616 |
amit.gupta |
1108 |
|
| 31753 |
tejbeer |
1109 |
/*
|
|
|
1110 |
* if (args.containsOption("checkRealmeImeiStatus")) { try {
|
|
|
1111 |
* standAlone.checkRealmeImeiStatus(); } catch (Exception e) {
|
|
|
1112 |
* e.printStackTrace(); } }
|
|
|
1113 |
*/
|
| 30616 |
amit.gupta |
1114 |
|
| 31753 |
tejbeer |
1115 |
if (args.containsOption("getCaptchaCode")) {
|
|
|
1116 |
try {
|
|
|
1117 |
captchaService.getCaptchaCode("/home/amit/Desktop/generatingCodes.jpg");
|
|
|
1118 |
} catch (Exception e) {
|
|
|
1119 |
e.printStackTrace();
|
|
|
1120 |
}
|
|
|
1121 |
}
|
| 30641 |
amit.gupta |
1122 |
|
| 37326 |
amit |
1123 |
// --backfillMissingEwb --invoiceNumbers=A,B,C [--dryRun]
|
|
|
1124 |
// Recovers EWB details from NIC for invoices whose IRN was recovered via DUPIRN, then
|
|
|
1125 |
// re-renders their PDFs so the e-way bill section appears.
|
|
|
1126 |
if (args.containsOption("backfillMissingEwb")) {
|
|
|
1127 |
try {
|
|
|
1128 |
List<String> invoiceNumbers = Arrays.stream(
|
|
|
1129 |
args.getOptionValues("invoiceNumbers").get(0).split(","))
|
|
|
1130 |
.map(String::trim).filter(x -> !x.isEmpty()).collect(Collectors.toList());
|
|
|
1131 |
boolean dryRun = args.containsOption("dryRun");
|
|
|
1132 |
System.out.println("backfillMissingEwb: " + invoiceNumbers.size()
|
|
|
1133 |
+ " invoice(s), dryRun=" + dryRun);
|
|
|
1134 |
runOnceTasks.backfillMissingEwb(invoiceNumbers, dryRun);
|
|
|
1135 |
} catch (Exception e) {
|
|
|
1136 |
e.printStackTrace();
|
|
|
1137 |
}
|
|
|
1138 |
}
|
|
|
1139 |
|
| 31753 |
tejbeer |
1140 |
if (args.containsOption("testIrnLive")) {
|
|
|
1141 |
try {
|
|
|
1142 |
runOnceTasks.testIrnLive(args.getOptionValues("invoiceNumber").get(0));
|
|
|
1143 |
} catch (Exception e) {
|
|
|
1144 |
e.printStackTrace();
|
|
|
1145 |
}
|
|
|
1146 |
}
|
| 30659 |
amit.gupta |
1147 |
|
| 31753 |
tejbeer |
1148 |
if (args.containsOption("createoffercriteria")) {
|
|
|
1149 |
try {
|
|
|
1150 |
runOnceTasks.createOfferCriteria();
|
|
|
1151 |
} catch (Exception e) {
|
|
|
1152 |
e.printStackTrace();
|
|
|
1153 |
}
|
|
|
1154 |
}
|
| 30659 |
amit.gupta |
1155 |
|
| 31753 |
tejbeer |
1156 |
if (args.containsOption("fix-price-drops")) {
|
|
|
1157 |
runOnceTasks.fixPriceDrop();
|
|
|
1158 |
}
|
| 29035 |
tejbeer |
1159 |
|
| 31753 |
tejbeer |
1160 |
if (args.containsOption("processSchemeByIds")) {
|
|
|
1161 |
List<String> schemeIds = Arrays.asList(args.getOptionValues("ids").get(0).split(","));
|
|
|
1162 |
List<Integer> schemeIdsInt = schemeIds.stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
|
|
|
1163 |
runOnceTasks.processSchemeByIds(schemeIdsInt);
|
|
|
1164 |
}
|
| 30859 |
tejbeer |
1165 |
|
| 31753 |
tejbeer |
1166 |
if (args.containsOption("updateSaholicCISTable")) {
|
|
|
1167 |
runOnceTasks.updateSaholicCISTable();
|
|
|
1168 |
}
|
| 30859 |
tejbeer |
1169 |
|
| 31753 |
tejbeer |
1170 |
if (args.containsOption("mapbag")) {
|
|
|
1171 |
runOnceTasks.mapBag();
|
|
|
1172 |
}
|
| 30859 |
tejbeer |
1173 |
|
| 34579 |
vikas.jang |
1174 |
if (args.containsOption("todayBidPO")) {
|
| 34443 |
vikas.jang |
1175 |
runOnceTasks.processBids(ProfitMandiConstants.BID_CRON_ENUM.TODAY);
|
|
|
1176 |
}
|
|
|
1177 |
|
| 34579 |
vikas.jang |
1178 |
if (args.containsOption("yesterdayBidPO")) {
|
|
|
1179 |
runOnceTasks.processBids(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY);
|
|
|
1180 |
}
|
|
|
1181 |
|
| 34547 |
vikas.jang |
1182 |
if (args.containsOption("biddingConsolidatedMessage")) {
|
|
|
1183 |
runOnceTasks.consolidatedBiddingMessage();
|
|
|
1184 |
}
|
|
|
1185 |
|
|
|
1186 |
if (args.containsOption("sendMailWhatsAppAfterLoanDueDate")) {
|
|
|
1187 |
scheduledTasks.sendMailWhatsAppAfterLoanDueDate();
|
|
|
1188 |
}
|
|
|
1189 |
|
| 34836 |
vikas |
1190 |
if (args.containsOption("yesterdayTrackingReport")) {
|
|
|
1191 |
runOnceTasks.yesterdayTrackingReport();
|
| 34770 |
vikas.jang |
1192 |
}
|
|
|
1193 |
|
| 31753 |
tejbeer |
1194 |
System.exit(0);
|
|
|
1195 |
}
|
| 30859 |
tejbeer |
1196 |
|
| 31753 |
tejbeer |
1197 |
if (args.containsOption("calculateInterestAccured")) {
|
| 30929 |
tejbeer |
1198 |
|
| 31753 |
tejbeer |
1199 |
scheduledTasks.calculateInterestAccured();
|
|
|
1200 |
System.exit(0);
|
|
|
1201 |
}
|
| 30929 |
tejbeer |
1202 |
|
| 31753 |
tejbeer |
1203 |
if (args.containsOption("loanSettlement")) {
|
| 30890 |
amit.gupta |
1204 |
|
| 31753 |
tejbeer |
1205 |
scheduledTasks.loanSettlement();
|
|
|
1206 |
System.exit(0);
|
|
|
1207 |
}
|
| 30896 |
amit.gupta |
1208 |
|
| 31753 |
tejbeer |
1209 |
if (args.containsOption("dailyLoanAlert")) {
|
| 30936 |
tejbeer |
1210 |
|
| 31753 |
tejbeer |
1211 |
scheduledTasks.dailyLoanAlert();
|
|
|
1212 |
System.exit(0);
|
|
|
1213 |
}
|
| 30982 |
tejbeer |
1214 |
|
| 36564 |
amit |
1215 |
if (args.containsOption("testFlagshipBilling")) {
|
|
|
1216 |
int trId = Integer.parseInt(args.getOptionValues("testFlagshipBilling").get(0));
|
|
|
1217 |
double amt = Double.parseDouble(args.getOptionValues("testFlagshipBillingAmount").get(0));
|
|
|
1218 |
String inv = args.getOptionValues("testFlagshipBillingInvoice").get(0);
|
|
|
1219 |
scheduledTasks.testFlagshipBilling(trId, amt, inv);
|
|
|
1220 |
System.exit(0);
|
|
|
1221 |
}
|
|
|
1222 |
|
| 36554 |
amit |
1223 |
if (args.containsOption("convertExpiredFlagshipCredits")) {
|
|
|
1224 |
scheduledTasks.convertExpiredFlagshipCredits();
|
|
|
1225 |
System.exit(0);
|
|
|
1226 |
}
|
|
|
1227 |
|
| 36745 |
ranu |
1228 |
// Manual back-fill for missed-beat detection. Default: today.
|
|
|
1229 |
// Usage: --detectMissedBeats [--date=YYYY-MM-DD]
|
|
|
1230 |
if (args.containsOption("detectMissedBeats")) {
|
|
|
1231 |
LocalDate date = LocalDate.now();
|
|
|
1232 |
if (args.containsOption("date")) {
|
|
|
1233 |
date = LocalDate.parse(args.getOptionValues("date").get(0));
|
|
|
1234 |
}
|
|
|
1235 |
int inserted = beatMissDetectorRunner.syncMissesForDate(date);
|
|
|
1236 |
LOGGER.info("detectMissedBeats: {} miss rows inserted for {}", inserted, date);
|
|
|
1237 |
System.exit(0);
|
|
|
1238 |
}
|
|
|
1239 |
|
| 36554 |
amit |
1240 |
if (args.containsOption("notifyFlagshipExpiryIn2Days")) {
|
|
|
1241 |
scheduledTasks.notifyFlagshipExpiryIn2Days();
|
|
|
1242 |
System.exit(0);
|
|
|
1243 |
}
|
|
|
1244 |
|
| 31753 |
tejbeer |
1245 |
if (args.containsOption("notifyDefaultLoans")) {
|
|
|
1246 |
scheduledTasks.notifyDefaultLoans();
|
|
|
1247 |
System.exit(0);
|
|
|
1248 |
}
|
| 31446 |
amit.gupta |
1249 |
|
| 31753 |
tejbeer |
1250 |
if (args.containsOption("fixinsurance")) {
|
|
|
1251 |
runOnceTasks.addMissingWalletDebitsForInsurance();
|
|
|
1252 |
System.exit(0);
|
|
|
1253 |
}
|
| 31604 |
tejbeer |
1254 |
|
| 31753 |
tejbeer |
1255 |
if (args.containsOption("processActivatedImeisForSchemes")) {
|
|
|
1256 |
scheduledTasks.processActivatedImeisForSchemes();
|
|
|
1257 |
System.exit(0);
|
|
|
1258 |
}
|
| 31604 |
tejbeer |
1259 |
|
| 36306 |
amit |
1260 |
if (args.containsOption("updatePartnerLimitWithBatch")) {
|
|
|
1261 |
System.out.println("Running updatePartnerLimit with batch tracking");
|
|
|
1262 |
batchScheduledTasks.updatePartnerLimitWithBatch();
|
|
|
1263 |
System.exit(0);
|
|
|
1264 |
}
|
|
|
1265 |
|
|
|
1266 |
if (args.containsOption("processOffersWithBatch")) {
|
|
|
1267 |
for (String val : args.getOptionValues("processOffersWithBatch")) {
|
|
|
1268 |
for (String id : val.split(",")) {
|
|
|
1269 |
int offerId = Integer.parseInt(id.trim());
|
|
|
1270 |
System.out.println("Processing offer with batch: " + offerId);
|
|
|
1271 |
batchScheduledTasks.processOfferWithBatch(offerId);
|
|
|
1272 |
}
|
|
|
1273 |
}
|
|
|
1274 |
System.exit(0);
|
|
|
1275 |
}
|
|
|
1276 |
|
| 31753 |
tejbeer |
1277 |
if (args.containsOption("notifyLoanDueDateCross")) {
|
|
|
1278 |
scheduledTasks.notifyLoanDueDateCross();
|
|
|
1279 |
System.exit(0);
|
|
|
1280 |
}
|
| 34275 |
tejus.loha |
1281 |
if (args.containsOption("sendTenOrMoreOrderStockReport")) {
|
|
|
1282 |
scheduledTasks.send10OrMoreOlderStockReport();
|
|
|
1283 |
System.exit(0);
|
|
|
1284 |
}
|
| 31604 |
tejbeer |
1285 |
|
| 31753 |
tejbeer |
1286 |
if (args.containsOption("alertForDueDate")) {
|
|
|
1287 |
scheduledTasks.alertForDueDate();
|
|
|
1288 |
System.exit(0);
|
|
|
1289 |
}
|
| 31648 |
tejbeer |
1290 |
|
| 31753 |
tejbeer |
1291 |
if (args.containsOption("fetchParnterStats")) {
|
|
|
1292 |
scheduledTasks.fetchParnterStats();
|
|
|
1293 |
System.exit(0);
|
|
|
1294 |
}
|
|
|
1295 |
|
|
|
1296 |
if (args.containsOption("morning")) {
|
|
|
1297 |
if (args.containsOption("0")) {
|
|
|
1298 |
scheduledTasks.sendPartnerInvestmentDetails();
|
|
|
1299 |
}
|
|
|
1300 |
if (args.containsOption("1")) {
|
|
|
1301 |
scheduledTasks.sendIndentTertiary();
|
|
|
1302 |
}
|
|
|
1303 |
// 0
|
|
|
1304 |
if (args.containsOption("2")) {
|
|
|
1305 |
scheduledTasks.calculateInterestAccured();
|
|
|
1306 |
}
|
|
|
1307 |
System.out.println("scheduledTasks.calculateInterestAccured()");
|
|
|
1308 |
// 0
|
|
|
1309 |
if (args.containsOption("3")) {
|
| 32831 |
amit.gupta |
1310 |
orderTrackingService.markDelhiveryOrderDelivered();
|
| 31753 |
tejbeer |
1311 |
}
|
|
|
1312 |
System.out.println("scheduledTasks.markDelhiveryOrderDelivered()");
|
|
|
1313 |
// 1
|
|
|
1314 |
if (args.containsOption("4")) {
|
|
|
1315 |
scheduledTasks.processActivatedImeisForSchemes();
|
|
|
1316 |
}
|
|
|
1317 |
System.out.println("scheduledTasks.processActivatedImeisForSchemes()");
|
|
|
1318 |
// 2
|
|
|
1319 |
if (args.containsOption("5")) {
|
|
|
1320 |
scheduledTasks.processActivation();
|
|
|
1321 |
}
|
|
|
1322 |
System.out.println("scheduledTasks.processActivation()");
|
|
|
1323 |
// 4
|
|
|
1324 |
if (args.containsOption("6")) {
|
|
|
1325 |
scheduledTasks.processPriceDrop();
|
|
|
1326 |
}
|
|
|
1327 |
System.out.println("scheduledTasks.processPriceDrop()");
|
|
|
1328 |
// 5
|
|
|
1329 |
if (args.containsOption("7")) {
|
|
|
1330 |
scheduledTasks.loanSettlement();
|
|
|
1331 |
}
|
|
|
1332 |
System.out.println("scheduledTasks.loanSettlement()");
|
| 36554 |
amit |
1333 |
if (args.containsOption("7a")) {
|
|
|
1334 |
scheduledTasks.convertExpiredFlagshipCredits();
|
|
|
1335 |
scheduledTasks.notifyFlagshipExpiryIn2Days();
|
|
|
1336 |
}
|
|
|
1337 |
System.out.println("scheduledTasks.convertExpiredFlagshipCredits()");
|
| 31753 |
tejbeer |
1338 |
// 8
|
|
|
1339 |
if (args.containsOption("8")) {
|
|
|
1340 |
scheduledTasks.reviewUncontactablePartner();
|
|
|
1341 |
}
|
|
|
1342 |
// 9
|
| 33859 |
tejus.loha |
1343 |
// if (args.containsOption("9")) {
|
|
|
1344 |
// onBoardingRelatedSchelduleTask.storeTimelinePromoterPending();
|
|
|
1345 |
// }
|
|
|
1346 |
// // 9
|
|
|
1347 |
// if (args.containsOption("10")) {
|
|
|
1348 |
// onBoardingRelatedSchelduleTask.advancePaymentPendinglegalAlert();
|
|
|
1349 |
// }
|
| 31753 |
tejbeer |
1350 |
// sendPartnerInvestment
|
|
|
1351 |
if (args.containsOption("11")) {
|
|
|
1352 |
scheduledTasks.sendPartnerInvestmentDetails();
|
|
|
1353 |
}
|
| 37236 |
amit |
1354 |
if (args.containsOption("1")) {
|
| 36993 |
amit |
1355 |
// Defaults to a dry-run (harmless dev path); pass --live to run the real pipeline.
|
|
|
1356 |
boolean dryRun = !args.containsOption("live");
|
|
|
1357 |
System.out.println("Calling sendCreditNote (dryRun=" + dryRun + ")");
|
| 34029 |
ranu |
1358 |
YearMonth yearMonth = YearMonth.now().minusMonths(1);
|
| 36993 |
amit |
1359 |
scheduledTasks.sendCreditNote(yearMonth, dryRun);
|
| 31753 |
tejbeer |
1360 |
}
|
| 37238 |
amit |
1361 |
if (args.containsOption("regenMarginIrns")) {
|
|
|
1362 |
// One-time: generate missing IRNs for issued margin CN/DNs (mixed-sign docs
|
|
|
1363 |
// now netted per GST rate in the payload). Dry-run by default; --live to run.
|
|
|
1364 |
boolean dryRun = !args.containsOption("live");
|
|
|
1365 |
try {
|
|
|
1366 |
String ymStr = args.getOptionValues("regenMarginIrns").isEmpty() ? null : args.getOptionValues("regenMarginIrns").get(0);
|
|
|
1367 |
YearMonth yearMonth = ymStr != null && !ymStr.isEmpty() ? YearMonth.parse(ymStr) : YearMonth.now().minusMonths(1);
|
|
|
1368 |
System.out.println("regenMarginIrns for " + yearMonth + " (dryRun=" + dryRun + ")");
|
|
|
1369 |
scheduledTasks.regenMarginIrns(yearMonth, dryRun);
|
|
|
1370 |
System.out.println("regenMarginIrns completed successfully");
|
|
|
1371 |
} catch (Exception e) {
|
|
|
1372 |
System.err.println("regenMarginIrns FAILED: " + e.getMessage());
|
|
|
1373 |
e.printStackTrace(System.err);
|
|
|
1374 |
}
|
|
|
1375 |
}
|
| 37236 |
amit |
1376 |
if (args.containsOption("cancelMarginDnIrns")) {
|
|
|
1377 |
// One-time: cancel IRNs of margin DNs inflated by the abs bug (24h NIC window!)
|
|
|
1378 |
// and mark them cancelled so a sendCreditNote rerun reissues corrected DNs.
|
|
|
1379 |
// Defaults to dry-run; pass --live to actually cancel.
|
|
|
1380 |
boolean dryRun = !args.containsOption("live");
|
|
|
1381 |
try {
|
|
|
1382 |
String ymStr = args.getOptionValues("cancelMarginDnIrns").isEmpty() ? null : args.getOptionValues("cancelMarginDnIrns").get(0);
|
|
|
1383 |
YearMonth yearMonth = ymStr != null && !ymStr.isEmpty() ? YearMonth.parse(ymStr) : YearMonth.now().minusMonths(1);
|
|
|
1384 |
System.out.println("cancelMarginDnIrns for " + yearMonth + " (dryRun=" + dryRun + ")");
|
|
|
1385 |
scheduledTasks.cancelMarginDnIrns(yearMonth, dryRun);
|
|
|
1386 |
System.out.println("cancelMarginDnIrns completed successfully");
|
|
|
1387 |
} catch (Exception e) {
|
|
|
1388 |
System.err.println("cancelMarginDnIrns FAILED: " + e.getMessage());
|
|
|
1389 |
e.printStackTrace(System.err);
|
|
|
1390 |
}
|
|
|
1391 |
}
|
| 37232 |
amit |
1392 |
if (args.containsOption("corrMarginCNs")) {
|
|
|
1393 |
// One-time corrective CNs against wrongly-inflated margin DNs.
|
|
|
1394 |
// Defaults to dry-run; pass --live to issue real documents.
|
|
|
1395 |
boolean dryRun = !args.containsOption("live");
|
|
|
1396 |
try {
|
|
|
1397 |
String ymStr = args.getOptionValues("corrMarginCNs").isEmpty() ? null : args.getOptionValues("corrMarginCNs").get(0);
|
|
|
1398 |
YearMonth yearMonth = ymStr != null && !ymStr.isEmpty() ? YearMonth.parse(ymStr) : YearMonth.now().minusMonths(1);
|
|
|
1399 |
System.out.println("corrMarginCNs for " + yearMonth + " (dryRun=" + dryRun + ")");
|
|
|
1400 |
scheduledTasks.corrMarginCNs(yearMonth, dryRun);
|
|
|
1401 |
System.out.println("corrMarginCNs completed successfully");
|
|
|
1402 |
} catch (Exception e) {
|
|
|
1403 |
System.err.println("corrMarginCNs FAILED: " + e.getMessage());
|
|
|
1404 |
e.printStackTrace(System.err);
|
|
|
1405 |
}
|
|
|
1406 |
}
|
| 36220 |
amit |
1407 |
if (args.containsOption("genDNs")) {
|
|
|
1408 |
System.out.println("Calling genDNs");
|
| 36254 |
amit |
1409 |
try {
|
|
|
1410 |
String ymStr = args.getOptionValues("genDNs").isEmpty() ? null : args.getOptionValues("genDNs").get(0);
|
|
|
1411 |
YearMonth yearMonth = ymStr != null ? YearMonth.parse(ymStr) : YearMonth.now().minusMonths(1);
|
|
|
1412 |
System.out.println("genDNs for " + yearMonth);
|
|
|
1413 |
scheduledTasks.genDNs(yearMonth);
|
|
|
1414 |
System.out.println("genDNs completed successfully");
|
|
|
1415 |
} catch (Exception e) {
|
|
|
1416 |
System.err.println("genDNs FAILED: " + e.getMessage());
|
|
|
1417 |
e.printStackTrace(System.err);
|
|
|
1418 |
}
|
| 36220 |
amit |
1419 |
}
|
| 36503 |
amit |
1420 |
if (args.containsOption("genDNsForCNs")) {
|
|
|
1421 |
System.out.println("Calling genDNsForCNs");
|
|
|
1422 |
try {
|
|
|
1423 |
String cnList = args.getOptionValues("genDNsForCNs").get(0);
|
|
|
1424 |
List<String> cnNumbers = Arrays.asList(cnList.split(","));
|
|
|
1425 |
System.out.println("genDNsForCNs for " + cnNumbers.size() + " CNs: " + cnNumbers);
|
|
|
1426 |
scheduledTasks.genDNsForCNs(cnNumbers);
|
|
|
1427 |
System.out.println("genDNsForCNs completed successfully");
|
|
|
1428 |
} catch (Exception e) {
|
|
|
1429 |
System.err.println("genDNsForCNs FAILED: " + e.getMessage());
|
|
|
1430 |
e.printStackTrace(System.err);
|
|
|
1431 |
}
|
|
|
1432 |
}
|
| 36433 |
amit |
1433 |
System.exit(0);
|
|
|
1434 |
}
|
|
|
1435 |
|
| 31753 |
tejbeer |
1436 |
}
|
| 24848 |
amit.gupta |
1437 |
}
|