Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
e900ce25
Commit
e900ce25
authored
Apr 15, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
89d894df
Changes
47
Show whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
106 additions
and
133 deletions
+106
-133
YzgError.java
...til-base/src/main/java/com/yanzuoguang/util/YzgError.java
+1
-1
YzgErrorData.java
...base/src/main/java/com/yanzuoguang/util/YzgErrorData.java
+1
-1
ObjectHelper.java
...src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
+5
-4
MemoryCache.java
...src/main/java/com/yanzuoguang/util/cache/MemoryCache.java
+2
-2
MemoryCacheNullUtil.java
.../java/com/yanzuoguang/util/cache/MemoryCacheNullUtil.java
+2
-2
ExceptionHelper.java
.../java/com/yanzuoguang/util/exception/ExceptionHelper.java
+1
-2
CheckerHelper.java
.../main/java/com/yanzuoguang/util/helper/CheckerHelper.java
+1
-1
DateAutoHelper.java
...main/java/com/yanzuoguang/util/helper/DateAutoHelper.java
+2
-2
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+2
-8
EnumHelper.java
...src/main/java/com/yanzuoguang/util/helper/EnumHelper.java
+1
-1
Event.java
...base/src/main/java/com/yanzuoguang/util/helper/Event.java
+1
-1
FileHelper.java
...src/main/java/com/yanzuoguang/util/helper/FileHelper.java
+1
-5
FormulaHelper.java
.../main/java/com/yanzuoguang/util/helper/FormulaHelper.java
+1
-1
SfzhUtil.java
...e/src/main/java/com/yanzuoguang/util/helper/SfzhUtil.java
+11
-20
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+7
-11
TypeHelper.java
...src/main/java/com/yanzuoguang/util/helper/TypeHelper.java
+1
-4
YzgLanguage.java
...rc/main/java/com/yanzuoguang/util/helper/YzgLanguage.java
+3
-3
ZipHelper.java
.../src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
+5
-4
Log.java
...util-base/src/main/java/com/yanzuoguang/util/log/Log.java
+2
-2
LogDefault.java
...se/src/main/java/com/yanzuoguang/util/log/LogDefault.java
+2
-2
AbstractThreadList.java
.../java/com/yanzuoguang/util/thread/AbstractThreadList.java
+8
-11
RunPlan.java
...se/src/main/java/com/yanzuoguang/util/thread/RunPlan.java
+6
-6
RunnableListAuto.java
...in/java/com/yanzuoguang/util/thread/RunnableListAuto.java
+1
-1
ThreadHelper.java
...c/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
+2
-2
ThreadWait.java
...src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
+1
-1
DataDaoVo.java
...base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
+4
-4
TestSfzUtil.java
yzg-util-base/src/test/java/helper/TestSfzUtil.java
+2
-2
ChineseHelper.java
...ese/src/main/java/com/yanzuoguang/util/ChineseHelper.java
+1
-1
BaseRequestAspect.java
...ain/java/com/yanzuoguang/cloud/aop/BaseRequestAspect.java
+1
-1
RequestCacheResult.java
...in/java/com/yanzuoguang/cloud/aop/RequestCacheResult.java
+1
-1
Timeout.java
...loud/src/main/java/com/yanzuoguang/cloud/aop/Timeout.java
+2
-2
YzgFileProcedure.java
...ain/java/com/yanzuoguang/cloud/file/YzgFileProcedure.java
+2
-2
TokenServiceCall.java
.../java/com/yanzuoguang/cloud/service/TokenServiceCall.java
+1
-1
SqlCondEquals.java
...src/main/java/com/yanzuoguang/dao/cond/SqlCondEquals.java
+1
-1
TableSqlCache.java
...src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
+1
-1
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+1
-1
AllBeanRowMapper.java
...c/main/java/com/yanzuoguang/db/impl/AllBeanRowMapper.java
+2
-2
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+1
-1
ExcelRowDefault.java
.../src/main/java/com/yanzuoguang/excel/ExcelRowDefault.java
+1
-1
YzgFileServiceImpl.java
...n/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
+1
-1
HlsDownloader.java
...ge/src/main/java/com/yanzuoguang/media/HlsDownloader.java
+3
-2
MediaCacheLocal.java
.../src/main/java/com/yanzuoguang/media/MediaCacheLocal.java
+1
-1
MediaFirst.java
...image/src/main/java/com/yanzuoguang/media/MediaFirst.java
+1
-1
MessageLogServiceImpl.java
...om/yanzuoguang/mq/service/impl/MessageLogServiceImpl.java
+1
-1
FormatCenter.java
...ava/com/yanzuoguang/util/printer/format/FormatCenter.java
+2
-2
FormatHandleDefault.java
.../yanzuoguang/util/printer/format/FormatHandleDefault.java
+1
-1
CacheLock.java
...-redis/src/main/java/com.yanzuoguang.redis/CacheLock.java
+5
-5
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgError.java
View file @
e900ce25
...
@@ -10,7 +10,7 @@ import com.yanzuoguang.util.exception.RuntimeCodeException;
...
@@ -10,7 +10,7 @@ import com.yanzuoguang.util.exception.RuntimeCodeException;
*/
*/
public
class
YzgError
{
public
class
YzgError
{
private
static
YzgErrorData
error
=
new
YzgErrorData
(
"999."
);
private
static
final
YzgErrorData
error
=
new
YzgErrorData
(
"999."
);
private
static
void
init
()
{
private
static
void
init
()
{
error
.
add
(
"000"
,
"%s"
);
error
.
add
(
"000"
,
"%s"
);
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgErrorData.java
View file @
e900ce25
...
@@ -22,7 +22,7 @@ public class YzgErrorData {
...
@@ -22,7 +22,7 @@ public class YzgErrorData {
/**
/**
* 错误缓存消息
* 错误缓存消息
*/
*/
private
Map
<
String
,
String
>
ErrorCode
=
new
HashMap
<>();
private
final
Map
<
String
,
String
>
ErrorCode
=
new
HashMap
<>();
public
YzgErrorData
(
String
TAG
)
{
public
YzgErrorData
(
String
TAG
)
{
this
.
TAG
=
TAG
;
this
.
TAG
=
TAG
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
View file @
e900ce25
...
@@ -20,7 +20,7 @@ public class ObjectHelper {
...
@@ -20,7 +20,7 @@ public class ObjectHelper {
/**
/**
* 缓存的类型
* 缓存的类型
*/
*/
private
static
Map
<
Class
<?>,
HashMap
<
String
,
MethodField
>>
mapCache
=
new
HashMap
<>();
private
static
final
Map
<
Class
<?>,
HashMap
<
String
,
MethodField
>>
mapCache
=
new
HashMap
<>();
// --------------------------------------------- 类型判断 ---------------------------------------------------------
// --------------------------------------------- 类型判断 ---------------------------------------------------------
...
@@ -198,7 +198,7 @@ public class ObjectHelper {
...
@@ -198,7 +198,7 @@ public class ObjectHelper {
try
{
try
{
setByType
(
vType
,
target
,
field
,
value
);
setByType
(
vType
,
target
,
field
,
value
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
"字段"
+
field
+
"设置错误"
,
ex
);
}
}
}
}
}
}
...
@@ -219,7 +219,8 @@ public class ObjectHelper {
...
@@ -219,7 +219,8 @@ public class ObjectHelper {
try
{
try
{
setByType
(
target
,
item
,
value
);
setByType
(
target
,
item
,
value
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ExceptionHelper
.
handleException
(
ObjectHelper
.
class
,
ex
,
item
.
getName
());
System
.
err
.
println
(
"字段"
+
field
+
"设置错误"
);
ExceptionHelper
.
handleException
(
ObjectHelper
.
class
,
ex
,
field
);
}
}
}
}
...
@@ -254,7 +255,7 @@ public class ObjectHelper {
...
@@ -254,7 +255,7 @@ public class ObjectHelper {
writeWithFromClass
(
to
,
from
);
writeWithFromClass
(
to
,
from
);
return
(
T
)
to
;
return
(
T
)
to
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
YzgError
.
getRuntimeException
(
e
,
"006"
,
cls
.
getName
());
throw
YzgError
.
getRuntimeException
(
e
,
"006"
,
cls
.
getName
());
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/cache/MemoryCache.java
View file @
e900ce25
...
@@ -16,7 +16,7 @@ public class MemoryCache<T> {
...
@@ -16,7 +16,7 @@ public class MemoryCache<T> {
/**
/**
* 缓存的对象
* 缓存的对象
*/
*/
private
Map
<
String
,
MemoryCacheItem
<
T
>>
cache
=
new
ConcurrentHashMap
<>();
private
final
Map
<
String
,
MemoryCacheItem
<
T
>>
cache
=
new
ConcurrentHashMap
<>();
/**
/**
* 清除时间
* 清除时间
...
@@ -26,7 +26,7 @@ public class MemoryCache<T> {
...
@@ -26,7 +26,7 @@ public class MemoryCache<T> {
/**
/**
* 是否自动清除缓存
* 是否自动清除缓存
*/
*/
private
boolean
isAutoClear
;
private
final
boolean
isAutoClear
;
/**
/**
* 读取时是否激活
* 读取时是否激活
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/cache/MemoryCacheNullUtil.java
View file @
e900ce25
...
@@ -14,12 +14,12 @@ public abstract class MemoryCacheNullUtil<T, M> {
...
@@ -14,12 +14,12 @@ public abstract class MemoryCacheNullUtil<T, M> {
* 缓存的公司和数据中心Id
* 缓存的公司和数据中心Id
* 缓存一个小时
* 缓存一个小时
*/
*/
private
MemoryCache
<
M
>
cache
=
new
MemoryCache
<>(
60
*
60
);
private
final
MemoryCache
<
M
>
cache
=
new
MemoryCache
<>(
60
*
60
);
/**
/**
* 缓存的公司和数据中心Id
* 缓存的公司和数据中心Id
* 缓存一分钟
* 缓存一分钟
*/
*/
private
MemoryCache
<
Boolean
>
cacheIsNull
=
new
MemoryCache
<>(
60
);
private
final
MemoryCache
<
Boolean
>
cacheIsNull
=
new
MemoryCache
<>(
60
);
public
MemoryCacheNullUtil
()
{
public
MemoryCacheNullUtil
()
{
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/exception/ExceptionHelper.java
View file @
e900ce25
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.exception;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.exception;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
com.yanzuoguang.util.vo.ResponseResult
;
/**
/**
...
@@ -29,8 +30,6 @@ public class ExceptionHelper {
...
@@ -29,8 +30,6 @@ public class ExceptionHelper {
*/
*/
public
static
void
handleException
(
Class
<?>
cls
,
Throwable
ex
,
Object
from
)
{
public
static
void
handleException
(
Class
<?>
cls
,
Throwable
ex
,
Object
from
)
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
// todo: 需要修改
// Log.error(ExceptionHelper.class, ex, StringHelper.toString(from));
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/CheckerHelper.java
View file @
e900ce25
...
@@ -60,7 +60,7 @@ public final class CheckerHelper {
...
@@ -60,7 +60,7 @@ public final class CheckerHelper {
public
static
final
String
DATE_CHECK_TYPE_MONTH
=
"month"
;
public
static
final
String
DATE_CHECK_TYPE_MONTH
=
"month"
;
public
static
final
String
DATE_CHECK_TYPE_MONTH_CH
=
"月份"
;
public
static
final
String
DATE_CHECK_TYPE_MONTH_CH
=
"月份"
;
private
static
YzgLanguage
language
=
YzgLanguage
.
get
();
private
static
final
YzgLanguage
language
=
YzgLanguage
.
get
();
static
{
static
{
language
.
setEnglishChinese
(
PARAM_NOT_NULL_TIPS
,
PARAM_NOT_NULL_TIPS_CH
)
language
.
setEnglishChinese
(
PARAM_NOT_NULL_TIPS
,
PARAM_NOT_NULL_TIPS_CH
)
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateAutoHelper.java
View file @
e900ce25
...
@@ -56,7 +56,7 @@ public class DateAutoHelper {
...
@@ -56,7 +56,7 @@ public class DateAutoHelper {
/**
/**
* 缓存的自动识别的格式正则表达式
* 缓存的自动识别的格式正则表达式
*/
*/
private
static
List
<
DateReplace
>
autoDateCache
=
new
ArrayList
<>();
private
static
final
List
<
DateReplace
>
autoDateCache
=
new
ArrayList
<>();
static
{
static
{
registerAutoFormat
(
DATE_FORMAT_NO_SPLIT_REGEX
,
DATE_FORMAT_COMMON_REPLACE
);
registerAutoFormat
(
DATE_FORMAT_NO_SPLIT_REGEX
,
DATE_FORMAT_COMMON_REPLACE
);
...
@@ -133,7 +133,7 @@ public class DateAutoHelper {
...
@@ -133,7 +133,7 @@ public class DateAutoHelper {
}
}
}
}
// 将正常格式的时间字符串转换为时间
// 将正常格式的时间字符串转换为时间
return
new
SimpleDateFormat
(
DATETIME_FULL_FORMAT
).
parse
(
String
.
valueOf
(
date
)
);
return
new
SimpleDateFormat
(
DATETIME_FULL_FORMAT
).
parse
(
date
);
}
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
e900ce25
...
@@ -48,10 +48,7 @@ public class DateHelper {
...
@@ -48,10 +48,7 @@ public class DateHelper {
if
(
StringHelper
.
isEmpty
(
time
))
{
if
(
StringHelper
.
isEmpty
(
time
))
{
return
true
;
return
true
;
}
}
if
(
StringHelper
.
compare
(
time
,
INIT_TIME
.
substring
(
0
,
time
.
length
())))
{
return
StringHelper
.
compare
(
time
,
INIT_TIME
.
substring
(
0
,
time
.
length
()));
return
true
;
}
return
false
;
}
}
/**
/**
...
@@ -864,10 +861,7 @@ public class DateHelper {
...
@@ -864,10 +861,7 @@ public class DateHelper {
if
(
fromDate
!=
null
&&
date
.
getTime
()
<
fromDate
.
getTime
())
{
if
(
fromDate
!=
null
&&
date
.
getTime
()
<
fromDate
.
getTime
())
{
return
false
;
return
false
;
}
}
if
(
toDate
!=
null
&&
date
.
getTime
()
>
toDate
.
getTime
())
{
return
toDate
==
null
||
date
.
getTime
()
<=
toDate
.
getTime
();
return
false
;
}
return
true
;
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/EnumHelper.java
View file @
e900ce25
...
@@ -11,7 +11,7 @@ import java.util.HashMap;
...
@@ -11,7 +11,7 @@ import java.util.HashMap;
*/
*/
public
class
EnumHelper
{
public
class
EnumHelper
{
private
static
HashMap
<
Class
,
Method
>
CacheMethod
=
new
HashMap
<>();
private
static
final
HashMap
<
Class
,
Method
>
CacheMethod
=
new
HashMap
<>();
public
static
<
T
extends
Enum
<
T
>>
T
toEnum
(
String
vStr
,
T
vDefault
)
{
public
static
<
T
extends
Enum
<
T
>>
T
toEnum
(
String
vStr
,
T
vDefault
)
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/Event.java
View file @
e900ce25
...
@@ -13,7 +13,7 @@ public class Event<T> {
...
@@ -13,7 +13,7 @@ public class Event<T> {
/**
/**
* 事件列表
* 事件列表
*/
*/
private
List
<
T
>
list
=
new
ArrayList
<>();
private
final
List
<
T
>
list
=
new
ArrayList
<>();
/**
/**
* 添加处理对象
* 添加处理对象
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/FileHelper.java
View file @
e900ce25
...
@@ -320,10 +320,6 @@ public class FileHelper {
...
@@ -320,10 +320,6 @@ public class FileHelper {
return
false
;
return
false
;
}
}
//删除当前目录
//删除当前目录
if
(
dirFile
.
delete
())
{
return
dirFile
.
delete
();
return
true
;
}
else
{
return
false
;
}
}
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/FormulaHelper.java
View file @
e900ce25
...
@@ -24,7 +24,7 @@ public class FormulaHelper {
...
@@ -24,7 +24,7 @@ public class FormulaHelper {
private
static
final
String
EMPTY_CHAR
=
" "
;
private
static
final
String
EMPTY_CHAR
=
" "
;
private
static
final
String
TEMP_VAR_NAME
=
"@temp"
;
private
static
final
String
TEMP_VAR_NAME
=
"@temp"
;
private
static
FormulaHelper
calcInstance
=
new
FormulaHelper
();
private
static
final
FormulaHelper
calcInstance
=
new
FormulaHelper
();
/**
/**
* 公式参数获取
* 公式参数获取
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/SfzhUtil.java
View file @
e900ce25
...
@@ -23,7 +23,7 @@ public class SfzhUtil {
...
@@ -23,7 +23,7 @@ public class SfzhUtil {
/**
/**
* 省、直辖市代码表
* 省、直辖市代码表
*/
*/
public
static
final
String
cityCode
[]
=
{
public
static
final
String
[]
cityCode
=
{
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"21"
,
"22"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"21"
,
"22"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
"62"
,
"63"
,
"64"
,
"65"
,
"71"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
"62"
,
"63"
,
"64"
,
"65"
,
"71"
,
"81"
,
"82"
,
"91"
"81"
,
"82"
,
"91"
...
@@ -32,14 +32,14 @@ public class SfzhUtil {
...
@@ -32,14 +32,14 @@ public class SfzhUtil {
/**
/**
* 每位加权因子
* 每位加权因子
*/
*/
public
static
final
int
power
[]
=
{
public
static
final
int
[]
power
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
};
/**
/**
* 第18位校检码
* 第18位校检码
*/
*/
public
static
final
String
verifyCode
[]
=
{
public
static
final
String
[]
verifyCode
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
};
/**
/**
...
@@ -186,16 +186,13 @@ public class SfzhUtil {
...
@@ -186,16 +186,13 @@ public class SfzhUtil {
if
(
validateIdCard18
(
card
))
{
if
(
validateIdCard18
(
card
))
{
return
true
;
return
true
;
}
}
if
(
validateIdCard15
(
card
))
{
return
validateIdCard15
(
card
);
return
true
;
}
// String[] cardval = validateIdCard10(card);
// String[] cardval = validateIdCard10(card);
// if (cardval != null) {
// if (cardval != null) {
// if (cardval[2].equals("true")) {
// if (cardval[2].equals("true")) {
// return true;
// return true;
// }
// }
// }
// }
return
false
;
}
}
/**
/**
...
@@ -252,14 +249,11 @@ public class SfzhUtil {
...
@@ -252,14 +249,11 @@ public class SfzhUtil {
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
if
(
birthDate
!=
null
)
if
(
birthDate
!=
null
)
cal
.
setTime
(
birthDate
);
cal
.
setTime
(
birthDate
);
if
(!
valiDate
(
cal
.
get
(
Calendar
.
YEAR
),
Integer
.
valueOf
(
birthCode
.
substring
(
2
,
4
)),
return
valiDate
(
cal
.
get
(
Calendar
.
YEAR
),
Integer
.
valueOf
(
birthCode
.
substring
(
2
,
4
)),
Integer
.
valueOf
(
birthCode
.
substring
(
4
,
6
))))
{
Integer
.
valueOf
(
birthCode
.
substring
(
4
,
6
)));
return
false
;
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
return
true
;
}
}
/**
/**
...
@@ -268,10 +262,7 @@ public class SfzhUtil {
...
@@ -268,10 +262,7 @@ public class SfzhUtil {
public
static
boolean
validateCardOther
(
String
idCard
)
{
public
static
boolean
validateCardOther
(
String
idCard
)
{
String
card
=
idCard
.
trim
();
String
card
=
idCard
.
trim
();
String
[]
cardval
=
validateIdCard10
(
card
);
String
[]
cardval
=
validateIdCard10
(
card
);
if
(
cardval
!=
null
&&
cardval
[
2
].
equals
(
"true"
))
{
return
cardval
!=
null
&&
cardval
[
2
].
equals
(
"true"
);
return
true
;
}
return
false
;
}
}
/**
/**
...
@@ -339,7 +330,7 @@ public class SfzhUtil {
...
@@ -339,7 +330,7 @@ public class SfzhUtil {
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
iflag
--;
iflag
--;
}
}
return
(
sum
%
10
==
0
?
0
:
(
10
-
sum
%
10
))
==
Integer
.
valueOf
(
end
)
?
true
:
false
;
return
(
sum
%
10
==
0
?
0
:
(
10
-
sum
%
10
))
==
Integer
.
valueOf
(
end
);
}
}
/**
/**
...
@@ -373,12 +364,12 @@ public class SfzhUtil {
...
@@ -373,12 +364,12 @@ public class SfzhUtil {
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
iflag
--;
iflag
--;
}
}
if
(
end
.
toUpperCase
().
equals
(
"A"
))
{
if
(
end
.
equalsIgnoreCase
(
"A"
))
{
sum
=
sum
+
10
;
sum
=
sum
+
10
;
}
else
{
}
else
{
sum
=
sum
+
Integer
.
valueOf
(
end
);
sum
=
sum
+
Integer
.
valueOf
(
end
);
}
}
return
(
sum
%
11
==
0
)
?
true
:
false
;
return
sum
%
11
==
0
;
}
}
/**
/**
...
@@ -595,7 +586,7 @@ public class SfzhUtil {
...
@@ -595,7 +586,7 @@ public class SfzhUtil {
* @return 提取的数字。
* @return 提取的数字。
*/
*/
public
static
boolean
isNum
(
String
val
)
{
public
static
boolean
isNum
(
String
val
)
{
return
val
==
null
||
""
.
equals
(
val
)
?
false
:
val
.
matches
(
"^[0-9]*$"
);
return
val
!=
null
&&
!
""
.
equals
(
val
)
&&
val
.
matches
(
"^[0-9]*$"
);
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
e900ce25
...
@@ -6,6 +6,7 @@ import com.yanzuoguang.util.exception.ExceptionHelper;
...
@@ -6,6 +6,7 @@ import com.yanzuoguang.util.exception.ExceptionHelper;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -38,13 +39,10 @@ public class StringHelper {
...
@@ -38,13 +39,10 @@ public class StringHelper {
* @return 检测结果
* @return 检测结果
*/
*/
public
static
boolean
isEmptyChar
(
char
p
)
{
public
static
boolean
isEmptyChar
(
char
p
)
{
if
(
p
==
'\r'
return
p
==
'\r'
||
p
==
'\n'
||
p
==
'\n'
||
p
==
'\t'
||
p
==
'\t'
||
p
==
' '
)
{
||
p
==
' '
;
return
true
;
}
return
false
;
}
}
/**
/**
...
@@ -898,7 +896,7 @@ public class StringHelper {
...
@@ -898,7 +896,7 @@ public class StringHelper {
*/
*/
public
static
String
md5
(
String
string
)
{
public
static
String
md5
(
String
string
)
{
try
{
try
{
byte
[]
hash
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
string
.
getBytes
(
"UTF-8"
));
byte
[]
hash
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
string
.
getBytes
(
StandardCharsets
.
UTF_8
));
StringBuilder
hex
=
new
StringBuilder
(
hash
.
length
*
2
);
StringBuilder
hex
=
new
StringBuilder
(
hash
.
length
*
2
);
for
(
byte
b
:
hash
)
{
for
(
byte
b
:
hash
)
{
if
((
b
&
0xFF
)
<
0x10
)
{
if
((
b
&
0xFF
)
<
0x10
)
{
...
@@ -909,8 +907,6 @@ public class StringHelper {
...
@@ -909,8 +907,6 @@ public class StringHelper {
return
hex
.
toString
();
return
hex
.
toString
();
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
return
StringHelper
.
EMPTY
;
return
StringHelper
.
EMPTY
;
}
}
...
@@ -927,7 +923,7 @@ public class StringHelper {
...
@@ -927,7 +923,7 @@ public class StringHelper {
// 生成实现指定摘要算法的 MessageDigest 对象。
// 生成实现指定摘要算法的 MessageDigest 对象。
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
// 使用指定的字节数组更新摘要。
// 使用指定的字节数组更新摘要。
md
.
update
(
from
.
getBytes
(
Charset
.
forName
(
"utf-8"
)
));
md
.
update
(
from
.
getBytes
(
StandardCharsets
.
UTF_8
));
// 通过执行诸如填充之类的最终操作完成哈希计算。
// 通过执行诸如填充之类的最终操作完成哈希计算。
byte
[]
b
=
md
.
digest
();
byte
[]
b
=
md
.
digest
();
// 生成具体的md5密码到buf数组
// 生成具体的md5密码到buf数组
...
@@ -1148,7 +1144,7 @@ public class StringHelper {
...
@@ -1148,7 +1144,7 @@ public class StringHelper {
});
});
}
}
private
static
Pattern
reg
=
Pattern
.
compile
(
"\\{(.+?)\\}"
);
private
static
final
Pattern
reg
=
Pattern
.
compile
(
"\\{(.+?)\\}"
);
/**
/**
* 进行字段格式化处理
* 进行字段格式化处理
...
@@ -1165,7 +1161,7 @@ public class StringHelper {
...
@@ -1165,7 +1161,7 @@ public class StringHelper {
while
(
matches
.
find
())
{
while
(
matches
.
find
())
{
int
len
=
matches
.
start
()
-
start
;
int
len
=
matches
.
start
()
-
start
;
if
(
len
>
0
)
{
if
(
len
>
0
)
{
sb
.
append
(
format
.
substring
(
start
,
matches
.
start
()
));
sb
.
append
(
format
,
start
,
matches
.
start
(
));
}
}
String
group
=
matches
.
group
(
0
);
String
group
=
matches
.
group
(
0
);
String
fieldFull
=
matches
.
group
(
1
);
String
fieldFull
=
matches
.
group
(
1
);
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/TypeHelper.java
View file @
e900ce25
...
@@ -59,10 +59,7 @@ public class TypeHelper {
...
@@ -59,10 +59,7 @@ public class TypeHelper {
* @return
* @return
*/
*/
public
static
boolean
isClass
(
Class
from
,
Class
to
)
{
public
static
boolean
isClass
(
Class
from
,
Class
to
)
{
if
(
from
.
equals
(
to
))
{
return
from
.
equals
(
to
);
return
true
;
}
return
false
;
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/YzgLanguage.java
View file @
e900ce25
...
@@ -40,16 +40,16 @@ public class YzgLanguage {
...
@@ -40,16 +40,16 @@ public class YzgLanguage {
/**
/**
* 当前线程默认语言
* 当前线程默认语言
*/
*/
private
ThreadLocal
<
String
>
threadLanguage
=
new
ThreadLocal
<>();
private
final
ThreadLocal
<
String
>
threadLanguage
=
new
ThreadLocal
<>();
/**
/**
* 当前线程默认场景
* 当前线程默认场景
*/
*/
private
ThreadLocal
<
String
>
threadScene
=
new
ThreadLocal
<>();
private
final
ThreadLocal
<
String
>
threadScene
=
new
ThreadLocal
<>();
/**
/**
* 场景语言
* 场景语言
*/
*/
private
Map
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>
mapScene
=
new
HashMap
<>();
private
final
Map
<
String
,
Map
<
String
,
Map
<
String
,
String
>>>
mapScene
=
new
HashMap
<>();
/**
/**
* 设置默认语言,默认为英语(en)
* 设置默认语言,默认为英语(en)
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
View file @
e900ce25
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.util.YzgError;
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.util.YzgError;
import
java.io.*
;
import
java.io.*
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
...
@@ -45,7 +46,7 @@ public class ZipHelper {
...
@@ -45,7 +46,7 @@ public class ZipHelper {
dirName
=
dirFile
.
getName
()
+
File
.
separator
;
dirName
=
dirFile
.
getName
()
+
File
.
separator
;
}
}
// 创建zip输出流
// 创建zip输出流
ZipOutputStream
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipFile
),
Charset
.
forName
(
"UTF-8"
)
);
ZipOutputStream
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipFile
),
StandardCharsets
.
UTF_8
);
try
{
try
{
// 创建缓冲输出流
// 创建缓冲输出流
BufferedOutputStream
bufferOutStream
=
new
BufferedOutputStream
(
zipOutStream
);
BufferedOutputStream
bufferOutStream
=
new
BufferedOutputStream
(
zipOutStream
);
...
@@ -84,7 +85,7 @@ public class ZipHelper {
...
@@ -84,7 +85,7 @@ public class ZipHelper {
*/
*/
public
static
void
zipTo
(
File
zipTo
,
File
zipFrom
,
String
sourcePath
,
File
...
sourceFiles
)
throws
IOException
{
public
static
void
zipTo
(
File
zipTo
,
File
zipFrom
,
String
sourcePath
,
File
...
sourceFiles
)
throws
IOException
{
// 创建zip输出流
// 创建zip输出流
ZipOutputStream
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipTo
),
Charset
.
forName
(
"UTF-8"
)
);
ZipOutputStream
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipTo
),
StandardCharsets
.
UTF_8
);
try
{
try
{
// 创建缓冲输出流
// 创建缓冲输出流
BufferedOutputStream
bufferOutStream
=
new
BufferedOutputStream
(
zipOutStream
);
BufferedOutputStream
bufferOutStream
=
new
BufferedOutputStream
(
zipOutStream
);
...
@@ -121,10 +122,10 @@ public class ZipHelper {
...
@@ -121,10 +122,10 @@ public class ZipHelper {
ZipOutputStream
zipOutStream
;
ZipOutputStream
zipOutStream
;
if
(
exints
)
{
if
(
exints
)
{
// 创建临时压缩文件
// 创建临时压缩文件
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
tempFile
),
Charset
.
forName
(
"UTF-8"
)
);
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
tempFile
),
StandardCharsets
.
UTF_8
);
}
else
{
}
else
{
// 新创建压缩文件
// 新创建压缩文件
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipTo
),
Charset
.
forName
(
"UTF-8"
)
);
zipOutStream
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipTo
),
StandardCharsets
.
UTF_8
);
}
}
try
{
try
{
// 创建缓冲输出流
// 创建缓冲输出流
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/log/Log.java
View file @
e900ce25
...
@@ -15,12 +15,12 @@ public class Log {
...
@@ -15,12 +15,12 @@ public class Log {
/**
/**
* 当前线程缓存的对象
* 当前线程缓存的对象
*/
*/
private
static
HashMap
<
String
,
LogDate
>
threadCache
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
LogDate
>
threadCache
=
new
HashMap
<>();
/**
/**
* 缓存的日志处理对象
* 缓存的日志处理对象
*/
*/
private
static
RunnableLog
writeLogDefault
=
new
LogDefault
();
private
static
final
RunnableLog
writeLogDefault
=
new
LogDefault
();
/**
/**
* 写入错误消息
* 写入错误消息
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/log/LogDefault.java
View file @
e900ce25
...
@@ -64,11 +64,11 @@ public class LogDefault implements RunnableLog {
...
@@ -64,11 +64,11 @@ public class LogDefault implements RunnableLog {
sb
.
append
(
ex
.
getClass
().
getName
());
sb
.
append
(
ex
.
getClass
().
getName
());
sb
.
append
(
ex
.
getMessage
());
sb
.
append
(
ex
.
getMessage
());
sb
.
append
(
System
.
getProperty
(
"line.separator"
));
sb
.
append
(
System
.
getProperty
(
"line.separator"
));
System
.
err
.
print
(
sb
.
toString
()
);
System
.
err
.
print
(
sb
);
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
else
{
}
else
{
sb
.
append
(
System
.
getProperty
(
"line.separator"
));
sb
.
append
(
System
.
getProperty
(
"line.separator"
));
System
.
out
.
print
(
sb
.
toString
()
);
System
.
out
.
print
(
sb
);
}
}
if
(!
StringHelper
.
isEmpty
(
pathFormat
))
{
if
(!
StringHelper
.
isEmpty
(
pathFormat
))
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/AbstractThreadList.java
View file @
e900ce25
...
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
* @author 颜佐光
* @author 颜佐光
*/
*/
public
abstract
class
AbstractThreadList
<
T
extends
Object
>
implements
ThreadWaitExecute
{
public
abstract
class
AbstractThreadList
<
T
extends
Object
>
implements
ThreadWaitExecute
{
private
long
threadID
;
private
final
long
threadID
;
/**
/**
* 线程等待间隔
* 线程等待间隔
*/
*/
...
@@ -27,32 +27,32 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
...
@@ -27,32 +27,32 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
/**
/**
* 线程记录数量
* 线程记录数量
*/
*/
private
int
logSize
=
1000
;
private
final
int
logSize
=
1000
;
/**
/**
* 线程人数
* 线程人数
*/
*/
private
volatile
ThreadListNum
threadListNum
=
new
ThreadListNum
();
private
final
ThreadListNum
threadListNum
=
new
ThreadListNum
();
/**
/**
* 缓存队列
* 缓存队列
*/
*/
private
volatile
LinkedBlockingQueue
<
T
>
cache
=
new
LinkedBlockingQueue
<
T
>();
private
final
LinkedBlockingQueue
<
T
>
cache
=
new
LinkedBlockingQueue
<
T
>();
/**
/**
* 缓存的线程
* 缓存的线程
*/
*/
private
Map
<
Thread
,
ThreadListData
<
T
>>
cacheThread
=
new
Hashtable
<
Thread
,
ThreadListData
<
T
>>();
private
final
Map
<
Thread
,
ThreadListData
<
T
>>
cacheThread
=
new
Hashtable
<
Thread
,
ThreadListData
<
T
>>();
/**
/**
* 缓存的异常数据
* 缓存的异常数据
*/
*/
private
List
<
RuntimeException
>
exceptions
=
new
ArrayList
<>();
private
final
List
<
RuntimeException
>
exceptions
=
new
ArrayList
<>();
/**
/**
* 等待对象
* 等待对象
*/
*/
private
ThreadWait
threadWait
=
new
ThreadWait
(
this
);
private
final
ThreadWait
threadWait
=
new
ThreadWait
(
this
);
/**
/**
* 线程开启数量
* 线程开启数量
...
@@ -214,10 +214,7 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
...
@@ -214,10 +214,7 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
if
(
this
.
isWait
())
{
if
(
this
.
isWait
())
{
return
false
;
return
false
;
}
}
if
(
cacheThread
.
size
()
==
0
)
{
return
cacheThread
.
size
()
==
0
;
return
true
;
}
return
false
;
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunPlan.java
View file @
e900ce25
...
@@ -17,27 +17,27 @@ public class RunPlan {
...
@@ -17,27 +17,27 @@ public class RunPlan {
/**
/**
* 任务锁
* 任务锁
*/
*/
private
Object
lock
=
new
Object
();
private
final
Object
lock
=
new
Object
();
/**
/**
* 任务队列
* 任务队列
*/
*/
private
List
<
RunPlanData
>
list
=
new
ArrayList
<>();
private
final
List
<
RunPlanData
>
list
=
new
ArrayList
<>();
/**
/**
* 增加时触发的事件队列
* 增加时触发的事件队列
*/
*/
private
Event
<
Runnable
>
onAdd
=
new
Event
<>();
private
final
Event
<
Runnable
>
onAdd
=
new
Event
<>();
/**
/**
* 增加时触发的事件队列
* 增加时触发的事件队列
*/
*/
private
Event
<
Runnable
>
onRemove
=
new
Event
<>();
private
final
Event
<
Runnable
>
onRemove
=
new
Event
<>();
/**
/**
* 单项成功执行时的事件队列
* 单项成功执行时的事件队列
*/
*/
private
Event
<
Runnable
>
onItemExecuted
=
new
Event
<>();
private
final
Event
<
Runnable
>
onItemExecuted
=
new
Event
<>();
/**
/**
* 全部执行完时触发的事件队列
* 全部执行完时触发的事件队列
*/
*/
private
Event
<
Runnable
>
onExecuted
=
new
Event
<>();
private
final
Event
<
Runnable
>
onExecuted
=
new
Event
<>();
/**
/**
* 增加时触发的事件队列
* 增加时触发的事件队列
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAuto.java
View file @
e900ce25
...
@@ -22,7 +22,7 @@ public final class RunnableListAuto {
...
@@ -22,7 +22,7 @@ public final class RunnableListAuto {
/**
/**
* 缓存的执行对象的数据大小
* 缓存的执行对象的数据大小
*/
*/
private
static
Map
<
String
,
RunnableListAutoItem
>
cache
=
new
Hashtable
<
String
,
RunnableListAutoItem
>();
private
static
final
Map
<
String
,
RunnableListAutoItem
>
cache
=
new
Hashtable
<
String
,
RunnableListAutoItem
>();
/**
/**
* 自动开启线程去执行代码,并根据执行时间调整先后顺序
* 自动开启线程去执行代码,并根据执行时间调整先后顺序
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
View file @
e900ce25
...
@@ -12,7 +12,7 @@ import java.util.concurrent.Executors;
...
@@ -12,7 +12,7 @@ import java.util.concurrent.Executors;
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
ThreadHelper
{
public
class
ThreadHelper
{
private
static
Object
threadLock
=
new
Object
();
private
static
final
Object
threadLock
=
new
Object
();
private
static
boolean
threadIsRun
=
false
;
private
static
boolean
threadIsRun
=
false
;
private
static
Date
threadDate
=
null
;
private
static
Date
threadDate
=
null
;
private
static
RunPlan
timeout
;
private
static
RunPlan
timeout
;
...
@@ -22,7 +22,7 @@ public class ThreadHelper {
...
@@ -22,7 +22,7 @@ public class ThreadHelper {
/**
/**
* 线程对象
* 线程对象
*/
*/
private
static
ExecutorService
executeService
=
Executors
.
newCachedThreadPool
();
private
static
final
ExecutorService
executeService
=
Executors
.
newCachedThreadPool
();
/**
/**
* 初始化线程对象,需要调用该函数之后才能使用
* 初始化线程对象,需要调用该函数之后才能使用
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
View file @
e900ce25
...
@@ -17,7 +17,7 @@ public class ThreadWait {
...
@@ -17,7 +17,7 @@ public class ThreadWait {
/**
/**
* 需要判断的任务
* 需要判断的任务
*/
*/
private
ThreadWaitExecute
execute
;
private
final
ThreadWaitExecute
execute
;
/**
/**
* 取消定时任务
* 取消定时任务
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/DataDaoVo.java
View file @
e900ce25
...
@@ -12,10 +12,10 @@ import java.util.Map;
...
@@ -12,10 +12,10 @@ import java.util.Map;
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
DataDaoVo
<
T
>
{
public
class
DataDaoVo
<
T
>
{
private
List
<
T
>
creates
=
new
ArrayList
<>();
private
final
List
<
T
>
creates
=
new
ArrayList
<>();
private
List
<
T
>
updates
=
new
ArrayList
<>();
private
final
List
<
T
>
updates
=
new
ArrayList
<>();
private
List
<
T
>
removes
=
new
ArrayList
<>();
private
final
List
<
T
>
removes
=
new
ArrayList
<>();
private
Map
<
String
,
T
>
mapNow
=
new
HashMap
<>();
private
final
Map
<
String
,
T
>
mapNow
=
new
HashMap
<>();
/**
/**
* 将历史数据映射为HashMap
* 将历史数据映射为HashMap
...
...
yzg-util-base/src/test/java/helper/TestSfzUtil.java
View file @
e900ce25
...
@@ -97,7 +97,7 @@ public class TestSfzUtil {
...
@@ -97,7 +97,7 @@ public class TestSfzUtil {
* @return 提取的数字。
* @return 提取的数字。
*/
*/
public
static
boolean
isNum
(
String
val
)
{
public
static
boolean
isNum
(
String
val
)
{
return
val
==
null
||
""
.
equals
(
val
)
?
false
:
val
.
matches
(
"^[0-9]*$"
);
return
val
!=
null
&&
!
""
.
equals
(
val
)
&&
val
.
matches
(
"^[0-9]*$"
);
}
}
...
@@ -195,7 +195,7 @@ public class TestSfzUtil {
...
@@ -195,7 +195,7 @@ public class TestSfzUtil {
/**
/**
* 每位加权因子
* 每位加权因子
*/
*/
public
static
final
int
power
[]
=
{
public
static
final
int
[]
power
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
};
}
}
yzg-util-chinese/src/main/java/com/yanzuoguang/util/ChineseHelper.java
View file @
e900ce25
...
@@ -32,7 +32,7 @@ public class ChineseHelper {
...
@@ -32,7 +32,7 @@ public class ChineseHelper {
* ^[\u4E00-\u9FFF]+$ 匹配简体和繁体
* ^[\u4E00-\u9FFF]+$ 匹配简体和繁体
* ^[\u4E00-\u9FA5]+$ 匹配简体
* ^[\u4E00-\u9FA5]+$ 匹配简体
*/
*/
private
static
Pattern
pattern
=
Pattern
.
compile
(
"^[\u4E00-\u9FFF]+$"
);
private
static
final
Pattern
pattern
=
Pattern
.
compile
(
"^[\u4E00-\u9FFF]+$"
);
/**
/**
* 获取汉字全拼
* 获取汉字全拼
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/BaseRequestAspect.java
View file @
e900ce25
...
@@ -43,7 +43,7 @@ public class BaseRequestAspect {
...
@@ -43,7 +43,7 @@ public class BaseRequestAspect {
@Autowired
@Autowired
protected
CloudConfig
cloudConfig
;
protected
CloudConfig
cloudConfig
;
private
ResponseResult
responseDefault
=
new
ResponseResult
();
private
final
ResponseResult
responseDefault
=
new
ResponseResult
();
/**
/**
* 开始记录日志对象
* 开始记录日志对象
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/RequestCacheResult.java
View file @
e900ce25
...
@@ -20,7 +20,7 @@ public class RequestCacheResult {
...
@@ -20,7 +20,7 @@ public class RequestCacheResult {
/**
/**
* 请求编号
* 请求编号
*/
*/
private
String
reqID
;
private
final
String
reqID
;
/**
/**
* 结果
* 结果
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/Timeout.java
View file @
e900ce25
...
@@ -11,7 +11,7 @@ public class Timeout<T extends Object> {
...
@@ -11,7 +11,7 @@ public class Timeout<T extends Object> {
/**
/**
* 开始时间
* 开始时间
*/
*/
private
long
start
;
private
final
long
start
;
/**
/**
* 上次通知时间
* 上次通知时间
...
@@ -21,7 +21,7 @@ public class Timeout<T extends Object> {
...
@@ -21,7 +21,7 @@ public class Timeout<T extends Object> {
/**
/**
* 结束时间
* 结束时间
*/
*/
private
T
data
;
private
final
T
data
;
/**
/**
* 构造函数
* 构造函数
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/YzgFileProcedure.java
View file @
e900ce25
...
@@ -40,8 +40,8 @@ public class YzgFileProcedure implements InitializingBean {
...
@@ -40,8 +40,8 @@ public class YzgFileProcedure implements InitializingBean {
/**
/**
* 缓存24小时
* 缓存24小时
*/
*/
private
MemoryCache
<
Boolean
>
folderCache
=
new
MemoryCache
<>(
24
*
60
*
60
);
private
final
MemoryCache
<
Boolean
>
folderCache
=
new
MemoryCache
<>(
24
*
60
*
60
);
private
Map
<
String
,
Boolean
>
mapCallbackMQ
=
new
HashMap
<>();
private
final
Map
<
String
,
Boolean
>
mapCallbackMQ
=
new
HashMap
<>();
@Autowired
@Autowired
private
MqService
mqService
;
private
MqService
mqService
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/service/TokenServiceCall.java
View file @
e900ce25
...
@@ -22,7 +22,7 @@ public class TokenServiceCall implements TokenLoad, ApplicationContextAware {
...
@@ -22,7 +22,7 @@ public class TokenServiceCall implements TokenLoad, ApplicationContextAware {
private
TokenService
tokenService
=
null
;
private
TokenService
tokenService
=
null
;
private
MemoryCache
<
Integer
>
countCache
=
new
MemoryCache
<>();
private
final
MemoryCache
<
Integer
>
countCache
=
new
MemoryCache
<>();
public
TokenServiceCall
()
{
public
TokenServiceCall
()
{
TokenHelper
.
setTokenLoad
(
this
);
TokenHelper
.
setTokenLoad
(
this
);
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/cond/SqlCondEquals.java
View file @
e900ce25
...
@@ -22,7 +22,7 @@ public class SqlCondEquals extends SqlCondBase<SqlCondEquals> {
...
@@ -22,7 +22,7 @@ public class SqlCondEquals extends SqlCondBase<SqlCondEquals> {
private
boolean
valIsInteger
=
false
;
private
boolean
valIsInteger
=
false
;
private
Map
<
Object
,
Boolean
>
mapValue
=
new
HashMap
<>();
private
final
Map
<
Object
,
Boolean
>
mapValue
=
new
HashMap
<>();
public
SqlCondEquals
(
String
field
,
Object
...
vals
)
{
public
SqlCondEquals
(
String
field
,
Object
...
vals
)
{
this
(
Arrays
.
asList
(
field
),
vals
);
this
(
Arrays
.
asList
(
field
),
vals
);
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
View file @
e900ce25
...
@@ -35,7 +35,7 @@ public class TableSqlCache {
...
@@ -35,7 +35,7 @@ public class TableSqlCache {
/**
/**
* 根据Sql语句类型进行缓存,按照类型进行缓存
* 根据Sql语句类型进行缓存,按照类型进行缓存
*/
*/
private
MemoryCache
<
List
<
SqlData
>>
typeCache
=
new
MemoryCache
<>();
private
final
MemoryCache
<
List
<
SqlData
>>
typeCache
=
new
MemoryCache
<>();
/**
/**
* 构造函数
* 构造函数
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
e900ce25
...
@@ -30,7 +30,7 @@ public class TableStruct {
...
@@ -30,7 +30,7 @@ public class TableStruct {
/**
/**
* 缓存的字段,根据字段的类型进行缓存,同一个字段可能会属于多个类型。
* 缓存的字段,根据字段的类型进行缓存,同一个字段可能会属于多个类型。
*/
*/
private
Map
<
Integer
,
List
<
TableFieldVo
>>
typeFieldCache
=
new
HashMap
<>();
private
final
Map
<
Integer
,
List
<
TableFieldVo
>>
typeFieldCache
=
new
HashMap
<>();
/**
/**
* 构造函数
* 构造函数
...
...
yzg-util-db/src/main/java/com/yanzuoguang/db/impl/AllBeanRowMapper.java
View file @
e900ce25
...
@@ -47,7 +47,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
...
@@ -47,7 +47,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
/**
/**
* 配置信息
* 配置信息
*/
*/
private
ConfigDb
configDb
;
private
final
ConfigDb
configDb
;
/**
/**
* 构造函数
* 构造函数
...
@@ -228,7 +228,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
...
@@ -228,7 +228,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
/**
/**
* 缓存的处理类
* 缓存的处理类
*/
*/
private
static
Map
<
Class
,
Object
>
Cache
=
new
HashMap
<
Class
,
Object
>();
private
static
final
Map
<
Class
,
Object
>
Cache
=
new
HashMap
<
Class
,
Object
>();
/**
/**
* 获取可以转化实体
* 获取可以转化实体
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
e900ce25
...
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
...
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
ExcelConsole
<
T
extends
Object
>
implements
DbRow
<
T
>
{
public
class
ExcelConsole
<
T
extends
Object
>
implements
DbRow
<
T
>
{
private
Pattern
chinese
=
Pattern
.
compile
(
"[^x00-xff]"
);
private
final
Pattern
chinese
=
Pattern
.
compile
(
"[^x00-xff]"
);
/**
/**
* 配置信息
* 配置信息
*/
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelRowDefault.java
View file @
e900ce25
...
@@ -21,7 +21,7 @@ public class ExcelRowDefault implements ExcelRow<Object> {
...
@@ -21,7 +21,7 @@ public class ExcelRowDefault implements ExcelRow<Object> {
return
ObjectHelper
.
getString
(
row
,
field
);
return
ObjectHelper
.
getString
(
row
,
field
);
}
}
private
static
ExcelRowDefault
my
=
new
ExcelRowDefault
();
private
static
final
ExcelRowDefault
my
=
new
ExcelRowDefault
();
/**
/**
* 获取默认实例
* 获取默认实例
...
...
yzg-util-file/src/main/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
View file @
e900ce25
...
@@ -44,7 +44,7 @@ public class YzgFileServiceImpl implements YzgFileService, ApplicationContextAwa
...
@@ -44,7 +44,7 @@ public class YzgFileServiceImpl implements YzgFileService, ApplicationContextAwa
private
YzgFileProcedure
procedure
;
private
YzgFileProcedure
procedure
;
private
MemoryCache
<
Boolean
>
cacheRemoveTempFolder
=
new
MemoryCache
<>(
10
*
60
);
private
final
MemoryCache
<
Boolean
>
cacheRemoveTempFolder
=
new
MemoryCache
<>(
10
*
60
);
/**
/**
* Set the ApplicationContext that this object runs in.
* Set the ApplicationContext that this object runs in.
...
...
yzg-util-image/src/main/java/com/yanzuoguang/media/HlsDownloader.java
View file @
e900ce25
...
@@ -7,6 +7,7 @@ import com.yanzuoguang.util.thread.ThreadHelper;
...
@@ -7,6 +7,7 @@ import com.yanzuoguang.util.thread.ThreadHelper;
import
java.io.*
;
import
java.io.*
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,7 +23,7 @@ public class HlsDownloader {
...
@@ -22,7 +23,7 @@ public class HlsDownloader {
/**
/**
* 匹配ts文件
* 匹配ts文件
*/
*/
private
static
Pattern
pattern
=
Pattern
.
compile
(
".*ts"
);
private
static
final
Pattern
pattern
=
Pattern
.
compile
(
".*ts"
);
/**
/**
* 源地址
* 源地址
*/
*/
...
@@ -160,7 +161,7 @@ public class HlsDownloader {
...
@@ -160,7 +161,7 @@ public class HlsDownloader {
StringBuilder
content
=
new
StringBuilder
();
StringBuilder
content
=
new
StringBuilder
();
URL
url
=
new
URL
(
this
.
serverUrl
);
URL
url
=
new
URL
(
this
.
serverUrl
);
//下载资源
//下载资源
try
(
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
"UTF-8"
)))
{
try
(
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
StandardCharsets
.
UTF_8
)))
{
String
line
;
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
while
((
line
=
in
.
readLine
())
!=
null
)
{
content
.
append
(
line
);
content
.
append
(
line
);
...
...
yzg-util-image/src/main/java/com/yanzuoguang/media/MediaCacheLocal.java
View file @
e900ce25
...
@@ -12,7 +12,7 @@ import java.util.Map;
...
@@ -12,7 +12,7 @@ import java.util.Map;
*/
*/
public
class
MediaCacheLocal
implements
MediaCacheBase
{
public
class
MediaCacheLocal
implements
MediaCacheBase
{
private
Map
<
String
,
MapLock
>
mapLock
=
new
HashMap
<
String
,
MapLock
>();
private
final
Map
<
String
,
MapLock
>
mapLock
=
new
HashMap
<
String
,
MapLock
>();
/**
/**
* 获取缓存是否正在执行
* 获取缓存是否正在执行
...
...
yzg-util-image/src/main/java/com/yanzuoguang/media/MediaFirst.java
View file @
e900ce25
...
@@ -24,7 +24,7 @@ public class MediaFirst {
...
@@ -24,7 +24,7 @@ public class MediaFirst {
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
private
MediaCache
cache
;
private
MediaCache
cache
;
private
MediaCacheBase
cacheLocal
=
new
MediaCacheLocal
();
private
final
MediaCacheBase
cacheLocal
=
new
MediaCacheLocal
();
public
MediaFirst
()
{
public
MediaFirst
()
{
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageLogServiceImpl.java
View file @
e900ce25
...
@@ -38,7 +38,7 @@ public class MessageLogServiceImpl implements MessageLogService {
...
@@ -38,7 +38,7 @@ public class MessageLogServiceImpl implements MessageLogService {
@Autowired
@Autowired
private
YzgMqProcedure
yzgMqProcedure
;
private
YzgMqProcedure
yzgMqProcedure
;
private
ThreadLocal
<
Message
>
localMessage
=
new
ThreadLocal
<>();
private
final
ThreadLocal
<
Message
>
localMessage
=
new
ThreadLocal
<>();
/**
/**
* 写入当前对象
* 写入当前对象
...
...
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/format/FormatCenter.java
View file @
e900ce25
...
@@ -12,8 +12,8 @@ import java.util.Map;
...
@@ -12,8 +12,8 @@ import java.util.Map;
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
FormatCenter
{
public
class
FormatCenter
{
private
static
FormatCenter
formatCenter
=
new
FormatCenter
();
private
static
final
FormatCenter
formatCenter
=
new
FormatCenter
();
private
Map
<
String
,
FormatHandle
>
cache
=
new
HashMap
<>();
private
final
Map
<
String
,
FormatHandle
>
cache
=
new
HashMap
<>();
private
boolean
init
=
false
;
private
boolean
init
=
false
;
private
FormatCenter
()
{
private
FormatCenter
()
{
...
...
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/format/FormatHandleDefault.java
View file @
e900ce25
...
@@ -45,7 +45,7 @@ public class FormatHandleDefault implements FormatHandle {
...
@@ -45,7 +45,7 @@ public class FormatHandleDefault implements FormatHandle {
}
}
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
formatValue
.
substring
(
0
,
start
)
);
sb
.
append
(
formatValue
,
0
,
start
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
sb
.
append
(
"*"
);
sb
.
append
(
"*"
);
}
}
...
...
yzg-util-redis/src/main/java/com.yanzuoguang.redis/CacheLock.java
View file @
e900ce25
...
@@ -20,25 +20,25 @@ public class CacheLock implements Runnable {
...
@@ -20,25 +20,25 @@ public class CacheLock implements Runnable {
/**
/**
* 缓存对象
* 缓存对象
*/
*/
private
Cache
cache
;
private
final
Cache
cache
;
/**
/**
* Redis 锁定时间(豪秒)
* Redis 锁定时间(豪秒)
*/
*/
private
int
lockTime
;
private
final
int
lockTime
;
/**
/**
* 每次等待时间(毫秒)
* 每次等待时间(毫秒)
*/
*/
private
int
waitUnitTime
;
private
final
int
waitUnitTime
;
/**
/**
* 关键字
* 关键字
*/
*/
private
String
key
;
private
final
String
key
;
/**
/**
* 执行函数
* 执行函数
*/
*/
private
Runnable
funcWait
;
private
final
Runnable
funcWait
;
/**
/**
* 执行函数
* 执行函数
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment