jiangping
2025-06-11 731f121d4e3966dfcc0f122542f489c225489702
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -321,22 +321,34 @@
    }
    public static int calculateAge(String idCard,Date dateDate) {
        if (idCard == null || idCard.length() != 18) {
            throw new IllegalArgumentException("身份证号码必须是18位");
        try{
            Integer happenYear = Integer.valueOf(DateUtil.dateToString(dateDate,"yyyy"));
            Integer birthYear = Integer.valueOf(idCard.substring(6,10));
            return happenYear - birthYear;
        }catch (Exception e){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"年龄信息错误");
        }
        // 提取出生日期
        String birthDateStr = idCard.substring(6, 14); // 例如:19900101
        LocalDate birthDate = LocalDate.parse(birthDateStr);
        Instant instant = dateDate.toInstant();
        // 获取当前日期
        LocalDate currentDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); // 转换为 LocalDate
        // 计算年龄
        Period period = Period.between(birthDate, currentDate);
        int age = period.getYears(); // 直接获取年份差即为年龄
        return age;
//        if (idCard == null || idCard.length() != 18) {
//            throw new IllegalArgumentException("身份证号码必须是18位");
//        }
//
//        // 提取出生日期
//        String birthDateStr = idCard.substring(6, 14); // 例如:19900101
//        LocalDate birthDate = LocalDate.parse(birthDateStr);
//        Instant instant = dateDate.toInstant();
//        // 获取当前日期
//        LocalDate currentDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); // 转换为 LocalDate
//
//        // 计算年龄
//        Period period = Period.between(birthDate, currentDate);
//        int age = period.getYears(); // 直接获取年份差即为年龄
//        return age;
    }
@@ -1999,7 +2011,7 @@
        ACCEPTANCE(9, "已受理",3),//待理算
        WAIT_AUDIT_COMPENSATION(10, "待核赔",4),
        COMPENSATION(11, "已核赔",5),
        CONFIRM_FEE(12, "已确认金额",5),
        CONFIRM_FEE(12, "待结案",5),
        CLOSE_CASE(13, "已结案",6),
        RETURN(14, "已撤案",7),
        ;
@@ -2058,7 +2070,7 @@
        SUPPLEMENT(5, "补充说明","提交意见:${param}"),
        PLATFORM_LP_DEAL(6, "平台理赔处理","已在平台完成理赔"),
        PLATFORM_REMARK(7, "备注标签","${param}"),
        PLATFORM_ADDCODE(8, "平台添加报案号","备案号:${param}"),
        PLATFORM_ADDCODE(8, "平台修改报案号","备案号:${param}"),
        PLATFORM_UN_AGREE_BACK(9, "企业下载资料",""),
        PLATFORM_DOWNLOAD(10, "平台下载资料",""),
        PLATFORM_CHECK_PASS(11, "平台上传资料",""),