| Line 1... |
Line 1... |
| 1 |
package in.shop2020;
|
1 |
package in.shop2020;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.order.OrderSource;
|
3 |
import in.shop2020.serving.services.SnapdealSessionCookie;
|
| 4 |
import in.shop2020.model.v1.order.OrderStatus;
|
- |
|
| 5 |
import in.shop2020.thrift.clients.TransactionClient;
|
4 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 6 |
import in.shop2020.utils.GmailUtils;
|
5 |
import in.shop2020.utils.GmailUtils;
|
| 7 |
|
6 |
|
| 8 |
import java.io.BufferedReader;
|
7 |
import java.io.BufferedReader;
|
| 9 |
import java.io.IOException;
|
8 |
import java.io.IOException;
|
| Line 28... |
Line 27... |
| 28 |
import org.apache.http.client.methods.HttpPost;
|
27 |
import org.apache.http.client.methods.HttpPost;
|
| 29 |
import org.apache.http.impl.client.DefaultHttpClient;
|
28 |
import org.apache.http.impl.client.DefaultHttpClient;
|
| 30 |
import org.apache.http.message.BasicNameValuePair;
|
29 |
import org.apache.http.message.BasicNameValuePair;
|
| 31 |
import org.json.JSONArray;
|
30 |
import org.json.JSONArray;
|
| 32 |
import org.json.JSONObject;
|
31 |
import org.json.JSONObject;
|
| 33 |
import org.slf4j.LoggerFactory;
|
- |
|
| 34 |
import org.slf4j.Logger;
|
32 |
import org.slf4j.Logger;
|
| - |
|
33 |
import org.slf4j.LoggerFactory;
|
| 35 |
|
34 |
|
| 36 |
|
35 |
|
| 37 |
|
36 |
|
| 38 |
public class SnapdealOrderStatusReconciliation{
|
37 |
public class SnapdealOrderStatusReconciliation{
|
| 39 |
private static Logger logger;
|
38 |
private static Logger logger;
|
| Line 41... |
Line 40... |
| 41 |
static String emailFromAddress;
|
40 |
static String emailFromAddress;
|
| 42 |
static String password;
|
41 |
static String password;
|
| 43 |
static GmailUtils mailer;
|
42 |
static GmailUtils mailer;
|
| 44 |
static String sendTo[];
|
43 |
static String sendTo[];
|
| 45 |
|
44 |
|
| - |
|
45 |
private static Map<String, String> headers = new HashMap<String, String>();
|
| - |
|
46 |
|
| 46 |
static {
|
47 |
static {
|
| 47 |
emailFromAddress = "build-staging@shop2020.in";
|
48 |
emailFromAddress = "build-staging@shop2020.in";
|
| 48 |
password = "shop2020";
|
49 |
password = "shop2020";
|
| 49 |
mailer = new GmailUtils();
|
50 |
mailer = new GmailUtils();
|
| 50 |
sendTo = new String[] { "kshitij.sood@shop2020.in", "manish.sharma@shop2020.in", "amit.gupta@shop2020.in" };
|
51 |
sendTo = new String[] { "kshitij.sood@shop2020.in", "manish.sharma@shop2020.in", "amit.gupta@shop2020.in" };
|
| - |
|
52 |
headers.put("User-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11");
|
| - |
|
53 |
headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
| - |
|
54 |
headers.put("Accept-Language", "en-US,en;q=0.8");
|
| - |
|
55 |
headers.put("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
|
| 51 |
}
|
56 |
}
|
| 52 |
|
57 |
|
| 53 |
public static void main(String[] args) throws UnsupportedEncodingException, MessagingException{
|
58 |
public static void main(String[] args) throws UnsupportedEncodingException, MessagingException{
|
| 54 |
try{
|
59 |
try{
|
| 55 |
logger = LoggerFactory.getLogger(SnapdealOrderStatusReconciliation.class);
|
60 |
logger = LoggerFactory.getLogger(SnapdealOrderStatusReconciliation.class);
|
| 56 |
/*List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
- |
|
| 57 |
statuses.add(OrderStatus.SHIPPED_FROM_WH);
|
- |
|
| 58 |
statuses.add(OrderStatus.SHIPPED_TO_LOGST);*/
|
- |
|
| 59 |
|
61 |
|
| 60 |
Map<String,List<List<String>>> orderDataMap = new HashMap<String,List<List<String>>>();
|
62 |
Map<String,List<List<String>>> orderDataMap = new HashMap<String,List<List<String>>>();
|
| 61 |
List<List<String>> deliveredOrderDataList = new ArrayList<List<String>>();
|
63 |
List<List<String>> deliveredOrderDataList = new ArrayList<List<String>>();
|
| 62 |
List<List<String>> cancelledOrderDataList = new ArrayList<List<String>>();
|
64 |
List<List<String>> cancelledOrderDataList = new ArrayList<List<String>>();
|
| 63 |
long minCreationDate = 0l;
|
65 |
long minCreationDate = 0l;
|
| 64 |
long currentTime = System.currentTimeMillis();
|
66 |
long currentTime = System.currentTimeMillis();
|
| - |
|
67 |
|
| - |
|
68 |
SnapdealSessionCookie sdSessionCookie = new SnapdealSessionCookie();
|
| - |
|
69 |
String cookies = sdSessionCookie.getCookies();
|
| - |
|
70 |
JSONObject cookieObject = new JSONObject(cookies);
|
| 65 |
|
71 |
|
| 66 |
Calendar cal = Calendar.getInstance();
|
72 |
Calendar cal = Calendar.getInstance();
|
| 67 |
cal.add(Calendar.DAY_OF_MONTH, -60);
|
73 |
cal.add(Calendar.DAY_OF_MONTH, -60);
|
| 68 |
minCreationDate = cal.getTimeInMillis();
|
74 |
minCreationDate = cal.getTimeInMillis();
|
| 69 |
/*TransactionClient tsc = null;
|
- |
|
| 70 |
try {
|
- |
|
| 71 |
tsc = new TransactionClient();
|
- |
|
| 72 |
minCreationDate = tsc.getClient().getMinCreatedTimeStampUndeliveredOrdersForSource(OrderSource.SNAPDEAL.getValue());
|
- |
|
| 73 |
minCreationDate = 1393612200000l;
|
- |
|
| 74 |
} catch (Exception e) {
|
- |
|
| 75 |
logger.error("Unable to establish connection to the transaction service while getting Minimum Order Created Timstamp for Undelivered Orders ", e);
|
- |
|
| 76 |
}//Dec 14, 2013 12:00:00 AM 1383291412000l
|
- |
|
| 77 |
*/
|
75 |
|
| 78 |
SimpleDateFormat snapdealDateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
76 |
SimpleDateFormat snapdealDateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
| 79 |
SimpleDateFormat gotSnapdealDateFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss aaa");
|
77 |
SimpleDateFormat gotSnapdealDateFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss aaa");
|
| 80 |
SimpleDateFormat ourDBDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
78 |
SimpleDateFormat ourDBDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| 81 |
String startDate= "";
|
79 |
String startDate= "";
|
| 82 |
Date start_date = new Date(minCreationDate);
|
80 |
Date start_date = new Date(minCreationDate);
|
| Line 95... |
Line 93... |
| 95 |
//endDate = endDate.replace("-", "%2F");
|
93 |
//endDate = endDate.replace("-", "%2F");
|
| 96 |
|
94 |
|
| 97 |
|
95 |
|
| 98 |
HttpClient client = new DefaultHttpClient();
|
96 |
HttpClient client = new DefaultHttpClient();
|
| 99 |
|
97 |
|
| 100 |
HttpGet get = new HttpGet("http://selleraccounts.snapdeal.com/keymaker/login");
|
- |
|
| 101 |
HttpResponse response = null;
|
98 |
HttpResponse response = null;
|
| 102 |
try {
|
- |
|
| 103 |
response = client.execute(get);
|
- |
|
| 104 |
} catch (Exception e) {
|
- |
|
| 105 |
e.printStackTrace();
|
- |
|
| 106 |
throw new Exception("Excption while login to snapdeal panel");
|
- |
|
| 107 |
}
|
- |
|
| 108 |
BufferedReader rd = null;
|
99 |
BufferedReader rd = null;
|
| 109 |
try {
|
- |
|
| 110 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
- |
|
| 111 |
} catch (Exception e1) {
|
- |
|
| 112 |
e1.printStackTrace();
|
- |
|
| 113 |
throw new Exception("Excption while reading login response");
|
- |
|
| 114 |
}
|
- |
|
| 115 |
String line = "";
|
100 |
String line = "";
|
| 116 |
StringBuffer sb = new StringBuffer();
|
- |
|
| 117 |
try {
|
- |
|
| 118 |
while ((line = rd.readLine()) != null) {
|
- |
|
| 119 |
sb.append(line);
|
- |
|
| 120 |
//System.out.println(line);
|
- |
|
| 121 |
}
|
- |
|
| 122 |
} catch (IOException e) {
|
- |
|
| 123 |
e.printStackTrace();
|
- |
|
| 124 |
throw new Exception("Excption while reading login response");
|
- |
|
| 125 |
}
|
- |
|
| 126 |
int i= sb.toString().indexOf("name=\"lt\" value=");
|
- |
|
| 127 |
char[] charArray = sb.toString().toCharArray();
|
- |
|
| 128 |
String lt = "";
|
- |
|
| 129 |
int j=0;
|
- |
|
| 130 |
for(j=i+16;j<=charArray.length;j++){
|
- |
|
| 131 |
|
- |
|
| 132 |
if(charArray[j]==' '){
|
- |
|
| 133 |
break;
|
- |
|
| 134 |
}
|
- |
|
| 135 |
}
|
- |
|
| 136 |
lt = sb.substring(i+17,j-1);
|
- |
|
| 137 |
System.out.println("LT VALUE " + lt);
|
- |
|
| 138 |
i= sb.toString().indexOf("name=\"execution\" value=");
|
- |
|
| 139 |
charArray = sb.toString().toCharArray();
|
- |
|
| 140 |
|
- |
|
| 141 |
String ex = "";
|
- |
|
| 142 |
j=0;
|
- |
|
| 143 |
for(j=i+24;j<=charArray.length;j++){
|
- |
|
| 144 |
if(charArray[j]==' '){
|
- |
|
| 145 |
break;
|
- |
|
| 146 |
}
|
- |
|
| 147 |
}
|
- |
|
| 148 |
ex = sb.substring(i+24,j-1);
|
- |
|
| 149 |
System.out.println("EXECUTION VALUE " + ex);
|
- |
|
| 150 |
|
- |
|
| 151 |
|
- |
|
| 152 |
|
- |
|
| 153 |
HttpPost post = new HttpPost("http://selleraccounts.snapdeal.com/login?service=http%3A%2F%2Fshipping.snapdeal.com%2Fj_spring_cas_security_check");
|
- |
|
| 154 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
- |
|
| 155 |
//nameValuePairs.add(new BasicNameValuePair("username",
|
- |
|
| 156 |
//"khushal.bhatia@saholic.com"));
|
- |
|
| 157 |
nameValuePairs.add(new BasicNameValuePair("username",
|
- |
|
| 158 |
"saholic-snapdeal@saholic.com"));
|
- |
|
| 159 |
//nameValuePairs.add(new BasicNameValuePair("password",
|
- |
|
| 160 |
//"sonline"));
|
- |
|
| 161 |
nameValuePairs.add(new BasicNameValuePair("password",
|
- |
|
| 162 |
"saholic15"));
|
- |
|
| 163 |
nameValuePairs.add(new BasicNameValuePair("_eventId","submit"));
|
- |
|
| 164 |
nameValuePairs.add(new BasicNameValuePair("execution",ex));
|
- |
|
| 165 |
nameValuePairs.add(new BasicNameValuePair("lt",lt));
|
- |
|
| 166 |
nameValuePairs.add(new BasicNameValuePair("submit","LOGIN"));
|
- |
|
| 167 |
post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
|
- |
|
| 168 |
//response = null;
|
- |
|
| 169 |
try {
|
- |
|
| 170 |
response = client.execute(post);
|
- |
|
| 171 |
} catch (Exception e) {
|
- |
|
| 172 |
logger.error("Unable to get Http Response for snapdeal seller portal login", e);
|
- |
|
| 173 |
}
|
- |
|
| 174 |
try {
|
- |
|
| 175 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
- |
|
| 176 |
} catch (Exception e1) {
|
- |
|
| 177 |
logger.error("Unable to read Http Response for snapdeal seller portal login", e1);
|
- |
|
| 178 |
throw new Exception("Unable to read Http Response for snapdeal seller portal login");
|
- |
|
| 179 |
}
|
- |
|
| 180 |
|
- |
|
| 181 |
//Striline = "";
|
- |
|
| 182 |
try {
|
- |
|
| 183 |
while ((line = rd.readLine()) != null) {
|
- |
|
| 184 |
System.out.println(line);
|
- |
|
| 185 |
}
|
- |
|
| 186 |
} catch (Exception e) {
|
- |
|
| 187 |
logger.error("Unable to extract Http Response for snapdeal seller portal login", e);
|
- |
|
| 188 |
throw new Exception("Unable to extract Http Response for snapdeal seller portal login");
|
- |
|
| 189 |
}
|
- |
|
| 190 |
|
101 |
|
| 191 |
get = new HttpGet("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/pendingOrders/40?fulfillmentModelCode=ONESHIP");
|
102 |
HttpGet get = new HttpGet("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/pendingOrders/40?fulfillmentModelCode=ONESHIP");
|
| - |
|
103 |
for(String key:headers.keySet())
|
| - |
|
104 |
get.addHeader(key, headers.get(key));
|
| - |
|
105 |
get.addHeader("Cookie","AWSELB="+cookieObject.get("AWSELB")+";JSESSIONID="+cookieObject.get("JSESSIONID")+";");
|
| - |
|
106 |
|
| 192 |
try {
|
107 |
try {
|
| 193 |
response = client.execute(get);
|
108 |
response = client.execute(get);
|
| 194 |
} catch (ClientProtocolException e) {
|
109 |
} catch (ClientProtocolException e) {
|
| 195 |
e.printStackTrace();
|
110 |
e.printStackTrace();
|
| 196 |
} catch (IOException e) {
|
111 |
} catch (IOException e) {
|
| Line 204... |
Line 119... |
| 204 |
|
119 |
|
| 205 |
|
120 |
|
| 206 |
|
121 |
|
| 207 |
JSONArray jsonDataObj = null;
|
122 |
JSONArray jsonDataObj = null;
|
| 208 |
JSONArray jsonDataShip = null;
|
123 |
JSONArray jsonDataShip = null;
|
| 209 |
String line1 = "";
|
- |
|
| 210 |
|
124 |
|
| 211 |
for(long start = start_date.getTime(); start < end_date.getTime();){
|
125 |
for(long start = start_date.getTime(); start < end_date.getTime();){
|
| 212 |
long end = start + 604800000l;
|
126 |
long end = start + 604800000l;
|
| 213 |
if(end > end_date.getTime()){
|
127 |
if(end > end_date.getTime()){
|
| 214 |
end = end_date.getTime();
|
128 |
end = end_date.getTime();
|
| 215 |
}
|
129 |
}
|
| 216 |
startDate = snapdealDateFormat.format(new Date(start));
|
130 |
startDate = snapdealDateFormat.format(new Date(start));
|
| 217 |
endDate = snapdealDateFormat.format(new Date(end));
|
131 |
endDate = snapdealDateFormat.format(new Date(end));
|
| 218 |
|
132 |
|
| 219 |
logger.info("==== Start Date.."+startDate+"\n");
|
133 |
logger.info("==== Start Date.."+startDate+"\n");
|
| 220 |
logger.info("==== End Date.."+endDate+"\n");
|
134 |
logger.info("==== End Date.."+endDate+"\n");
|
| 221 |
|
- |
|
| 222 |
|
- |
|
| 223 |
/*logger.info("Getting Delivery Information for DropShip Snapdeal Orders");
|
- |
|
| 224 |
//http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch?statusCode=COURIER_DELIVERED&dispatchCategoryId=0&startDate=2014%2F04%2F01&endDate=2014%2F04%2F07&statusColumn=deliveredOn
|
- |
|
| 225 |
String dropshipUrl = "http://shipping.snapdeal.com/vendor/DROPSHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
|
- |
|
| 226 |
logger.info("Drop Ship Url "+dropshipUrl);
|
- |
|
| 227 |
|
- |
|
| 228 |
get = new HttpGet(dropshipUrl);
|
- |
|
| 229 |
|
- |
|
| 230 |
try {
|
- |
|
| 231 |
response = client.execute(get);
|
- |
|
| 232 |
} catch (Exception e) {
|
- |
|
| 233 |
logger.error("Unable to get Http Response for snapdeal dropship delivered orders", e);
|
- |
|
| 234 |
}
|
135 |
|
| 235 |
|
- |
|
| 236 |
try {
|
- |
|
| 237 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
- |
|
| 238 |
} catch (Exception e) {
|
- |
|
| 239 |
logger.error("Unable to read Http Response for snapdeal dropship delivered orders", e);
|
- |
|
| 240 |
}
|
- |
|
| 241 |
|
- |
|
| 242 |
|
- |
|
| 243 |
try {
|
136 |
int i;
|
| 244 |
|
- |
|
| 245 |
String resP = rd.readLine();
|
- |
|
| 246 |
jsonDataObj = new JSONArray("["+resP+"]");
|
- |
|
| 247 |
JSONObject j1 = (JSONObject)jsonDataObj.get(0);
|
- |
|
| 248 |
jsonDataShip = new JSONArray(j1.get("jsonDataString").toString());
|
- |
|
| 249 |
} catch (Exception e) {
|
- |
|
| 250 |
logger.error("Unable to extract Http Response for snapdeal dropship delivered orders", e);
|
- |
|
| 251 |
}
|
- |
|
| 252 |
|
- |
|
| 253 |
|
- |
|
| 254 |
if(jsonDataShip!=null && jsonDataShip.length()>0){
|
- |
|
| 255 |
for(i=0; i< jsonDataShip.length(); i++){
|
- |
|
| 256 |
JSONObject jsonObj = null;
|
- |
|
| 257 |
try {
|
- |
|
| 258 |
jsonObj = jsonDataShip.getJSONObject(i);
|
- |
|
| 259 |
|
- |
|
| 260 |
if(jsonObj!=null){
|
- |
|
| 261 |
String subOrderCode =(String) jsonObj.get("suborderCode");
|
- |
|
| 262 |
String referenceNumber =(String) jsonObj.get("referenceCode");
|
- |
|
| 263 |
String deliveryDate =(String) jsonObj.get("deliveredOn");
|
- |
|
| 264 |
logger.info("Snapdeal Dropship Order Details...suborderCode... "+subOrderCode+" ...referenceNumber... "+ referenceNumber+ " ...deliveryDate... "+ deliveryDate);
|
- |
|
| 265 |
deliveryDate = ourDBDateFormat.format(gotSnapdealDateFormat.parse(deliveryDate).getTime());
|
- |
|
| 266 |
List<String> deliveredOrdelList = new ArrayList<String>();
|
- |
|
| 267 |
deliveredOrdelList.add(referenceNumber);
|
- |
|
| 268 |
deliveredOrdelList.add(subOrderCode);
|
- |
|
| 269 |
deliveredOrdelList.add(deliveryDate);
|
- |
|
| 270 |
deliveredOrderDataList.add(deliveredOrdelList);
|
- |
|
| 271 |
}
|
- |
|
| 272 |
} catch (Exception e) {
|
- |
|
| 273 |
logger.error("Unable to add delivered order details for updation regarding snapdeal dropship delivered orders", e);
|
- |
|
| 274 |
}
|
- |
|
| 275 |
}
|
- |
|
| 276 |
}*/
|
- |
|
| 277 |
|
137 |
|
| 278 |
logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
|
138 |
logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
|
| 279 |
//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
|
139 |
//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
|
| 280 |
String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
|
140 |
String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
|
| 281 |
logger.info("One Ship Url "+oneShipUrl);
|
141 |
logger.info("One Ship Url "+oneShipUrl);
|
| 282 |
|
142 |
|
| 283 |
post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
|
143 |
HttpPost post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
|
| - |
|
144 |
cookies = sdSessionCookie.getCookies();
|
| - |
|
145 |
cookieObject = new JSONObject(cookies);
|
| - |
|
146 |
for(String key:headers.keySet())
|
| - |
|
147 |
post.addHeader(key, headers.get(key));
|
| - |
|
148 |
post.addHeader("Cookie","AWSELB="+cookieObject.get("AWSELB")+";JSESSIONID="+cookieObject.get("JSESSIONID")+";");
|
| 284 |
nameValuePairs = new ArrayList<NameValuePair>();
|
149 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
| 285 |
nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
|
150 |
nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
|
| 286 |
nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
|
151 |
nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
|
| 287 |
nameValuePairs.add(new BasicNameValuePair("statusColumn","deliveredOn"));
|
152 |
nameValuePairs.add(new BasicNameValuePair("statusColumn","deliveredOn"));
|
| 288 |
nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
|
153 |
nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
|
| 289 |
nameValuePairs.add(new BasicNameValuePair("statusCode","COURIER_DELIVERED"));
|
154 |
nameValuePairs.add(new BasicNameValuePair("statusCode","COURIER_DELIVERED"));
|
| Line 345... |
Line 210... |
| 345 |
throw new Exception("Unable to add delivered order details for updation regarding snapdeal oneship delivered orders");
|
210 |
throw new Exception("Unable to add delivered order details for updation regarding snapdeal oneship delivered orders");
|
| 346 |
}
|
211 |
}
|
| 347 |
}
|
212 |
}
|
| 348 |
}
|
213 |
}
|
| 349 |
|
214 |
|
| 350 |
|
- |
|
| 351 |
/*logger.info("Getting Information for Cancelled DropShip Snapdeal Orders");
|
- |
|
| 352 |
String dropshipCancelUrl = "http://shipping.snapdeal.com/vendor/DROPSHIP/product-shipment/shippedData/fetch/?statusCode=CLD&dispatchCategoryId=0&startDate="+startDate+"&endDate="+endDate+"&statusColumn=cancelledOn";
|
- |
|
| 353 |
logger.info("Drop Ship Cancel Url "+dropshipCancelUrl);
|
- |
|
| 354 |
|
- |
|
| 355 |
get = new HttpGet(dropshipCancelUrl);
|
- |
|
| 356 |
|
- |
|
| 357 |
try {
|
- |
|
| 358 |
response = client.execute(get);
|
- |
|
| 359 |
} catch (Exception e) {
|
- |
|
| 360 |
logger.error("Unable to get Http Response for snapdeal dropship cancelled orders", e);
|
- |
|
| 361 |
}
|
- |
|
| 362 |
|
- |
|
| 363 |
try {
|
- |
|
| 364 |
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
- |
|
| 365 |
} catch (Exception e) {
|
- |
|
| 366 |
logger.error("Unable to read Http Response for snapdeal dropship cancelled orders", e);
|
- |
|
| 367 |
}
|
- |
|
| 368 |
|
- |
|
| 369 |
try {
|
- |
|
| 370 |
String resP = rd.readLine();
|
- |
|
| 371 |
jsonDataObj = new JSONArray("["+resP+"]");
|
- |
|
| 372 |
JSONObject j1 = (JSONObject)jsonDataObj.get(0);
|
- |
|
| 373 |
jsonDataShip = new JSONArray(j1.get("jsonDataString").toString());
|
- |
|
| 374 |
} catch (Exception e) {
|
- |
|
| 375 |
logger.error("Unable to extract Http Response for snapdeal dropship cancelled orders", e);
|
- |
|
| 376 |
}
|
- |
|
| 377 |
|
- |
|
| 378 |
if(jsonDataShip!=null && jsonDataShip.length()>0){
|
- |
|
| 379 |
for(i=0; i< jsonDataShip.length(); i++){
|
- |
|
| 380 |
JSONObject jsonObj = null;
|
- |
|
| 381 |
try {
|
- |
|
| 382 |
jsonObj = jsonDataShip.getJSONObject(i);
|
- |
|
| 383 |
|
- |
|
| 384 |
if(jsonObj!=null){
|
- |
|
| 385 |
String subOrderCode =(String) jsonObj.get("suborderCode");
|
- |
|
| 386 |
String referenceNumber =(String) jsonObj.get("referenceCode");
|
- |
|
| 387 |
logger.info("Snapdeal Dropship Order Details...suborderCode... "+subOrderCode+" ...referenceNumber... "+ referenceNumber);
|
- |
|
| 388 |
List<String> cancelledOrdelList = new ArrayList<String>();
|
- |
|
| 389 |
cancelledOrdelList.add(referenceNumber);
|
- |
|
| 390 |
cancelledOrdelList.add(subOrderCode);
|
- |
|
| 391 |
cancelledOrderDataList.add(cancelledOrdelList);
|
- |
|
| 392 |
}
|
- |
|
| 393 |
} catch (Exception e) {
|
- |
|
| 394 |
logger.error("Unable to add cancelled order details for updation regarding snapdeal dropship orders", e);
|
- |
|
| 395 |
}
|
- |
|
| 396 |
}
|
- |
|
| 397 |
}*/
|
- |
|
| 398 |
|
- |
|
| 399 |
logger.info("Getting Information for OneShip Snapdeal Cancelled Orders");
|
215 |
logger.info("Getting Information for OneShip Snapdeal Cancelled Orders");
|
| 400 |
String oneShipCancelUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?statusCode=CLD&dispatchCategoryId=0&startDate="+startDate+"&endDate="+endDate+"&statusColumn=cancelledOn";
|
216 |
String oneShipCancelUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?statusCode=CLD&dispatchCategoryId=0&startDate="+startDate+"&endDate="+endDate+"&statusColumn=cancelledOn";
|
| 401 |
logger.info("One Ship Cancel Url "+oneShipCancelUrl);
|
217 |
logger.info("One Ship Cancel Url "+oneShipCancelUrl);
|
| 402 |
|
218 |
|
| 403 |
post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
|
219 |
post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
|
| - |
|
220 |
cookies = sdSessionCookie.getCookies();
|
| - |
|
221 |
cookieObject = new JSONObject(cookies);
|
| - |
|
222 |
for(String key:headers.keySet())
|
| - |
|
223 |
post.addHeader(key, headers.get(key));
|
| - |
|
224 |
post.addHeader("Cookie","AWSELB="+cookieObject.get("AWSELB")+";JSESSIONID="+cookieObject.get("JSESSIONID")+";");
|
| 404 |
nameValuePairs = new ArrayList<NameValuePair>();
|
225 |
nameValuePairs = new ArrayList<NameValuePair>();
|
| 405 |
nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
|
226 |
nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
|
| 406 |
nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
|
227 |
nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
|
| 407 |
nameValuePairs.add(new BasicNameValuePair("statusColumn","cancelledOn"));
|
228 |
nameValuePairs.add(new BasicNameValuePair("statusColumn","cancelledOn"));
|
| 408 |
nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
|
229 |
nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
|