批量导入功能问题修改。

This commit is contained in:
Renpc-kilig 2021-03-17 18:04:02 +08:00
parent bb15f1e84d
commit 8166d7698f
11 changed files with 301 additions and 163 deletions

View File

@ -12,6 +12,7 @@ import com.cm.population.utils.ImportExcelHelper;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
/**
* 导入excel的监听处理类
@ -125,7 +126,7 @@ public class ImportExcelListener<T> extends AnalysisEventListener<T>{
if(list.size() > BATCH_COUNT){
try {
insertData();
} catch (NoSuchMethodException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -143,6 +144,8 @@ public class ImportExcelListener<T> extends AnalysisEventListener<T>{
insertData();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@ -198,127 +201,127 @@ public class ImportExcelListener<T> extends AnalysisEventListener<T>{
/**
* 将数据插入数据库操作
*/
private void insertData() throws NoSuchMethodException {
private void insertData() throws Exception {
String value = "";
// 出租房
if(list.get(0) instanceof RentalHousingModel) {
for(int i=0;i<listForDistinct.size();i++) {
RentalHousingModel rentalHousingModel = (RentalHousingModel) listForDistinct.get(i);
if(i == 0) {
value = rentalHousingModel.getHouseNumber();
continue;
}
if(value.equals(rentalHousingModel.getHouseNumber())) {
T t = (T) rentalHousingModel;
String msg = "房屋编号重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveRentalHousing(list);
List<RentalHousingModel> rentalHousingModelList = (List<RentalHousingModel>) list;
// 用来临时储存数据
List<String> houseNumber = new ArrayList<>();
// 过滤去重
List<RentalHousingModel> rentalHousingModelList1 = rentalHousingModelList.stream().filter(
v -> {
boolean flag = !houseNumber.contains(v.getHouseNumber());
houseNumber.add(v.getHouseNumber());
if(!flag) {
String msg = "房屋编号重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveRentalHousing(rentalHousingModelList1, importFailDtoList);
}
// 户籍信息
if(list.get(0) instanceof CensusMsgModel) {
for(int i=0;i<listForDistinct.size();i++) {
CensusMsgModel censusMsgModel = (CensusMsgModel) listForDistinct.get(i);
if(i == 0) {
value = censusMsgModel.getBaseId();
continue;
}
if(value.equals(censusMsgModel.getBaseId())) {
T t = (T) censusMsgModel;
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveCensusMsg(list);
List<CensusMsgModel> censusMsgModelList = (List<CensusMsgModel>) list;
// 用来临时储存数据
List<String> baseId = new ArrayList<>();
// 过滤去重
List<CensusMsgModel> censusMsgModelList1 = censusMsgModelList.stream().filter(
v -> {
boolean flag = !baseId.contains(v.getBaseId());
baseId.add(v.getBaseId());
if(!flag) {
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveCensusMsg(censusMsgModelList1, importFailDtoList);
}
// 留守人员
if(list.get(0) instanceof HomePersonModel) {
for(int i=0;i<listForDistinct.size();i++) {
HomePersonModel homePersonModel = (HomePersonModel) listForDistinct.get(i);
if(i == 0) {
value = homePersonModel.getBaseId();
continue;
}
if(value.equals(homePersonModel.getBaseId())) {
T t = (T) homePersonModel;
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveHomePerson(list);
List<HomePersonModel> homePersonModelList = (List<HomePersonModel>) list;
// 用来临时储存数据
List<String> baseId = new ArrayList<>();
// 过滤去重
List<HomePersonModel> homePersonModelList1 = homePersonModelList.stream().filter(
v -> {
boolean flag = !baseId.contains(v.getBaseId());
baseId.add(v.getBaseId());
if(!flag) {
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveHomePerson(homePersonModelList1, importFailDtoList);
}
// 流动人口
if(list.get(0) instanceof FloatingPopulationModel) {
for(int i=0;i<listForDistinct.size();i++) {
FloatingPopulationModel floatingPopulationModel = (FloatingPopulationModel) listForDistinct.get(i);
if(i == 0) {
value = floatingPopulationModel.getBaseId();
continue;
}
if(value.equals(floatingPopulationModel.getBaseId())) {
T t = (T) floatingPopulationModel;
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveFloatingPopulation(list);
List<FloatingPopulationModel> floatingPopulationModelList = (List<FloatingPopulationModel>) list;
// 用来临时储存数据
List<String> baseId = new ArrayList<>();
// 过滤去重
List<FloatingPopulationModel> floatingPopulationModelList1 = floatingPopulationModelList.stream().filter(
v -> {
boolean flag = !baseId.contains(v.getBaseId());
baseId.add(v.getBaseId());
if(!flag) {
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveFloatingPopulation(floatingPopulationModelList1, importFailDtoList);
}
// 重点青少年
if(list.get(0) instanceof KeyTeenagersModel) {
for(int i=0;i<listForDistinct.size();i++) {
KeyTeenagersModel keyTeenagersModel = (KeyTeenagersModel) listForDistinct.get(i);
if(i == 0) {
value = keyTeenagersModel.getBaseId();
continue;
}
if(value.equals(keyTeenagersModel.getBaseId())) {
T t = (T) keyTeenagersModel;
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveKeyTeenagers(list);
List<KeyTeenagersModel> keyTeenagersModelList = (List<KeyTeenagersModel>) list;
// 用来临时储存数据
List<String> baseId = new ArrayList<>();
// 过滤去重
List<KeyTeenagersModel> keyTeenagersModelList1 = keyTeenagersModelList.stream().filter(
v -> {
boolean flag = !baseId.contains(v.getBaseId());
baseId.add(v.getBaseId());
if(!flag) {
String msg = "身份证号码重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveKeyTeenagers(keyTeenagersModelList1, importFailDtoList);
}
// 境外人员
if(list.get(0) instanceof OverseaspersonnelModel) {
for(int i=0;i<listForDistinct.size();i++) {
OverseaspersonnelModel overseaspersonnelModel = (OverseaspersonnelModel) listForDistinct.get(i);
if(i == 0) {
value = overseaspersonnelModel.getCardNumber();
continue;
}
if(value.equals(overseaspersonnelModel.getCardNumber())) {
T t = (T) overseaspersonnelModel;
String msg = "证件号码重复";
ImportFailDto importFailDto = new ImportFailDto(t, msg);
importFailDtoList.add(importFailDto);
listForDistinct.remove(i);
list.remove(i);
continue;
}
}
handleImportExcelService.saveOverseaspersonnel(list);
List<OverseaspersonnelModel> overseaspersonnelModelList = (List<OverseaspersonnelModel>) list;
// 用来临时储存数据
List<String> cardNumber = new ArrayList<>();
// 过滤去重
List<OverseaspersonnelModel> overseaspersonnelModelList1 = overseaspersonnelModelList.stream().filter(
v -> {
boolean flag = !cardNumber.contains(v.getCardNumber());
cardNumber.add(v.getCardNumber());
if(!flag) {
String msg = "证件号码重复";
ImportFailDto importFailDto = new ImportFailDto(v, msg);
importFailDtoList.add(importFailDto);
}
return flag;
}
).collect(Collectors.toList());
handleImportExcelService.saveOverseaspersonnel(overseaspersonnelModelList1, importFailDtoList);
}
listForDistinct.clear();
list.clear();

View File

@ -48,6 +48,7 @@ public class RentalHousingModel {
private String modifier;
private String gmtModified;
private String isDelete;
private String id;
public String getHouseNumber() {
return houseNumber == null ? "" : houseNumber;
@ -224,4 +225,12 @@ public class RentalHousingModel {
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getId() {
return id == null ? "" : id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@ -1,5 +1,6 @@
package com.cm.population.service.handleimportexcel;
import com.cm.population.pojo.dtos.excel.ImportFailDto;
import com.cm.population.pojo.dtos.excel.ImportResultDto;
import java.util.List;
@ -38,42 +39,54 @@ public interface IHandleImportExcelService {
/**
* 批量保存出租房信息
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveRentalHousing(List<T> list);
public <T> void saveRentalHousing(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
/**
* 批量保存户籍信息
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveCensusMsg(List<T> list);
public <T> void saveCensusMsg(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
/**
* 批量保存留守人员
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveHomePerson(List<T> list);
public <T> void saveHomePerson(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
/**
* 批量保存流动人员
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveFloatingPopulation(List<T> list);
public <T> void saveFloatingPopulation(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
/**
* 批量保存重点青少年
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveKeyTeenagers(List<T> list);
public <T> void saveKeyTeenagers(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
/**
* 批量保存境外人员
* @param list
* @param importFailDtoList
* @param <T>
* @throws Exception
*/
public <T> void saveOverseaspersonnel(List<T> list);
public <T> void saveOverseaspersonnel(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception;
}

View File

@ -1,6 +1,8 @@
package com.cm.population.service.handleimportexcel.impl;
import com.alibaba.excel.util.StringUtils;
import com.cm.common.base.AbstractService;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.population.dao.censusmsg.ICensusMsgDao;
import com.cm.population.dao.floatingpopulation.IFloatingPopulationDao;
@ -8,6 +10,7 @@ import com.cm.population.dao.homeperson.IHomePersonDao;
import com.cm.population.dao.keyteenagers.IKeyTeenagersDao;
import com.cm.population.dao.overseaspersonnel.IOverseasPersonnelDao;
import com.cm.population.dao.rentalhousing.IRentalHousingDao;
import com.cm.population.pojo.dtos.excel.ImportFailDto;
import com.cm.population.pojo.dtos.excel.ImportResultDto;
import com.cm.population.pojo.model.*;
import com.cm.population.service.handleimportexcel.IHandleImportExcelService;
@ -57,7 +60,7 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
}
@Override
public <T> void saveRentalHousing(List<T> list) {
public <T> void saveRentalHousing(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<RentalHousingModel> rentalHousingModelList = (List<RentalHousingModel>) list;
for(RentalHousingModel rentalHousingModel: rentalHousingModelList) {
String rentalHousingId = UUIDUtil.getUUID();
@ -69,12 +72,19 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
rentalHousingModel.setModifier(params.get("modifier").toString());
rentalHousingModel.setGmtModified(params.get("gmtModified").toString());
rentalHousingModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(rentalHousingModel);
rentalHousingDao.saveRentalHousing(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(rentalHousingModel, msg);
importFailDtoList.add(importFailDto);
}
}
rentalHousingDao.saveRentalHousingList(rentalHousingModelList);
// rentalHousingDao.saveRentalHousingList(rentalHousingModelList);
}
@Override
public <T> void saveCensusMsg(List<T> list) {
public <T> void saveCensusMsg(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<CensusMsgModel> censusMsgModelList = (List<CensusMsgModel>) list;
for(CensusMsgModel censusMsgModel: censusMsgModelList) {
String censusMsgId = UUIDUtil.getUUID();
@ -86,12 +96,19 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
censusMsgModel.setModifier(params.get("modifier").toString());
censusMsgModel.setGmtModified(params.get("gmtModified").toString());
censusMsgModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(censusMsgModel);
censusMsgDao.saveCensusMsg(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(censusMsgModel, msg);
importFailDtoList.add(importFailDto);
}
}
censusMsgDao.saveCensusMsgList(censusMsgModelList);
// censusMsgDao.saveCensusMsgList(censusMsgModelList);
}
@Override
public <T> void saveHomePerson(List<T> list) {
public <T> void saveHomePerson(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<HomePersonModel> homePersonModelList = (List<HomePersonModel>) list;
for(HomePersonModel homePersonModel: homePersonModelList) {
String homePersonId = UUIDUtil.getUUID();
@ -103,12 +120,19 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
homePersonModel.setModifier(params.get("modifier").toString());
homePersonModel.setGmtModified(params.get("gmtModified").toString());
homePersonModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(homePersonModel);
homePersonDao.saveHomePerson(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(homePersonModel, msg);
importFailDtoList.add(importFailDto);
}
}
homePersonDao.saveHomePersonList(homePersonModelList);
// homePersonDao.saveHomePersonList(homePersonModelList);
}
@Override
public <T> void saveFloatingPopulation(List<T> list) {
public <T> void saveFloatingPopulation(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<FloatingPopulationModel> floatingPopulationModelList = (List<FloatingPopulationModel>) list;
for(FloatingPopulationModel floatingPopulationModel: floatingPopulationModelList) {
String floatingPopulationId = UUIDUtil.getUUID();
@ -120,12 +144,19 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
floatingPopulationModel.setModifier(params.get("modifier").toString());
floatingPopulationModel.setGmtModified(params.get("gmtModified").toString());
floatingPopulationModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(floatingPopulationModel);
floatingPopulationDao.saveFloatingPopulation(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(floatingPopulationModel, msg);
importFailDtoList.add(importFailDto);
}
}
floatingPopulationDao.saveFloatingPopulationList(floatingPopulationModelList);
// floatingPopulationDao.saveFloatingPopulationList(floatingPopulationModelList);
}
@Override
public <T> void saveKeyTeenagers(List<T> list) {
public <T> void saveKeyTeenagers(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<KeyTeenagersModel> keyTeenagersModelList = (List<KeyTeenagersModel>) list;
for(KeyTeenagersModel keyTeenagersModel: keyTeenagersModelList) {
String keyTeenagersId = UUIDUtil.getUUID();
@ -137,12 +168,19 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
keyTeenagersModel.setModifier(params.get("modifier").toString());
keyTeenagersModel.setGmtModified(params.get("gmtModified").toString());
keyTeenagersModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(keyTeenagersModel);
keyTeenagersDao.saveKeyTeenagers(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(keyTeenagersModel, msg);
importFailDtoList.add(importFailDto);
}
}
keyTeenagersDao.saveKeyTeenagersList(keyTeenagersModelList);
// keyTeenagersDao.saveKeyTeenagersList(keyTeenagersModelList);
}
@Override
public <T> void saveOverseaspersonnel(List<T> list) {
public <T> void saveOverseaspersonnel(List<T> list, List<ImportFailDto> importFailDtoList) throws Exception {
List<OverseaspersonnelModel> overseaspersonnelModelList = (List<OverseaspersonnelModel>) list;
for(OverseaspersonnelModel overseaspersonnelModel: overseaspersonnelModelList) {
String overseasPersonnelId = UUIDUtil.getUUID();
@ -154,8 +192,15 @@ public class HandleImportExcelServiceImpl extends AbstractService implements IHa
overseaspersonnelModel.setModifier(params.get("modifier").toString());
overseaspersonnelModel.setGmtModified(params.get("gmtModified").toString());
overseaspersonnelModel.setIsDelete("0");
Map<String, Object> param = HashMapUtil.beanToMap(overseaspersonnelModel);
overseasPersonnelDao.saveOverseasPersonnel(param);
if(StringUtils.isEmpty(param.get("id"))) {
String msg = "该数据已存在";
ImportFailDto importFailDto = new ImportFailDto(overseaspersonnelModel, msg);
importFailDtoList.add(importFailDto);
}
}
overseasPersonnelDao.saveOverseaspersonnelList(overseaspersonnelModelList);
// overseasPersonnelDao.saveOverseaspersonnelList(overseaspersonnelModelList);
}

View File

@ -105,40 +105,52 @@ public class ImportExcelHelper {
*/
private static String checkRentalHousingData(RentalHousingModel rentalHousingModel) {
if(StringUtils.isEmpty(rentalHousingModel.getHouseNumber())) {
return "房屋编号必填";
rentalHousingModel.setHouseNumber("" + Math.random() * 1000000);
// return "房屋编号必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getHouseAddress())) {
return "房屋地址必填";
// rentalHousingModel.setHouseAddress("");
// return "房屋地址必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getCardCode())) {
return "证件代码必填";
// rentalHousingModel.setCardCode("");
// return "证件代码必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getCardNumber())) {
return "证件号码必填";
// rentalHousingModel.setCardNumber("");
// return "证件号码必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getHouserName())) {
return "房主姓名必填";
// rentalHousingModel.setHouserName("");
// return "房主姓名必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getHouserPhone())) {
return "房主联系方式必填";
// rentalHousingModel.setHouserPhone("");
// return "房主联系方式必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getHouserAddress())) {
return "房主现居地址必填";
// rentalHousingModel.setHouserAddress("");
// return "房主现居地址必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getLeasePurpose())) {
return "出租用途必填";
// rentalHousingModel.setLeasePurpose("");
// return "出租用途必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getHiddenDangerType())) {
return "隐患类型必填";
// rentalHousingModel.setHiddenDangerType("");
// return "隐患类型必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getLesseeCardNumber())) {
return "承租人身份证号必填";
// rentalHousingModel.setLesseeCardNumber("");
// return "承租人身份证号必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getLesseeName())) {
return "承租人姓名必填";
// rentalHousingModel.setLesseeName("");
// return "承租人姓名必填";
}
if(StringUtils.isEmpty(rentalHousingModel.getLesseePhone())) {
return "承租人联系方式必填";
// rentalHousingModel.setLesseePhone("");
// return "承租人联系方式必填";
}
return "";
}
@ -159,13 +171,13 @@ public class ImportExcelHelper {
return "须先完善人员基础信息";
}
if(StringUtils.isEmpty(censusMsgModel.getPeopleSameCensus())) {
return "人户一致标识必填";
// return "人户一致标识必填";
}
if(StringUtils.isEmpty(censusMsgModel.getCensusNumber())) {
return "户号必填";
// return "户号必填";
}
if(StringUtils.isEmpty(censusMsgModel.getIdCardOfHouseholder())) {
return "户主公民身份证号必填";
// return "户主公民身份证号必填";
}
if(StringUtils.isEmpty(censusMsgModel.getNameOfHouseholder())) {
return "户主姓名必填";
@ -192,7 +204,7 @@ public class ImportExcelHelper {
return "须先完善人员基础信息";
}
if(StringUtils.isEmpty(homePersonModel.getPeopleSameCensus())) {
return "人户一致标识必填";
// return "人户一致标识必填";
}
if(StringUtils.isEmpty(homePersonModel.getHomePersonType())) {
return "留守人员类型必填";
@ -224,6 +236,9 @@ public class ImportExcelHelper {
if(StringUtils.isEmpty(floatingPopulationModel.getBaseId())) {
return "身份证号码必填";
}
if(19 == floatingPopulationModel.getBaseId().length()) {
floatingPopulationModel.setBaseId(floatingPopulationModel.getBaseId().substring(1, 18));
}
Map<String, Object> param = new HashMap<>();
param.put("idCardNumber", floatingPopulationModel.getBaseId());
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
@ -231,7 +246,7 @@ public class ImportExcelHelper {
return "须先完善人员基础信息";
}
if(StringUtils.isEmpty(floatingPopulationModel.getInflowReason())) {
return "流入原因必填";
// return "流入原因必填";
}
if(StringUtils.isEmpty(floatingPopulationModel.getResidenceType())) {
return "住所类型必填";
@ -402,7 +417,9 @@ public class ImportExcelHelper {
* @param rentalHousingModel
*/
private static void rentalHousingCheck(RentalHousingModel rentalHousingModel) {
if(19 == rentalHousingModel.getLesseeCardNumber().length()) {
rentalHousingModel.setLesseeCardNumber(rentalHousingModel.getLesseeCardNumber().substring(1, 18));
}
}
/**
@ -416,6 +433,13 @@ public class ImportExcelHelper {
if(!StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
censusMsgModel.setBaseId(basePopulationInfoDTO.getBasePopulationInfoId());
}
if(19 == censusMsgModel.getBaseId().length()) {
censusMsgModel.setBaseId(censusMsgModel.getBaseId().substring(1, 18));
}
if(19 == censusMsgModel.getIdCardOfHouseholder().length()) {
censusMsgModel.setIdCardOfHouseholder(censusMsgModel.getIdCardOfHouseholder().substring(1, 18));
}
}
/**
@ -429,6 +453,14 @@ public class ImportExcelHelper {
if(!StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
homePersonModel.setBaseId(basePopulationInfoDTO.getBasePopulationInfoId());
}
// 身份证号码
if(19 == homePersonModel.getBaseId().length()) {
homePersonModel.setBaseId(homePersonModel.getBaseId().substring(1, 18));
}
// 监护人身份证号码
if(19 == homePersonModel.getLeadingCard().length()) {
homePersonModel.setLeadingCard(homePersonModel.getLeadingCard().substring(1, 18));
}
// 人户一致标识
if("一致".equals(homePersonModel.getPeopleSameCensus())) {
homePersonModel.setPeopleSameCensus("01");
@ -490,6 +522,12 @@ public class ImportExcelHelper {
if(!StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
floatingPopulationModel.setBaseId(basePopulationInfoDTO.getBasePopulationInfoId());
}
if(19 == floatingPopulationModel.getBaseId().length()) {
floatingPopulationModel.setBaseId(floatingPopulationModel.getBaseId().substring(1, 18));
}
if(19 == floatingPopulationModel.getCardNumber().length()) {
floatingPopulationModel.setCardNumber(floatingPopulationModel.getCardNumber().substring(1, 18));
}
/*// 办证类型
switch (floatingPopulationModel.getRegistrationType()) {
case "居住证":
@ -531,6 +569,12 @@ public class ImportExcelHelper {
if(!StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
keyTeenagersModel.setBaseId(basePopulationInfoDTO.getBasePopulationInfoId());
}
if(19 == keyTeenagersModel.getBaseId().length()) {
keyTeenagersModel.setBaseId(keyTeenagersModel.getBaseId().substring(1, 18));
}
if(19 == keyTeenagersModel.getGuardianCard().length()) {
keyTeenagersModel.setGuardianCard(keyTeenagersModel.getGuardianCard().substring(1, 18));
}
/*// 人员类型
switch (keyTeenagersModel.getPersonType()) {
case "闲散青少年":
@ -591,6 +635,7 @@ public class ImportExcelHelper {
* @param overseaspersonnelModel
*/
private static void overseaspersonnelCheck(OverseaspersonnelModel overseaspersonnelModel) {
overseaspersonnelModel.setCardNumber(overseaspersonnelModel.getCardNumber().substring(1, overseaspersonnelModel.getCardNumber().length() - 1));
/*// 性别
switch (overseaspersonnelModel.getSex()) {
case "未知的性别":

View File

@ -21,8 +21,8 @@
</resultMap>
<!-- 新增户籍信息 -->
<insert id="saveCensusMsg" parameterType="map">
INSERT INTO gen_census_msg(
<insert id="saveCensusMsg" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_census_msg(
census_msg_id,
base_id,
name_of_householder,
@ -66,7 +66,7 @@
<!-- 批量新增户籍信息 -->
<insert id="saveCensusMsgList" parameterType="java.util.List">
INSERT INTO gen_census_msg(
INSERT IGNORE INTO gen_census_msg(
census_msg_id,
base_id,
name_of_householder,

View File

@ -21,8 +21,8 @@
</resultMap>
<!-- 新增流动人口 -->
<insert id="saveFloatingPopulation" parameterType="map">
INSERT INTO gen_floating_population(
<insert id="saveFloatingPopulation" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_floating_population(
floating_population_id,
base_id,
card_expire_date,
@ -68,7 +68,7 @@
<!-- 批量新增流动人口 -->
<insert id="saveFloatingPopulationList" parameterType="java.util.List">
INSERT INTO gen_floating_population(
INSERT IGNORE INTO gen_floating_population(
floating_population_id,
base_id,
card_expire_date,

View File

@ -28,8 +28,8 @@
</resultMap>
<!-- 新增留守人员 -->
<insert id="saveHomePerson" parameterType="map">
INSERT INTO gen_home_person(
<insert id="saveHomePerson" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_home_person(
home_person_id,
healthy,
relationship_with_home_people,
@ -87,7 +87,7 @@
<!-- 批量新增留守人员 -->
<insert id="saveHomePersonList" parameterType="java.util.List">
INSERT INTO gen_home_person(
INSERT IGNORE INTO gen_home_person(
home_person_id,
healthy,
relationship_with_home_people,

View File

@ -28,8 +28,8 @@
</resultMap>
<!-- 新增重点青少年 -->
<insert id="saveKeyTeenagers" parameterType="map">
INSERT INTO gen_key_teenagers(
<insert id="saveKeyTeenagers" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_key_teenagers(
key_teenagers_id,
relationship_with_guardian,
family_situation,
@ -87,7 +87,7 @@
<!-- 批量新增重点青少年 -->
<insert id="saveKeyTeenagersList" parameterType="java.util.List">
INSERT INTO gen_key_teenagers(
INSERT IGNORE INTO gen_key_teenagers(
key_teenagers_id,
relationship_with_guardian,
family_situation,

View File

@ -28,8 +28,8 @@
</resultMap>
<!-- 新增境外人员 -->
<insert id="saveOverseasPersonnel" parameterType="map">
INSERT INTO gen_overseas_personnel(
<insert id="saveOverseasPersonnel" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_overseas_personnel(
overseas_personnel_id,
to_china_purpose,
service_address,
@ -56,7 +56,8 @@
modifier,
gmt_modified,
is_delete
) VALUES(
)
SELECT
#{overseasPersonnelId},
#{toChinaPurpose},
#{serviceAddress},
@ -83,12 +84,23 @@
#{modifier},
#{gmtModified},
#{isDelete}
)
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
*
FROM
gen_overseas_personnel
WHERE
card_number = #{cardNumber}
AND is_delete = 0
)
</insert>
<!-- 新增境外人员 -->
<insert id="saveOverseaspersonnelList" parameterType="java.util.List">
INSERT INTO gen_overseas_personnel(
INSERT IGNORE INTO gen_overseas_personnel(
overseas_personnel_id,
to_china_purpose,
service_address,

View File

@ -23,8 +23,8 @@
</resultMap>
<!-- 新增出租房 -->
<insert id="saveRentalHousing" parameterType="map">
INSERT INTO gen_rental_housing(
<insert id="saveRentalHousing" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_rental_housing(
rental_housing_id,
lessee_name,
longitude,
@ -47,7 +47,7 @@
modifier,
gmt_modified,
is_delete
) VALUES(
) SELECT
#{rentalHousingId},
#{lesseeName},
#{longitude},
@ -70,12 +70,23 @@
#{modifier},
#{gmtModified},
#{isDelete}
)
FROM
DUAL
WHERE
NOT EXISTS (
SELECT
*
FROM
gen_rental_housing
WHERE
house_number = #{houseNumber}
AND is_delete = 0
)
</insert>
<!-- 批量导入出租房 -->
<insert id="saveRentalHousingList" parameterType="java.util.List">
INSERT INTO gen_rental_housing(
<insert id="saveRentalHousingList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT IGNORE INTO gen_rental_housing(
rental_housing_id,
lessee_name,
longitude,