|
@ -253,7 +253,6 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
public Result importManualScoreExcel(MultipartFile file) { |
|
|
public Result importManualScoreExcel(MultipartFile file) { |
|
|
log.info("进入Excel数据导入"); |
|
|
log.info("进入Excel数据导入"); |
|
|
File f = StreamUtils.conversionFile(file); |
|
|
File f = StreamUtils.conversionFile(file); |
|
|
String checkInfo = ""; |
|
|
|
|
|
try { |
|
|
try { |
|
|
//判断上传文件类型
|
|
|
//判断上传文件类型
|
|
|
String originalFilename = file.getOriginalFilename(); |
|
|
String originalFilename = file.getOriginalFilename(); |
|
@ -266,16 +265,15 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
return new Result().error("导入内容不能为空"); |
|
|
return new Result().error("导入内容不能为空"); |
|
|
} |
|
|
} |
|
|
// 存储检测excel是否存在重复身份证号使用
|
|
|
// 存储检测excel是否存在重复身份证号使用
|
|
|
List<String> checkIdCardList = new ArrayList<String>(); |
|
|
List<String> checkIdCardList = new ArrayList<>(); |
|
|
// 存储需要逻辑删除的身份证号
|
|
|
// 存储需要逻辑删除的身份证号
|
|
|
List<String> deleteIdCardArr = new ArrayList<String>(); |
|
|
List<String> deleteIdCardArr = new ArrayList<>(); |
|
|
// 存储批量插入实体
|
|
|
// 存储批量插入实体
|
|
|
List<EpidemicReportUserInfoAllExcel> addList = new ArrayList<EpidemicReportUserInfoAllExcel>(); |
|
|
List<EpidemicReportUserInfoAllExcel> addList = new ArrayList<>(); |
|
|
// 存储错误数据批量插入实体
|
|
|
// 存储错误数据批量插入实体
|
|
|
List<EpidemicReportUserInfoAllExcel> addErrorList = new ArrayList<EpidemicReportUserInfoAllExcel>(); |
|
|
List<EpidemicReportUserInfoAllExcel> addErrorList = new ArrayList<>(); |
|
|
log.info("准备进入Excel数据导入循环"); |
|
|
log.info("准备进入Excel数据导入循环"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EpidemicReportUserInfoAllExcel epidemicReportUserInfoAllExcel; |
|
|
EpidemicReportUserInfoAllExcel epidemicReportUserInfoAllExcel; |
|
|
String idCard; |
|
|
String idCard; |
|
|
int age; |
|
|
int age; |
|
@ -284,7 +282,6 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
|
|
|
|
|
|
// 校验是否存在空单元格(校验必填)
|
|
|
// 校验是否存在空单元格(校验必填)
|
|
|
if (checkNullCell(epidemicReportUserInfoAllExcel)) { |
|
|
if (checkNullCell(epidemicReportUserInfoAllExcel)) { |
|
|
checkInfo += "第" + (i + 1) + "条、"; |
|
|
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("存在空单元格"); |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("存在空单元格"); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
continue; |
|
|
continue; |
|
@ -293,7 +290,6 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
idCard = epidemicReportUserInfoAllExcel.getIdCard(); |
|
|
idCard = epidemicReportUserInfoAllExcel.getIdCard(); |
|
|
// 校验excel中身份证号是否存在重复
|
|
|
// 校验excel中身份证号是否存在重复
|
|
|
if (checkIdCardList.contains(idCard)) { |
|
|
if (checkIdCardList.contains(idCard)) { |
|
|
checkInfo += "第" + (i + 1) + "条、"; |
|
|
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号存在重复"); |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号存在重复"); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
continue; |
|
|
continue; |
|
@ -308,12 +304,10 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
if (StringUtils.isBlank(checkInfoStr)) { |
|
|
if (StringUtils.isBlank(checkInfoStr)) { |
|
|
epidemicReportUserInfoAllExcel = addressCheckDto.getEpidemicReportUserInfoAllExcel(); |
|
|
epidemicReportUserInfoAllExcel = addressCheckDto.getEpidemicReportUserInfoAllExcel(); |
|
|
} else { |
|
|
} else { |
|
|
checkInfo += checkInfoStr; |
|
|
|
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(idCard) || (idCard.length() != 18 && idCard.length() != 15)) { |
|
|
if (StringUtils.isBlank(idCard) || (idCard.length() != 18 && idCard.length() != 15)) { |
|
|
checkInfo += "第" + (i + 1) + "条、"; |
|
|
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号不合法"); |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号不合法"); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
continue; |
|
|
continue; |
|
@ -322,6 +316,7 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
age = IdentityNoUtils.getAge(idCard); |
|
|
age = IdentityNoUtils.getAge(idCard); |
|
|
if (age < 0 || age > 150) { |
|
|
if (age < 0 || age > 150) { |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号年龄异常"); |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号年龄异常"); |
|
|
|
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
epidemicReportUserInfoAllExcel.setAge(age); |
|
|
epidemicReportUserInfoAllExcel.setAge(age); |
|
@ -359,7 +354,7 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
epidemicUserErrorService.insertBatch(insertErrorList); |
|
|
epidemicUserErrorService.insertBatch(insertErrorList); |
|
|
|
|
|
|
|
|
// 提示报错信息
|
|
|
// 提示报错信息
|
|
|
if (checkInfo.length() > 0) { |
|
|
if (CollUtil.isNotEmpty(insertErrorList)) { |
|
|
return new Result().ok("数据异常,请下载Excel后重新导入!"); |
|
|
return new Result().ok("数据异常,请下载Excel后重新导入!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|