| Line 12... |
Line 12... |
| 12 |
import org.apache.poi.ss.usermodel.CellType;
|
12 |
import org.apache.poi.ss.usermodel.CellType;
|
| 13 |
import org.apache.poi.ss.usermodel.Row;
|
13 |
import org.apache.poi.ss.usermodel.Row;
|
| 14 |
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
14 |
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
| 15 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
15 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
| 16 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
16 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
| - |
|
17 |
import org.slf4j.Logger;
|
| - |
|
18 |
import org.slf4j.LoggerFactory;
|
| 17 |
|
19 |
|
| 18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
20 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
21 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 20 |
import com.spice.profitmandi.common.model.TagListingModel;
|
22 |
import com.spice.profitmandi.common.model.TagListingModel;
|
| 21 |
|
23 |
|
| Line 31... |
Line 33... |
| 31 |
private static final String MOP = "MOP";
|
33 |
private static final String MOP = "MOP";
|
| 32 |
private static final String SUPPORT_PRICE = "Support Price";
|
34 |
private static final String SUPPORT_PRICE = "Support Price";
|
| 33 |
private static final String START_DATE = "Start Date";
|
35 |
private static final String START_DATE = "Start Date";
|
| 34 |
private static final String TAG_LISTING = "Tag Listing";
|
36 |
private static final String TAG_LISTING = "Tag Listing";
|
| 35 |
|
37 |
|
| 36 |
//private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtils.class);
|
38 |
private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtils.class);
|
| 37 |
|
39 |
|
| 38 |
public static void main(String[] args) throws Throwable{
|
40 |
public static void main(String[] args) throws Throwable{
|
| 39 |
parse(null);
|
41 |
parse(null);
|
| 40 |
}
|
42 |
}
|
| 41 |
public static List<TagListingModel> parse(InputStream inputStream) throws ProfitMandiBusinessException{
|
43 |
public static List<TagListingModel> parse(InputStream inputStream) throws ProfitMandiBusinessException{
|
| Line 89... |
Line 91... |
| 89 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
91 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 90 |
throw profitMandiBusinessException;
|
92 |
throw profitMandiBusinessException;
|
| 91 |
}
|
93 |
}
|
| 92 |
}else if(rowNumber == 0 && row == null){
|
94 |
}else if(rowNumber == 0 && row == null){
|
| 93 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LISTING, "", "TGLSTNG_VE_1012");
|
95 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LISTING, "", "TGLSTNG_VE_1012");
|
| 94 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
96 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 95 |
throw profitMandiBusinessException;
|
97 |
throw profitMandiBusinessException;
|
| 96 |
// missing headers in first row
|
98 |
// missing headers in first row
|
| 97 |
}
|
99 |
}
|
| 98 |
if(rowNumber > 0 && row != null && row.getLastCellNum() == 11){
|
100 |
if(rowNumber > 0 && row != null && row.getLastCellNum() == 11){
|
| 99 |
TagListingModel tagListing = new TagListingModel();
|
101 |
TagListingModel tagListing = new TagListingModel();
|
| Line 145... |
Line 147... |
| 145 |
throw profitMandiBusinessException;
|
147 |
throw profitMandiBusinessException;
|
| 146 |
}
|
148 |
}
|
| 147 |
tagListings.add(tagListing);
|
149 |
tagListings.add(tagListing);
|
| 148 |
} else {
|
150 |
} else {
|
| 149 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LISTING, "", "TGLSTNG_VE_1012");
|
151 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LISTING, "", "TGLSTNG_VE_1012");
|
| 150 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
152 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 151 |
throw profitMandiBusinessException;
|
153 |
throw profitMandiBusinessException;
|
| 152 |
}
|
154 |
}
|
| 153 |
|
155 |
|
| 154 |
}
|
156 |
}
|
| 155 |
myWorkBook.close();
|
157 |
myWorkBook.close();
|