mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix bug
This commit is contained in:
parent
82496327ab
commit
b44dc1bb98
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.5.3 (2020-12-10)
|
||||
# 5.5.3 (2020-12-11)
|
||||
|
||||
### 新特性
|
||||
* 【core 】 IdcardUtil增加行政区划83(issue#1277@Github)
|
||||
@ -17,6 +17,7 @@
|
||||
* 【core 】 增加CharSequenceUtil
|
||||
* 【poi 】 Excel07SaxReader拆分出SheetDataSaxHandler
|
||||
* 【core 】 CollUtil.addAll增加判空(pr#228@Gitee)
|
||||
* 【core 】 修正DateUtil.betweenXXX注释错误(issue#I28XGW@Gitee)
|
||||
|
||||
### Bug修复
|
||||
* 【cache 】 修复Cache中get重复misCount计数问题(issue#1281@Github)
|
||||
@ -27,6 +28,7 @@
|
||||
* 【cache 】 get中unlock改为unlockRead(issue#1294@Github)
|
||||
* 【db 】 修复表名包含点导致的问题(issue#1300@Github)
|
||||
* 【poi 】 修复xdr:row标签导致的问题(issue#1297@Github)
|
||||
* 【core 】 修复FileUtil.loopFiles使用FileFilter无效问题(issue#I28V48@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class DateBetween implements Serializable{
|
||||
|
||||
/**
|
||||
* 计算两个日期相差月数<br>
|
||||
* 在非重置情况下,如果起始日期的天小于结束日期的天,月数要少算1(不足1个月)
|
||||
* 在非重置情况下,如果起始日期的天大于结束日期的天,月数要少算1(不足1个月)
|
||||
*
|
||||
* @param isReset 是否重置时间为起始时间(重置天时分秒)
|
||||
* @return 相差月数
|
||||
@ -122,7 +122,7 @@ public class DateBetween implements Serializable{
|
||||
|
||||
/**
|
||||
* 计算两个日期相差年数<br>
|
||||
* 在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年)
|
||||
* 在非重置情况下,如果起始日期的月大于结束日期的月,年数要少算1(不足1年)
|
||||
*
|
||||
* @param isReset 是否重置时间为起始时间(重置月天时分秒)
|
||||
* @return 相差年数
|
||||
|
@ -1375,7 +1375,7 @@ public class DateUtil extends CalendarUtil {
|
||||
|
||||
/**
|
||||
* 计算两个日期相差月数<br>
|
||||
* 在非重置情况下,如果起始日期的天小于结束日期的天,月数要少算1(不足1个月)
|
||||
* 在非重置情况下,如果起始日期的天大于结束日期的天,月数要少算1(不足1个月)
|
||||
*
|
||||
* @param beginDate 起始日期
|
||||
* @param endDate 结束日期
|
||||
@ -1389,7 +1389,7 @@ public class DateUtil extends CalendarUtil {
|
||||
|
||||
/**
|
||||
* 计算两个日期相差年数<br>
|
||||
* 在非重置情况下,如果起始日期的月小于结束日期的月,年数要少算1(不足1年)
|
||||
* 在非重置情况下,如果起始日期的月大于结束日期的月,年数要少算1(不足1年)
|
||||
*
|
||||
* @param beginDate 起始日期
|
||||
* @param endDate 结束日期
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.hutool.core.io;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.io.file.FileCopier;
|
||||
import cn.hutool.core.io.file.FileMode;
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
@ -173,13 +172,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 文件列表
|
||||
*/
|
||||
public static List<File> loopFiles(File file, FileFilter fileFilter) {
|
||||
if (null == file || false == file.exists()) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
|
||||
final List<File> fileList = new ArrayList<>();
|
||||
walkFiles(file, fileList::add);
|
||||
return fileList;
|
||||
return loopFiles(file, -1, fileFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,7 +209,7 @@ public class FileUtil extends PathUtil {
|
||||
* @return 文件列表
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public static List<File> loopFiles(File file, int maxDepth, final FileFilter fileFilter) {
|
||||
public static List<File> loopFiles(File file, int maxDepth, FileFilter fileFilter) {
|
||||
return loopFiles(file.toPath(), maxDepth, fileFilter);
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class IdcardUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份编号获取户籍省份,只支持15或18位身份证号码
|
||||
* 根据身份编号获取市级编码,只支持15或18位身份证号码
|
||||
*
|
||||
* @param idcard 身份编码
|
||||
* @return 市级编码。
|
||||
@ -658,9 +658,9 @@ public class IdcardUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省份代码
|
||||
* 获取市级编码
|
||||
*
|
||||
* @return 省份代码
|
||||
* @return 市级编码
|
||||
*/
|
||||
public String getCityCode() {
|
||||
return this.cityCode;
|
||||
|
@ -75,6 +75,12 @@ public class IdcardUtilTest {
|
||||
Assert.assertEquals(province2, "内蒙古");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCityCodeByIdCardTest() {
|
||||
String codeByIdCard = IdcardUtil.getCityCodeByIdCard(ID_18);
|
||||
Assert.assertEquals("32108", codeByIdCard);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getGenderByIdCardTest() {
|
||||
int gender = IdcardUtil.getGenderByIdCard(ID_18);
|
||||
|
Loading…
x
Reference in New Issue
Block a user