|
@@ -12,7 +12,7 @@ import lombok.extern.log4j.Log4j;
|
|
|
import org.apache.log4j.LogManager;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
-import org.apache.poi.ss.usermodel.CellType;
|
|
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
@@ -98,9 +98,11 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
inputStream.close();
|
|
|
outputStream.close();
|
|
|
//然后解析表格
|
|
|
- XSSFWorkbook workbook = new XSSFWorkbook(file);
|
|
|
+ Workbook wb = WorkbookFactory.create(new FileInputStream(file));
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
+// XSSFWorkbook workbook = new XSSFWorkbook(file);
|
|
|
//我们只需要第一个sheet
|
|
|
- XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
+// XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
//要插入的账号列表
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
@@ -133,7 +135,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
int rowNum = sheet.getLastRowNum();
|
|
|
for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
|
|
|
|
- XSSFRow row = sheet.getRow(rowIndex);
|
|
|
+ Row row = sheet.getRow(rowIndex);
|
|
|
if (row == null) {
|
|
|
continue;
|
|
|
}
|
|
@@ -141,18 +143,18 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
|
continue;
|
|
|
}
|
|
|
//姓名 工资 奖金 津贴 养老保险 医疗保险 失业保险 住房公积金 其他; 可能有自定义的项
|
|
|
- XSSFCell nameCell = row.getCell(0);
|
|
|
- XSSFCell salaryCell = row.getCell(1);
|
|
|
- XSSFCell bonusCell = row.getCell(2);
|
|
|
- XSSFCell allowanceCell = row.getCell(3);
|
|
|
- XSSFCell inOldCell = row.getCell(4);
|
|
|
- XSSFCell inMedicalCell = row.getCell(5);
|
|
|
- XSSFCell inJobCell = row.getCell(6);
|
|
|
- XSSFCell houseFundCell = row.getCell(7);
|
|
|
- XSSFCell otherCell = row.getCell(8);
|
|
|
- XSSFCell field1 = cusColList.size() > 0?row.getCell(9):null;
|
|
|
- XSSFCell field2 = cusColList.size() > 1?row.getCell(10):null;
|
|
|
- XSSFCell field3 = cusColList.size() > 2?row.getCell(11):null;
|
|
|
+ Cell nameCell = row.getCell(0);
|
|
|
+ Cell salaryCell = row.getCell(1);
|
|
|
+ Cell bonusCell = row.getCell(2);
|
|
|
+ Cell allowanceCell = row.getCell(3);
|
|
|
+ Cell inOldCell = row.getCell(4);
|
|
|
+ Cell inMedicalCell = row.getCell(5);
|
|
|
+ Cell inJobCell = row.getCell(6);
|
|
|
+ Cell houseFundCell = row.getCell(7);
|
|
|
+ Cell otherCell = row.getCell(8);
|
|
|
+ Cell field1 = cusColList.size() > 0?row.getCell(9):null;
|
|
|
+ Cell field2 = cusColList.size() > 1?row.getCell(10):null;
|
|
|
+ Cell field3 = cusColList.size() > 2?row.getCell(11):null;
|
|
|
|
|
|
|
|
|
nameCell.setCellType(CellType.STRING);
|