| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron;
|
1 |
package com.smartdukaan.cron;
|
| 2 |
|
2 |
|
| 3 |
import java.util.List;
|
3 |
import java.util.List;
|
| 4 |
import java.util.Properties;
|
4 |
import java.util.Properties;
|
| 5 |
import java.util.concurrent.ScheduledExecutorService;
|
- |
|
| 6 |
|
5 |
|
| 7 |
import org.apache.logging.log4j.LogManager;
|
6 |
import org.apache.logging.log4j.LogManager;
|
| 8 |
import org.apache.logging.log4j.Logger;
|
7 |
import org.apache.logging.log4j.Logger;
|
| 9 |
import org.springframework.beans.factory.annotation.Autowired;
|
8 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 10 |
import org.springframework.boot.ApplicationArguments;
|
9 |
import org.springframework.boot.ApplicationArguments;
|
| Line 37... |
Line 36... |
| 37 |
|
36 |
|
| 38 |
private static final Logger LOGGER = LogManager.getLogger(Application.class);
|
37 |
private static final Logger LOGGER = LogManager.getLogger(Application.class);
|
| 39 |
|
38 |
|
| 40 |
@Autowired
|
39 |
@Autowired
|
| 41 |
private SchemeService schemeService;
|
40 |
private SchemeService schemeService;
|
| 42 |
|
41 |
|
| 43 |
@Autowired
|
42 |
@Autowired
|
| 44 |
private ScheduledSkeleton scheduledSkeleton;
|
43 |
private ScheduledSkeleton scheduledSkeleton;
|
| 45 |
|
44 |
|
| 46 |
public static void main(String[] args) throws Throwable {
|
45 |
public static void main(String[] args) throws Throwable {
|
| 47 |
new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE).run(args);
|
46 |
new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE).run(args);
|
| Line 200... |
Line 199... |
| 200 |
if (args.containsOption("3")) {
|
199 |
if (args.containsOption("3")) {
|
| 201 |
if (args.getOptionNames().contains("offset")) {
|
200 |
if (args.getOptionNames().contains("offset")) {
|
| 202 |
int offset = Integer.parseInt(args.getOptionValues("offset").get(0));
|
201 |
int offset = Integer.parseInt(args.getOptionValues("offset").get(0));
|
| 203 |
if (args.getOptionNames().contains("days")) {
|
202 |
if (args.getOptionNames().contains("days")) {
|
| 204 |
int durationDays = Integer.parseInt(args.getOptionValues("days").get(0));
|
203 |
int durationDays = Integer.parseInt(args.getOptionValues("days").get(0));
|
| 205 |
scheduledTasks.processScheme(offset, durationDays);
|
204 |
scheduledTasks.processScheme(offset, durationDays, args.containsOption("dryRun"));
|
| 206 |
} else {
|
205 |
} else {
|
| 207 |
scheduledTasks.processScheme(offset);
|
206 |
scheduledTasks.processScheme(offset, args.containsOption("dryRun"));
|
| 208 |
}
|
207 |
}
|
| 209 |
} else if (args.containsOption("catalogid")) {
|
208 |
} else if (args.containsOption("catalogid")) {
|
| 210 |
// scheduledTasks.processSchemeForModel(args.getOptionValues("catalogid").get(0));
|
209 |
// scheduledTasks.processSchemeForModel(args.getOptionValues("catalogid").get(0));
|
| 211 |
} else {
|
210 |
} else {
|
| 212 |
scheduledTasks.processScheme();
|
211 |
scheduledTasks.processScheme(args.containsOption("dryRun"));
|
| 213 |
}
|
212 |
}
|
| 214 |
System.exit(0);
|
213 |
System.exit(0);
|
| 215 |
}
|
214 |
}
|
| 216 |
if (args.containsOption("4")) {
|
215 |
if (args.containsOption("4")) {
|
| 217 |
scheduledTasks.evaluateExcessSchemeOut();
|
216 |
scheduledTasks.evaluateExcessSchemeOut();
|
| 218 |
}
|
217 |
}
|
| 219 |
if (args.containsOption("5")) {
|
218 |
if (args.containsOption("5")) {
|
| 220 |
int offset = Integer.parseInt(args.getOptionValues("offset").get(0));
|
219 |
int offset = Integer.parseInt(args.getOptionValues("offset").get(0));
|
| 221 |
scheduledTasks.processScheme(offset);
|
220 |
scheduledTasks.processScheme(offset, args.containsOption("dryRun"));
|
| 222 |
System.exit(0);
|
221 |
System.exit(0);
|
| 223 |
}
|
222 |
}
|
| 224 |
if (args.containsOption("cancelOrder")) {
|
223 |
if (args.containsOption("cancelOrder")) {
|
| 225 |
List<String> invoiceNumbers = args.getOptionValues("invoiceNumber");
|
224 |
List<String> invoiceNumbers = args.getOptionValues("invoiceNumber");
|
| 226 |
runOnceTasks.cancelOrder(invoiceNumbers);
|
225 |
runOnceTasks.cancelOrder(invoiceNumbers);
|