|
@@ -190,57 +190,59 @@ public class TTargetlistController extends BaseController
|
|
try {
|
|
try {
|
|
logger.info("读取行数:" + i);
|
|
logger.info("读取行数:" + i);
|
|
Row row = sheet.getRow(i);
|
|
Row row = sheet.getRow(i);
|
|
- int cellNum = row.getPhysicalNumberOfCells();
|
|
|
|
|
|
+ int cellNum = row.getLastCellNum();
|
|
TTargetlist entity = new TTargetlist();
|
|
TTargetlist entity = new TTargetlist();
|
|
String year = null;
|
|
String year = null;
|
|
for (int j = 0; j < cellNum; j++) {
|
|
for (int j = 0; j < cellNum; j++) {
|
|
Cell cell = row.getCell(j);
|
|
Cell cell = row.getCell(j);
|
|
- cell.setCellType(CellType.STRING);
|
|
|
|
- String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
|
- logger.info("cellValue:" + cellValue);
|
|
|
|
- if (j == 0) {
|
|
|
|
- for (SysDictData p : plant) {
|
|
|
|
- if (p.getDictLabel().equals(cellValue.trim())) {
|
|
|
|
- entity.setPlantCode(p.getDictValue());//装置名称
|
|
|
|
|
|
+ if (cell != null) {
|
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
|
+ String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
|
+ logger.info("cellValue:" + cellValue);
|
|
|
|
+ if (j == 0) {
|
|
|
|
+ for (SysDictData p : plant) {
|
|
|
|
+ if (p.getDictLabel().equals(cellValue.trim())) {
|
|
|
|
+ entity.setPlantCode(p.getDictValue());//装置名称
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- } else if (j == 1) {
|
|
|
|
- entity.setItem(cellValue);//序号
|
|
|
|
- } else if (j == 2) {
|
|
|
|
- entity.setDescription(cellValue);//内容
|
|
|
|
- } else if (j == 3) {
|
|
|
|
- entity.setTargets(cellValue);//目标
|
|
|
|
- } else if (j == 4) {
|
|
|
|
- if (!cellValue.equals("")) {
|
|
|
|
- entity.setYear(cellValue);//年度
|
|
|
|
- year = cellValue;
|
|
|
|
- }
|
|
|
|
- } else if (j == 5) {
|
|
|
|
- if (!cellValue.equals("")) {
|
|
|
|
- for (TTargetlist t : tTargetlists) {
|
|
|
|
- if (t.getItem().equals(cellValue.trim()) && t.getYear().equals(year)) {
|
|
|
|
- entity.setParentId(t.getId());//父菜单ID
|
|
|
|
|
|
+ } else if (j == 1) {
|
|
|
|
+ entity.setItem(cellValue);//序号
|
|
|
|
+ } else if (j == 2) {
|
|
|
|
+ entity.setDescription(cellValue);//内容
|
|
|
|
+ } else if (j == 3) {
|
|
|
|
+ entity.setTargets(cellValue);//目标
|
|
|
|
+ } else if (j == 4) {
|
|
|
|
+ if (!cellValue.equals("")) {
|
|
|
|
+ entity.setYear(cellValue);//年度
|
|
|
|
+ year = cellValue;
|
|
|
|
+ }
|
|
|
|
+ } else if (j == 5) {
|
|
|
|
+ if (!cellValue.equals("")) {
|
|
|
|
+ for (TTargetlist t : tTargetlists) {
|
|
|
|
+ if (t.getItem().equals(cellValue.trim()) && t.getYear().equals(year)) {
|
|
|
|
+ entity.setParentId(t.getId());//父菜单ID
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ entity.setParentId(Long.parseLong("0"));
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- entity.setParentId(Long.parseLong("0"));
|
|
|
|
- }
|
|
|
|
- } else if (j == 6) {
|
|
|
|
- entity.setYardstick(cellValue);//判断标准
|
|
|
|
- } else if (j == 7) {
|
|
|
|
- for (SysDictData p : partners) {
|
|
|
|
- if (p.getDictLabel().equals(cellValue)) {
|
|
|
|
- entity.setPartners(p.getDictValue());//合作者
|
|
|
|
|
|
+ } else if (j == 6) {
|
|
|
|
+ entity.setYardstick(cellValue);//判断标准
|
|
|
|
+ } else if (j == 7) {
|
|
|
|
+ for (SysDictData p : partners) {
|
|
|
|
+ if (p.getDictLabel().equals(cellValue)) {
|
|
|
|
+ entity.setPartners(p.getDictValue());//合作者
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- } else if (j == 8) {
|
|
|
|
- for (SysDept d : dept) {
|
|
|
|
- if (d.getDeptName().equals(cellValue.trim())) {
|
|
|
|
- entity.setDeptId(d.getDeptId());//部门编号
|
|
|
|
|
|
+ } else if (j == 8) {
|
|
|
|
+ for (SysDept d : dept) {
|
|
|
|
+ if (d.getDeptName().equals(cellValue.trim())) {
|
|
|
|
+ entity.setDeptId(d.getDeptId());//部门编号
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else if (j == 9) {
|
|
|
|
+ entity.setRemarks(cellValue);//备注
|
|
}
|
|
}
|
|
- } else if (j == 9) {
|
|
|
|
- entity.setRemarks(cellValue);//备注
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
entity.setCreaterCode(userId.toString());
|
|
entity.setCreaterCode(userId.toString());
|