Browse Source

format

feature/yujt_vim
zhangyuan 4 years ago
parent
commit
d9e671636d
  1. 32
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java

32
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java

@ -222,7 +222,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
String vaccineName = epidemicReportUserInfoAllExcel.getVaccineName(); String vaccineName = epidemicReportUserInfoAllExcel.getVaccineName();
if (StringUtils.isNotBlank(vaccineName)) { if (StringUtils.isNotBlank(vaccineName)) {
List<VaccineDto> vaccine = vaccineList.stream().filter(item -> vaccineName.equals(item.getLabel())).collect(Collectors.toList()); List<VaccineDto> vaccine = vaccineList.stream().filter(item -> vaccineName.equals(item.getLabel())).collect(Collectors.toList());
if (vaccine.size() > 0) { if (!vaccine.isEmpty()) {
epidemicReportUserInfoAllExcel.setVaccineId(vaccine.get(0).getValue()); epidemicReportUserInfoAllExcel.setVaccineId(vaccine.get(0).getValue());
} else { } else {
checkInfo += "第" + (i + 1) + "条、"; checkInfo += "第" + (i + 1) + "条、";
@ -241,7 +241,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
String companyName = epidemicReportUserInfoAllExcel.getCompanyName(); String companyName = epidemicReportUserInfoAllExcel.getCompanyName();
if (StringUtils.isNotBlank(vaccineName)) { if (StringUtils.isNotBlank(vaccineName)) {
List<VaccineDto> company = companyList.stream().filter(item -> companyName.equals(item.getLabel())).collect(Collectors.toList()); List<VaccineDto> company = companyList.stream().filter(item -> companyName.equals(item.getLabel())).collect(Collectors.toList());
if (company.size() > 0) { if (!company.isEmpty()) {
epidemicReportUserInfoAllExcel.setCompanyId(company.get(0).getValue()); epidemicReportUserInfoAllExcel.setCompanyId(company.get(0).getValue());
maxDose = company.get(0).getMaxDose(); maxDose = company.get(0).getMaxDose();
} else { } else {
@ -261,7 +261,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
String siteName = epidemicReportUserInfoAllExcel.getSiteName(); String siteName = epidemicReportUserInfoAllExcel.getSiteName();
if (StringUtils.isNotBlank(vaccineName)) { if (StringUtils.isNotBlank(vaccineName)) {
List<VaccineDto> site = siteList.stream().filter(item -> siteName.equals(item.getLabel())).collect(Collectors.toList()); List<VaccineDto> site = siteList.stream().filter(item -> siteName.equals(item.getLabel())).collect(Collectors.toList());
if (site.size() > 0) { if (!site.isEmpty()) {
epidemicReportUserInfoAllExcel.setSiteId(site.get(0).getValue()); epidemicReportUserInfoAllExcel.setSiteId(site.get(0).getValue());
} else { } else {
checkInfo += "第" + (i + 1) + "条、"; checkInfo += "第" + (i + 1) + "条、";
@ -293,24 +293,22 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
addList.add(epidemicReportUserInfoAllExcel); addList.add(epidemicReportUserInfoAllExcel);
// 检查重复数据,对旧数据进行覆盖
List<VaccinationInfoEntity> checkList = checkVaccination(vaccinationInfoDTO); List<VaccinationInfoEntity> checkList = checkVaccination(vaccinationInfoDTO);
if (!checkList.isEmpty()) { if (!checkList.isEmpty()) {
deleteIdCardArr.addAll(checkList.stream().map(VaccinationInfoEntity::getId).collect(Collectors.toList())); deleteIdCardArr.addAll(checkList.stream().map(VaccinationInfoEntity::getId).collect(Collectors.toList()));
} }
} }
log.info("循环结束,进入人员数据处理");
// 对规范数据,根据身份证号进行逻辑删除
if (deleteIdCardArr.size() > 0) {
baseDao.deleteDistinctDose(deleteIdCardArr);
}
List<String> idCards = new ArrayList<>(maxDoseMap.keySet()); log.info("循环结束,判断人员信息是否需要更新");
List<String> idCards = new ArrayList<>(maxDoseMap.keySet());
List<EpidemicUserInfoDTO> updateList = new ArrayList<>(); List<EpidemicUserInfoDTO> updateList = new ArrayList<>();
if (!idCards.isEmpty()) {
if (!idCards.isEmpty()) {
List<EpidemicUserInfoDTO> existUserList = epidemicUserInfoDao.selectByIdCards(idCards); List<EpidemicUserInfoDTO> existUserList = epidemicUserInfoDao.selectByIdCards(idCards);
existUserList.forEach(item -> { existUserList.forEach(item -> {
EpidemicUserInfoDTO updateDto = new EpidemicUserInfoDTO(); EpidemicUserInfoDTO updateDto = new EpidemicUserInfoDTO();
if (item.getVaccinationState() == 2) { if (item.getVaccinationState() == 2) {
@ -330,11 +328,16 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
updateList.add(updateDto); updateList.add(updateDto);
} }
} }
}); });
} }
log.info("需要更新的人员信息数量为:" + updateList.size()); log.info("需要更新的人员信息数量为:" + updateList.size());
// 对规范数据,根据身份证号进行逻辑删除
if (!deleteIdCardArr.isEmpty()) {
baseDao.deleteDistinctDose(deleteIdCardArr);
}
// 插入数据----需改为批量插入 // 插入数据----需改为批量插入
List<VaccinationInfoEntity> insertUserList = new ArrayList<>(); List<VaccinationInfoEntity> insertUserList = new ArrayList<>();
@ -343,12 +346,13 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
userEntity = ConvertUtils.sourceToTarget(vaccinationInfoAllExcel, VaccinationInfoEntity.class); userEntity = ConvertUtils.sourceToTarget(vaccinationInfoAllExcel, VaccinationInfoEntity.class);
insertUserList.add(userEntity); insertUserList.add(userEntity);
} }
insertBatch(insertUserList);
// 更新人员的接种信息 // 更新人员的接种信息
for (EpidemicUserInfoDTO dto : updateList) { for (EpidemicUserInfoDTO dto : updateList) {
epidemicUserInfoDao.updateVaccinationInfo(dto); epidemicUserInfoDao.updateVaccinationInfo(dto);
} }
insertBatch(insertUserList);
// 批量插入错误数据 // 批量插入错误数据
List<VaccinationErrorEntity> insertErrorList = ConvertUtils.sourceToTarget(addErrorList, VaccinationErrorEntity.class); List<VaccinationErrorEntity> insertErrorList = ConvertUtils.sourceToTarget(addErrorList, VaccinationErrorEntity.class);
Integer insertNo = vaccinationErrorDao.getMaxInsertNo(); Integer insertNo = vaccinationErrorDao.getMaxInsertNo();
@ -377,7 +381,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
* @param infoAllExcel * @param infoAllExcel
* @return * @return
*/ */
private Boolean checkNullCell(VaccinationInfoAllExcel infoAllExcel) { private boolean checkNullCell(VaccinationInfoAllExcel infoAllExcel) {
// 校验必填项 (用户名、身份证号) // 校验必填项 (用户名、身份证号)
return StringUtils.isBlank(infoAllExcel.getRealName()) || StringUtils.isBlank(infoAllExcel.getIdentityNo()) || infoAllExcel.getDose() == null; return StringUtils.isBlank(infoAllExcel.getRealName()) || StringUtils.isBlank(infoAllExcel.getIdentityNo()) || infoAllExcel.getDose() == null;
} }

Loading…
Cancel
Save