| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.services;
|
1 |
package in.shop2020.serving.services;
|
| 2 |
|
2 |
|
| 3 |
import java.io.BufferedReader;
|
3 |
import java.io.BufferedReader;
|
| - |
|
4 |
import java.io.BufferedWriter;
|
| 4 |
import java.io.File;
|
5 |
import java.io.File;
|
| - |
|
6 |
import java.io.FileWriter;
|
| 5 |
import java.io.IOException;
|
7 |
import java.io.IOException;
|
| 6 |
import java.io.InputStreamReader;
|
8 |
import java.io.InputStreamReader;
|
| - |
|
9 |
import java.text.SimpleDateFormat;
|
| 7 |
import java.util.ArrayList;
|
10 |
import java.util.ArrayList;
|
| 8 |
import java.util.Calendar;
|
11 |
import java.util.Calendar;
|
| - |
|
12 |
import java.util.Date;
|
| 9 |
import java.util.GregorianCalendar;
|
13 |
import java.util.GregorianCalendar;
|
| 10 |
import java.util.List;
|
14 |
import java.util.List;
|
| 11 |
import java.util.concurrent.TimeUnit;
|
15 |
import java.util.concurrent.TimeUnit;
|
| 12 |
|
16 |
|
| 13 |
import in.shop2020.model.v1.order.FlipkartOrder;
|
17 |
import in.shop2020.model.v1.order.FlipkartOrder;
|
| Line 16... |
Line 20... |
| 16 |
import in.shop2020.serving.model.Order;
|
20 |
import in.shop2020.serving.model.Order;
|
| 17 |
import in.shop2020.serving.model.OrderItems;
|
21 |
import in.shop2020.serving.model.OrderItems;
|
| 18 |
import in.shop2020.thrift.clients.TransactionClient;
|
22 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 19 |
import in.shop2020.utils.GmailUtils;
|
23 |
import in.shop2020.utils.GmailUtils;
|
| 20 |
|
24 |
|
| - |
|
25 |
import org.apache.commons.lang.StringUtils;
|
| 21 |
import org.apache.http.HttpResponse;
|
26 |
import org.apache.http.HttpResponse;
|
| 22 |
import org.apache.http.NameValuePair;
|
27 |
import org.apache.http.NameValuePair;
|
| 23 |
import org.apache.http.client.HttpClient;
|
28 |
import org.apache.http.client.HttpClient;
|
| 24 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
29 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
| 25 |
import org.apache.http.client.methods.HttpGet;
|
30 |
import org.apache.http.client.methods.HttpGet;
|
| Line 37... |
Line 42... |
| 37 |
public class FlipkartHoldOrdersReconciliation{
|
42 |
public class FlipkartHoldOrdersReconciliation{
|
| 38 |
private static String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "eng@shop2020.in" ,
|
43 |
private static String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "eng@shop2020.in" ,
|
| 39 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
44 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| 40 |
"yukti.jain@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in"};
|
45 |
"yukti.jain@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in"};
|
| 41 |
//private static String sendTo1[] = new String[]{"manish.sharma@shop2020.in"};
|
46 |
//private static String sendTo1[] = new String[]{"manish.sharma@shop2020.in"};
|
| 42 |
private static java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
47 |
private static java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| 43 |
private static Calendar cal=GregorianCalendar.getInstance();
|
48 |
private static Calendar cal=GregorianCalendar.getInstance();
|
| 44 |
private static String emailFromAddress = "build-staging@shop2020.in";
|
49 |
private static String emailFromAddress = "build-staging@shop2020.in";
|
| 45 |
private static String password = "shop2020";
|
50 |
private static String password = "shop2020";
|
| 46 |
private static GmailUtils mailer = new GmailUtils();
|
51 |
private static GmailUtils mailer = new GmailUtils();
|
| 47 |
|
52 |
|
| 48 |
public static void main(String[] args) throws TException, TransactionServiceException, JSONException {
|
53 |
public static void main(String[] args) throws IOException{
|
| - |
|
54 |
File file = new File("/home/manish/alerts/fkhold.txt");
|
| - |
|
55 |
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
|
| - |
|
56 |
|
| 49 |
HttpClient client = new DefaultHttpClient();
|
57 |
HttpClient client = new DefaultHttpClient();
|
| 50 |
HttpPost post = new HttpPost("https://seller.flipkart.com/login");
|
58 |
HttpPost post = new HttpPost("https://seller.flipkart.com/login");
|
| 51 |
BufferedReader rd= null;
|
59 |
BufferedReader rd= null;
|
| 52 |
try {
|
60 |
try {
|
| 53 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
61 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
| Line 166... |
Line 174... |
| 166 |
System.out.println(order.getOrderId()+" "+ order.getFlipkartOrderId());
|
174 |
System.out.println(order.getOrderId()+" "+ order.getFlipkartOrderId());
|
| 167 |
}
|
175 |
}
|
| 168 |
String emailSubjectTxt = " Flipkart Hold Order Reconcilaition Process "+sdf.format(cal.getTime());
|
176 |
String emailSubjectTxt = " Flipkart Hold Order Reconcilaition Process "+sdf.format(cal.getTime());
|
| 169 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt, resB.toString(), emailFromAddress, password, new ArrayList<File>());
|
177 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt, resB.toString(), emailFromAddress, password, new ArrayList<File>());
|
| 170 |
System.out.println(sb.toString());
|
178 |
System.out.println(sb.toString());
|
| - |
|
179 |
|
| - |
|
180 |
bufferedWriter.write(StringUtils.join(new String[] {"FlipkartHoldUpdationDate",sdf.format(new Date())}, '\t'));
|
| - |
|
181 |
bufferedWriter.close();
|
| 171 |
} catch (Exception e) {
|
182 |
} catch (Exception e) {
|
| 172 |
e.printStackTrace();
|
183 |
e.printStackTrace();
|
| 173 |
try{
|
184 |
try{
|
| 174 |
mailer.sendSSLMessage(sendTo, "Error in Hold Order Recon Process", "Please inform Engineering Team", emailFromAddress, password, new ArrayList<File>());
|
185 |
mailer.sendSSLMessage(sendTo, "Error in Hold Order Recon Process", "Please inform Engineering Team", emailFromAddress, password, new ArrayList<File>());
|
| 175 |
}catch (Exception e1) {
|
186 |
}catch (Exception e1) {
|