| | |
| | | import java.math.RoundingMode; |
| | | import java.net.URL; |
| | | import java.net.URLDecoder; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | |
| | | } |
| | | return Constants.countPriceVO(countCyclePriceDTO.getStartDate(),countCyclePriceDTO.getSolutions()); |
| | | } |
| | | |
| | | public static int calculateAge(String idCard,Date dateDate) { |
| | | 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; |
| | | } |
| | | |
| | | |
| | | public static CountCyclePriceVO countPriceVO(Date startDate, Solutions solutions){ |
| | | CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // 普通方法 |
| | | public static SettleClaimsLogParentStatus getAll(int index) { |