| | |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageServeExcelVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.common.utlis.IdCardUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | ArrayList<ComMngPopulationServeExcelVO> voList = Lists.newArrayList(); |
| | | for (Map<Integer, String> oneData : list) { |
| | | ComMngPopulationServeExcelVO vo = new ComMngPopulationServeExcelVO(); |
| | | if(oneData.get(0) == null){ |
| | | throw new ServiceException("500", "名字不可为空:第" + index + "行,第1列"); |
| | | } |
| | | vo.setName(oneData.get(0)); |
| | | vo.setSex(PopulSexEnum.getCodeByName(oneData.get(1))); |
| | | if(oneData.get(2) == null){ |
| | | throw new ServiceException("500", "年龄不可为空:第" + index + "行,第3列"); |
| | | if(oneData.get(1) == null){ |
| | | throw new ServiceException("500", "身份证号不可为空:第" + index + "行,第2列"); |
| | | } |
| | | vo.setAge(Integer.valueOf(oneData.get(2))); |
| | | if(oneData.get(3) == null){ |
| | | throw new ServiceException("500", "是否租住不可为空:第" + index + "行,第4列"); |
| | | vo.setCardNo(oneData.get(1)); |
| | | //根据身份证号码解析年龄以及性别 |
| | | if(IdCardUtil.strongVerifyIdNumber(vo.getCardNo())){ |
| | | //获取用户生日 |
| | | String birthday = vo.getCardNo().substring(6, 14); |
| | | //设置用户年龄 |
| | | vo.setAge(AgeUtils.getAgeFromBirthTime(birthday)); |
| | | //获取用户性别 |
| | | int sex = Integer.parseInt(vo.getCardNo().substring(16, 17)); |
| | | if(sex%2 == 1){ |
| | | vo.setSex(PopulSexEnum.nan.getCode()); |
| | | }else{ |
| | | vo.setSex(PopulSexEnum.nv.getCode()); |
| | | } |
| | | }else{ |
| | | throw new ServiceException("500", "身份证号码有误:第" + index + "行,第3列"); |
| | | } |
| | | vo.setIsRent(PopulIsOkEnum.getCodeByName(oneData.get(3))); |
| | | vo.setRoad(oneData.get(4)); |
| | | if(oneData.get(5) == null){ |
| | | throw new ServiceException("500", "门牌号不可为空:第" + index + "行,第6列"); |
| | | |
| | | if(oneData.get(2) != null){ |
| | | vo.setNation(oneData.get(2)); |
| | | } |
| | | vo.setDoorNo(Integer.valueOf(oneData.get(5))); |
| | | vo.setFloor(oneData.get(6)); |
| | | if(oneData.get(7) == null){ |
| | | throw new ServiceException("500", "单元号不可为空:第" + index + "行,第8列"); |
| | | if(oneData.get(3) != null){ |
| | | vo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCodeByName(oneData.get(3))); |
| | | } |
| | | vo.setUnitNo(Integer.valueOf(oneData.get(7))); |
| | | if(oneData.get(8) == null){ |
| | | throw new ServiceException("500", "户室不可为空:第" + index + "行,第9列"); |
| | | if(oneData.get(4) != null){ |
| | | vo.setIsRent(PopulIsOkEnum.getCodeByName(oneData.get(4))); |
| | | } |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(8))); |
| | | vo.setNation(oneData.get(9)); |
| | | if(oneData.get(10) == null){ |
| | | throw new ServiceException("500", "政治面貌不可为空:第" + index + "行,第11列"); |
| | | if(oneData.get(5) != null){ |
| | | vo.setRelation(oneData.get(5)); |
| | | } |
| | | vo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCodeByName(oneData.get(10))); |
| | | vo.setCardNo(oneData.get(11)); |
| | | vo.setPhone(oneData.get(12)); |
| | | vo.setNativePlace(oneData.get(13)); |
| | | vo.setWorkCompany(oneData.get(14)); |
| | | for (int i = 15; i < headSize; i++) { |
| | | if(oneData.get(6) != null){ |
| | | vo.setRoad(oneData.get(6)); |
| | | } |
| | | if(oneData.get(7) != null){ |
| | | vo.setDoorNo(Integer.valueOf(oneData.get(7))); |
| | | } |
| | | if(oneData.get(8) != null){ |
| | | vo.setFloor(oneData.get(8)); |
| | | } |
| | | if(oneData.get(9) != null){ |
| | | vo.setUnitNo(Integer.valueOf(oneData.get(9))); |
| | | } |
| | | if(oneData.get(10) != null){ |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(10))); |
| | | } |
| | | if(oneData.get(11) != null){ |
| | | vo.setPhone(oneData.get(11)); |
| | | } |
| | | if(oneData.get(12) != null){ |
| | | vo.setNativePlace(oneData.get(12)); |
| | | } |
| | | if(oneData.get(13) != null){ |
| | | vo.setCultureLevel(oneData.get(13)); |
| | | } |
| | | if(oneData.get(14) != null){ |
| | | vo.setMarriage(oneData.get(14)); |
| | | } |
| | | if(oneData.get(15) != null){ |
| | | vo.setHealthy(oneData.get(15)); |
| | | } |
| | | if(oneData.get(16) != null){ |
| | | vo.setWorkCompany(oneData.get(16)); |
| | | } |
| | | if(oneData.get(17) != null){ |
| | | vo.setRemark(oneData.get(17)); |
| | | } |
| | | for (int i = 18; i < headSize; i++) { |
| | | if (oneData.get(i) != null && oneData.get(i).equals("是")) { |
| | | vo.getUserTagStr().add(headData.get(i)); |
| | | } |
| | |
| | | @Data |
| | | public class ComMngPopulationServeExcelVO implements Serializable { |
| | | |
| | | @ExcelProperty(value = "家庭成员(姓名)", index = 0) |
| | | @ExcelProperty(value = "姓名", index = 0) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "性别(1.男 2.女 3.未知)", index = 1) |
| | | private Integer sex; |
| | | |
| | | @ExcelProperty(value = "年龄", index = 2) |
| | | private Integer age; |
| | | |
| | | @ExcelProperty(value = "是否租住", index = 3) |
| | | private Integer isRent; |
| | | |
| | | @ExcelProperty(value = "街路巷", index = 4) |
| | | private String road; |
| | | |
| | | @ExcelProperty(value = "门牌号", index = 5) |
| | | private Integer doorNo; |
| | | |
| | | @ExcelProperty(value = "楼排号", index = 6) |
| | | private String floor; |
| | | |
| | | @ExcelProperty(value = "单元号", index = 7) |
| | | private Integer unitNo; |
| | | |
| | | @ExcelProperty(value = "户室(房间号)", index = 8) |
| | | private Integer houseNo; |
| | | |
| | | @ExcelProperty(value = "民族", index = 9) |
| | | private String nation; |
| | | |
| | | @ExcelProperty(value = "政治面貌(1.中共党员2.中共预备党员3.共青团员4.民革党员5.民盟盟员6.民建会员7.8.农工党党员9.致公党党员10.九三学社社员11.台盟盟员12.无党派人士13.群众)", index = 10) |
| | | private Integer politicalOutlook; |
| | | |
| | | @ExcelProperty(value = "身份证号码", index = 11) |
| | | @ExcelProperty(value = "身份证号码", index = 1) |
| | | private String cardNo; |
| | | |
| | | @ExcelProperty(value = "联系方式", index = 12) |
| | | @ExcelProperty(value = "民族", index = 2) |
| | | private String nation; |
| | | |
| | | @ExcelProperty(value = "政治面貌", index = 3) |
| | | private Integer politicalOutlook; |
| | | |
| | | @ExcelProperty(value = "是否租住", index = 4) |
| | | private Integer isRent; |
| | | |
| | | @ExcelProperty(value = "与户主关系", index = 5) |
| | | private String relation; |
| | | |
| | | @ExcelProperty(value = "街路巷", index = 6) |
| | | private String road; |
| | | |
| | | @ExcelProperty(value = "门牌号", index = 7) |
| | | private Integer doorNo; |
| | | |
| | | @ExcelProperty(value = "楼排号", index = 8) |
| | | private String floor; |
| | | |
| | | @ExcelProperty(value = "单元号", index = 9) |
| | | private Integer unitNo; |
| | | |
| | | @ExcelProperty(value = "户室(房间号)", index = 10) |
| | | private Integer houseNo; |
| | | |
| | | @ExcelProperty(value = "联系方式", index = 11) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "籍贯", index = 13) |
| | | @ExcelProperty(value = "籍贯", index = 12) |
| | | private String nativePlace; |
| | | |
| | | @ExcelProperty(value = "工作单位", index = 14) |
| | | @ExcelProperty(value = "文化程度", index = 13) |
| | | private String cultureLevel; |
| | | |
| | | @ExcelProperty(value = "婚姻状况", index = 14) |
| | | private String marriage; |
| | | |
| | | @ExcelProperty(value = "健康状况", index = 15) |
| | | private String healthy; |
| | | |
| | | @ExcelProperty(value = "工作单位", index = 16) |
| | | private String workCompany; |
| | | |
| | | @ExcelProperty(value = "备注", index = 17) |
| | | private String remark; |
| | | |
| | | private Integer age; |
| | | |
| | | private Integer sex; |
| | | /** |
| | | * 扩展字段用逗号隔开 |
| | | */ |
| | | private List<String> userTagStr = Lists.newArrayList(); |
| | | |
| | | public interface sex{ |
| | | String nan = "男"; |
| | | String nv = "女"; |
| | | String no = "未知"; |
| | | } |
| | | |
| | | public interface isOk{ |
| | | String yes = "是"; |
| | | String no = "否"; |
| | | } |
| | | |
| | | public interface politicalOutlook{ |
| | | String dang = "中共党员"; |
| | | String tuan = "共青团员"; |
| | | String wu = "无党派人员"; |
| | | String qun = "群众"; |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField; |
| | | import com.panzhihua.common.model.helper.sensitive.Sensitive; |
| | | import com.panzhihua.common.model.helper.sensitive.SensitiveStrategy; |
| | | import com.panzhihua.common.model.vos.user.ComHouseMemberVo; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModelProperty("小区名字") |
| | | private String alley; |
| | | /** |
| | | * 家庭成员 |
| | | * 房屋成员 |
| | | */ |
| | | @ApiModelProperty("家庭成员") |
| | | private List<ComMngFamilyInfoVO> comMngFamilyInfoVOS; |
| | | @ApiModelProperty("房屋成员") |
| | | private List<ComHouseMemberVo> comMngFamilyInfoVOS; |
| | | |
| | | /** |
| | | * 是否租住(0.否 1.是) |
| | |
| | | private Integer isRent; |
| | | |
| | | /** |
| | | * 文化程度 |
| | | */ |
| | | @ApiModelProperty("文化程度") |
| | | private String cultureLevel; |
| | | |
| | | /** |
| | | * 婚姻状况 |
| | | */ |
| | | @ApiModelProperty("婚姻状况") |
| | | private String marriage; |
| | | |
| | | /** |
| | | * 健康状况 |
| | | */ |
| | | @ApiModelProperty("健康状况") |
| | | private String healthy; |
| | | |
| | | /** |
| | | * 性别(1.男 2.女 3.未知) |
| | | */ |
| | | public interface sex{ |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("房屋成员信息") |
| | | public class ComHouseMemberVo { |
| | | |
| | | @ApiModelProperty("房屋成员用户id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("与户主关系") |
| | | private String relation; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * Created by qing on 2017/3/28. |
| | | */ |
| | | public class AgeUtils { |
| | | // 根据年月日计算年龄,birthTimeString:"1994-11-14" |
| | | public static int getAgeFromBirthTime(String birthTimeString) { |
| | | // 先截取到字符串中的年、月、日 |
| | | int selectYear = Integer.parseInt(birthTimeString.substring(0,4)); |
| | | int selectMonth = Integer.parseInt(birthTimeString.substring(4,6)); |
| | | int selectDay = Integer.parseInt(birthTimeString.substring(6,8)); |
| | | // 得到当前时间的年、月、日 |
| | | Calendar cal = Calendar.getInstance(); |
| | | int yearNow = cal.get(Calendar.YEAR); |
| | | int monthNow = cal.get(Calendar.MONTH) + 1; |
| | | int dayNow = cal.get(Calendar.DATE); |
| | | |
| | | // 用当前年月日减去生日年月日 |
| | | int yearMinus = yearNow - selectYear; |
| | | int monthMinus = monthNow - selectMonth; |
| | | int dayMinus = dayNow - selectDay; |
| | | |
| | | int age = yearMinus;// 先大致赋值 |
| | | if (yearMinus < 0) {// 选了未来的年份 |
| | | age = 0; |
| | | } else if (yearMinus == 0) {// 同年的,要么为1,要么为0 |
| | | if (monthMinus < 0) {// 选了未来的月份 |
| | | age = 0; |
| | | } else if (monthMinus == 0) {// 同月份的 |
| | | if (dayMinus < 0) {// 选了未来的日期 |
| | | age = 0; |
| | | } else if (dayMinus >= 0) { |
| | | age = 1; |
| | | } |
| | | } else if (monthMinus > 0) { |
| | | age = 1; |
| | | } |
| | | } else if (yearMinus > 0) { |
| | | if (monthMinus < 0) {// 当前月>生日月 |
| | | } else if (monthMinus == 0) {// 同月份的,再根据日期计算年龄 |
| | | if (dayMinus < 0) { |
| | | } else if (dayMinus >= 0) { |
| | | age = age + 1; |
| | | } |
| | | } else if (monthMinus > 0) { |
| | | age = age + 1; |
| | | } |
| | | } |
| | | return age; |
| | | } |
| | | |
| | | // 根据时间戳计算年龄 |
| | | public static int getAgeFromBirthTime(long birthTimeLong) { |
| | | Date date = new Date(birthTimeLong * 1000l); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String birthTimeString = format.format(date); |
| | | return getAgeFromBirthTime(birthTimeString); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String yese = "19980516"; |
| | | String year = yese.substring(0,4); |
| | | String month = yese.substring(4,6); |
| | | String ri = yese.substring(6,8); |
| | | System.out.println(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * 身份证正则校验工具类 |
| | | */ |
| | | public class IdCardUtil { |
| | | /** 大陆地区地域编码最大值 **/ |
| | | public static final int MAX_MAINLAND_AREACODE = 659004; |
| | | /** 大陆地区地域编码最小值 **/ |
| | | public static final int MIN_MAINLAND_AREACODE = 110000; |
| | | /** 香港地域编码值 **/ |
| | | public static final int HONGKONG_AREACODE = 810000; // 香港地域编码值 |
| | | /** 台湾地域编码值 **/ |
| | | public static final int TAIWAN_AREACODE = 710000; |
| | | /** 澳门地域编码值 **/ |
| | | public static final int MACAO_AREACODE = 820000; |
| | | |
| | | /** 数字正则 **/ |
| | | public static final String regexNum = "^[0-9]*$"; |
| | | /** 闰年生日正则 **/ |
| | | public static final String regexBirthdayInLeapYear = "^((19[0-9]{2})|(200[0-9])|(201[0-5]))((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))$"; |
| | | /** 平年生日正则 **/ |
| | | public static final String regexBirthdayInCommonYear = "^((19[0-9]{2})|(200[0-9])|(201[0-5]))((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))$"; |
| | | |
| | | private static final HashSet<String> BLACK_SET = new HashSet<String>() { |
| | | |
| | | private static final long serialVersionUID = 48136604486603324L; |
| | | { |
| | | add("111111111111111"); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * <p> |
| | | * 身份证格式强校验 |
| | | * </p> |
| | | * <p> |
| | | * 1、号码的结构 公民身份号码是特征组合码,由十七位数字本体码和一位校验码组成。排列顺序从左至右依次为:六位数字地址码, |
| | | * 八位数字出生日期码,三位数字顺序码和一位数字校验码。 |
| | | * </p> |
| | | * <p> |
| | | * 2、地址码(前六位数)表示编码对象常住户口所在县(市、旗、区)的行政区划代码,按GB/T2260的规定执行。 |
| | | * </p> |
| | | * <p> |
| | | * 3、出生日期码(第七位至十四位)表示编码对象出生的年、月、日,按GB/T7408的规定执行,年、月、日代码之间不用分隔符。 |
| | | * </p> |
| | | * <p> |
| | | * 4、顺序码(第十五位至十七位)表示在同一地址码所标识的区域范围内,对同年、同月、同日出生的人编定的顺序号, 顺序码的奇数分配给男性,偶数分配给女性。 |
| | | * </p> |
| | | * <p> |
| | | * 5、校验码(第十八位数) |
| | | * (1)十七位数字本体码加权求和公式 S = Sum(Ai * Wi), i = 0, ... , 16 ,先对前17位数字的权求和 |
| | | * Ai:表示第i位置上的身份证号码数字值 Wi:表示第i位置上的加权因子 Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 |
| | | * 2 (2)计算模 Y = mod(S, 11) (3)通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 |
| | | * X 9 8 7 6 5 4 3 2 |
| | | * </p> |
| | | */ |
| | | public static final boolean strongVerifyIdNumber(String idNumber) { |
| | | if (StringUtils.isBlank(idNumber)) { |
| | | return false; |
| | | } |
| | | idNumber = idNumber.trim(); |
| | | |
| | | if (BLACK_SET.contains(idNumber)) { |
| | | return false; |
| | | } |
| | | if (!checkIdNumberRegex(idNumber)) { |
| | | return false; |
| | | } |
| | | if (!checkIdNumberArea(idNumber.substring(0, 6))) { |
| | | return false; |
| | | } |
| | | idNumber = convertFifteenToEighteen(idNumber); |
| | | if (!checkBirthday(idNumber.substring(6, 14))) { |
| | | return false; |
| | | } |
| | | if (!checkIdNumberVerifyCode(idNumber)) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 身份证正则校验 |
| | | */ |
| | | private static boolean checkIdNumberRegex(String idNumber) { |
| | | return Pattern.matches("^([0-9]{17}[0-9Xx])|([0-9]{15})$", idNumber); |
| | | } |
| | | |
| | | /** |
| | | * 身份证地区码检查 |
| | | */ |
| | | private static boolean checkIdNumberArea(String idNumberArea) { |
| | | int areaCode = Integer.parseInt(idNumberArea); |
| | | if (areaCode == HONGKONG_AREACODE || areaCode == MACAO_AREACODE || areaCode == TAIWAN_AREACODE) { |
| | | return true; |
| | | } |
| | | if (areaCode <= MAX_MAINLAND_AREACODE && areaCode >= MIN_MAINLAND_AREACODE) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 将15位身份证转换为18位 |
| | | */ |
| | | private static String convertFifteenToEighteen(String idNumber) { |
| | | if (15 != idNumber.length()) { |
| | | return idNumber; |
| | | } |
| | | idNumber = idNumber.substring(0, 6) + "19" + idNumber.substring(6, 15); |
| | | idNumber = idNumber + getVerifyCode(idNumber); |
| | | return idNumber; |
| | | } |
| | | |
| | | /** |
| | | * 根据身份证前17位计算身份证校验码 |
| | | */ |
| | | private static String getVerifyCode(String idNumber) { |
| | | if (!Pattern.matches(regexNum, idNumber.substring(0, 17))) { |
| | | return null; |
| | | } |
| | | String[] ValCodeArr = { "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2" }; |
| | | String[] Wi = { "7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2" }; |
| | | |
| | | int sum = 0; |
| | | for (int i = 0; i < 17; i++) { |
| | | sum = sum + Integer.parseInt(String.valueOf(idNumber.charAt(i))) * Integer.parseInt(Wi[i]); |
| | | } |
| | | return ValCodeArr[sum % 11]; |
| | | } |
| | | |
| | | /** |
| | | * 身份证出生日期嘛检查 |
| | | */ |
| | | private static boolean checkBirthday(String idNumberBirthdayStr) { |
| | | Integer year = null; |
| | | try { |
| | | year = Integer.valueOf(idNumberBirthdayStr.substring(0, 4)); |
| | | } catch (Exception e) { |
| | | } |
| | | if (null == year) { |
| | | return false; |
| | | } |
| | | if (isLeapYear(year)) { |
| | | return Pattern.matches(regexBirthdayInLeapYear, idNumberBirthdayStr); |
| | | } else { |
| | | return Pattern.matches(regexBirthdayInCommonYear, idNumberBirthdayStr); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为闰年 |
| | | */ |
| | | private static boolean isLeapYear(int year) { |
| | | return (year % 400 == 0) || (year % 100 != 0 && year % 4 == 0); |
| | | } |
| | | |
| | | /** |
| | | * 身份证校验码检查 |
| | | */ |
| | | private static boolean checkIdNumberVerifyCode(String idNumber) { |
| | | return getVerifyCode(idNumber).equalsIgnoreCase(idNumber.substring(17)); |
| | | } |
| | | |
| | | } |
| | |
| | | private List<List<String>> headDataFilling(){ |
| | | List<List<String>> list = new ArrayList<List<String>>(); |
| | | List<String> head0 = new ArrayList<String>(); |
| | | head0.add("家庭成员"); |
| | | head0.add("姓名"); |
| | | List<String> head1 = new ArrayList<String>(); |
| | | head1.add("性别"); |
| | | head1.add("身份证(性别和年龄自动根据身份证号识别)"); |
| | | List<String> head2 = new ArrayList<String>(); |
| | | head2.add("年龄"); |
| | | head2.add("民族"); |
| | | List<String> head3 = new ArrayList<String>(); |
| | | head3.add("是否租住"); |
| | | head3.add("政治面貌(群众/中共党员/共青团员)"); |
| | | List<String> head4 = new ArrayList<String>(); |
| | | head4.add("街路巷"); |
| | | head4.add("是否租住"); |
| | | List<String> head5 = new ArrayList<String>(); |
| | | head5.add("门牌号"); |
| | | head5.add("与户主关系"); |
| | | List<String> head6 = new ArrayList<String>(); |
| | | head6.add("楼排号"); |
| | | head6.add("街道"); |
| | | List<String> head7 = new ArrayList<String>(); |
| | | head7.add("单元号"); |
| | | head7.add("小区号(政府对于每个小区都有特定编号)"); |
| | | List<String> head8 = new ArrayList<String>(); |
| | | head8.add("户室"); |
| | | head8.add("楼排号"); |
| | | List<String> head10 = new ArrayList<String>(); |
| | | head10.add("民族"); |
| | | head10.add("单元号"); |
| | | List<String> head11 = new ArrayList<String>(); |
| | | head11.add("政治面貌(群众/中共党员/共青团员)"); |
| | | head11.add("户室(四位数表示。前两位楼层,后两位户号)"); |
| | | List<String> head12 = new ArrayList<String>(); |
| | | head12.add("身份证"); |
| | | head12.add("联系方式"); |
| | | List<String> head13 = new ArrayList<String>(); |
| | | head13.add("联系方式"); |
| | | head13.add("籍贯"); |
| | | List<String> head14 = new ArrayList<String>(); |
| | | head14.add("籍贯"); |
| | | head14.add("文化程度"); |
| | | List<String> head15 = new ArrayList<String>(); |
| | | head15.add("工作单位"); |
| | | head15.add("婚姻状况"); |
| | | List<String> head16 = new ArrayList<String>(); |
| | | head16.add("健康状况"); |
| | | List<String> head17 = new ArrayList<String>(); |
| | | head17.add("工作单位"); |
| | | List<String> head18 = new ArrayList<String>(); |
| | | head18.add("备注"); |
| | | list.add(head0); |
| | | list.add(head1); |
| | | list.add(head2); |
| | |
| | | list.add(head13); |
| | | list.add(head14); |
| | | list.add(head15); |
| | | list.add(head16); |
| | | list.add(head17); |
| | | list.add(head18); |
| | | return list; |
| | | } |
| | | |
| | | private List<Object> formDataFilling(){ |
| | | List<Object> data = new ArrayList<>(); |
| | | data.add("张三"); |
| | | data.add("男"); |
| | | data.add(25); |
| | | data.add("513421199508187219"); |
| | | data.add("汉族"); |
| | | data.add("群众"); |
| | | data.add("是"); |
| | | data.add(""); |
| | | data.add("樱花街"); |
| | | data.add(115); |
| | | data.add("15栋"); |
| | | data.add(10); |
| | | data.add(1001); |
| | | data.add("汉族"); |
| | | data.add("群众"); |
| | | data.add("513421199508187219"); |
| | | data.add("13768548521"); |
| | | data.add("中国"); |
| | | data.add(""); |
| | | data.add(""); |
| | | data.add(""); |
| | | data.add("阿里巴巴"); |
| | | data.add(""); |
| | | return data; |
| | | } |
| | | |
| | |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | |
| | | import com.panzhihua.common.model.vos.community.ComActMessageVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationVO; |
| | | import com.panzhihua.common.model.vos.community.PageComActMessageVO; |
| | | import com.panzhihua.common.model.vos.user.ComHouseMemberVo; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | @Select("select id,user_id,relationship,`name`,id_card,phone,age,health,job,create_at,update_at from com_mng_family_info where user_id=#{userId}") |
| | | List<ComMngFamilyInfoVO> listFamilyByUserId(Long userId); |
| | | |
| | | @Select("select id,`name`,phone,relation from com_mng_population where road = #{comMngPopulationDO.road} and door_no = #{comMngPopulationDO.doorNo} and floor = #{comMngPopulationDO.floor} and unit_no = #{comMngPopulationDO.unitNo} and house_no = #{comMngPopulationDO.houseNo} and id != #{comMngPopulationDO.id}") |
| | | List<ComHouseMemberVo> listHouseMermberByUserId(ComMngPopulationDO comMngPopulationDO); |
| | | |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "cmp.`name`,\n" + |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass; |
| | | import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private Date updateAt; |
| | | /** |
| | | * 籍贯 |
| | |
| | | private String villageName; |
| | | |
| | | /** |
| | | * 与户主关系 |
| | | */ |
| | | private String relation; |
| | | |
| | | /** |
| | | * 文化程度 |
| | | */ |
| | | private String cultureLevel; |
| | | |
| | | /** |
| | | * 婚姻状况 |
| | | */ |
| | | private String marriage; |
| | | |
| | | /** |
| | | * 健康状况 |
| | | */ |
| | | private String healthy; |
| | | |
| | | /** |
| | | * 性别(1.男 2.女 3.未知) |
| | | */ |
| | | public interface sex{ |
| | |
| | | import com.panzhihua.common.model.dtos.community.PageComActDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.ComHouseMemberVo; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.service_community.dao.ComActActivityDAO; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | |
| | | ComMngPopulationVO comMngPopulationVO = new ComMngPopulationVO(); |
| | | BeanUtils.copyProperties(comMngPopulationDO, comMngPopulationVO); |
| | | |
| | | //查询家庭成员信息 |
| | | List<ComMngFamilyInfoVO> comMngFamilyInfoVOS = populationDAO.listFamilyByUserId(comMngPopulationDO.getId()); |
| | | //查询房屋成员信息 |
| | | List<ComHouseMemberVo> comMngFamilyInfoVOS = populationDAO.listHouseMermberByUserId(comMngPopulationDO); |
| | | if (!comMngFamilyInfoVOS.isEmpty()) { |
| | | comMngPopulationVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS); |
| | | } |
| | |
| | | List<ComMngVillageDO> villageDOList = comActVillageDAO.selectList(new QueryWrapper<ComMngVillageDO>().lambda().eq(ComMngVillageDO::getCommunityId, communityId)); |
| | | int index = 2; |
| | | for (ComMngPopulationServeExcelVO vo : list) { |
| | | if (vo.getName() == null) { |
| | | return R.fail("家庭成员(姓名)第" + index + "行为空!"); |
| | | } |
| | | if (vo.getSex() == null) { |
| | | return R.fail("性别第" + index + "行为空!"); |
| | | } |
| | | if (vo.getAge() == null) { |
| | | return R.fail("年龄" + index + "行为空!"); |
| | | } |
| | | |
| | | if (vo.getIsRent() == null) { |
| | | return R.fail("是否租住,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getRoad() == null) { |
| | | return R.fail("街路巷,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getDoorNo() == null) { |
| | | return R.fail("门牌号,第" + index + "行为空!"); |
| | | } |
| | | |
| | | if (vo.getFloor() == null) { |
| | | return R.fail("楼排号,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getUnitNo() == null) { |
| | | return R.fail("单元号,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getHouseNo() == null) { |
| | | return R.fail("户室,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getNation() == null) { |
| | | return R.fail("民族,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getPoliticalOutlook() == null) { |
| | | return R.fail("政治面貌,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getCardNo() == null) { |
| | | return R.fail("身份证号码,第" + index + "行为空!"); |
| | | } |
| | | if (vo.getPhone() == null) { |
| | | return R.fail("联系方式,第" + index + "行为空!"); |
| | | } |
| | | //判断DB和exel数据重复判断 |
| | | boolean result = comMngPopulationDOS.stream().anyMatch(population -> population.getCardNo().equals(vo.getCardNo())); |
| | | if (result) { |