From ca9fc9f1daff1a4ddd73e1b976a72e691538a2e4 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 26 一月 2024 10:55:39 +0800
Subject: [PATCH] Mr.Shi
---
server/service/src/main/java/com/doumee/core/utils/Constants.java | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index 2c7f422..2325066 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -3,6 +3,7 @@
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.dao.business.model.Solutions;
+import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -13,6 +14,8 @@
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;
+import java.time.LocalDate;
+import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Date;
import java.util.regex.Matcher;
@@ -145,6 +148,36 @@
}
return d.intValue();
}
+
+ 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));
+
+ LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay);
+ LocalDate currentDate = LocalDate.now();
+ long age = ChronoUnit.YEARS.between(birthDate, currentDate);
+ return age;
+ }
+
+ public static Integer getSexByIdCard(String idCard){
+ Pattern pattern = Pattern.compile("\\d{17}[\\d|x]"); // 瀹氫箟韬唤璇佸彿鐮佹牸寮忕殑姝e垯琛ㄨ揪寮�
+ Matcher matcher = pattern.matcher(idCard);
+ Integer sex = 1;
+ if (matcher.matches()) {
+ int genderCode = Integer.parseInt(idCard.substring(16, 17)); // 浠庣17浣嶅紑濮嬫彁鍙栨�у埆缂栫爜锛堝鏁颁负鐢锋�э紝鍋舵暟涓哄コ鎬э級
+
+ if ((genderCode % 2 == 1)) {
+ sex = 1;
+ } else {
+ sex = 2;
+ }
+ } else {
+ sex = -1;
+ }
+ return sex;
+ }
+
/**
* 鐘舵�� 0宸蹭繚瀛樸��1寰呭鏍搞��2瀹℃牳閫氳繃銆�3閫�鍥炰慨鏀广��4瀹℃牳椹冲洖銆�5寰呮湇鍔℃満鏋勭‘璁ゃ��6鏈嶅姟鏈烘瀯鎷掔粷銆�7宸插垎閰嶆湇鍔℃満鏋勩��8璇婃柇涓�
* 锛堟垚鍔熶笂浼犵涓�浠芥湇鍔¤祫鏂欙級銆�9鏈嶅姟瀹屾垚銆�10宸插垎閰嶈瘎鍒嗕笓瀹躲��11宸插畬鎴愶紙涓撳涓婁紶璇勫垎锛� 12閫�鍥炰慨鏀逛腑 13 宸插畬鎴愰��鍥炰慨鏀�
@@ -373,8 +406,9 @@
BD_SIGNED_PDF(9, "绛剧讲鍚庝繚鍗曠敵璇疯〃PDF", "绛剧讲鍚庝繚鍗曠敵璇疯〃PDF"),
COM_SING_IMG(10, "浼佷笟鍗扮珷", "浼佷笟鍗扮珷"),
BD_DONE_PDF(11, "鏈�缁堟姤鍗�", "鏈�缁堟姤鍗�"),
-
CA_PD_PDF(12, "鏈�缁堟姤鍗�", "鏈�缁堟姤鍗�"),
+ CA_APPLY_JIAJIAN_SIGN(13, "鍔犲噺淇濈敵璇风绔犳枃浠�", "鍔犲噺淇濈敵璇风绔犳枃浠�"),
+ CA_APPLY_CHANGEUNIT_SIGN(14, "鎹㈠巶鐢宠绛剧珷鏂囦欢", "鎹㈠巶鐢宠绛剧珷鏂囦欢"),
;
@@ -650,6 +684,9 @@
CA_PALTFORM_REFUSE_APPLY(20, "椹冲洖閫�鍥炵敵璇�",""),
CA_PALTFORM_EDIT_PIDAN(21, "淇敼鎵瑰崟","淇敼鍘熷洜锛�${param}"),
PALTFORM_EDIT_BD(22, "淇敼淇濆崟","淇敼鍘熷洜锛�${param}"),
+
+ CA_CHANGUNIT_APPLY_SIGN(24, "鎹㈡垚鐢宠浼佷笟绛剧珷",""),
+ CA_JIAJIAN_APPLY_SIGN(23, "鍔犲噺淇濈敵璇蜂紒涓氱绔�",""),
;
// 鎴愬憳鍙橀噺
private String name;
--
Gitblit v1.9.3