diff --git a/dsBase/src/main/java/com/dsideal/Base/Util/ExcelCommonUtil.java b/dsBase/src/main/java/com/dsideal/Base/Util/ExcelCommonUtil.java index 337406f8..0ac1c081 100644 --- a/dsBase/src/main/java/com/dsideal/Base/Util/ExcelCommonUtil.java +++ b/dsBase/src/main/java/com/dsideal/Base/Util/ExcelCommonUtil.java @@ -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(); diff --git a/dsBase/src/main/java/com/dsideal/Base/Util/IDCardUtil.java b/dsBase/src/main/java/com/dsideal/Base/Util/IDCardUtil.java index fd41d94c..90041217 100644 --- a/dsBase/src/main/java/com/dsideal/Base/Util/IDCardUtil.java +++ b/dsBase/src/main/java/com/dsideal/Base/Util/IDCardUtil.java @@ -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 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 getAreaCode() { + Map 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; } diff --git a/pom.xml b/pom.xml index 2dd74b00..d5ea610d 100644 --- a/pom.xml +++ b/pom.xml @@ -15,38 +15,6 @@ dsAi dsSso - - - - - org.apache.logging.log4j - log4j-core - 2.20.0 - provided - - - org.apache.logging.log4j - log4j-api - 2.20.0 - provided - - - - - - - ali-maven - https://maven.aliyun.com/nexus/content/groups/public - - true - - - true - always - fail - - - UTF-8 @@ -94,6 +62,7 @@ 1.0.5 2.3.0 1.1.1 + 3.30.2-GA 4.5.14 0.2.19 @@ -117,4 +86,42 @@ 1.4.4 ${jjwt.version} + + + + + org.apache.logging.log4j + log4j-core + 2.20.0 + provided + + + org.apache.logging.log4j + log4j-api + 2.20.0 + provided + + + org.javassist + javassist + ${javassist.version} + + + + + + + ali-maven + https://maven.aliyun.com/nexus/content/groups/public + + true + + + true + always + fail + + + + \ No newline at end of file