From 642634a0a3794489b7a3dba1b898d005cb9f5d98 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Thu, 2 Jun 2022 09:07:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=94=B9=E4=B8=BA=E6=89=B9?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EpidemicUserInfoServiceImpl.java | 134 +++++++++--------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java index c37689f..10fef45 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java @@ -34,7 +34,6 @@ import com.elink.esua.epdc.vaccine.epidemic.dto.result.VaccinationInfoResultDTO; import com.elink.esua.epdc.vaccine.epidemic.dto.result.VaccinationInfoResultV2DTO; import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserErrorEntity; import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; -import com.elink.esua.epdc.vaccine.epidemic.excel.EpidemicReportUserInfoAllExcel; import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicReportUserInfoService; import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserErrorService; import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService; @@ -50,7 +49,6 @@ import com.elink.esua.epdc.vaccine.vim.service.VaccinationInfoService; import com.elink.esua.epdc.vaccine.vim.service.VaccinationUserRoleService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -138,8 +136,8 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl sysPopulationSimpleDictDTOS = new ArrayList<>(); - getSysDictList(sysPopulationSimpleDictFormDTO,sysPopulationSimpleDictDTOS); - if(CollectionUtils.isEmpty(sysPopulationSimpleDictDTOS)){ + getSysDictList(sysPopulationSimpleDictFormDTO, sysPopulationSimpleDictDTOS); + if (CollectionUtils.isEmpty(sysPopulationSimpleDictDTOS)) { Result> listResult = adminVimFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO); if (listResult == null || !listResult.success()) { return new Result().error("获取字典信息失败"); @@ -700,23 +698,24 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl populationIdNoAndIdMap = new HashMap<>(); //户主导入数据 // List basePopulationInformationExcels = null; //户主导入数据异常提示 -// List epdcHouseAndHouseHeadErrorResultDTOS = null; +// List epdcHouseAndHouseHeadErrorResultDTOS; //居民导入数据 - List BaseResidentInformationUpdateExcels = null; - List baseResidentInformationUpdateExcelsNew = null;// 处理错误数据使用 + List BaseResidentInformationUpdateExcels; + // 处理错误数据使用 + List baseResidentInformationUpdateExcelsNew; //居民导入数据异常提示 - List epdcResidentErrorResultDTOS = null; + List epdcResidentErrorResultDTOS; // 存储批量插入实体 - List addList = new ArrayList(); + List addList = new ArrayList<>(); // 存储错误数据批量插入实体 - List addErrorList = new ArrayList(); + List addErrorList = new ArrayList<>(); //户主身份证列表,便于校验居住人页填写的身份证信息是否正确 // Set residentIdentifyNo = new HashSet<>(); @@ -731,11 +730,12 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl // residentIdentifyNo.add(basePopulationInformationExcel.getResidentsIdentityNo()) // ); -// } else if (numSheet == 1) {//检验和新增居住人信息 +// } else if (numSheet == 1) { + // 检验和新增居住人信息 BaseResidentInformationUpdateExcels = ExcelImportUtil.importExcel(f, BaseResidentInformationUpdateExcel.class, importParams); baseResidentInformationUpdateExcelsNew = ExcelImportUtil.importExcel(f, BaseResidentInformationUpdateExcel.class, importParams); // 校验数据 - epdcResidentErrorResultDTOS = this.checkResidentsExcel(BaseResidentInformationUpdateExcels,baseResidentInformationUpdateExcelsNew, sysPopulationSimpleDictDTOS,addList,addErrorList); + epdcResidentErrorResultDTOS = this.checkResidentsExcel(BaseResidentInformationUpdateExcels, baseResidentInformationUpdateExcelsNew, sysPopulationSimpleDictDTOS, addList, addErrorList); // } // } // 校验户主和房屋信息 @@ -744,7 +744,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl 0) { + if (addList.size() > 0) { saveResidentList(addList, parentAndAllDeptDTO, populationIdNoAndIdMap); } // 批量插入错误数据 @@ -756,7 +756,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl 0) { + if (epdcResidentErrorResultDTOS.size() > 0) { return new Result().ok(epdcResidentErrorResultDTOS); } // 保存户主和房屋信息 @@ -776,14 +776,14 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl dicTypes = new ArrayList<>(); @@ -839,8 +839,8 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl sysPopulationSimpleDictDTOS = new ArrayList<>(); - getSysDictList(sysPopulationSimpleDictFormDTO,sysPopulationSimpleDictDTOS); - if(CollectionUtils.isEmpty(sysPopulationSimpleDictDTOS)){ + getSysDictList(sysPopulationSimpleDictFormDTO, sysPopulationSimpleDictDTOS); + if (CollectionUtils.isEmpty(sysPopulationSimpleDictDTOS)) { Result> listResult = adminVimFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO); if (listResult == null || !listResult.success()) { throw new RenException("获取字典信息失败"); @@ -848,7 +848,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl parentAndAllDept = adminVimFeignClient.getParentAndAllDept(deptId); if (!parentAndAllDept.success() || parentAndAllDept.getData() == null) { - log.info("根据deptId暂无获取到部门信息:"+entity.toString()); - return ; + log.info("根据deptId暂无获取到部门信息:" + entity.toString()); + return; } ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); entity.setDeptId(parentAndAllDeptDTO.getGridId()); @@ -1054,7 +1054,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl addErrorList) { // 不匹配信息 List errorLineInfoList = new ArrayList<>(); - EpdcPopulationErrorResultDTO errorLineInfoDto = null; - BaseResidentInformationUpdateExcel baseResidentInformationUpdateExcelNew = new BaseResidentInformationUpdateExcel(); + EpdcPopulationErrorResultDTO errorLineInfoDto; + BaseResidentInformationUpdateExcel errorBaseUserInfo; for (int i = 0; i < basePopulationInformationExcels.size(); i++) { String errorInfo = ""; BaseResidentInformationUpdateExcel BaseResidentInformationUpdateExcel = basePopulationInformationExcels.get(i); - baseResidentInformationUpdateExcelNew = basePopulationInformationExcelsNew.get(i); -// String residentsIdentityNo = BaseResidentInformationUpdateExcel.getResidentsIdentityNo() == null ? null : BaseResidentInformationUpdateExcel.getResidentsIdentityNo().trim(); + errorBaseUserInfo = basePopulationInformationExcelsNew.get(i); String selfIdentityNo = BaseResidentInformationUpdateExcel.getSelfIdentityNo() == null ? null : BaseResidentInformationUpdateExcel.getSelfIdentityNo().trim(); -// String houseHeadRelation = BaseResidentInformationUpdateExcel.getHouseHeadRelation() == null ? null : BaseResidentInformationUpdateExcel.getHouseHeadRelation().trim(); String residentsName = BaseResidentInformationUpdateExcel.getUserName() == null ? null : BaseResidentInformationUpdateExcel.getUserName().trim(); String residentsSex = BaseResidentInformationUpdateExcel.getGender() == null ? null : BaseResidentInformationUpdateExcel.getGender().trim(); String residentsNation = BaseResidentInformationUpdateExcel.getNation() == null ? null : BaseResidentInformationUpdateExcel.getNation().trim(); @@ -1111,8 +1109,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl addList = new ArrayList<>(); + List updateList = new ArrayList<>(); if (null == check) { -// epidemicUserInfoEntity.setRelation(baseResidentInformationExcel.getHouseHeadRelation()); - epidemicUserInfoService.insert(epidemicUserInfoEntity); + addList.add(epidemicUserInfoEntity); +// epidemicUserInfoService.insert(epidemicUserInfoEntity); } else { -// check.setRelation(baseResidentInformationExcel.getHouseHeadRelation()); check.setUserName(epidemicUserInfoEntity.getUserName()); check.setGender(epidemicUserInfoEntity.getGender()); check.setNation(epidemicUserInfoEntity.getNation()); @@ -1424,7 +1421,6 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl