|
|
@ -43,6 +43,8 @@ import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
import java.time.temporal.TemporalUnit; |
|
|
|
import java.util.*; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
@ -60,6 +62,8 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
public static final Pattern REG_DATE = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})"); |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ResiByPolicyInfoResultDTO> listByPolicyRules(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, |
|
|
|
String houseId, String idCard, String name, Integer pageNo, Integer pageSize, |
|
|
@ -212,8 +216,14 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { |
|
|
|
if (r.getBirthday() != null) { |
|
|
|
Integer age = null; |
|
|
|
try { |
|
|
|
LocalDate birthdayLocalDate = LocalDateTime.ofInstant(r.getBirthday().toInstant(), ZoneId.systemDefault()).toLocalDate(); |
|
|
|
age = Period.between(birthdayLocalDate, LocalDate.now()).getYears(); |
|
|
|
Matcher matcher = REG_DATE.matcher(r.getBirthday()); |
|
|
|
if (matcher.matches()) { |
|
|
|
String year = matcher.group(1); |
|
|
|
String month = matcher.group(2); |
|
|
|
String day = matcher.group(3); |
|
|
|
LocalDate birthdayLocalDate = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); |
|
|
|
age = Period.between(birthdayLocalDate, LocalDate.now()).getYears(); |
|
|
|
} |
|
|
|
} catch (DateTimeException e) { |
|
|
|
throw new EpmetException("居民生日计算错误"); |
|
|
|
} |
|
|
|