| Line 26... |
Line 26... |
| 26 |
private static final String BRAND = "Brand";
|
26 |
private static final String BRAND = "Brand";
|
| 27 |
private static final String MODEL_NAME = "Model Name";
|
27 |
private static final String MODEL_NAME = "Model Name";
|
| 28 |
private static final String MODEL_NUMBER = "Model Number";
|
28 |
private static final String MODEL_NUMBER = "Model Number";
|
| 29 |
private static final String COLOR = "Color";
|
29 |
private static final String COLOR = "Color";
|
| 30 |
private static final String SELLING_PRICE = "Selling Price";
|
30 |
private static final String SELLING_PRICE = "Selling Price";
|
| - |
|
31 |
private static final String MOP = "MOP";
|
| 31 |
private static final String SUPPORT_PRICE = "Support Price";
|
32 |
private static final String SUPPORT_PRICE = "Support Price";
|
| 32 |
private static final String START_DATE = "Start Date";
|
33 |
private static final String START_DATE = "Start Date";
|
| 33 |
private static final String TAG_LISTING = "Tag Listing";
|
34 |
private static final String TAG_LISTING = "Tag Listing";
|
| 34 |
|
35 |
|
| 35 |
//private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtils.class);
|
36 |
//private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtils.class);
|
| Line 50... |
Line 51... |
| 50 |
XSSFSheet mySheet = myWorkBook.getSheetAt(0);
|
51 |
XSSFSheet mySheet = myWorkBook.getSheetAt(0);
|
| 51 |
|
52 |
|
| 52 |
for(int rowNumber = mySheet.getFirstRowNum(); rowNumber <= mySheet.getLastRowNum(); rowNumber++){
|
53 |
for(int rowNumber = mySheet.getFirstRowNum(); rowNumber <= mySheet.getLastRowNum(); rowNumber++){
|
| 53 |
Row row = mySheet.getRow(rowNumber);
|
54 |
Row row = mySheet.getRow(rowNumber);
|
| 54 |
if(rowNumber == 0 && row != null){
|
55 |
if(rowNumber == 0 && row != null){
|
| 55 |
if(row.getPhysicalNumberOfCells() == 10){
|
56 |
if(row.getPhysicalNumberOfCells() == 11){
|
| 56 |
if(!(TAG_ID.equals(row.getCell(0).toString()) || row.getCell(0).getCellTypeEnum() != CellType.STRING)){
|
57 |
if(!(TAG_ID.equals(row.getCell(0).toString()) || row.getCell(0).getCellTypeEnum() != CellType.STRING)){
|
| 57 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_ID, row.getCell(0).toString(), "TGLSTNG_VE_1000");
|
58 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_ID, row.getCell(0).toString(), "TGLSTNG_VE_1000");
|
| 58 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
59 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 59 |
throw profitMandiBusinessException;
|
60 |
throw profitMandiBusinessException;
|
| 60 |
}
|
61 |
}
|
| 61 |
if(!(TAG_LABEL.equals(row.getCell(1).toString()) || row.getCell(1).getCellTypeEnum() != CellType.STRING)){
|
- |
|
| 62 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LABEL, row.getCell(1).toString(), "TGLSTNG_VE_1001");
|
- |
|
| 63 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 64 |
throw profitMandiBusinessException;
|
- |
|
| 65 |
}
|
- |
|
| 66 |
if(!(ITEM_ID.equals(row.getCell(2).toString()) || row.getCell(2).getCellTypeEnum() != CellType.STRING)){
|
62 |
if(!(ITEM_ID.equals(row.getCell(2).toString()) || row.getCell(2).getCellTypeEnum() != CellType.STRING)){
|
| 67 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ITEM_ID, row.getCell(2).toString(), "TGLSTNG_VE_1002");
|
63 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ITEM_ID, row.getCell(2).toString(), "TGLSTNG_VE_1002");
|
| 68 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
64 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 69 |
throw profitMandiBusinessException;
|
65 |
throw profitMandiBusinessException;
|
| 70 |
}
|
66 |
}
|
| 71 |
if(!(BRAND.equals(row.getCell(3).toString()) || row.getCell(3).getCellTypeEnum() != CellType.STRING)){
|
- |
|
| 72 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(BRAND, row.getCell(3).toString(), "TGLSTNG_VE_1003");
|
- |
|
| 73 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 74 |
throw profitMandiBusinessException;
|
- |
|
| 75 |
}
|
- |
|
| 76 |
if(!(MODEL_NAME.equals(row.getCell(4).toString()) || row.getCell(4).getCellTypeEnum() != CellType.STRING)){
|
67 |
if(!(SELLING_PRICE.equals(row.getCell(7).toString()) || row.getCell(7).getCellTypeEnum() != CellType.STRING)){
|
| 77 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(MODEL_NAME, row.getCell(4).toString(), "TGLSTNG_VE_1004");
|
68 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SELLING_PRICE, row.getCell(7).toString(), "TGLSTNG_VE_1007");
|
| 78 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 79 |
throw profitMandiBusinessException;
|
- |
|
| 80 |
}
|
- |
|
| 81 |
if(!(MODEL_NUMBER.equals(row.getCell(5).toString()) || row.getCell(5).getCellTypeEnum() != CellType.STRING)){
|
- |
|
| 82 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(MODEL_NUMBER, row.getCell(5).toString(), "TGLSTNG_VE_1005");
|
- |
|
| 83 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 84 |
throw profitMandiBusinessException;
|
- |
|
| 85 |
}
|
- |
|
| 86 |
if(!(COLOR.equals(row.getCell(6).toString()) || row.getCell(6).getCellTypeEnum() != CellType.STRING)){
|
- |
|
| 87 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(COLOR, row.getCell(6).toString(), "TGLSTNG_VE_1006");
|
- |
|
| 88 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
69 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 89 |
throw profitMandiBusinessException;
|
70 |
throw profitMandiBusinessException;
|
| 90 |
}
|
71 |
}
|
| 91 |
if(!(SELLING_PRICE.equals(row.getCell(7).toString()) || row.getCell(7).getCellTypeEnum() != CellType.STRING)){
|
72 |
if(!(MOP.equals(row.getCell(8).toString()) || row.getCell(8).getCellTypeEnum() != CellType.STRING)){
|
| 92 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SELLING_PRICE, row.getCell(7).toString(), "TGLSTNG_VE_1007");
|
73 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SELLING_PRICE, row.getCell(7).toString(), "TGLSTNG_VE_1007");
|
| 93 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
74 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 94 |
throw profitMandiBusinessException;
|
75 |
throw profitMandiBusinessException;
|
| 95 |
}
|
76 |
}
|
| 96 |
if(!(SUPPORT_PRICE.equals(row.getCell(8).toString()) || row.getCell(8).getCellTypeEnum() != CellType.STRING)){
|
77 |
if(!(SUPPORT_PRICE.equals(row.getCell(9).toString()) || row.getCell(9).getCellTypeEnum() != CellType.STRING)){
|
| 97 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SUPPORT_PRICE, row.getCell(8).toString(), "TGLSTNG_VE_1008");
|
78 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SUPPORT_PRICE, row.getCell(8).toString(), "TGLSTNG_VE_1008");
|
| 98 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
79 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 99 |
throw profitMandiBusinessException;
|
80 |
throw profitMandiBusinessException;
|
| 100 |
}
|
81 |
}
|
| 101 |
if(!(START_DATE.equals(row.getCell(9).toString()) || row.getCell(8).getCellTypeEnum() != CellType.STRING)){
|
82 |
if(!(START_DATE.equals(row.getCell(10).toString()) || row.getCell(10).getCellTypeEnum() != CellType.STRING)){
|
| 102 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(START_DATE, row.getCell(9).toString(), "TGLSTNG_VE_1009");
|
83 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(START_DATE, row.getCell(9).toString(), "TGLSTNG_VE_1009");
|
| 103 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
84 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 104 |
throw profitMandiBusinessException;
|
85 |
throw profitMandiBusinessException;
|
| 105 |
}
|
86 |
}
|
| 106 |
}else{
|
87 |
}else{
|
| Line 122... |
Line 103... |
| 122 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_ID, row.getCell(0).toString(), "TGLSTNG_VE_1010");
|
103 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_ID, row.getCell(0).toString(), "TGLSTNG_VE_1010");
|
| 123 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
104 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 124 |
throw profitMandiBusinessException;
|
105 |
throw profitMandiBusinessException;
|
| 125 |
}
|
106 |
}
|
| 126 |
|
107 |
|
| 127 |
if(row.getCell(1) != null && row.getCell(1).getCellTypeEnum() == CellType.STRING){
|
- |
|
| 128 |
tagListing.setLabel(row.getCell(1).toString());
|
- |
|
| 129 |
}else{
|
- |
|
| 130 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(TAG_LABEL,row.getCell(1).toString(), "TGLSTNG_VE_1010");
|
- |
|
| 131 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 132 |
throw profitMandiBusinessException;
|
- |
|
| 133 |
}
|
- |
|
| 134 |
|
108 |
|
| 135 |
if(row.getCell(2) != null && row.getCell(2).getCellTypeEnum() == CellType.NUMERIC){
|
109 |
if(row.getCell(2) != null && row.getCell(2).getCellTypeEnum() == CellType.NUMERIC){
|
| 136 |
tagListing.setItemId(Double.valueOf(row.getCell(2).toString()).intValue());
|
110 |
tagListing.setItemId(Double.valueOf(row.getCell(2).toString()).intValue());
|
| 137 |
}else{
|
111 |
}else{
|
| 138 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ITEM_ID, row.getCell(2).toString(), "TGLSTNG_VE_1010");
|
112 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(ITEM_ID, row.getCell(2).toString(), "TGLSTNG_VE_1010");
|
| 139 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
113 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 140 |
throw profitMandiBusinessException;
|
114 |
throw profitMandiBusinessException;
|
| 141 |
}
|
115 |
}
|
| 142 |
|
116 |
|
| 143 |
if(row.getCell(7) != null && row.getCell(7).getCellTypeEnum() == CellType.NUMERIC){
|
117 |
if(row.getCell(7) != null && row.getCell(7).getCellTypeEnum() == CellType.NUMERIC){
|
| 144 |
tagListing.setSellingPrice(Double.valueOf(row.getCell(7).toString()).floatValue());
|
118 |
tagListing.setSellingPrice(Double.valueOf(row.getCell(7).toString()).floatValue());
|
| 145 |
}else{
|
119 |
}else{
|
| 146 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SELLING_PRICE, row.getCell(7), "TGLSTNG_VE_1010");
|
120 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SELLING_PRICE, row.getCell(7), "TGLSTNG_VE_1010");
|
| 147 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
121 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 148 |
throw profitMandiBusinessException;
|
122 |
throw profitMandiBusinessException;
|
| 149 |
}
|
123 |
}
|
| 150 |
if(row.getCell(8) != null && row.getCell(8).getCellTypeEnum() == CellType.NUMERIC){
|
124 |
if(row.getCell(8) != null && row.getCell(8).getCellTypeEnum() == CellType.NUMERIC){
|
| - |
|
125 |
tagListing.setMop(Double.valueOf(row.getCell(8).toString()).floatValue());
|
| - |
|
126 |
}else{
|
| - |
|
127 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(MOP, row.getCell(7), "TGLSTNG_VE_1010");
|
| - |
|
128 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| - |
|
129 |
throw profitMandiBusinessException;
|
| - |
|
130 |
}
|
| - |
|
131 |
if(row.getCell(9) != null && row.getCell(9).getCellTypeEnum() == CellType.NUMERIC){
|
| 151 |
tagListing.setSupportPrice(Double.valueOf(row.getCell(8).toString()).floatValue());
|
132 |
tagListing.setSupportPrice(Double.valueOf(row.getCell(8).toString()).floatValue());
|
| 152 |
}else{
|
133 |
}else{
|
| 153 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SUPPORT_PRICE, row.getCell(8).toString(), "TGLSTNG_VE_1010");
|
134 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(SUPPORT_PRICE, row.getCell(8).toString(), "TGLSTNG_VE_1010");
|
| 154 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
135 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| 155 |
throw profitMandiBusinessException;
|
136 |
throw profitMandiBusinessException;
|
| 156 |
}
|
137 |
}
|
| 157 |
if(row.getCell(9) != null && HSSFDateUtil.isCellDateFormatted(row.getCell(9))){
|
138 |
if(row.getCell(10) != null && HSSFDateUtil.isCellDateFormatted(row.getCell(10))){
|
| 158 |
Date date = row.getCell(9).getDateCellValue();
|
139 |
Date date = row.getCell(10).getDateCellValue();
|
| 159 |
LocalDateTime startDate = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
140 |
LocalDateTime startDate = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
| 160 |
tagListing.setStartDate(startDate);
|
141 |
tagListing.setStartDate(startDate);
|
| 161 |
}else{
|
142 |
}else{
|
| 162 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(START_DATE, row.getCell(9).toString(), "TGLSTNG_VE_1010");
|
143 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(START_DATE, row.getCell(9).toString(), "TGLSTNG_VE_1010");
|
| 163 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
144 |
//LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|