Subversion Repositories SmartDukaan

Rev

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

Rev 8968 Rev 8969
Line 114... Line 114...
114
			return "flipkart-options";
114
			return "flipkart-options";
115
		}
115
		}
116
 
116
 
117
		return "id";
117
		return "id";
118
	}
118
	}
119
	@SuppressWarnings("unused")
-
 
120
	public void uploadOrdersFile() throws IOException, CatalogServiceException, TException{
119
	public void uploadOrdersFile() throws IOException, CatalogServiceException, TException{
121
		File fileToCreate = new File("/tmp/", "Flipkart-Orders.csv");
120
		File fileToCreate = new File("/tmp/", "Flipkart-Orders.csv");
122
		FileUtils.copyFile(this.file, fileToCreate);
121
		FileUtils.copyFile(this.file, fileToCreate);
123
		FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
122
		FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
124
		CSVReader orderfilereader = null;
123
		CSVReader orderfilereader = null;
Line 151... Line 150...
151
				logger.info("User is " + user.getEmail());
150
				logger.info("User is " + user.getEmail());
152
			} catch (Exception e) {
151
			} catch (Exception e) {
153
				logger.error("Unable to establish connection to the User service ", e);
152
				logger.error("Unable to establish connection to the User service ", e);
154
			}
153
			}
155
			logger.info("Before iterating orders in file");
154
			logger.info("Before iterating orders in file");
156
			while ((nextLine = orderfilereader.readNext()) != null) {
155
			while ((nextLine = orderfilereader.readNext()) != null && nextLine.length !=0 ) {
157
				logger.info("Order file entry  ");
156
				logger.info("Order file entry  " + nextLine);
158
				String orderId,subOrderId,create_date;
157
				String orderId,subOrderId,create_date;
159
				long sku;
158
				long sku;
160
				logger.info("Processing order " + nextLine[3]+ " " + nextLine[4]);
159
				logger.info("Processing order " + nextLine[3]+ " " + nextLine[4]);
161
				if(nextLine[3].length()==0 || nextLine[4].length()==0 ){
160
				if(nextLine[3].length()==0 || nextLine[4].length()==0 ){
162
					sb.append(" Could not parse order id " + nextLine[3]+ " " + nextLine[4] + "\n");
161
					sb.append(" Could not parse order id " + nextLine[3]+ " " + nextLine[4] + "\n");
Line 173... Line 172...
173
				}
172
				}
174
				else{
173
				else{
175
					sb.append(orderId+" "+subOrderId + " Could not parse order date" +"\n");
174
					sb.append(orderId+" "+subOrderId + " Could not parse order date" +"\n");
176
					logger.info(orderId+" "+subOrderId + " Could not parse order date");
175
					logger.info(orderId+" "+subOrderId + " Could not parse order date");
177
					continue;
176
					continue;
178
				}
177
				!
179
				if(nextLine[5].length()==0){
178
				if(nextLine[5].length()==0){
180
					sb.append(orderId+" "+subOrderId + " Could not parse sku" +"\n");
179
					sb.append(orderId+" "+subOrderId + " Could not parse sku" +"\n");
181
					logger.info(orderId+" "+subOrderId + " Could not parse sku");
180
					logger.info(orderId+" "+subOrderId + " Could not parse sku");
182
					continue;
181
					continue;
183
				}
182
				}