main
HuangHai 1 month ago
parent 88df612673
commit 9a601400bd

@ -84,7 +84,7 @@ public class ExcelCommonUtil {
record.set("Number", (i + 1));
list.add(record);
}
page = new Page(list, page.getPageNumber(), page.getPageSize(), page.getTotalPage(), page.getTotalRow());
page = new Page<>(list, page.getPageNumber(), page.getPageSize(), page.getTotalPage(), page.getTotalRow());
}
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();

@ -2,6 +2,7 @@ package com.dsideal.Base.Util;
import com.alibaba.fastjson.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
@ -30,7 +31,7 @@ public class IDCardUtil {
String tipInfo = "身份证正常";// 记录错误信息
String Ai = "";
if (null == IDStr || IDStr.trim().isEmpty()) {
if (IDStr.trim().isEmpty()) {
tipInfo = "身份证号码长度应该为15位或18位。";
jo.put("success", false);
jo.put("message", tipInfo);
@ -59,7 +60,7 @@ public class IDCardUtil {
String strYear = Ai.substring(6, 10);// 年份
String strMonth = Ai.substring(10, 12);// 月份
String strDay = Ai.substring(12, 14);// 日期
if (isDate(strYear + "-" + strMonth + "-" + strDay) == false) {
if (!isDate(strYear + "-" + strMonth + "-" + strDay)) {
tipInfo = "身份证出生日期无效。";
jo.put("success", false);
jo.put("message", tipInfo);
@ -75,9 +76,7 @@ public class IDCardUtil {
jo.put("message", tipInfo);
return jo;
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (java.text.ParseException e) {
} catch (NumberFormatException | ParseException e) {
e.printStackTrace();
}
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
@ -93,7 +92,7 @@ public class IDCardUtil {
return jo;
}
// 判断地区码是否有效
Hashtable areacode = GetAreaCode();
Map<String,String> areacode = getAreaCode();
// 如果身份证前两位的地区码不在Hashtable则地区码有误
if (areacode.get(Ai.substring(0, 2)) == null) {
tipInfo = "身份证地区编码错误。";
@ -102,7 +101,7 @@ public class IDCardUtil {
return jo;
}
//判断第18位校验码是否正确
if (isVarifyCode(Ai, IDStr) == false) {
if (!isVarifyCode(Ai, IDStr)) {
tipInfo = "身份证校验码无效,不是合法的身份证号码";
jo.put("success", false);
jo.put("message", tipInfo);
@ -188,44 +187,44 @@ public class IDCardUtil {
*
* @return Hashtable
*/
private static Hashtable GetAreaCode() {
Hashtable hashtable = new Hashtable();
hashtable.put("11", "北京");
hashtable.put("12", "天津");
hashtable.put("13", "河北");
hashtable.put("14", "山西");
hashtable.put("15", "内蒙古");
hashtable.put("21", "辽宁");
hashtable.put("22", "吉林");
hashtable.put("23", "黑龙江");
hashtable.put("31", "上海");
hashtable.put("32", "江苏");
hashtable.put("33", "浙江");
hashtable.put("34", "安徽");
hashtable.put("35", "福建");
hashtable.put("36", "江西");
hashtable.put("37", "山东");
hashtable.put("41", "河南");
hashtable.put("42", "湖北");
hashtable.put("43", "湖南");
hashtable.put("44", "广东");
hashtable.put("45", "广西");
hashtable.put("46", "海南");
hashtable.put("50", "重庆");
hashtable.put("51", "四川");
hashtable.put("52", "贵州");
hashtable.put("53", "云南");
hashtable.put("54", "西藏");
hashtable.put("61", "陕西");
hashtable.put("62", "甘肃");
hashtable.put("63", "青海");
hashtable.put("64", "宁夏");
hashtable.put("65", "新疆");
hashtable.put("71", "台湾");
hashtable.put("81", "香港");
hashtable.put("82", "澳门");
hashtable.put("91", "国外");
return hashtable;
private static Map<String, String> getAreaCode() {
Map<String, String> areaCodeMap = new HashMap<>();
areaCodeMap.put("11", "北京");
areaCodeMap.put("12", "天津");
areaCodeMap.put("13", "河北");
areaCodeMap.put("14", "山西");
areaCodeMap.put("15", "内蒙古");
areaCodeMap.put("21", "辽宁");
areaCodeMap.put("22", "吉林");
areaCodeMap.put("23", "黑龙江");
areaCodeMap.put("31", "上海");
areaCodeMap.put("32", "江苏");
areaCodeMap.put("33", "浙江");
areaCodeMap.put("34", "安徽");
areaCodeMap.put("35", "福建");
areaCodeMap.put("36", "江西");
areaCodeMap.put("37", "山东");
areaCodeMap.put("41", "河南");
areaCodeMap.put("42", "湖北");
areaCodeMap.put("43", "湖南");
areaCodeMap.put("44", "广东");
areaCodeMap.put("45", "广西");
areaCodeMap.put("46", "海南");
areaCodeMap.put("50", "重庆");
areaCodeMap.put("51", "四川");
areaCodeMap.put("52", "贵州");
areaCodeMap.put("53", "云南");
areaCodeMap.put("54", "西藏");
areaCodeMap.put("61", "陕西");
areaCodeMap.put("62", "甘肃");
areaCodeMap.put("63", "青海");
areaCodeMap.put("64", "宁夏");
areaCodeMap.put("65", "新疆");
areaCodeMap.put("71", "台湾");
areaCodeMap.put("81", "香港");
areaCodeMap.put("82", "澳门");
areaCodeMap.put("91", "国外");
return areaCodeMap;
}

@ -15,38 +15,6 @@
<module>dsAi</module>
<module>dsSso</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- 全局排除Log4j2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- 使用阿里 maven 库 -->
<repositories>
<repository>
<id>ali-maven</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
<properties>
<!-- 项目基础配置 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -94,6 +62,7 @@
<screw-core.version>1.0.5</screw-core.version>
<jaxb-core.version>2.3.0</jaxb-core.version>
<javax.activation.version>1.1.1</javax.activation.version>
<javassist.version>3.30.2-GA</javassist.version>
<!-- 网络相关 -->
<httpmime.version>4.5.14</httpmime.version>
<jsch.version>0.2.19</jsch.version>
@ -117,4 +86,42 @@
<japidocs.version>1.4.4</japidocs.version>
<jjwt-jackson.version>${jjwt.version}</jjwt-jackson.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 全局排除Log4j2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!-- 使用阿里 maven 库 -->
<repositories>
<repository>
<id>ali-maven</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
</project>
Loading…
Cancel
Save