jiangping
2024-05-11 3a0712a70ab0f97b4190842c33d27ba8d0d6cec3
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -156,18 +156,22 @@
    }
    public static long getAgeByIdCard(String idCard){
        int birthYear = Integer.parseInt(idCard.substring(6, 10));
        int birthMonth = Integer.parseInt(idCard.substring(10, 12));
        int birthDay = Integer.parseInt(idCard.substring(12, 14));
        try{
            LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay);
            LocalDate currentDate = LocalDate.now();
            long age = ChronoUnit.YEARS.between(birthDate, currentDate);
            return age;
        try {
            int birthYear = Integer.parseInt(idCard.substring(6, 10));
            int birthMonth = Integer.parseInt(idCard.substring(10, 12));
            int birthDay = Integer.parseInt(idCard.substring(12, 14));
            try{
                LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay);
                LocalDate currentDate = LocalDate.now();
                long age = ChronoUnit.YEARS.between(birthDate, currentDate);
                return age;
            }catch (Exception e){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"身份证号码错误:"+idCard);
            }
        }catch (Exception e){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"身份证号码错误:"+idCard);
        }
        }
        return 0;
    }
@@ -721,7 +725,8 @@
        WTBDCD(23, "待出单"),
        WTBYTH(24, "已退回"),
        WTBYGB(25, "已关闭"),
        WTBTBZ(26, "投保中"),
        //2024年4月25日15:17:13 修改 投保中 = 》 批改申请中
        WTBTBZ(26, "批改申请中"),
        WTBBZZ(27, "保障中"),
        ;
        // 成员变量