| Line 76... |
Line 76... |
| 76 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
76 |
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| 77 |
emailFromAddress = "build@shop2020.in";
|
77 |
emailFromAddress = "build@shop2020.in";
|
| 78 |
password = "cafe@nes";
|
78 |
password = "cafe@nes";
|
| 79 |
mailer = new GmailUtils();
|
79 |
mailer = new GmailUtils();
|
| 80 |
sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
80 |
sendTo = new String[]{"vikram.raghav@shop2020.in"};
|
| 81 |
/* sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
81 |
/* sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| 82 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
82 |
"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
|
| 83 |
"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
83 |
"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
| 84 |
*/ List<String> flipkartorderids = null;
|
84 |
*/ List<String> flipkartorderids = null;
|
| 85 |
Client catalogServiceClient = null;
|
85 |
Client catalogServiceClient = null;
|
| 86 |
try {
|
86 |
try {
|
| 87 |
catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
87 |
catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
| 88 |
} catch (TTransportException e) {
|
88 |
} catch (TTransportException e) {
|
| 89 |
e.printStackTrace();
|
89 |
e.printStackTrace();
|
| 90 |
}
|
90 |
}
|
| 91 |
try {
|
91 |
try {
|
| 92 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
92 |
flipkartItems = catalogServiceClient.getAllFlipkartItems();
|
| 93 |
snapdealItems = catalogServiceClient.getAllSnapdealItems();
|
93 |
snapdealItems = catalogServiceClient.getAllSnapdealItems();
|
| 94 |
} catch (TException e) {
|
94 |
} catch (TException e) {
|
| 95 |
e.printStackTrace();
|
95 |
e.printStackTrace();
|
| 96 |
}
|
96 |
}
|
| 97 |
for(FlipkartItem flipkartItem:flipkartItems){
|
97 |
for(FlipkartItem flipkartItem:flipkartItems){
|
| 98 |
if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed())
|
98 |
if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed())
|
| 99 |
flipkartInventoryItems.add(flipkartItem);
|
99 |
flipkartInventoryItems.add(flipkartItem);
|
| 100 |
}
|
100 |
}
|
| 101 |
for(SnapdealItemDetails snapdealItem:snapdealItems){
|
101 |
for(SnapdealItemDetails snapdealItem:snapdealItems){
|
| 102 |
snapdealItemsMap.put(snapdealItem.getItem_id(),snapdealItem);
|
102 |
snapdealItemsMap.put(snapdealItem.getItem_id(),snapdealItem);
|
| 103 |
}
|
103 |
}
|
| 104 |
if(flipkartInventoryItems.size()==0){
|
104 |
if(flipkartInventoryItems.size()==0){
|
| 105 |
String text = "";
|
105 |
String text = "";
|
| 106 |
try {
|
106 |
try {
|
| 107 |
mailer.sendSSLMessage(sendTo,"No items to send inventory ", emailFromAddress, password, text);
|
107 |
mailer.sendSSLMessage(sendTo,"No items to send inventory ", emailFromAddress, password, text);
|
| 108 |
System.exit(0);
|
108 |
System.exit(0);
|
| 109 |
} catch (MessagingException e) {
|
109 |
} catch (MessagingException e) {
|
| 110 |
e.printStackTrace();
|
110 |
e.printStackTrace();
|
| 111 |
}
|
111 |
}
|
| 112 |
}
|
112 |
}
|
| 113 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
113 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
| 114 |
try {
|
114 |
try {
|
| 115 |
flipkartorderids = FetchOrders();
|
115 |
flipkartorderids = FetchOrders();
|
| 116 |
} catch (ClientProtocolException e1) {
|
116 |
} catch (ClientProtocolException e1) {
|
| 117 |
e1.printStackTrace();
|
117 |
e1.printStackTrace();
|
| 118 |
} catch (IOException e1) {
|
118 |
} catch (IOException e1) {
|
| 119 |
e1.printStackTrace();
|
119 |
e1.printStackTrace();
|
| 120 |
}
|
120 |
}
|
| 121 |
try {
|
121 |
try {
|
| 122 |
transactionClient = new TransactionClient().getClient();
|
122 |
transactionClient = new TransactionClient().getClient();
|
| 123 |
if(flipkartorderids!=null && flipkartorderids.size()>0){
|
123 |
if(flipkartorderids!=null && flipkartorderids.size()>0){
|
| 124 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
124 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
| 125 |
}
|
125 |
}
|
| 126 |
} catch (TTransportException e) {
|
126 |
} catch (TTransportException e) {
|
| 127 |
try {
|
127 |
try {
|
| 128 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
128 |
itemIdOrdersMap = transactionClient.getCreatedOrdersForFlipkart(flipkartorderids);
|
| 129 |
} catch (TException e1) {
|
129 |
} catch (TException e1) {
|
| 130 |
e1.printStackTrace();
|
130 |
e1.printStackTrace();
|
| 131 |
}
|
131 |
}
|
| 132 |
}catch (TException e) {
|
132 |
}catch (TException e) {
|
| 133 |
e.printStackTrace();
|
133 |
e.printStackTrace();
|
| 134 |
}
|
134 |
}
|
| 135 |
try {
|
135 |
try {
|
| 136 |
List<FlipkartInventorySnapshot> updatedFlipkartInventoryList = new InventoryClient().getClient().getFlipkartInventorySnapshot();
|
136 |
List<FlipkartInventorySnapshot> updatedFlipkartInventoryList = new InventoryClient().getClient().getFlipkartInventorySnapshot();
|
| 137 |
for(FlipkartInventorySnapshot updatedFlipkartInventory:updatedFlipkartInventoryList){
|
137 |
for(FlipkartInventorySnapshot updatedFlipkartInventory:updatedFlipkartInventoryList){
|
| 138 |
updatedFlipkartInventoryMap.put(updatedFlipkartInventory.getItem_id(),updatedFlipkartInventory.getAvailability());
|
138 |
updatedFlipkartInventoryMap.put(updatedFlipkartInventory.getItem_id(),updatedFlipkartInventory.getAvailability());
|
| 139 |
}
|
139 |
}
|
| 140 |
} catch (TException e) {
|
140 |
} catch (TException e) {
|
| 141 |
e.printStackTrace();
|
141 |
e.printStackTrace();
|
| - |
|
142 |
}
|
| - |
|
143 |
catch(Exception e){
|
| - |
|
144 |
List<FlipkartInventorySnapshot> updatedFlipkartInventoryList = null;
|
| - |
|
145 |
try {
|
| - |
|
146 |
updatedFlipkartInventoryList = new InventoryClient().getClient().getFlipkartInventorySnapshot();
|
| - |
|
147 |
} catch (TTransportException e1) {
|
| - |
|
148 |
e1.printStackTrace();
|
| - |
|
149 |
} catch (TException e1) {
|
| - |
|
150 |
e1.printStackTrace();
|
| - |
|
151 |
}
|
| - |
|
152 |
if(updatedFlipkartInventoryList != null){
|
| - |
|
153 |
for(FlipkartInventorySnapshot updatedFlipkartInventory:updatedFlipkartInventoryList){
|
| - |
|
154 |
updatedFlipkartInventoryMap.put(updatedFlipkartInventory.getItem_id(),updatedFlipkartInventory.getAvailability());
|
| - |
|
155 |
}
|
| - |
|
156 |
}
|
| 142 |
}
|
157 |
}
|
| 143 |
|
158 |
|
| 144 |
|
159 |
|
| 145 |
}
|
160 |
}
|
| 146 |
|
161 |
|
| 147 |
public static void main(String[] args) throws ClientProtocolException, TException{
|
162 |
public static void main(String[] args) throws ClientProtocolException, TException{
|