xuhy
2025-11-11 c14d9e1eba68d0127d19a8bd4e0fc80be5ad3138
大屏接口校验规则
1个文件已添加
11个文件已修改
100 ■■■■■ 已修改文件
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeDept.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeKeyGridUser.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeKeyPersonnelType.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeOrganization.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeResource.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeResourceType.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeSocialWorker.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeUser.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeVolunteer.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TLargeKeyGridUserServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/utils/util/IDCardAgeCalculator.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/TLargeKeyGridUserVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeDept.java
@@ -6,7 +6,9 @@
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;
@@ -29,6 +31,9 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeKeyGridUser.java
@@ -6,7 +6,9 @@
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;
@@ -29,26 +31,32 @@
    @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;
@@ -57,10 +65,12 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeKeyPersonnelType.java
@@ -6,6 +6,7 @@
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;
@@ -29,6 +30,7 @@
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    @Length(max = 40,message = "分类名称不能超过40个字符")
    @ApiModelProperty(value = "分类名称")
    @TableField("type_name")
    private String typeName;
@@ -37,6 +39,7 @@
    @TableField("show_type")
    private Integer showType;
    @Length(max = 11,message = "显示数量不能超过11个字符")
    @ApiModelProperty(value = "显示数量")
    @TableField("show_number")
    private Integer showNumber;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeOrganization.java
@@ -6,7 +6,9 @@
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;
@@ -29,10 +31,12 @@
    @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;
@@ -41,6 +45,7 @@
    @TableField("address")
    private String address;
    @Pattern(regexp = "^1[3-9]\\\\d{9}$",message = "手机号格式不正确")
    @ApiModelProperty(value = "联系电话")
    @TableField("contact_number")
    private String contactNumber;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeResource.java
@@ -6,7 +6,9 @@
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;
@@ -37,6 +39,7 @@
    @TableField("type_children_id")
    private String typeChildrenId;
    @Length(max = 40,message = "资源单位不能超过40个字符")
    @ApiModelProperty(value = "资源单位")
    @TableField("resource_unit")
    private String resourceUnit;
@@ -45,6 +48,7 @@
    @TableField("resource_name_desc")
    private String resourceNameDesc;
    @Length(max = 50,message = "资源来源不能超过50个字符")
    @ApiModelProperty(value = "资源来源")
    @TableField("resource_source")
    private String resourceSource;
@@ -53,10 +57,12 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeResourceType.java
@@ -6,6 +6,7 @@
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;
@@ -34,10 +35,12 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeSocialWorker.java
@@ -7,7 +7,9 @@
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;
@@ -31,6 +33,7 @@
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    @Length(max = 20,message = "姓名不能超过20个字符")
    @ApiModelProperty(value = "姓名")
    @TableField("user_name")
    private String userName;
@@ -44,18 +47,22 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeUser.java
@@ -6,7 +6,10 @@
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;
@@ -37,14 +40,17 @@
    @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;
ruoyi-system/src/main/java/com/ruoyi/system/model/TLargeVolunteer.java
@@ -7,6 +7,7 @@
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;
@@ -32,6 +33,7 @@
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    @Length(max = 20,message = "姓名不能超过20个字符")
    @ApiModelProperty(value = "姓名")
    @TableField("user_name")
    private String userName;
@@ -45,6 +47,7 @@
    @TableField("birth_date")
    private LocalDate birthDate;
    @Length(max = 40,message = "服务区域不能超过40个字符")
    @ApiModelProperty(value = "服务区域")
    @TableField("service_area")
    private String serviceArea;
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TLargeKeyGridUserServiceImpl.java
@@ -6,9 +6,11 @@
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;
@@ -27,6 +29,15 @@
    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;
    }
ruoyi-system/src/main/java/com/ruoyi/system/utils/util/IDCardAgeCalculator.java
New file
@@ -0,0 +1,38 @@
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());
        }
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/vo/TLargeKeyGridUserVO.java
@@ -12,4 +12,7 @@
    @ApiModelProperty(value = "人员类别")
    private String typeName;
    @ApiModelProperty(value = "年龄")
    private Integer age;
}