|
|
|
@ -371,6 +371,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
int numberOfSheets = wb.getNumberOfSheets(); |
|
|
|
|
for (int i = 0; i < numberOfSheets; i++) { |
|
|
|
|
Sheet sheet = wb.getSheetAt(i); |
|
|
|
|
|
|
|
|
|
//获取行数
|
|
|
|
|
int physicalNumberOfRows = sheet.getPhysicalNumberOfRows(); |
|
|
|
|
for (int j = 2; j < physicalNumberOfRows; j++) { |
|
|
|
@ -380,6 +381,14 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
if(row==null){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
boolean rowEmpty = isRowEmpty(row); |
|
|
|
|
if(rowEmpty){ |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("status", "模块管理execl表格不规范有空行存在,请重新上传"); |
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("模块管理execl表格不规范有空行存在,请重新上传"); |
|
|
|
|
} |
|
|
|
|
//获取单行单元格数
|
|
|
|
|
Integer physicalNumberOfCells = null; |
|
|
|
|
if (row == null) { |
|
|
|
@ -432,7 +441,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
int annual = 0; |
|
|
|
|
for (int k = 0; k < physicalNumberOfCells; k++) { |
|
|
|
|
Cell cell = row.getCell(k); |
|
|
|
|
String value = cell.getStringCellValue(); |
|
|
|
|
String value=""; |
|
|
|
|
if(cell!=null){ |
|
|
|
|
value = cell.getStringCellValue(); |
|
|
|
|
} |
|
|
|
|
switch (k){ |
|
|
|
|
case 0: |
|
|
|
|
modulexVo.setPid(value); |
|
|
|
@ -957,9 +969,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
} |
|
|
|
|
modulexList.add(modulex); |
|
|
|
|
} |
|
|
|
|
// for (ModulexTemplate modulexTemplate : modulexTemplates) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
boolean result = this.saveSingleBatch(modulexList, loginUser, message); |
|
|
|
|
if(!result){ |
|
|
|
|
message.put("isError", "true"); |
|
|
|
@ -1323,7 +1332,18 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
} |
|
|
|
|
return pinyinStr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断是否有空行 |
|
|
|
|
* @param row |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private boolean isRowEmpty(Row row) { |
|
|
|
|
for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) { |
|
|
|
|
Cell cell = row.getCell(c); |
|
|
|
|
if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|