|
@@ -110,32 +110,36 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean importData(List<WhitelistManagementPageVo> savedDataList) {
|
|
|
+ public List<Map<Integer, Object>> importData(List<Map<Integer, Object>> savedDataList) {
|
|
|
+ List<Map<Integer, Object>> errorList = new ArrayList<>();
|
|
|
+
|
|
|
List<WhitelistManagement> whitelistManagements = new ArrayList<>();
|
|
|
List<String> errorLogs = new ArrayList<>();
|
|
|
|
|
|
- for (WhitelistManagementPageVo vo : savedDataList) {
|
|
|
- try {
|
|
|
- if (this.checkExist(vo.getCredentialNumber())) continue;
|
|
|
-
|
|
|
- String name = this.GetName(vo.getName());
|
|
|
- String credentialNumber = this.GetCredentialNumber(vo.getCredentialNumber());
|
|
|
- Long userId = this.getUserId(credentialNumber);
|
|
|
- String phone = this.GetPhone(vo.getPhone().toString());
|
|
|
-
|
|
|
- if (!name.isEmpty() && !credentialNumber.isEmpty() && !phone.isEmpty()) {
|
|
|
- WhitelistManagement whitelistManagement = new WhitelistManagement();
|
|
|
- whitelistManagement.setCreateDate(new Date());
|
|
|
- whitelistManagement.setDeleteMark(0);
|
|
|
- whitelistManagement.setEnabledMark(0);
|
|
|
- whitelistManagement.setUserId(userId);
|
|
|
- whitelistManagement.setName(name);
|
|
|
- whitelistManagement.setCredentialNumber(credentialNumber);
|
|
|
- whitelistManagement.setPhone(phone);
|
|
|
- whitelistManagements.add(whitelistManagement);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- errorLogs.add(String.format("[意外错误(检查输入的是否正确且存在,输入错误可能返回 null)] 姓名: %s, 身份证: %s, 手机号: %s - 错误信息:%s", vo.getName(), vo.getCredentialNumber(), vo.getPhone(), e.getMessage()));
|
|
|
+ for (Map<Integer, Object> vo : savedDataList) {
|
|
|
+ if(vo.get(0) == null || vo.get(1) == null || vo.get(2) == null){
|
|
|
+ errorList.add(vo);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (this.checkExist(vo.get(1).toString())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String name = this.GetName(vo.get(0).toString());
|
|
|
+ String credentialNumber = this.GetCredentialNumber(vo.get(1).toString());
|
|
|
+ Long userId = this.getUserId(credentialNumber);
|
|
|
+ String phone = this.GetPhone(vo.get(2).toString());
|
|
|
+
|
|
|
+ if (!name.isEmpty() && !credentialNumber.isEmpty() && !phone.isEmpty()) {
|
|
|
+ WhitelistManagement whitelistManagement = new WhitelistManagement();
|
|
|
+ whitelistManagement.setCreateDate(new Date());
|
|
|
+ whitelistManagement.setDeleteMark(0);
|
|
|
+ whitelistManagement.setEnabledMark(0);
|
|
|
+ whitelistManagement.setUserId(userId);
|
|
|
+ whitelistManagement.setName(name);
|
|
|
+ whitelistManagement.setCredentialNumber(credentialNumber);
|
|
|
+ whitelistManagement.setPhone(phone);
|
|
|
+ whitelistManagements.add(whitelistManagement);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -150,6 +154,6 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
throw new MyException(detailedMessage);
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ return errorList;
|
|
|
}
|
|
|
}
|