|
|
@@ -113,10 +113,17 @@ public class BasePersonnelLabourCapitalController {
|
|
|
}
|
|
|
@PostMapping("/import")
|
|
|
@ApiOperation(value = "导入")
|
|
|
- public RT<Boolean> importData(@Valid ImportBasePersonnelLabourCapitalDto dto, @RequestParam("file") MultipartFile file) throws IOException {
|
|
|
+ public RT<Boolean> importData(@Valid AddBasePersonnelLabourCapitalDto dto, @RequestParam("file") MultipartFile file) throws IOException {
|
|
|
List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(dto.getDataRow() - 1).doReadSync();
|
|
|
//验证数据
|
|
|
|
|
|
+ //默认数据
|
|
|
+ dto.setDataRow(4);
|
|
|
+ dto.setIdNumberColumn(1);
|
|
|
+ dto.setIdTypeColumn(0);
|
|
|
+ dto.setPersonnelNameColumn(3);
|
|
|
+ dto.setJobNumberColumn(2);
|
|
|
+ dto.setAmountToColumn(4);
|
|
|
|
|
|
//处理表头数据,目前只支持2行表头
|
|
|
List<BasePersonnelLabourCapitalTitle> titleList = initTitleList(excelDataList.get(0), excelDataList.get(1));
|
|
|
@@ -138,7 +145,7 @@ public class BasePersonnelLabourCapitalController {
|
|
|
* @param excelDataList 表格数据
|
|
|
* @return 返回集合
|
|
|
*/
|
|
|
- List<BasePersonnelLabourCapitalData> initDataList(ImportBasePersonnelLabourCapitalDto dto, List<Map<Integer, Object>> excelDataList){
|
|
|
+ List<BasePersonnelLabourCapitalData> initDataList(AddBasePersonnelLabourCapitalDto dto, List<Map<Integer, Object>> excelDataList){
|
|
|
List<BasePersonnelLabourCapitalData> resultList = new ArrayList<>();
|
|
|
for (int i = 0; i < excelDataList.size(); i ++){
|
|
|
//跳过表头
|