| Line 44... |
Line 44... |
| 44 |
import org.apache.http.client.ClientProtocolException;
|
44 |
import org.apache.http.client.ClientProtocolException;
|
| 45 |
import org.apache.http.client.HttpClient;
|
45 |
import org.apache.http.client.HttpClient;
|
| 46 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
46 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
| 47 |
import org.apache.http.client.methods.HttpGet;
|
47 |
import org.apache.http.client.methods.HttpGet;
|
| 48 |
import org.apache.http.client.methods.HttpPost;
|
48 |
import org.apache.http.client.methods.HttpPost;
|
| - |
|
49 |
import org.apache.http.entity.mime.MultipartEntity;
|
| - |
|
50 |
import org.apache.http.entity.mime.content.ContentBody;
|
| - |
|
51 |
import org.apache.http.entity.mime.content.FileBody;
|
| 49 |
import org.apache.http.impl.client.DefaultHttpClient;
|
52 |
import org.apache.http.impl.client.DefaultHttpClient;
|
| 50 |
import org.apache.http.message.BasicNameValuePair;
|
53 |
import org.apache.http.message.BasicNameValuePair;
|
| 51 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
54 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
| 52 |
import org.apache.poi.ss.usermodel.Row;
|
55 |
import org.apache.poi.ss.usermodel.Row;
|
| 53 |
import org.apache.poi.ss.usermodel.Sheet;
|
56 |
import org.apache.poi.ss.usermodel.Sheet;
|
| Line 726... |
Line 729... |
| 726 |
hwb.write(fileOut);
|
729 |
hwb.write(fileOut);
|
| 727 |
} catch (IOException e) {
|
730 |
} catch (IOException e) {
|
| 728 |
// TODO Auto-generated catch block
|
731 |
// TODO Auto-generated catch block
|
| 729 |
e.printStackTrace();
|
732 |
e.printStackTrace();
|
| 730 |
}
|
733 |
}
|
| 731 |
/* HttpClient client = new DefaultHttpClient();
|
734 |
HttpClient client = new DefaultHttpClient();
|
| 732 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/login_security_check?spring-security-redirect=http://seller.snapdeal.com/inventory&");
|
735 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/login_security_check?spring-security-redirect=http://seller.snapdeal.com/inventory&");
|
| 733 |
BufferedReader rd= null;
|
736 |
BufferedReader rd= null;
|
| 734 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
737 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
| 735 |
nameValuePairs.add(new BasicNameValuePair("j_username",
|
738 |
nameValuePairs.add(new BasicNameValuePair("j_username",
|
| 736 |
"khushal.bhatia@saholic.com"));
|
739 |
"khushal.bhatia@saholic.com"));
|
| Line 752... |
Line 755... |
| 752 |
} catch (IOException e) {
|
755 |
} catch (IOException e) {
|
| 753 |
// TODO Auto-generated catch block
|
756 |
// TODO Auto-generated catch block
|
| 754 |
e.printStackTrace();
|
757 |
e.printStackTrace();
|
| 755 |
}
|
758 |
}
|
| 756 |
post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
|
759 |
post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
|
| 757 |
File file = new File("/home/vikram/snapdeal-inventory-1389608325312.xls");
|
760 |
File file = new File("/root/code/trunk/SnapDealFeeds/SellerInventory.xls");
|
| 758 |
MultipartEntity mpEntity = new MultipartEntity();
|
761 |
MultipartEntity mpEntity = new MultipartEntity();
|
| 759 |
ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
|
762 |
ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
|
| 760 |
mpEntity.addPart("file", cbFile);
|
763 |
mpEntity.addPart("file", cbFile);
|
| 761 |
post.setEntity(mpEntity);
|
764 |
post.setEntity(mpEntity);
|
| 762 |
response = client.execute(post);
|
765 |
response = client.execute(post);
|
| Line 776... |
Line 779... |
| 776 |
}
|
779 |
}
|
| 777 |
} catch (IOException e) {
|
780 |
} catch (IOException e) {
|
| 778 |
// TODO Auto-generated catch block
|
781 |
// TODO Auto-generated catch block
|
| 779 |
e.printStackTrace();
|
782 |
e.printStackTrace();
|
| 780 |
}
|
783 |
}
|
| 781 |
*/
|
- |
|
| 782 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
784 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
| 783 |
long lastSentInventoryTime = System.currentTimeMillis();
|
785 |
long lastSentInventoryTime = System.currentTimeMillis();
|
| 784 |
try {
|
786 |
try {
|
| 785 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
787 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
| 786 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
788 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
| Line 794... |
Line 796... |
| 794 |
}
|
796 |
}
|
| 795 |
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
797 |
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| 796 |
String emailFromAddress = "build@shop2020.in";
|
798 |
String emailFromAddress = "build@shop2020.in";
|
| 797 |
String password = "cafe@nes";
|
799 |
String password = "cafe@nes";
|
| 798 |
GmailUtils mailer = new GmailUtils();
|
800 |
GmailUtils mailer = new GmailUtils();
|
| 799 |
String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
|
801 |
String sendTo[] = new String[]{"vikram.raghav@shop2020.in","rajveer.singh@shop2020.in"};
|
| 800 |
//String sendTo[] = new String[]{"vikram.raghav@shop2020.in","kshitij.sood@shop2020.in"};
|
802 |
//String sendTo[] = new String[]{"vikram.raghav@shop2020.in","kshitij.sood@shop2020.in"};
|
| 801 |
/*String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
803 |
/*String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| 802 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
804 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| 803 |
"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
805 |
"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
| 804 |
*/
|
806 |
*/
|
| Line 821... |
Line 823... |
| 821 |
}
|
823 |
}
|
| 822 |
}
|
824 |
}
|
| 823 |
List<File> files = new ArrayList<File>();
|
825 |
List<File> files = new ArrayList<File>();
|
| 824 |
files.add(new File(SNAPDEAL_INVENTORY_SHEET));
|
826 |
files.add(new File(SNAPDEAL_INVENTORY_SHEET));
|
| 825 |
try {
|
827 |
try {
|
| 826 |
mailer.sendSSLMessage(sendTo,"Inventory File","Please see attached inventory file", emailFromAddress, password, files);
|
828 |
mailer.sendSSLMessage(sendTo,"Inventory File","Please see attached inventory file with Feed ID " + line, emailFromAddress, password, files);
|
| 827 |
} catch (MessagingException e) {
|
829 |
} catch (MessagingException e) {
|
| 828 |
e.printStackTrace();
|
830 |
e.printStackTrace();
|
| 829 |
}
|
831 |
}
|
| 830 |
|
832 |
|
| 831 |
|
833 |
|