| Line 1... |
Line 1... |
| 1 |
package in.shop2020.warehouse.util;
|
1 |
package in.shop2020.warehouse.util;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.io.BufferedWriter;
|
| 3 |
import java.io.File;
|
4 |
import java.io.File;
|
| - |
|
5 |
import java.io.FileWriter;
|
| - |
|
6 |
import java.io.IOException;
|
| 4 |
import java.util.ArrayList;
|
7 |
import java.util.ArrayList;
|
| 5 |
import java.util.Calendar;
|
8 |
import java.util.Calendar;
|
| - |
|
9 |
import java.util.Date;
|
| 6 |
import java.util.HashMap;
|
10 |
import java.util.HashMap;
|
| 7 |
import java.util.List;
|
11 |
import java.util.List;
|
| 8 |
import java.util.Map;
|
12 |
import java.util.Map;
|
| 9 |
|
13 |
|
| 10 |
import javax.mail.MessagingException;
|
14 |
import javax.mail.MessagingException;
|
| 11 |
|
15 |
|
| - |
|
16 |
import org.apache.commons.lang.StringUtils;
|
| 12 |
import org.apache.commons.logging.Log;
|
17 |
import org.apache.commons.logging.Log;
|
| 13 |
import org.apache.commons.logging.LogFactory;
|
18 |
import org.apache.commons.logging.LogFactory;
|
| 14 |
import org.apache.thrift.transport.TTransportException;
|
19 |
import org.apache.thrift.transport.TTransportException;
|
| 15 |
|
20 |
|
| 16 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
21 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| Line 25... |
Line 30... |
| 25 |
private static Log log = LogFactory.getLog(OosStatusMarker.class);
|
30 |
private static Log log = LogFactory.getLog(OosStatusMarker.class);
|
| 26 |
|
31 |
|
| 27 |
private static final Integer OOS_STATUS_CUTOFF_HOUR = 23;
|
32 |
private static final Integer OOS_STATUS_CUTOFF_HOUR = 23;
|
| 28 |
private static final Integer OOS_STATUS_CUTOFF_MINUTE = 59;
|
33 |
private static final Integer OOS_STATUS_CUTOFF_MINUTE = 59;
|
| 29 |
|
34 |
|
| - |
|
35 |
private static java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| - |
|
36 |
|
| 30 |
private static final String[] tomail = {"manish.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "khushal.bhatia@shop2020.in", "anikendra.das@shop2020.in","vikram.raghav@shop2020.in","kshitij.sood@shop2020.in"};
|
37 |
private static final String[] tomail = {"manish.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "khushal.bhatia@shop2020.in", "anikendra.das@shop2020.in","vikram.raghav@shop2020.in","kshitij.sood@shop2020.in"};
|
| 31 |
//private static final String[] tomail = {"amar.kumar@shop2020.in"};
|
38 |
//private static final String[] tomail = {"amar.kumar@shop2020.in"};
|
| 32 |
|
39 |
|
| 33 |
public static void main(String[] args) throws TTransportException {
|
40 |
public static void main(String[] args) throws TTransportException, IOException {
|
| - |
|
41 |
File file = new File("/home/manish/alerts/oosmarker.txt");
|
| - |
|
42 |
|
| 34 |
Calendar oosEvaluationDate = Calendar.getInstance();
|
43 |
Calendar oosEvaluationDate = Calendar.getInstance();
|
| 35 |
Calendar cartAdditionStartDate = Calendar.getInstance();
|
44 |
Calendar cartAdditionStartDate = Calendar.getInstance();
|
| 36 |
oosEvaluationDate.add(Calendar.DATE, -1);
|
45 |
oosEvaluationDate.add(Calendar.DATE, -1);
|
| 37 |
oosEvaluationDate.set(oosEvaluationDate.get(Calendar.YEAR),
|
46 |
oosEvaluationDate.set(oosEvaluationDate.get(Calendar.YEAR),
|
| 38 |
oosEvaluationDate.get(Calendar.MONTH), oosEvaluationDate.get(Calendar.DATE),
|
47 |
oosEvaluationDate.get(Calendar.MONTH), oosEvaluationDate.get(Calendar.DATE),
|
| Line 84... |
Line 93... |
| 84 |
} catch(Exception e) {
|
93 |
} catch(Exception e) {
|
| 85 |
log.error("Error while adding OOS Status", e);
|
94 |
log.error("Error while adding OOS Status", e);
|
| 86 |
sendMailForError("Error while adding OOS Status");
|
95 |
sendMailForError("Error while adding OOS Status");
|
| 87 |
return;
|
96 |
return;
|
| 88 |
}
|
97 |
}
|
| - |
|
98 |
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
|
| - |
|
99 |
|
| - |
|
100 |
bufferedWriter.write(StringUtils.join(new String[] {"OosStatusUpdationDate",sdf.format(new Date())}, '\t'));
|
| - |
|
101 |
bufferedWriter.close();
|
| 89 |
sendMailForSuccess(failedItemsList);
|
102 |
sendMailForSuccess(failedItemsList);
|
| 90 |
}
|
103 |
}
|
| 91 |
|
104 |
|
| 92 |
private static void sendMailForError(String errorMessage) {
|
105 |
private static void sendMailForError(String errorMessage) {
|
| 93 |
|
106 |
|