| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 20,message = "部门名称长度不能超过20个字符") |
| | | @NotBlank(message = "部门名称不能为空") |
| | | @ApiModelProperty(value = "部门名称") |
| | | @TableField("dept_name") |
| | | private String deptName; |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 40,message = "网格不能超过40个字符") |
| | | @ApiModelProperty(value = "网格") |
| | | @TableField("grid_info") |
| | | private String gridInfo; |
| | | |
| | | @Length(max = 40,message = "小区名称不能超过40个字符") |
| | | @ApiModelProperty(value = "小区名称") |
| | | @TableField("community_name") |
| | | private String communityName; |
| | | |
| | | @Length(max = 100,message = "楼栋信息不能超过100个字符") |
| | | @ApiModelProperty(value = "楼栋信息") |
| | | @TableField("building_info") |
| | | private String buildingInfo; |
| | | |
| | | @Length(max = 40,message = "单元号不能超过40个字符") |
| | | @ApiModelProperty(value = "单元号") |
| | | @TableField("unit_number") |
| | | private String unitNumber; |
| | | |
| | | @Length(max = 40,message = "门牌号不能超过40个字符") |
| | | @ApiModelProperty(value = "门牌号") |
| | | @TableField("house_number") |
| | | private String houseNumber; |
| | | |
| | | @Length(max = 20,message = "姓名不能超过20个字符") |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("user_name") |
| | | private String userName; |
| | |
| | | @TableField("user_sex") |
| | | private Integer userSex; |
| | | |
| | | @Pattern(regexp = "^$|(^[1-9]\\\\d{7}((0\\\\d)|(1[0-2]))(([0-2]\\\\d)|3[0-1])\\\\d{3}$)|(^[1-9]\\\\d{5}[1-9]\\\\d{3}((0\\\\d)|(1[0-2]))(([0-2]\\\\d)|3[0-1])((\\\\d{4})|\\\\d{3}[Xx])$)\n",message = "身份证号格式不正确") |
| | | @ApiModelProperty(value = "身份证号") |
| | | @TableField("id_card") |
| | | private String idCard; |
| | | |
| | | @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确") |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("contact_number") |
| | | private String contactNumber; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 40,message = "分类名称不能超过40个字符") |
| | | @ApiModelProperty(value = "分类名称") |
| | | @TableField("type_name") |
| | | private String typeName; |
| | |
| | | @TableField("show_type") |
| | | private Integer showType; |
| | | |
| | | @Length(max = 11,message = "显示数量不能超过11个字符") |
| | | @ApiModelProperty(value = "显示数量") |
| | | @TableField("show_number") |
| | | private Integer showNumber; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 50,message = "组织名称不能超过50个字符") |
| | | @ApiModelProperty(value = "组织名称") |
| | | @TableField("organization_name") |
| | | private String organizationName; |
| | | |
| | | @Length(max = 20,message = "组织负责人不能超过20个字符") |
| | | @ApiModelProperty(value = "组织负责人") |
| | | @TableField("organization_person") |
| | | private String organizationPerson; |
| | |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确") |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("contact_number") |
| | | private String contactNumber; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableField("type_children_id") |
| | | private String typeChildrenId; |
| | | |
| | | @Length(max = 40,message = "资源单位不能超过40个字符") |
| | | @ApiModelProperty(value = "资源单位") |
| | | @TableField("resource_unit") |
| | | private String resourceUnit; |
| | |
| | | @TableField("resource_name_desc") |
| | | private String resourceNameDesc; |
| | | |
| | | @Length(max = 50,message = "资源来源不能超过50个字符") |
| | | @ApiModelProperty(value = "资源来源") |
| | | @TableField("resource_source") |
| | | private String resourceSource; |
| | |
| | | @TableField("quantity_scale") |
| | | private String quantityScale; |
| | | |
| | | @Length(max = 20,message = "联系人不能超过20个字符") |
| | | @ApiModelProperty(value = "联系人") |
| | | @TableField("contact_person") |
| | | private String contactPerson; |
| | | |
| | | @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确") |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("contact_number") |
| | | private String contactNumber; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | @TableField("parent_id") |
| | | private String parentId; |
| | | |
| | | @Length(max = 40,message = "分类名称不能超过40个字符") |
| | | @ApiModelProperty(value = "分类名称") |
| | | @TableField("type_name") |
| | | private String typeName; |
| | | |
| | | @Length(max = 40,message = "单位名称不能超过40个字符") |
| | | @ApiModelProperty(value = "单位名称") |
| | | @TableField("unit_name") |
| | | private String unitName; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 20,message = "姓名不能超过20个字符") |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("user_name") |
| | | private String userName; |
| | |
| | | @TableField("birth_date") |
| | | private LocalDate birthDate; |
| | | |
| | | @Length(max = 20,message = "文化程度不能超过20个字符") |
| | | @ApiModelProperty(value = "文化程度") |
| | | @TableField("educational_level") |
| | | private String educationalLevel; |
| | | |
| | | @Length(max = 20,message = "政治面貌不能超过20个字符") |
| | | @ApiModelProperty(value = "政治面貌") |
| | | @TableField("political_status") |
| | | private String politicalStatus; |
| | | |
| | | @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确") |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("contact_number") |
| | | private String contactNumber; |
| | | |
| | | @Length(max = 40,message = "工作单位及职务不能超过40个字符") |
| | | @ApiModelProperty(value = "工作单位及职务") |
| | | @TableField("employer_position") |
| | | private String employerPosition; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableField("avatar") |
| | | private String avatar; |
| | | |
| | | @Length(max = 20,message = "姓名长度不能超过20个字符") |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("user_name") |
| | | private String userName; |
| | | |
| | | @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确") |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("user_phone") |
| | | private String userPhone; |
| | | |
| | | @Length(max = 20,message = "职位长度不能超过20个字符") |
| | | @ApiModelProperty(value = "职位") |
| | | @TableField("user_position") |
| | | private String userPosition; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private String id; |
| | | |
| | | @Length(max = 20,message = "姓名不能超过20个字符") |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("user_name") |
| | | private String userName; |
| | |
| | | @TableField("birth_date") |
| | | private LocalDate birthDate; |
| | | |
| | | @Length(max = 40,message = "服务区域不能超过40个字符") |
| | | @ApiModelProperty(value = "服务区域") |
| | | @TableField("service_area") |
| | | private String serviceArea; |
| | |
| | | import com.ruoyi.system.model.TLargeKeyGridUser; |
| | | import com.ruoyi.system.query.TLargeKeyGridUserQuery; |
| | | import com.ruoyi.system.service.TLargeKeyGridUserService; |
| | | import com.ruoyi.system.utils.util.IDCardAgeCalculator; |
| | | import com.ruoyi.system.vo.TCourseVO; |
| | | import com.ruoyi.system.vo.TLargeKeyGridUserVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public PageInfo<TLargeKeyGridUserVO> pageList(TLargeKeyGridUserQuery query) { |
| | | PageInfo<TLargeKeyGridUserVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TLargeKeyGridUserVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | |
| | | for (TLargeKeyGridUserVO tLargeKeyGridUserVO : list) { |
| | | int age = IDCardAgeCalculator.calculateAge(tLargeKeyGridUserVO.getIdCard()); |
| | | tLargeKeyGridUserVO.setAge(age); |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.utils.util; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | public class IDCardAgeCalculator { |
| | | |
| | | public static int calculateAge(String idCard) { |
| | | // 检查身份证号码是否为18位 |
| | | if (idCard == null || idCard.length() != 18) { |
| | | throw new IllegalArgumentException("身份证号码必须为18位"); |
| | | } |
| | | |
| | | // 解析出生日期 |
| | | String birthDateStr = idCard.substring(6, 14); // 获取出生日期部分 |
| | | LocalDate birthDate = LocalDate.parse(birthDateStr, DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | |
| | | // 计算年龄 |
| | | Period period = Period.between(birthDate, currentDate); |
| | | int age = period.getYears(); // 直接获取年份差即为年龄 |
| | | |
| | | return age; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String idCard = "110105194912311234"; // 示例身份证号码 |
| | | try { |
| | | int age = calculateAge(idCard); |
| | | System.out.println("年龄: " + age); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "人员类别") |
| | | private String typeName; |
| | | |
| | | @ApiModelProperty(value = "年龄") |
| | | private Integer age; |
| | | |
| | | } |