|
|
@@ -50,7 +50,9 @@ import javax.validation.Valid;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -221,9 +223,53 @@ public class TeacherbaseManagerController {
|
|
|
@PostMapping("/import")
|
|
|
@ApiOperation(value = "导入教职工信息")
|
|
|
@XjrLog(value = "导入教职工信息", saveRequestData = false, saveResponseData = true)
|
|
|
- public RT<Boolean> importData(@RequestParam("file") MultipartFile file) throws IOException, ParseException {
|
|
|
+ public RT<List<Map<String, String>>> importData(@RequestParam("file") MultipartFile file) throws IOException, ParseException {
|
|
|
List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(3).doReadSync();
|
|
|
- return RT.ok(teacherbaseManagerService.importData(excelDataList));
|
|
|
+ List<Map<Integer, Object>> errorList = teacherbaseManagerService.importData(excelDataList);
|
|
|
+ List<Map<String, String>> result = new ArrayList<>();
|
|
|
+ for (Map<Integer, Object> objectMap : errorList) {
|
|
|
+ Map<String, String> object = new LinkedHashMap<>();
|
|
|
+ List<String> errorMsg = new ArrayList<>();
|
|
|
+ if (objectMap.get(0) == null) {
|
|
|
+ errorMsg.add("工号未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(1) == null) {
|
|
|
+ errorMsg.add("姓名未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(2) == null) {
|
|
|
+ errorMsg.add("性别未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(3) == null) {
|
|
|
+ errorMsg.add("证件类型未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(4) == null) {
|
|
|
+ errorMsg.add("身份证未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(5) == null) {
|
|
|
+ errorMsg.add("手机号未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(6) == null) {
|
|
|
+ errorMsg.add("聘用类型未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(7) == null) {
|
|
|
+ errorMsg.add("所属机构未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(8) == null) {
|
|
|
+ errorMsg.add("岗位未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(9) == null) {
|
|
|
+ errorMsg.add("来校时间未填写");
|
|
|
+ }
|
|
|
+ if (objectMap.get(10) == null) {
|
|
|
+ errorMsg.add("任课状况未填写");
|
|
|
+ }
|
|
|
+ object.put("姓名", objectMap.get(1) == null ? "" : objectMap.get(1).toString());
|
|
|
+ object.put("身份证", objectMap.get(4) == null ? "" : objectMap.get(4).toString());
|
|
|
+ object.put("手机号", objectMap.get(5) == null ? "" : objectMap.get(5).toString());
|
|
|
+ object.put("错误信息", errorMsg.toString().replace("[", "").replace("]", ""));
|
|
|
+ result.add(object);
|
|
|
+ }
|
|
|
+ return RT.ok(result);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/professional-title-import")
|