|
|
@ -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; |
|
|
@ -700,23 +698,24 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
ImportParams importParams = new ImportParams(); |
|
|
|
try { |
|
|
|
//获取多个sheet页
|
|
|
|
Workbook workBook = ExcelUtils.getWorkBook(file); |
|
|
|
// Workbook workBook = ExcelUtils.getWorkBook(file);
|
|
|
|
//户主身份证和插入的ID,便于保存居住人信息时匹配户主信息
|
|
|
|
Map<String, String> populationIdNoAndIdMap = new HashMap<>(); |
|
|
|
//户主导入数据
|
|
|
|
// List<BasePopulationInformationExcel> basePopulationInformationExcels = null;
|
|
|
|
//户主导入数据异常提示
|
|
|
|
// List<EpdcPopulationErrorResultDTO> epdcHouseAndHouseHeadErrorResultDTOS = null;
|
|
|
|
// List<EpdcPopulationErrorResultDTO> epdcHouseAndHouseHeadErrorResultDTOS;
|
|
|
|
//居民导入数据
|
|
|
|
List<BaseResidentInformationUpdateExcel> BaseResidentInformationUpdateExcels = null; |
|
|
|
List<BaseResidentInformationUpdateExcel> baseResidentInformationUpdateExcelsNew = null;// 处理错误数据使用
|
|
|
|
List<BaseResidentInformationUpdateExcel> BaseResidentInformationUpdateExcels; |
|
|
|
// 处理错误数据使用
|
|
|
|
List<BaseResidentInformationUpdateExcel> baseResidentInformationUpdateExcelsNew; |
|
|
|
//居民导入数据异常提示
|
|
|
|
List<EpdcPopulationErrorResultDTO> epdcResidentErrorResultDTOS = null; |
|
|
|
List<EpdcPopulationErrorResultDTO> epdcResidentErrorResultDTOS; |
|
|
|
|
|
|
|
// 存储批量插入实体
|
|
|
|
List<BaseResidentInformationUpdateExcel> addList = new ArrayList<BaseResidentInformationUpdateExcel>(); |
|
|
|
List<BaseResidentInformationUpdateExcel> addList = new ArrayList<>(); |
|
|
|
// 存储错误数据批量插入实体
|
|
|
|
List<BaseResidentInformationUpdateExcel> addErrorList = new ArrayList<BaseResidentInformationUpdateExcel>(); |
|
|
|
List<BaseResidentInformationUpdateExcel> addErrorList = new ArrayList<>(); |
|
|
|
|
|
|
|
//户主身份证列表,便于校验居住人页填写的身份证信息是否正确
|
|
|
|
// Set<String> residentIdentifyNo = new HashSet<>();
|
|
|
@ -731,7 +730,8 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
// basePopulationInformationExcels.forEach(basePopulationInformationExcel ->
|
|
|
|
// 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); |
|
|
|
// 校验数据
|
|
|
@ -744,7 +744,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
// }
|
|
|
|
|
|
|
|
// 保存居住人信息
|
|
|
|
if (addList != null && addList.size() > 0) { |
|
|
|
if (addList.size() > 0) { |
|
|
|
saveResidentList(addList, parentAndAllDeptDTO, populationIdNoAndIdMap); |
|
|
|
} |
|
|
|
// 批量插入错误数据
|
|
|
@ -756,7 +756,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
epidemicUserErrorService.insertBatch(insertErrorList); |
|
|
|
|
|
|
|
// 校验居住人信息
|
|
|
|
if (epdcResidentErrorResultDTOS != null && epdcResidentErrorResultDTOS.size() > 0) { |
|
|
|
if (epdcResidentErrorResultDTOS.size() > 0) { |
|
|
|
return new Result().ok(epdcResidentErrorResultDTOS); |
|
|
|
} |
|
|
|
// 保存户主和房屋信息
|
|
|
@ -814,11 +814,11 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @describe: 将县平台传送过来的字典汉字转换为字典值 |
|
|
|
* @author wangtong |
|
|
|
* @date 2022/1/14 16:06 |
|
|
|
* @params [dto] |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
private void updateDictColumn(SaveEpidemicUserDTO dto) { |
|
|
|
//获取字典信息
|
|
|
@ -1077,15 +1077,13 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
List<BaseResidentInformationUpdateExcel> addErrorList) { |
|
|
|
// 不匹配信息
|
|
|
|
List<EpdcPopulationErrorResultDTO> 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<EpidemicUserInf |
|
|
|
String result = IdentityNoUtils.IdentityNoVerification(selfIdentityNo); |
|
|
|
if (result != null) { |
|
|
|
errorInfo += "本人身份证号码有误;"; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
BaseResidentInformationUpdateExcel.setGender(IdentityNoUtils.getSex(selfIdentityNo)); |
|
|
|
BaseResidentInformationUpdateExcel.setAge(IdentityNoUtils.getAge(selfIdentityNo)); |
|
|
|
BaseResidentInformationUpdateExcel.setBirthday(IdentityNoUtils.getBirthday(selfIdentityNo)); |
|
|
@ -1352,9 +1349,9 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
|
|
|
|
// 设置错误信息
|
|
|
|
baseResidentInformationUpdateExcelNew.setErrorInfo(errorInfo); |
|
|
|
errorBaseUserInfo.setErrorInfo(errorInfo); |
|
|
|
// 加入错误列表
|
|
|
|
addErrorList.add(baseResidentInformationUpdateExcelNew); |
|
|
|
addErrorList.add(errorBaseUserInfo); |
|
|
|
|
|
|
|
} else { |
|
|
|
addList.add(BaseResidentInformationUpdateExcel); |
|
|
@ -1375,8 +1372,6 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
for (BaseResidentInformationUpdateExcel baseResidentInformationExcel : baseResidentInformationExcels) { |
|
|
|
//插入居民信息
|
|
|
|
EpidemicUserInfoEntity epidemicUserInfoEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, EpidemicUserInfoEntity.class); |
|
|
|
// populationInformationEntity.setResidentsIdentityNo(baseResidentInformationExcel.getResidentsFamilyIdentityNo());
|
|
|
|
// EpidemicUserInfoEntity epidemicUserInfoEntity = convertInformationToUserInfo(populationInformationEntity);
|
|
|
|
epidemicUserInfoEntity.setIdCard(baseResidentInformationExcel.getSelfIdentityNo()); |
|
|
|
if (StringUtils.isNotBlank(baseResidentInformationExcel.getMotorVehicleNum())) { |
|
|
|
epidemicUserInfoEntity.setMotorVehicleNum(Integer.valueOf(baseResidentInformationExcel.getMotorVehicleNum())); |
|
|
@ -1408,11 +1403,13 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
} |
|
|
|
// 已存在的居民信息进行更新,否则进行插入操作
|
|
|
|
EpidemicUserInfoEntity check = epidemicUserInfoService.selectInfoByIdCard(baseResidentInformationExcel.getSelfIdentityNo()); |
|
|
|
|
|
|
|
List<EpidemicUserInfoEntity> addList = new ArrayList<>(); |
|
|
|
List<EpidemicUserInfoEntity> 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<EpidemicUserInf |
|
|
|
check.setSpecialCrowd(epidemicUserInfoEntity.getSpecialCrowd()); |
|
|
|
check.setPoliticsStatus(epidemicUserInfoEntity.getPoliticsStatus()); |
|
|
|
|
|
|
|
|
|
|
|
check.setStandardOfCulture(epidemicUserInfoEntity.getStandardOfCulture()); |
|
|
|
check.setHealth(epidemicUserInfoEntity.getHealth()); |
|
|
|
check.setMaritalStatus(epidemicUserInfoEntity.getMaritalStatus()); |
|
|
@ -1473,7 +1469,15 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf |
|
|
|
check.setParentDeptNames(epidemicUserInfoEntity.getParentDeptNames()); |
|
|
|
check.setAllDeptIds(epidemicUserInfoEntity.getAllDeptIds()); |
|
|
|
check.setAllDeptNames(epidemicUserInfoEntity.getAllDeptNames()); |
|
|
|
epidemicUserInfoService.updateById(check); |
|
|
|
// epidemicUserInfoService.updateById(check);
|
|
|
|
updateList.add(check); |
|
|
|
} |
|
|
|
// 改为批量插入和批量按ID更新
|
|
|
|
if (!addList.isEmpty()) { |
|
|
|
epidemicUserInfoService.insertBatch(addList); |
|
|
|
} |
|
|
|
if (!updateList.isEmpty()) { |
|
|
|
epidemicUserInfoService.updateBatchById(updateList); |
|
|
|
} |
|
|
|
//插入房屋人员关联关系表
|
|
|
|
// HouseResidentEntity houseResidentEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, HouseResidentEntity.class);
|
|
|
|