|
@ -265,8 +265,10 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
if (!originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) { |
|
|
if (!originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) { |
|
|
return new Result().error("请选择.xls或者.xlsx格式文件"); |
|
|
return new Result().error("请选择.xls或者.xlsx格式文件"); |
|
|
} |
|
|
} |
|
|
|
|
|
ImportParams importParams = new ImportParams(); |
|
|
|
|
|
importParams.setKeyIndex(11); |
|
|
// 判断导入文件是否为空
|
|
|
// 判断导入文件是否为空
|
|
|
List<EpidemicReportUserInfoAllExcel> recordList = ExcelImportUtil.importExcel(f, EpidemicReportUserInfoAllExcel.class, new ImportParams()); |
|
|
List<EpidemicReportUserInfoAllExcel> recordList = ExcelImportUtil.importExcel(f, EpidemicReportUserInfoAllExcel.class, importParams); |
|
|
if (CollUtil.isEmpty(recordList)) { |
|
|
if (CollUtil.isEmpty(recordList)) { |
|
|
return new Result().error("导入内容不能为空"); |
|
|
return new Result().error("导入内容不能为空"); |
|
|
} |
|
|
} |
|
@ -274,6 +276,8 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
List<String> checkIdCardList = new ArrayList<>(); |
|
|
List<String> checkIdCardList = new ArrayList<>(); |
|
|
// 存储需要逻辑删除的身份证号
|
|
|
// 存储需要逻辑删除的身份证号
|
|
|
List<String> deleteIdCardArr = new ArrayList<>(); |
|
|
List<String> deleteIdCardArr = new ArrayList<>(); |
|
|
|
|
|
// 存储不更新人员只更新地址的的id
|
|
|
|
|
|
List<String> secretIdCardArr = new ArrayList<>(); |
|
|
// 存储批量插入实体
|
|
|
// 存储批量插入实体
|
|
|
List<EpidemicReportUserInfoAllExcel> addList = new ArrayList<>(); |
|
|
List<EpidemicReportUserInfoAllExcel> addList = new ArrayList<>(); |
|
|
// 存储错误数据批量插入实体
|
|
|
// 存储错误数据批量插入实体
|
|
@ -335,18 +339,18 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
if (allUserIdCards.contains(idCard.toLowerCase()) || allUserIdCards.contains(idCard.toUpperCase())) { |
|
|
if (allUserIdCards.contains(idCard.toLowerCase()) || allUserIdCards.contains(idCard.toUpperCase())) { |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("该人员已存在,无需再次导入"); |
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("该人员已存在,无需再次导入"); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
continue; |
|
|
secretIdCardArr.add(idCard.toUpperCase()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
addList.add(epidemicReportUserInfoAllExcel); |
|
|
addList.add(epidemicReportUserInfoAllExcel); |
|
|
deleteIdCardArr.add(idCard); |
|
|
deleteIdCardArr.add(idCard); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// // 对规范数据,根据身份证号进行逻辑删除
|
|
|
// 对规范数据,根据身份证号进行逻辑删除
|
|
|
// if (deleteIdCardArr.size() > 0) {
|
|
|
if (deleteIdCardArr.size() > 0) { |
|
|
// baseDao.deleteInfoByIdCard(deleteIdCardArr);
|
|
|
// baseDao.deleteInfoByIdCard(deleteIdCardArr);
|
|
|
// baseDao.deleteRecordByIdCard(deleteIdCardArr);
|
|
|
baseDao.deleteRecordByIdCard(deleteIdCardArr); |
|
|
// }
|
|
|
} |
|
|
|
|
|
|
|
|
// 插入数据----需改为批量插入
|
|
|
// 插入数据----需改为批量插入
|
|
|
List<EpidemicUserInfoEntity> insertUserList = new ArrayList<>(); |
|
|
List<EpidemicUserInfoEntity> insertUserList = new ArrayList<>(); |
|
@ -355,10 +359,14 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR |
|
|
EpidemicUserInfoEntity userEntity; |
|
|
EpidemicUserInfoEntity userEntity; |
|
|
EpidemicUserInoutRecordEntity userRecordEntity; |
|
|
EpidemicUserInoutRecordEntity userRecordEntity; |
|
|
for (int k = 0; k < addList.size(); k++) { |
|
|
for (int k = 0; k < addList.size(); k++) { |
|
|
userEntity = ConvertUtils.sourceToTarget(addList.get(k), EpidemicUserInfoEntity.class); |
|
|
// 人员出入记录是必定要进行更新的
|
|
|
userRecordEntity = ConvertUtils.sourceToTarget(addList.get(k), EpidemicUserInoutRecordEntity.class); |
|
|
userRecordEntity = ConvertUtils.sourceToTarget(addList.get(k), EpidemicUserInoutRecordEntity.class); |
|
|
insertUserList.add(userEntity); |
|
|
|
|
|
insertUserRecordList.add(userRecordEntity); |
|
|
insertUserRecordList.add(userRecordEntity); |
|
|
|
|
|
if(secretIdCardArr.contains(addList.get(k).getIdCard().toUpperCase())){ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
userEntity = ConvertUtils.sourceToTarget(addList.get(k), EpidemicUserInfoEntity.class); |
|
|
|
|
|
insertUserList.add(userEntity); |
|
|
} |
|
|
} |
|
|
epidemicUserInfoService.insertBatch(insertUserList); |
|
|
epidemicUserInfoService.insertBatch(insertUserList); |
|
|
epidemicUserInoutRecordService.insertBatch(insertUserRecordList); |
|
|
epidemicUserInoutRecordService.insertBatch(insertUserRecordList); |
|
|