699 lines
28 KiB
Java
699 lines
28 KiB
Java
package com.cm.population.utils;
|
|
|
|
import com.cm.population.dao.excel.IExcelDao;
|
|
import com.cm.population.pojo.dtos.basepopulationinfo.BasePopulationInfoDTO;
|
|
import com.cm.population.pojo.dtos.excel.ExcelDTO;
|
|
import com.cm.population.pojo.model.*;
|
|
import com.cm.population.service.basepopulationinfo.IBasePopulationInfoService;
|
|
import com.cm.population.service.handleimportexcel.IHandleImportExcelService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 导入excel数据的校验类
|
|
* @author renpc
|
|
*/
|
|
@Component
|
|
public class ImportExcelHelper {
|
|
|
|
@Autowired
|
|
private IHandleImportExcelService handleImportExcelService;
|
|
|
|
|
|
/**
|
|
* excelDao
|
|
*/
|
|
private static IExcelDao excelDao;
|
|
|
|
/**
|
|
* basePopulationInfoService
|
|
* @param excelDao
|
|
*/
|
|
private static IBasePopulationInfoService basePopulationInfoService;
|
|
|
|
@Autowired
|
|
public void init(IExcelDao excelDao) {
|
|
ImportExcelHelper.excelDao = excelDao;
|
|
}
|
|
@Autowired
|
|
public void init(IBasePopulationInfoService basePopulationInfoService) {
|
|
ImportExcelHelper.basePopulationInfoService = basePopulationInfoService;
|
|
}
|
|
|
|
public static <T> String checkDataValid(T obj) {
|
|
if(null == obj) {
|
|
return null;
|
|
}
|
|
String returnStr = isMustInput(obj);
|
|
return returnStr;
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失
|
|
* @param obj
|
|
* @param <T>
|
|
* @return
|
|
*/
|
|
private static <T> String isMustInput(T obj) {
|
|
// 出租房
|
|
if(obj instanceof RentalHousingModel) {
|
|
Object temp = obj;
|
|
RentalHousingModel rentalHousingModel = (RentalHousingModel) temp;
|
|
return checkRentalHousingData(rentalHousingModel);
|
|
}
|
|
// 户籍信息
|
|
if(obj instanceof CensusMsgModel) {
|
|
Object temp = obj;
|
|
CensusMsgModel censusMsgModel = (CensusMsgModel) temp;
|
|
return checkCensusMsgData(censusMsgModel);
|
|
}
|
|
// 留守人员
|
|
if(obj instanceof HomePersonModel) {
|
|
Object temp = obj;
|
|
HomePersonModel homePersonModel = (HomePersonModel) temp;
|
|
return checkHomePersonData(homePersonModel);
|
|
}
|
|
// 流动人口
|
|
if(obj instanceof FloatingPopulationModel) {
|
|
Object temp = obj;
|
|
FloatingPopulationModel floatingPopulationModel = (FloatingPopulationModel) temp;
|
|
return checkFloatingPopulationData(floatingPopulationModel);
|
|
}
|
|
// 重点青少年
|
|
if(obj instanceof KeyTeenagersModel) {
|
|
Object temp = obj;
|
|
KeyTeenagersModel keyTeenagersModel = (KeyTeenagersModel) temp;
|
|
return checKeyTeenagersData(keyTeenagersModel);
|
|
}
|
|
// 境外人员
|
|
if(obj instanceof OverseaspersonnelModel) {
|
|
Object temp = obj;
|
|
OverseaspersonnelModel overseaspersonnelModel = (OverseaspersonnelModel) temp;
|
|
return checOverseaspersonnelData(overseaspersonnelModel);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(出租房)
|
|
* @param rentalHousingModel
|
|
* @return
|
|
*/
|
|
private static String checkRentalHousingData(RentalHousingModel rentalHousingModel) {
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHouseNumber())) {
|
|
rentalHousingModel.setHouseNumber("" + Math.random() * 1000000);
|
|
// return "房屋编号必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHouseAddress())) {
|
|
// rentalHousingModel.setHouseAddress("无");
|
|
// return "房屋地址必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getCardCode())) {
|
|
// rentalHousingModel.setCardCode("无");
|
|
// return "证件代码必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getCardNumber())) {
|
|
// rentalHousingModel.setCardNumber("无");
|
|
// return "证件号码必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHouserName())) {
|
|
// rentalHousingModel.setHouserName("无");
|
|
// return "房主姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHouserPhone())) {
|
|
// rentalHousingModel.setHouserPhone("无");
|
|
// return "房主联系方式必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHouserAddress())) {
|
|
// rentalHousingModel.setHouserAddress("无");
|
|
// return "房主现居地址必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getLeasePurpose())) {
|
|
// rentalHousingModel.setLeasePurpose("无");
|
|
// return "出租用途必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getHiddenDangerType())) {
|
|
// rentalHousingModel.setHiddenDangerType("无");
|
|
// return "隐患类型必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getLesseeCardNumber())) {
|
|
// rentalHousingModel.setLesseeCardNumber("无");
|
|
// return "承租人身份证号必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getLesseeName())) {
|
|
// rentalHousingModel.setLesseeName("无");
|
|
// return "承租人姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(rentalHousingModel.getLesseePhone())) {
|
|
// rentalHousingModel.setLesseePhone("无");
|
|
// return "承租人联系方式必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(户籍信息)
|
|
* @param censusMsgModel
|
|
* @return
|
|
*/
|
|
private static String checkCensusMsgData(CensusMsgModel censusMsgModel) {
|
|
if(StringUtils.isEmpty(censusMsgModel.getBaseId())) {
|
|
return "身份证号码必填";
|
|
}
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", censusMsgModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
if(StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
|
|
return "须先完善人员基础信息";
|
|
}
|
|
if(StringUtils.isEmpty(censusMsgModel.getPeopleSameCensus())) {
|
|
// return "人户一致标识必填";
|
|
}
|
|
if(StringUtils.isEmpty(censusMsgModel.getCensusNumber())) {
|
|
// return "户号必填";
|
|
}
|
|
if(StringUtils.isEmpty(censusMsgModel.getIdCardOfHouseholder())) {
|
|
// return "户主公民身份证号必填";
|
|
}
|
|
if(StringUtils.isEmpty(censusMsgModel.getNameOfHouseholder())) {
|
|
return "户主姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(censusMsgModel.getRelationshipWithHouseholder())) {
|
|
return "与户主关系必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(留守人员)
|
|
* @param homePersonModel
|
|
* @return
|
|
*/
|
|
private static String checkHomePersonData(HomePersonModel homePersonModel) {
|
|
if(StringUtils.isEmpty(homePersonModel.getBaseId())) {
|
|
return "身份证号码必填";
|
|
}
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", homePersonModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
if(StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
|
|
return "须先完善人员基础信息";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getPeopleSameCensus())) {
|
|
// return "人户一致标识必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getHomePersonType())) {
|
|
return "留守人员类型必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getRelationshipWithHomePeople())) {
|
|
return "与留守人员关系必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getLeadingName())) {
|
|
return "家庭主要成员姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getLeadingPhone())) {
|
|
return "家庭主要成员联系方式必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getLeadingCard())) {
|
|
return "家庭主要成员身份证号码必填";
|
|
}
|
|
if(StringUtils.isEmpty(homePersonModel.getLeadingAddress())) {
|
|
return "家庭主要成员工作详细地址必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(流动人口)
|
|
* @param floatingPopulationModel
|
|
* @return
|
|
*/
|
|
private static String checkFloatingPopulationData(FloatingPopulationModel floatingPopulationModel) {
|
|
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);
|
|
if(StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
|
|
return "须先完善人员基础信息";
|
|
}
|
|
if(StringUtils.isEmpty(floatingPopulationModel.getInflowReason())) {
|
|
// return "流入原因必填";
|
|
}
|
|
if(StringUtils.isEmpty(floatingPopulationModel.getResidenceType())) {
|
|
return "住所类型必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(重点青少年)
|
|
* @param keyTeenagersModel
|
|
* @return
|
|
*/
|
|
private static String checKeyTeenagersData(KeyTeenagersModel keyTeenagersModel) {
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getBaseId())) {
|
|
return "身份证号码必填";
|
|
}
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", keyTeenagersModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
if(StringUtils.isEmpty(basePopulationInfoDTO.getBasePopulationInfoId())) {
|
|
return "须先完善人员基础信息";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getPersonType())) {
|
|
return "人员类型必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getFamilySituation())) {
|
|
return "家庭情况必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getGuardianName())) {
|
|
return "监护人姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getGuardianCard())) {
|
|
return "监护人公民身份证号码必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getRelationshipWithGuardian())) {
|
|
return "与监护人关系必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getGuardianPhone())) {
|
|
return "监护人联系方式必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getGuardianAddress())) {
|
|
return "监护人居住详情必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getHelperName())) {
|
|
return "帮扶人姓名必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getHelperPhone())) {
|
|
return "帮扶人联系方式必填";
|
|
}
|
|
if(StringUtils.isEmpty(keyTeenagersModel.getHelpingMethod())) {
|
|
return "帮扶手段必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 检查数据是否必填项缺失(境外人员)
|
|
* @param overseaspersonnelModel
|
|
* @return
|
|
*/
|
|
private static String checOverseaspersonnelData(OverseaspersonnelModel overseaspersonnelModel) {
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getSurname())) {
|
|
return "外文姓必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getName())) {
|
|
return "外文名必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getSex())) {
|
|
return "性别必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getBirthday())) {
|
|
return "出生日期必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getNationality())) {
|
|
return "国籍必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getReligiousBelief())) {
|
|
return "宗教信仰必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getCardCode())) {
|
|
return "证件代码必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getCardNumber())) {
|
|
return "证件号码必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getCardYear())) {
|
|
return "证件有效期必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getPhone())) {
|
|
return "联系方式必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getToChinaPurpose())) {
|
|
return "来华目的必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getLiveAddress())) {
|
|
return "现住地必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getLiveDetailAddress())) {
|
|
return "现住门(楼)祥址必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getArriveDate())) {
|
|
return "抵达日期必填";
|
|
}
|
|
if(StringUtils.isEmpty(overseaspersonnelModel.getLeaveDate())) {
|
|
return "预计离开日期必填";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据
|
|
* @param obj
|
|
* @param <T>
|
|
*/
|
|
public static <T> void checkDataFromDatabase(T obj) {
|
|
// 出租房
|
|
if(obj instanceof RentalHousingModel) {
|
|
Object temp = obj;
|
|
RentalHousingModel rentalHousingModel = (RentalHousingModel) temp;
|
|
rentalHousingCheck(rentalHousingModel);
|
|
temp = rentalHousingModel;
|
|
obj = (T) temp;
|
|
}
|
|
// 户籍信息
|
|
if(obj instanceof CensusMsgModel) {
|
|
Object temp = obj;
|
|
CensusMsgModel censusMsgModel = (CensusMsgModel) temp;
|
|
censusMsgCheck(censusMsgModel);
|
|
temp = censusMsgModel;
|
|
obj = (T) temp;
|
|
}
|
|
// 留守人员
|
|
if(obj instanceof HomePersonModel) {
|
|
Object temp = obj;
|
|
HomePersonModel homePersonModel = (HomePersonModel) temp;
|
|
homePersonCheck(homePersonModel);
|
|
temp = homePersonModel;
|
|
obj = (T) temp;
|
|
}
|
|
// 流动人口
|
|
if(obj instanceof FloatingPopulationModel) {
|
|
Object temp = obj;
|
|
FloatingPopulationModel floatingPopulationModel = (FloatingPopulationModel) temp;
|
|
floatingPopulationCheck(floatingPopulationModel);
|
|
temp = floatingPopulationModel;
|
|
obj = (T) temp;
|
|
}
|
|
// 重点青少年
|
|
if(obj instanceof KeyTeenagersModel) {
|
|
Object temp = obj;
|
|
KeyTeenagersModel keyTeenagersModel = (KeyTeenagersModel) temp;
|
|
keyTeenagersCheck(keyTeenagersModel);
|
|
temp = keyTeenagersModel;
|
|
obj = (T) temp;
|
|
}
|
|
// 境外人员
|
|
if(obj instanceof OverseaspersonnelModel) {
|
|
Object temp = obj;
|
|
OverseaspersonnelModel overseaspersonnelModel = (OverseaspersonnelModel) temp;
|
|
overseaspersonnelCheck(overseaspersonnelModel);
|
|
temp = overseaspersonnelModel;
|
|
obj = (T) temp;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(出租房)
|
|
* @param rentalHousingModel
|
|
*/
|
|
private static void rentalHousingCheck(RentalHousingModel rentalHousingModel) {
|
|
if(19 == rentalHousingModel.getLesseeCardNumber().length()) {
|
|
rentalHousingModel.setLesseeCardNumber(rentalHousingModel.getLesseeCardNumber().substring(1, 18));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(户籍信息)
|
|
* @param censusMsgModel
|
|
*/
|
|
private static void censusMsgCheck(CensusMsgModel censusMsgModel) {
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", censusMsgModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
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));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(留守人员)
|
|
* @param homePersonModel
|
|
*/
|
|
private static void homePersonCheck(HomePersonModel homePersonModel) {
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", homePersonModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
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");
|
|
}
|
|
if("不一致".equals(homePersonModel.getPeopleSameCensus())) {
|
|
homePersonModel.setPeopleSameCensus("02");
|
|
}
|
|
// 留守人员类型
|
|
switch (homePersonModel.getHomePersonType()) {
|
|
case "留守老人":
|
|
homePersonModel.setHomePersonType("01");
|
|
case "留守妇女":
|
|
homePersonModel.setHomePersonType("02");
|
|
case "留守儿童":
|
|
homePersonModel.setHomePersonType("03");
|
|
}
|
|
// 与留守人员关系
|
|
param.put("value", homePersonModel.getRelationshipWithHomePeople());
|
|
ExcelDTO excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
homePersonModel.setRelationshipWithHomePeople(excelDTO.getDictId());
|
|
}
|
|
// 健康状况
|
|
switch (homePersonModel.getHealthy()) {
|
|
case "很好":
|
|
homePersonModel.setHealthy("01");
|
|
case "较好":
|
|
homePersonModel.setHealthy("02");
|
|
case "一般":
|
|
homePersonModel.setHealthy("03");
|
|
case "较差":
|
|
homePersonModel.setHealthy("04");
|
|
case "很差":
|
|
homePersonModel.setHealthy("05");
|
|
}
|
|
// 家庭主要成员健康状况
|
|
switch (homePersonModel.getLeadingHealthy()) {
|
|
case "很好":
|
|
homePersonModel.setLeadingHealthy("01");
|
|
case "较好":
|
|
homePersonModel.setLeadingHealthy("02");
|
|
case "一般":
|
|
homePersonModel.setLeadingHealthy("03");
|
|
case "较差":
|
|
homePersonModel.setLeadingHealthy("04");
|
|
case "很差":
|
|
homePersonModel.setLeadingHealthy("05");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(流动人口)
|
|
* @param floatingPopulationModel
|
|
*/
|
|
private static void floatingPopulationCheck(FloatingPopulationModel floatingPopulationModel) {
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", floatingPopulationModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
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 "居住证":
|
|
floatingPopulationModel.setRegistrationType("01");
|
|
case "暂住证":
|
|
floatingPopulationModel.setRegistrationType("02");
|
|
case "其他":
|
|
floatingPopulationModel.setRegistrationType("99");
|
|
}
|
|
// 家庭主要成员健康状况
|
|
switch (floatingPopulationModel.getResidenceType()) {
|
|
case "自购房屋":
|
|
floatingPopulationModel.setResidenceType("01");
|
|
case "租赁房屋":
|
|
floatingPopulationModel.setResidenceType("02");
|
|
case "寄宿":
|
|
floatingPopulationModel.setResidenceType("03");
|
|
case "借住":
|
|
floatingPopulationModel.setResidenceType("04");
|
|
case "单位宿舍":
|
|
floatingPopulationModel.setResidenceType("05");
|
|
case "临时性宿舍":
|
|
floatingPopulationModel.setResidenceType("06");
|
|
case "农民工公寓":
|
|
floatingPopulationModel.setResidenceType("07");
|
|
case "其他":
|
|
floatingPopulationModel.setResidenceType("99");
|
|
}*/
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(重点青少年)
|
|
* @param keyTeenagersModel
|
|
*/
|
|
private static void keyTeenagersCheck(KeyTeenagersModel keyTeenagersModel) {
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("idCardNumber", keyTeenagersModel.getBaseId());
|
|
BasePopulationInfoDTO basePopulationInfoDTO = basePopulationInfoService.getBasePopulationInfo(param);
|
|
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 "闲散青少年":
|
|
keyTeenagersModel.setPersonType("01");
|
|
case "有不良行为或严重不良行为青少年":
|
|
keyTeenagersModel.setPersonType("02");
|
|
case "流浪乞讨未成年人":
|
|
keyTeenagersModel.setPersonType("03");
|
|
case "服刑人员未成年子女":
|
|
keyTeenagersModel.setPersonType("04");
|
|
case "农村留守儿童":
|
|
keyTeenagersModel.setPersonType("05");
|
|
case "其他":
|
|
keyTeenagersModel.setPersonType("99");
|
|
}
|
|
// 家庭情况
|
|
switch (keyTeenagersModel.getFamilySituation()) {
|
|
case "低收入家庭":
|
|
keyTeenagersModel.setFamilySituation("01");
|
|
case "单亲家庭":
|
|
keyTeenagersModel.setFamilySituation("02");
|
|
case "流动家庭":
|
|
keyTeenagersModel.setFamilySituation("03");
|
|
case "扶养人受教育水平相对较低":
|
|
keyTeenagersModel.setFamilySituation("04");
|
|
case "与父母关系不融洽":
|
|
keyTeenagersModel.setFamilySituation("05");
|
|
case "家庭成员的不良行为多":
|
|
keyTeenagersModel.setFamilySituation("06");
|
|
case "其他":
|
|
keyTeenagersModel.setFamilySituation("99");
|
|
}
|
|
// 与监护人关系
|
|
param.put("value", keyTeenagersModel.getRelationshipWithGuardian());
|
|
ExcelDTO excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
keyTeenagersModel.setRelationshipWithGuardian(excelDTO.getDictId());
|
|
}
|
|
// 是否违法犯罪
|
|
keyTeenagersModel.setIsCrime("是".equals(keyTeenagersModel.getIsCrime()) ? "1" : "0");
|
|
// 帮扶手段
|
|
switch (keyTeenagersModel.getHelpingMethod()) {
|
|
case "教育矫治":
|
|
keyTeenagersModel.setHelpingMethod("01");
|
|
case "思想引导":
|
|
keyTeenagersModel.setHelpingMethod("02");
|
|
case "困难帮扶":
|
|
keyTeenagersModel.setHelpingMethod("03");
|
|
case "心理关爱":
|
|
keyTeenagersModel.setHelpingMethod("04");
|
|
case "其他":
|
|
keyTeenagersModel.setHelpingMethod("99");
|
|
}*/
|
|
}
|
|
|
|
/**
|
|
* 从数据库比对数据,并转换为数据库数据(境外人员)
|
|
* @param overseaspersonnelModel
|
|
*/
|
|
private static void overseaspersonnelCheck(OverseaspersonnelModel overseaspersonnelModel) {
|
|
overseaspersonnelModel.setCardNumber(overseaspersonnelModel.getCardNumber().substring(1, overseaspersonnelModel.getCardNumber().length() - 1));
|
|
/*// 性别
|
|
switch (overseaspersonnelModel.getSex()) {
|
|
case "未知的性别":
|
|
overseaspersonnelModel.setSex("0");
|
|
case "男性":
|
|
overseaspersonnelModel.setSex("1");
|
|
case "女性":
|
|
overseaspersonnelModel.setSex("2");
|
|
case "未说明的性别":
|
|
overseaspersonnelModel.setSex("9");
|
|
}
|
|
// 国籍
|
|
Map<String, Object> param = new HashMap<>();
|
|
param.put("value", overseaspersonnelModel.getNationality());
|
|
ExcelDTO excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
overseaspersonnelModel.setNationality(excelDTO.getDictId());
|
|
}
|
|
// 宗教信仰
|
|
param.put("value", overseaspersonnelModel.getReligiousBelief());
|
|
excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
overseaspersonnelModel.setReligiousBelief(excelDTO.getDictId());
|
|
}
|
|
// 证件代码
|
|
param.put("value", overseaspersonnelModel.getCardCode());
|
|
excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
overseaspersonnelModel.setCardCode(excelDTO.getDictId());
|
|
}
|
|
// 来华目的
|
|
switch (overseaspersonnelModel.getToChinaPurpose()) {
|
|
case "商务":
|
|
overseaspersonnelModel.setToChinaPurpose("01");
|
|
case "就业":
|
|
overseaspersonnelModel.setToChinaPurpose("02");
|
|
case "学习":
|
|
overseaspersonnelModel.setToChinaPurpose("03");
|
|
case "定居":
|
|
overseaspersonnelModel.setToChinaPurpose("04");
|
|
case "探亲":
|
|
overseaspersonnelModel.setToChinaPurpose("05");
|
|
case "其他":
|
|
overseaspersonnelModel.setToChinaPurpose("99");
|
|
}
|
|
// 职业类别
|
|
param.put("value", overseaspersonnelModel.getOccupationType());
|
|
excelDTO = excelDao.checkDataFromDict(param);
|
|
if(null != excelDTO) {
|
|
overseaspersonnelModel.setOccupationType(excelDTO.getDictId());
|
|
}*/
|
|
// 抵达日期
|
|
overseaspersonnelModel.setArriveDate(overseaspersonnelModel.getArriveDate().substring(0, 10));
|
|
// 预计离开日期
|
|
overseaspersonnelModel.setLeaveDate(overseaspersonnelModel.getLeaveDate().substring(0, 10));
|
|
// 是否重点关注人员
|
|
overseaspersonnelModel.setKeyOfFollow("是".equals(overseaspersonnelModel.getKeyOfFollow()) ? "1" : "0");
|
|
}
|
|
|
|
}
|