Subversion Repositories SmartDukaan

Rev

Rev 10895 | Rev 10897 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10895 Rev 10896
Line 125... Line 125...
125
		String subOrderId;
125
		String subOrderId;
126
		for(Order order:orders.getOrder()){
126
		for(Order order:orders.getOrder()){
127
			subOrderId = order.getSuborderId();
127
			subOrderId = order.getSuborderId();
128
			Client transaction_client = null;
128
			Client transaction_client = null;
129
			new_orders++;
129
			new_orders++;
-
 
130
			boolean flag = false;
130
			try {
131
			try {
131
				transaction_client = new TransactionClient().getClient();
132
				transaction_client = new TransactionClient().getClient();
-
 
133
			} catch (TTransportException e2) {
-
 
134
				try {
132
				if(transaction_client.snapdealOrderExists(subOrderId, order.getReferenceCode())) {
135
					transaction_client = new TransactionClient().getClient();
-
 
136
				} catch (TTransportException e) {
133
					logger.error("Snapdeal suborder id exists " + subOrderId);
137
					logger.error("Problem with Transaction service " + subOrderId);
134
					duplicate_orders++;
138
					e.printStackTrace();
135
					continue;
139
					continue;
136
				}
140
				}
-
 
141
				e2.printStackTrace();
-
 
142
			}
-
 
143
			try {
-
 
144
				flag = transaction_client.snapdealOrderExists(subOrderId, order.getReferenceCode());
-
 
145
			} catch (TException e2) {
-
 
146
				try {
-
 
147
					flag = new TransactionClient().getClient().snapdealOrderExists(subOrderId, order.getReferenceCode());
-
 
148
				} catch (TTransportException e) {
-
 
149
					logger.error("Problem with Transaction service " + subOrderId);
-
 
150
					e.printStackTrace();
-
 
151
					continue;
-
 
152
				} catch (TException e) {
-
 
153
					logger.error("Problem with Transaction service " + subOrderId);
-
 
154
					e.printStackTrace();
-
 
155
					continue;
137
 
156
 
138
			} catch (TTransportException e1) {
-
 
139
				logger.error("Problem with Transaction service " , e1);
-
 
140
				e1.printStackTrace();
157
				}
141
				continue;
158
			}
142
			} catch (TException e) {
159
			if(flag) {
143
				logger.error("Problem.. thrift exception with Transaction service " , e);
160
				logger.error("Snapdeal suborder id exists " + subOrderId);
144
				e.printStackTrace();
161
				duplicate_orders++;
145
				continue;
162
				continue;
146
			}
163
			}
-
 
164
 
147
			Transaction txn = new Transaction();
165
			Transaction txn = new Transaction();
148
			txn.setShoppingCartid(user.getActiveCartId());
166
			txn.setShoppingCartid(user.getActiveCartId());
149
			txn.setCustomer_id(user.getUserId());
167
			txn.setCustomer_id(user.getUserId());
150
			System.out.println("User Id is " + user.getUserId());
168
			System.out.println("User Id is " + user.getUserId());
151
			txn.setCreatedOn(new Date().getTime());
169
			txn.setCreatedOn(new Date().getTime());
Line 367... Line 385...
367
			}
385
			}
368
			else if(order.getCourier().trim().equalsIgnoreCase(TANVI_EXPRESS)){
386
			else if(order.getCourier().trim().equalsIgnoreCase(TANVI_EXPRESS)){
369
				t_order.setLogistics_provider_id(41);
387
				t_order.setLogistics_provider_id(41);
370
			}
388
			}
371
			else if(order.getCourier().trim().equalsIgnoreCase(VELIX)){
389
			else if(order.getCourier().trim().equalsIgnoreCase(VELIX)){
372
                t_order.setLogistics_provider_id(42);
390
				t_order.setLogistics_provider_id(42);
373
            }
391
			}
374
			else if(order.getCourier().trim().equalsIgnoreCase(XPRESSBEES)){
392
			else if(order.getCourier().trim().equalsIgnoreCase(XPRESSBEES)){
375
                t_order.setLogistics_provider_id(43);
393
				t_order.setLogistics_provider_id(43);
376
            }
-
 
377
			
394
			}
-
 
395
 
378
			else {
396
			else {
379
				t_order.setLogistics_provider_id(44);
397
				t_order.setLogistics_provider_id(44);
380
				/*logger.error("Error No Courier Match please add courier to our system for suborderid  " + order.getSuborderId() + "Courier Name " + order.getCourier());
398
				/*logger.error("Error No Courier Match please add courier to our system for suborderid  " + order.getSuborderId() + "Courier Name " + order.getCourier());
381
				sb.append(order.getSuborderId() + " Error No Courier Match " + order.getCourier() +"\n");
399
				sb.append(order.getSuborderId() + " Error No Courier Match " + order.getCourier() +"\n");
382
				continue;
400
				continue;