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
951e5ae4
Commit
951e5ae4
authored
Dec 12, 2024
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复异常提醒,从而正确的跟踪异常信息
parent
fb618e70
Changes
42
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
135 additions
and
129 deletions
+135
-129
YzgErrorData.java
...base/src/main/java/com/yanzuoguang/util/YzgErrorData.java
+4
-2
ObjectHelper.java
...src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
+1
-1
ExceptionHelper.java
.../java/com/yanzuoguang/util/exception/ExceptionHelper.java
+14
-0
CheckerHelper.java
.../main/java/com/yanzuoguang/util/helper/CheckerHelper.java
+8
-7
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+4
-6
DesHelper.java
.../src/main/java/com/yanzuoguang/util/helper/DesHelper.java
+6
-4
EnumHelper.java
...src/main/java/com/yanzuoguang/util/helper/EnumHelper.java
+1
-3
JsonHelper.java
...src/main/java/com/yanzuoguang/util/helper/JsonHelper.java
+5
-10
RunHelper.java
.../src/main/java/com/yanzuoguang/util/helper/RunHelper.java
+4
-5
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+1
-1
UrlHelper.java
.../src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
+2
-1
YzgTimeout.java
...src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
+3
-2
Log.java
...util-base/src/main/java/com/yanzuoguang/util/log/Log.java
+21
-14
LogDefault.java
...se/src/main/java/com/yanzuoguang/util/log/LogDefault.java
+1
-3
SfzHandle15.java
...e/src/main/java/com/yanzuoguang/util/sfz/SfzHandle15.java
+4
-2
SfzHandle18.java
...e/src/main/java/com/yanzuoguang/util/sfz/SfzHandle18.java
+3
-1
ProcessData.java
...rc/main/java/com/yanzuoguang/util/thread/ProcessData.java
+1
-1
RunPlan.java
...se/src/main/java/com/yanzuoguang/util/thread/RunPlan.java
+1
-4
RunnableListAutoItem.java
...ava/com/yanzuoguang/util/thread/RunnableListAutoItem.java
+2
-1
ThreadHelper.java
...c/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
+0
-2
ThreadNext.java
...src/main/java/com/yanzuoguang/util/thread/ThreadNext.java
+3
-2
ThreadWait.java
...src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
+2
-1
BaseVo.java
...il-base/src/main/java/com/yanzuoguang/util/vo/BaseVo.java
+4
-3
HttpHelperTest.java
yzg-util-base/src/test/java/helper/HttpHelperTest.java
+2
-1
TestDateHelper.java
yzg-util-base/src/test/java/helper/TestDateHelper.java
+2
-1
TestSfzUtil.java
yzg-util-base/src/test/java/helper/TestSfzUtil.java
+2
-1
AspectLogResult.java
.../main/java/com/yanzuoguang/cloud/aop/AspectLogResult.java
+1
-1
AspectLogStart.java
...c/main/java/com/yanzuoguang/cloud/aop/AspectLogStart.java
+2
-1
LogBase.java
.../src/main/java/com/yanzuoguang/cloud/aop/log/LogBase.java
+2
-1
YzgEnvironmentPostProcessor.java
...om/yanzuoguang/cloud/env/YzgEnvironmentPostProcessor.java
+2
-2
ExcelHttp.java
.../src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
+2
-1
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+2
-1
YzgFileConsumer.java
...main/java/com/yanzuoguang/cloud/file/YzgFileConsumer.java
+0
-12
HlsDownloader.java
...ge/src/main/java/com/yanzuoguang/media/HlsDownloader.java
+3
-2
MediaFirst.java
...image/src/main/java/com/yanzuoguang/media/MediaFirst.java
+2
-1
MqConfigurable.java
...src/main/java/com/yanzuoguang/mq/base/MqConfigurable.java
+0
-2
YzgMqConsumer.java
.../src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
+13
-18
MessageSendServiceImpl.java
...m/yanzuoguang/mq/service/impl/MessageSendServiceImpl.java
+0
-1
MessageServeServiceImpl.java
.../yanzuoguang/mq/service/impl/MessageServeServiceImpl.java
+0
-2
MqServiceImpl.java
...n/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
+0
-2
QueueServiceImpl.java
...ava/com/yanzuoguang/mq/service/impl/QueueServiceImpl.java
+2
-1
WeChatUtil.java
...src/main/java/com/yanzuoguang/wxxcx/utils/WeChatUtil.java
+3
-2
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgErrorData.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeTargetException
;
import
com.yanzuoguang.util.exception.CodeTargetException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.RuntimeCodeException
;
import
com.yanzuoguang.util.exception.RuntimeCodeException
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -51,10 +52,11 @@ public class YzgErrorData {
...
@@ -51,10 +52,11 @@ public class YzgErrorData {
/**
/**
* 获取全编码
* 获取全编码
*
* @param code 原编码
* @param code 原编码
* @return 返回值
* @return 返回值
*/
*/
public
String
getFullCode
(
String
code
){
public
String
getFullCode
(
String
code
)
{
return
TAG
+
code
;
return
TAG
+
code
;
}
}
...
@@ -142,7 +144,7 @@ public class YzgErrorData {
...
@@ -142,7 +144,7 @@ public class YzgErrorData {
try
{
try
{
message
=
String
.
format
(
message
,
args
);
message
=
String
.
format
(
message
,
args
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
YzgErrorData
.
class
,
e
);
}
}
}
}
return
message
;
return
message
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
View file @
951e5ae4
...
@@ -171,7 +171,7 @@ public class ObjectHelper {
...
@@ -171,7 +171,7 @@ public class ObjectHelper {
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
System
.
err
.
println
(
"字段"
+
field
+
"读取错误"
);
System
.
err
.
println
(
"字段"
+
field
+
"读取错误"
);
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ObjectHelper
.
class
,
ex
);
}
}
return
null
;
return
null
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/exception/ExceptionHelper.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
exception
;
package
com
.
yanzuoguang
.
util
.
exception
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
com.yanzuoguang.util.vo.ResponseResult
;
...
@@ -89,4 +90,17 @@ public class ExceptionHelper {
...
@@ -89,4 +90,17 @@ public class ExceptionHelper {
return
ResponseResult
.
error
(
code
,
msg
);
return
ResponseResult
.
error
(
code
,
msg
);
}
}
}
}
public
static
void
PrintError
(
Class
<?>
cls
,
Throwable
ex
)
{
if
(
ex
==
null
)
{
return
;
}
if
(
ex
instanceof
RuntimeCodeException
)
{
RuntimeCodeException
rce
=
(
RuntimeCodeException
)
ex
;
String
log
=
String
.
format
(
"%s:%s %s target: %s "
,
cls
.
getName
(),
rce
.
getCode
(),
rce
.
getMessage
(),
JsonHelper
.
serialize
(
rce
.
getTarget
()));
System
.
err
.
println
(
log
);
}
else
{
ex
.
printStackTrace
();
}
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/CheckerHelper.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -388,14 +389,14 @@ public final class CheckerHelper {
...
@@ -388,14 +389,14 @@ public final class CheckerHelper {
try
{
try
{
Date
date
=
getDate
(
paramVal
,
formatStr
);
Date
date
=
getDate
(
paramVal
,
formatStr
);
String
dateResult
=
DateHelper
.
getDateTimeString
(
formatStr
,
date
);
String
dateResult
=
DateHelper
.
getDateTimeString
(
formatStr
,
date
);
if
(!
dateResult
.
startsWith
(
paramVal
)){
if
(!
dateResult
.
startsWith
(
paramVal
))
{
String
formatTo
=
StringHelper
.
getFirst
(
formatStr
,
DateHelper
.
FORMAT_SECOND_STRING
);
String
formatTo
=
StringHelper
.
getFirst
(
formatStr
,
DateHelper
.
FORMAT_SECOND_STRING
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatTo
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatTo
);
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
CheckerHelper
.
class
,
e
);
String
formatTo
=
StringHelper
.
getFirst
(
formatStr
,
DateHelper
.
FORMAT_SECOND_STRING
);
String
formatTo
=
StringHelper
.
getFirst
(
formatStr
,
DateHelper
.
FORMAT_SECOND_STRING
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatTo
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatTo
);
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
...
@@ -434,7 +435,7 @@ public final class CheckerHelper {
...
@@ -434,7 +435,7 @@ public final class CheckerHelper {
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
CheckerHelper
.
class
,
e
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatStr
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatStr
);
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
...
@@ -464,7 +465,7 @@ public final class CheckerHelper {
...
@@ -464,7 +465,7 @@ public final class CheckerHelper {
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
CheckerHelper
.
class
,
e
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatStr
);
this
.
checkResult
=
language
.
format
(
PARAM_NOT_DATE
,
paramName
,
formatStr
);
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
951e5ae4
...
@@ -101,7 +101,6 @@ public class DateHelper {
...
@@ -101,7 +101,6 @@ public class DateHelper {
}
}
return
initMillSecond
(
to
,
initMillSecond
);
return
initMillSecond
(
to
,
initMillSecond
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
DateHelper
.
class
,
ex
,
from
);
ExceptionHelper
.
handleException
(
DateHelper
.
class
,
ex
,
from
);
}
}
return
null
;
return
null
;
...
@@ -550,7 +549,7 @@ public class DateHelper {
...
@@ -550,7 +549,7 @@ public class DateHelper {
c
.
set
(
Calendar
.
DATE
,
1
);
c
.
set
(
Calendar
.
DATE
,
1
);
now
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
now
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
DateHelper
.
class
,
e
);
}
}
return
now
;
return
now
;
}
}
...
@@ -617,7 +616,7 @@ public class DateHelper {
...
@@ -617,7 +616,7 @@ public class DateHelper {
SimpleDateFormat
format
=
new
SimpleDateFormat
(
FORMAT_DAY_STRING
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
FORMAT_DAY_STRING
);
return
format
.
format
(
dateFrom
).
equals
(
format
.
format
(
dateTo
));
return
format
.
format
(
dateFrom
).
equals
(
format
.
format
(
dateTo
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
DateHelper
.
class
,
e
);
}
}
return
false
;
return
false
;
}
}
...
@@ -689,8 +688,7 @@ public class DateHelper {
...
@@ -689,8 +688,7 @@ public class DateHelper {
long
fromMill
=
cal
.
getTimeInMillis
();
long
fromMill
=
cal
.
getTimeInMillis
();
cal
.
setTime
(
to
);
cal
.
setTime
(
to
);
long
toMill
=
cal
.
getTimeInMillis
();
long
toMill
=
cal
.
getTimeInMillis
();
long
mill
=
toMill
-
fromMill
;
return
toMill
-
fromMill
;
return
mill
;
}
catch
(
ParseException
ex
)
{
}
catch
(
ParseException
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
...
@@ -854,7 +852,7 @@ public class DateHelper {
...
@@ -854,7 +852,7 @@ public class DateHelper {
*/
*/
public
static
String
getDateTimeString
(
String
format
,
Date
date
)
{
public
static
String
getDateTimeString
(
String
format
,
Date
date
)
{
if
(
date
!=
null
)
{
if
(
date
!=
null
)
{
String
formatTo
=
StringHelper
.
getFirst
(
format
,
FORMAT_SECOND_STRING
);
String
formatTo
=
StringHelper
.
getFirst
(
format
,
FORMAT_SECOND_STRING
);
return
new
SimpleDateFormat
(
formatTo
).
format
(
date
);
return
new
SimpleDateFormat
(
formatTo
).
format
(
date
);
}
}
return
StringHelper
.
EMPTY
;
return
StringHelper
.
EMPTY
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DesHelper.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
import
com.yanzuoguang.util.contants.SystemContants
;
import
com.yanzuoguang.util.contants.SystemContants
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
javax.crypto.Cipher
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKey
;
...
@@ -33,6 +34,7 @@ public class DesHelper {
...
@@ -33,6 +34,7 @@ public class DesHelper {
byte
[]
to
=
processCipher
(
from
,
getSecretKey
(
key
),
Cipher
.
ENCRYPT_MODE
,
ALGORITHM_DES
);
byte
[]
to
=
processCipher
(
from
,
getSecretKey
(
key
),
Cipher
.
ENCRYPT_MODE
,
ALGORITHM_DES
);
return
RsaHelper
.
encodeBase64
(
to
);
return
RsaHelper
.
encodeBase64
(
to
);
}
catch
(
UnsupportedEncodingException
ex
)
{
}
catch
(
UnsupportedEncodingException
ex
)
{
ExceptionHelper
.
PrintError
(
DesHelper
.
class
,
ex
);
throw
new
CodeException
(
"加密失败:"
+
ex
.
getMessage
(),
ex
);
throw
new
CodeException
(
"加密失败:"
+
ex
.
getMessage
(),
ex
);
}
}
}
}
...
@@ -50,6 +52,7 @@ public class DesHelper {
...
@@ -50,6 +52,7 @@ public class DesHelper {
byte
[]
to
=
processCipher
(
from
,
getSecretKey
(
key
),
Cipher
.
DECRYPT_MODE
,
ALGORITHM_DES
);
byte
[]
to
=
processCipher
(
from
,
getSecretKey
(
key
),
Cipher
.
DECRYPT_MODE
,
ALGORITHM_DES
);
return
new
String
(
to
,
SystemContants
.
UTF8
);
return
new
String
(
to
,
SystemContants
.
UTF8
);
}
catch
(
UnsupportedEncodingException
ex
)
{
}
catch
(
UnsupportedEncodingException
ex
)
{
ExceptionHelper
.
PrintError
(
DesHelper
.
class
,
ex
);
throw
new
CodeException
(
"解密失败:"
+
ex
.
getMessage
(),
ex
);
throw
new
CodeException
(
"解密失败:"
+
ex
.
getMessage
(),
ex
);
}
}
}
}
...
@@ -64,10 +67,9 @@ public class DesHelper {
...
@@ -64,10 +67,9 @@ public class DesHelper {
try
{
try
{
DESKeySpec
desKeySpec
=
new
DESKeySpec
(
key
.
getBytes
());
DESKeySpec
desKeySpec
=
new
DESKeySpec
(
key
.
getBytes
());
SecretKeyFactory
instance
=
SecretKeyFactory
.
getInstance
(
ALGORITHM_DES
);
SecretKeyFactory
instance
=
SecretKeyFactory
.
getInstance
(
ALGORITHM_DES
);
SecretKey
secretKey
=
instance
.
generateSecret
(
desKeySpec
);
return
instance
.
generateSecret
(
desKeySpec
);
return
secretKey
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
DesHelper
.
class
,
e
);
}
}
return
null
;
return
null
;
...
@@ -92,7 +94,7 @@ public class DesHelper {
...
@@ -92,7 +94,7 @@ public class DesHelper {
cipher
.
init
(
opsMode
,
key
,
secureRandom
);
cipher
.
init
(
opsMode
,
key
,
secureRandom
);
return
cipher
.
doFinal
(
processData
);
return
cipher
.
doFinal
(
processData
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
DesHelper
.
class
,
e
);
}
}
return
null
;
return
null
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/EnumHelper.java
View file @
951e5ae4
...
@@ -7,6 +7,7 @@ import java.util.HashMap;
...
@@ -7,6 +7,7 @@ import java.util.HashMap;
/**
/**
* 字符串和枚举进行转换
* 字符串和枚举进行转换
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
EnumHelper
{
public
class
EnumHelper
{
...
@@ -22,7 +23,6 @@ public class EnumHelper {
...
@@ -22,7 +23,6 @@ public class EnumHelper {
result
=
Enum
.
valueOf
(
vType
,
vStr
);
result
=
Enum
.
valueOf
(
vType
,
vStr
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
vStr
);
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
vStr
);
}
}
return
result
;
return
result
;
...
@@ -41,7 +41,6 @@ public class EnumHelper {
...
@@ -41,7 +41,6 @@ public class EnumHelper {
result
=
(
T
)
Enum
.
valueOf
((
Class
)
vType
,
vStr
);
result
=
(
T
)
Enum
.
valueOf
((
Class
)
vType
,
vStr
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
vStr
);
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
vStr
);
}
}
if
(
result
==
null
&&
vDefault
==
null
)
{
if
(
result
==
null
&&
vDefault
==
null
)
{
...
@@ -71,7 +70,6 @@ public class EnumHelper {
...
@@ -71,7 +70,6 @@ public class EnumHelper {
}
}
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
i
);
ExceptionHelper
.
handleException
(
EnumHelper
.
class
,
ex
,
i
);
}
}
return
result
;
return
result
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/JsonHelper.java
View file @
951e5ae4
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.util.helper;
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.util.helper;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
/**
/**
* JSON序列化的处理
* JSON序列化的处理
...
@@ -40,7 +41,6 @@ public class JsonHelper {
...
@@ -40,7 +41,6 @@ public class JsonHelper {
* @param type 对象的类型
* @param type 对象的类型
* @param <T> 转换后的结果的类型
* @param <T> 转换后的结果的类型
* @return 转换后的结果
* @return 转换后的结果
* @throws Exception 转换结果发生异常
*/
*/
public
static
<
T
>
T
to
(
Object
from
,
Class
<
T
>
type
)
{
public
static
<
T
>
T
to
(
Object
from
,
Class
<
T
>
type
)
{
String
json
=
serialize
(
from
);
String
json
=
serialize
(
from
);
...
@@ -54,7 +54,6 @@ public class JsonHelper {
...
@@ -54,7 +54,6 @@ public class JsonHelper {
* @param type 对象的类型
* @param type 对象的类型
* @param <T> 转换后的结果的类型
* @param <T> 转换后的结果的类型
* @return 转换后的结果
* @return 转换后的结果
* @throws Exception 转换结果发生异常
*/
*/
public
static
<
T
>
T
to
(
Object
from
,
TypeReference
<
T
>
type
)
{
public
static
<
T
>
T
to
(
Object
from
,
TypeReference
<
T
>
type
)
{
String
json
=
serialize
(
from
);
String
json
=
serialize
(
from
);
...
@@ -81,7 +80,6 @@ public class JsonHelper {
...
@@ -81,7 +80,6 @@ public class JsonHelper {
* @param type 对象的类型
* @param type 对象的类型
* @param <T> 转换后的结果的类型
* @param <T> 转换后的结果的类型
* @return 转换后的结果
* @return 转换后的结果
* @throws Exception 转换结果发生异常
*/
*/
public
static
<
T
>
T
deserialize
(
String
json
,
Class
<
T
>
type
)
{
public
static
<
T
>
T
deserialize
(
String
json
,
Class
<
T
>
type
)
{
if
(
isException
)
{
if
(
isException
)
{
...
@@ -90,7 +88,7 @@ public class JsonHelper {
...
@@ -90,7 +88,7 @@ public class JsonHelper {
try
{
try
{
return
JSON
.
parseObject
(
json
,
type
);
return
JSON
.
parseObject
(
json
,
type
);
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
JsonHelper
.
class
,
ex
);
return
null
;
return
null
;
}
}
}
}
...
@@ -103,7 +101,6 @@ public class JsonHelper {
...
@@ -103,7 +101,6 @@ public class JsonHelper {
* @param type 对象的类型
* @param type 对象的类型
* @param <T> 转换后的结果的类型
* @param <T> 转换后的结果的类型
* @return 转换后的结果
* @return 转换后的结果
* @throws Exception 转换结果发生异常
*/
*/
public
static
<
T
>
T
deserialize
(
String
json
,
TypeReference
<
T
>
type
)
{
public
static
<
T
>
T
deserialize
(
String
json
,
TypeReference
<
T
>
type
)
{
if
(
isException
)
{
if
(
isException
)
{
...
@@ -112,7 +109,7 @@ public class JsonHelper {
...
@@ -112,7 +109,7 @@ public class JsonHelper {
try
{
try
{
return
JSON
.
parseObject
(
json
,
type
);
return
JSON
.
parseObject
(
json
,
type
);
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
JsonHelper
.
class
,
ex
);
return
null
;
return
null
;
}
}
}
}
...
@@ -127,7 +124,7 @@ public class JsonHelper {
...
@@ -127,7 +124,7 @@ public class JsonHelper {
* @return 返回数组
* @return 返回数组
*/
*/
public
static
<
T
>
T
deserializeArray
(
String
json
,
TypeReference
<
T
>
type
)
{
public
static
<
T
>
T
deserializeArray
(
String
json
,
TypeReference
<
T
>
type
)
{
if
(
json
==
null
||
json
.
length
()
<
1
)
{
if
(
json
==
null
||
json
.
isEmpty
()
)
{
return
null
;
return
null
;
}
}
json
=
json
.
trim
();
json
=
json
.
trim
();
...
@@ -140,7 +137,7 @@ public class JsonHelper {
...
@@ -140,7 +137,7 @@ public class JsonHelper {
try
{
try
{
return
JSON
.
parseObject
(
json
,
type
);
return
JSON
.
parseObject
(
json
,
type
);
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
JsonHelper
.
class
,
ex
);
return
null
;
return
null
;
}
}
}
}
...
@@ -151,7 +148,6 @@ public class JsonHelper {
...
@@ -151,7 +148,6 @@ public class JsonHelper {
*
*
* @param value 需要序列化的对象
* @param value 需要序列化的对象
* @return JSON结果
* @return JSON结果
* @throws Exception 抛出的异常信息
*/
*/
public
static
String
serialize
(
Object
value
)
{
public
static
String
serialize
(
Object
value
)
{
return
JSON
.
toJSONString
(
value
);
return
JSON
.
toJSONString
(
value
);
...
@@ -163,7 +159,6 @@ public class JsonHelper {
...
@@ -163,7 +159,6 @@ public class JsonHelper {
* @param value 需要序列化的对象
* @param value 需要序列化的对象
* @param isLine 是否需要换行
* @param isLine 是否需要换行
* @return JSON结果
* @return JSON结果
* @throws Exception 抛出的异常信息
*/
*/
public
static
String
serialize
(
Object
value
,
boolean
isLine
)
{
public
static
String
serialize
(
Object
value
,
boolean
isLine
)
{
return
JSON
.
toJSONString
(
value
,
isLine
);
return
JSON
.
toJSONString
(
value
,
isLine
);
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/RunHelper.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.util.helper;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
/**
/**
...
@@ -43,11 +44,9 @@ public class RunHelper {
...
@@ -43,11 +44,9 @@ public class RunHelper {
ex
=
null
;
ex
=
null
;
break
;
break
;
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
e
.
printStackTrace
();
ExceptionHelper
.
PrintError
(
RunHelper
.
class
,
e
);
if
(
i
<
size
)
{
// 间隔100ms,防止服务器重启时请求失败
// 间隔100ms,防止服务器重启时请求失败
ThreadHelper
.
sleep
(
sleep
);
ThreadHelper
.
sleep
(
sleep
);
}
ex
=
e
;
ex
=
e
;
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
951e5ae4
...
@@ -1051,7 +1051,7 @@ public class StringHelper {
...
@@ -1051,7 +1051,7 @@ public class StringHelper {
}
}
return
hex
.
toString
();
return
hex
.
toString
();
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
StringHelper
.
class
,
e
);
}
}
return
StringHelper
.
EMPTY
;
return
StringHelper
.
EMPTY
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.contants.SystemContants
;
import
com.yanzuoguang.util.contants.SystemContants
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
java.net.*
;
import
java.net.*
;
import
java.util.*
;
import
java.util.*
;
...
@@ -92,7 +93,7 @@ public class UrlHelper {
...
@@ -92,7 +93,7 @@ public class UrlHelper {
}
}
}
}
}
catch
(
SocketException
e
)
{
}
catch
(
SocketException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
UrlHelper
.
class
,
e
);
}
}
return
ipList
;
return
ipList
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
...
@@ -99,7 +100,7 @@ public class YzgTimeout {
...
@@ -99,7 +100,7 @@ public class YzgTimeout {
try
{
try
{
runItem
();
runItem
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
YzgTimeout
.
class
,
ex
);
}
}
ThreadHelper
.
sleep
(
200
);
ThreadHelper
.
sleep
(
200
);
}
}
...
@@ -127,7 +128,7 @@ public class YzgTimeout {
...
@@ -127,7 +128,7 @@ public class YzgTimeout {
poll
.
setTimeMax
(
poll
.
getTimeMax
()
+
poll
.
getTimeOutTip
());
poll
.
setTimeMax
(
poll
.
getTimeMax
()
+
poll
.
getTimeOutTip
());
ThreadHelper
.
runThread
(()
->
poll
.
getHeart
().
heart
(
time
));
ThreadHelper
.
runThread
(()
->
poll
.
getHeart
().
heart
(
time
));
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
YzgTimeout
.
class
,
ex
);
}
}
}
}
if
(!
poll
.
isRun
())
{
if
(!
poll
.
isRun
())
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/log/Log.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
log
;
package
com
.
yanzuoguang
.
util
.
log
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.extend.ConfigBase
;
import
com.yanzuoguang.util.extend.ConfigBase
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -27,8 +28,8 @@ public class Log {
...
@@ -27,8 +28,8 @@ public class Log {
* 写入错误消息
* 写入错误消息
*
*
* @param cls 类
* @param cls 类
* @param msg
* @param msg
消息内容
* @param args
* @param args
参数信息
*/
*/
public
static
void
error
(
Class
<?>
cls
,
String
msg
,
Object
...
args
)
{
public
static
void
error
(
Class
<?>
cls
,
String
msg
,
Object
...
args
)
{
String
toMsg
=
getFormat
(
msg
,
args
);
String
toMsg
=
getFormat
(
msg
,
args
);
...
@@ -38,9 +39,11 @@ public class Log {
...
@@ -38,9 +39,11 @@ public class Log {
/**
/**
* 写入错误信息
* 写入错误信息
*
*
* @param ex
* @param cls 类
* @param ex 错误信息
*/
*/
public
static
void
error
(
Class
<?>
cls
,
Throwable
ex
)
{
public
static
void
error
(
Class
<?>
cls
,
Throwable
ex
)
{
ExceptionHelper
.
PrintError
(
cls
,
ex
);
add
(
new
LogInfo
(
cls
,
new
Date
(),
ex
!=
null
,
ex
,
StringHelper
.
EMPTY
));
add
(
new
LogInfo
(
cls
,
new
Date
(),
ex
!=
null
,
ex
,
StringHelper
.
EMPTY
));
}
}
...
@@ -52,6 +55,7 @@ public class Log {
...
@@ -52,6 +55,7 @@ public class Log {
* @param args 错误消息
* @param args 错误消息
*/
*/
public
static
void
error
(
Class
<?>
cls
,
Throwable
ex
,
String
msg
,
Object
...
args
)
{
public
static
void
error
(
Class
<?>
cls
,
Throwable
ex
,
String
msg
,
Object
...
args
)
{
ExceptionHelper
.
PrintError
(
cls
,
ex
);
String
toMsg
=
getFormat
(
msg
,
args
);
String
toMsg
=
getFormat
(
msg
,
args
);
add
(
new
LogInfo
(
cls
,
new
Date
(),
ex
!=
null
,
ex
,
toMsg
));
add
(
new
LogInfo
(
cls
,
new
Date
(),
ex
!=
null
,
ex
,
toMsg
));
}
}
...
@@ -59,8 +63,9 @@ public class Log {
...
@@ -59,8 +63,9 @@ public class Log {
/**
/**
* 警告信息
* 警告信息
*
*
* @param msg
* @param cls 类
* @param args
* @param msg 消息
* @param args 参数信息
*/
*/
public
static
void
info
(
Class
<?>
cls
,
String
msg
,
Object
...
args
)
{
public
static
void
info
(
Class
<?>
cls
,
String
msg
,
Object
...
args
)
{
String
toMsg
=
getFormat
(
msg
,
args
);
String
toMsg
=
getFormat
(
msg
,
args
);
...
@@ -70,8 +75,10 @@ public class Log {
...
@@ -70,8 +75,10 @@ public class Log {
/**
/**
* 警告信息
* 警告信息
*
*
* @param msg
* @param cls 类
* @param args
* @param tag 标签信息
* @param msg 消息
* @param args 参数信息
*/
*/
public
static
void
infoTag
(
Class
<?>
cls
,
String
tag
,
String
msg
,
Object
...
args
)
{
public
static
void
infoTag
(
Class
<?>
cls
,
String
tag
,
String
msg
,
Object
...
args
)
{
String
toMsg
=
getFormat
(
msg
,
args
);
String
toMsg
=
getFormat
(
msg
,
args
);
...
@@ -89,7 +96,6 @@ public class Log {
...
@@ -89,7 +96,6 @@ public class Log {
// 获取当前线程编号
// 获取当前线程编号
String
threadId
=
getThreadId
();
String
threadId
=
getThreadId
();
info
.
setThreadId
(
threadId
);
info
.
setThreadId
(
threadId
);
// 判断当前线程日志是否需要特殊处理
// 判断当前线程日志是否需要特殊处理
LogDate
date
;
LogDate
date
;
synchronized
(
Log
.
class
)
{
synchronized
(
Log
.
class
)
{
...
@@ -127,7 +133,7 @@ public class Log {
...
@@ -127,7 +133,7 @@ public class Log {
/**
/**
* 当前县城日志对象
* 当前县城日志对象
*
*
* @return
* @return
返回日志信息
*/
*/
public
static
LogDate
threadCurrent
()
{
public
static
LogDate
threadCurrent
()
{
String
threadId
=
getThreadId
();
String
threadId
=
getThreadId
();
...
@@ -136,6 +142,8 @@ public class Log {
...
@@ -136,6 +142,8 @@ public class Log {
/**
/**
* 当前线程结束处理特殊异常
* 当前线程结束处理特殊异常
*
* @return 返回日志信息
*/
*/
public
static
LogDate
threadCommit
()
{
public
static
LogDate
threadCommit
()
{
String
threadId
=
getThreadId
();
String
threadId
=
getThreadId
();
...
@@ -147,7 +155,7 @@ public class Log {
...
@@ -147,7 +155,7 @@ public class Log {
/**
/**
* 获取当前线程编号
* 获取当前线程编号
*
*
* @return
* @return
返回日志信息
*/
*/
private
static
String
getThreadId
()
{
private
static
String
getThreadId
()
{
return
String
.
valueOf
(
Thread
.
currentThread
().
getId
());
return
String
.
valueOf
(
Thread
.
currentThread
().
getId
());
...
@@ -156,16 +164,15 @@ public class Log {
...
@@ -156,16 +164,15 @@ public class Log {
/**
/**
* 将异常消息格式化
* 将异常消息格式化
*
*
* @param msg
* @param msg
消息
* @param args
* @param args
参数信息
* @return
* @return
结果字符串
*/
*/
private
static
String
getFormat
(
String
msg
,
Object
...
args
)
{
private
static
String
getFormat
(
String
msg
,
Object
...
args
)
{
if
(
args
!=
null
&&
args
.
length
>
0
)
{
if
(
args
!=
null
&&
args
.
length
>
0
)
{
try
{
try
{
msg
=
String
.
format
(
msg
,
args
);
msg
=
String
.
format
(
msg
,
args
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
Log
.
class
,
ex
);
Log
.
error
(
Log
.
class
,
ex
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/log/LogDefault.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
log
;
package
com
.
yanzuoguang
.
util
.
log
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -65,9 +66,6 @@ public class LogDefault implements RunnableLog {
...
@@ -65,9 +66,6 @@ public class LogDefault implements RunnableLog {
sb
.
append
(
ex
.
getMessage
());
sb
.
append
(
ex
.
getMessage
());
}
}
System
.
err
.
println
(
sb
);
System
.
err
.
println
(
sb
);
if
(
ex
!=
null
)
{
ex
.
printStackTrace
();
}
}
else
{
}
else
{
System
.
out
.
println
(
sb
);
System
.
out
.
println
(
sb
);
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/sfz/SfzHandle15.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
sfz
;
package
com
.
yanzuoguang
.
util
.
sfz
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -36,7 +38,7 @@ public class SfzHandle15 implements SfzHandle {
...
@@ -36,7 +38,7 @@ public class SfzHandle15 implements SfzHandle {
try
{
try
{
birthDate
=
new
SimpleDateFormat
(
"yy"
).
parse
(
birthCode
.
substring
(
0
,
2
));
birthDate
=
new
SimpleDateFormat
(
"yy"
).
parse
(
birthCode
.
substring
(
0
,
2
));
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
SfzHandle15
.
class
,
e
);
}
}
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
if
(
birthDate
!=
null
)
if
(
birthDate
!=
null
)
...
@@ -94,7 +96,7 @@ public class SfzHandle15 implements SfzHandle {
...
@@ -94,7 +96,7 @@ public class SfzHandle15 implements SfzHandle {
try
{
try
{
birthDate
=
new
SimpleDateFormat
(
"yyMMdd"
).
parse
(
birthday
);
birthDate
=
new
SimpleDateFormat
(
"yyMMdd"
).
parse
(
birthday
);
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
SfzHandle15
.
class
,
e
);
}
}
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
if
(
birthDate
!=
null
)
{
if
(
birthDate
!=
null
)
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/sfz/SfzHandle18.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
sfz
;
package
com
.
yanzuoguang
.
util
.
sfz
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
static
com
.
yanzuoguang
.
util
.
sfz
.
SfzHandle15
.
CHINA_ID_MIN_LENGTH
;
import
static
com
.
yanzuoguang
.
util
.
sfz
.
SfzHandle15
.
CHINA_ID_MIN_LENGTH
;
import
static
com
.
yanzuoguang
.
util
.
sfz
.
SfzHandleUtil
.
cityCodes
;
import
static
com
.
yanzuoguang
.
util
.
sfz
.
SfzHandleUtil
.
cityCodes
;
...
@@ -113,7 +115,7 @@ public class SfzHandle18 implements SfzHandle {
...
@@ -113,7 +115,7 @@ public class SfzHandle18 implements SfzHandle {
iArr
[
i
]
=
Integer
.
parseInt
(
String
.
valueOf
(
ca
[
i
]));
iArr
[
i
]
=
Integer
.
parseInt
(
String
.
valueOf
(
ca
[
i
]));
}
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
SfzHandle18
.
class
,
e
);
}
}
return
iArr
;
return
iArr
;
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ProcessData.java
View file @
951e5ae4
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.util.log.Log;
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.util.log.Log;
/**
/**
* 进度数据
* 进度数据
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
ProcessData
{
public
class
ProcessData
{
...
@@ -75,7 +76,6 @@ public class ProcessData {
...
@@ -75,7 +76,6 @@ public class ProcessData {
try
{
try
{
runProcess
.
execute
(
this
);
runProcess
.
execute
(
this
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
HttpHelper
.
class
,
ex
);
Log
.
error
(
HttpHelper
.
class
,
ex
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunPlan.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.helper.Event
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.Event
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -102,7 +101,6 @@ public class RunPlan {
...
@@ -102,7 +101,6 @@ public class RunPlan {
}
}
millSeconds
=
(
now
-
item
.
getDate
());
millSeconds
=
(
now
-
item
.
getDate
());
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
}
}
// 未到执行时间
// 未到执行时间
...
@@ -118,7 +116,6 @@ public class RunPlan {
...
@@ -118,7 +116,6 @@ public class RunPlan {
this
.
triggerEvent
(
this
.
onItemExecuted
);
this
.
triggerEvent
(
this
.
onItemExecuted
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
RunPlan
.
class
,
ex
);
ExceptionHelper
.
handleException
(
RunPlan
.
class
,
ex
);
}
}
item
.
initDate
();
item
.
initDate
();
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAutoItem.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -142,7 +143,6 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
...
@@ -142,7 +143,6 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
}
}
this
.
code
.
run
();
this
.
code
.
run
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
this
.
handleException
(
ex
);
this
.
handleException
(
ex
);
}
finally
{
}
finally
{
this
.
count
++;
this
.
count
++;
...
@@ -156,6 +156,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
...
@@ -156,6 +156,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
* @param ex
* @param ex
*/
*/
private
void
handleException
(
Throwable
ex
)
{
private
void
handleException
(
Throwable
ex
)
{
ExceptionHelper
.
PrintError
(
RunnableListAutoItem
.
class
,
ex
);
if
(
ex
instanceof
RuntimeException
)
{
if
(
ex
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
ex
;
throw
(
RuntimeException
)
ex
;
}
else
{
}
else
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadHelper.java
View file @
951e5ae4
...
@@ -75,13 +75,11 @@ public class ThreadHelper {
...
@@ -75,13 +75,11 @@ public class ThreadHelper {
try
{
try
{
timeout
.
run
(
true
,
-
1
);
timeout
.
run
(
true
,
-
1
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
}
}
try
{
try
{
interval
.
run
(
false
,
-
1
);
interval
.
run
(
false
,
-
1
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
ExceptionHelper
.
handleException
(
ThreadHelper
.
class
,
ex
);
}
}
if
(
timeout
.
getCount
()
==
0
&&
interval
.
getCount
()
==
0
)
{
if
(
timeout
.
getCount
()
==
0
&&
interval
.
getCount
()
==
0
)
{
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadNext.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
...
@@ -61,7 +62,7 @@ public class ThreadNext {
...
@@ -61,7 +62,7 @@ public class ThreadNext {
try
{
try
{
isPause
=
next
.
next
();
isPause
=
next
.
next
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ThreadNext
.
class
,
ex
);
boolean
isNewEx
=
frontEx
==
null
||
!(
frontEx
.
getClass
()
==
ex
.
getClass
()
&&
boolean
isNewEx
=
frontEx
==
null
||
!(
frontEx
.
getClass
()
==
ex
.
getClass
()
&&
StringHelper
.
compare
(
frontEx
.
getMessage
(),
ex
.
getMessage
()));
StringHelper
.
compare
(
frontEx
.
getMessage
(),
ex
.
getMessage
()));
if
(
isNewEx
||
System
.
currentTimeMillis
()
-
newErrorTime
>
5L
*
60L
*
1000L
)
{
if
(
isNewEx
||
System
.
currentTimeMillis
()
-
newErrorTime
>
5L
*
60L
*
1000L
)
{
...
@@ -75,7 +76,7 @@ public class ThreadNext {
...
@@ -75,7 +76,7 @@ public class ThreadNext {
int
max
=
Math
.
max
(
next
.
getNextTime
(),
100
);
int
max
=
Math
.
max
(
next
.
getNextTime
(),
100
);
Thread
.
sleep
(
max
);
Thread
.
sleep
(
max
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ThreadNext
.
class
,
e
);
}
}
}
else
{
}
else
{
break
;
break
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/ThreadWait.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.extend.ConfigBase
;
import
com.yanzuoguang.util.extend.ConfigBase
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
...
@@ -54,7 +55,7 @@ public class ThreadWait {
...
@@ -54,7 +55,7 @@ public class ThreadWait {
try
{
try
{
this
.
wait
();
this
.
wait
();
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ThreadWait
.
class
,
e
);
}
}
this
.
stopPrint
();
this
.
stopPrint
();
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/BaseVo.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
util
.
vo
;
package
com
.
yanzuoguang
.
util
.
vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -24,7 +25,7 @@ public class BaseVo implements Serializable {
...
@@ -24,7 +25,7 @@ public class BaseVo implements Serializable {
MapRow
rowThat
=
JsonHelper
.
to
(
that
,
MapRow
.
class
);
MapRow
rowThat
=
JsonHelper
.
to
(
that
,
MapRow
.
class
);
return
rowThis
.
equals
(
rowThat
);
return
rowThis
.
equals
(
rowThat
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
BaseVo
.
class
,
ex
);
return
super
.
equals
(
that
);
return
super
.
equals
(
that
);
}
}
}
}
...
@@ -35,7 +36,7 @@ public class BaseVo implements Serializable {
...
@@ -35,7 +36,7 @@ public class BaseVo implements Serializable {
MapRow
row
=
JsonHelper
.
to
(
this
,
MapRow
.
class
);
MapRow
row
=
JsonHelper
.
to
(
this
,
MapRow
.
class
);
return
row
.
hashCode
();
return
row
.
hashCode
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
BaseVo
.
class
,
ex
);
return
super
.
hashCode
();
return
super
.
hashCode
();
}
}
}
}
...
@@ -45,7 +46,7 @@ public class BaseVo implements Serializable {
...
@@ -45,7 +46,7 @@ public class BaseVo implements Serializable {
try
{
try
{
return
JsonHelper
.
serialize
(
this
,
false
);
return
JsonHelper
.
serialize
(
this
,
false
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
BaseVo
.
class
,
ex
);
return
super
.
toString
();
return
super
.
toString
();
}
}
}
}
...
...
yzg-util-base/src/test/java/helper/HttpHelperTest.java
View file @
951e5ae4
package
helper
;
package
helper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.BaiduHelper
;
import
com.yanzuoguang.util.helper.BaiduHelper
;
import
com.yanzuoguang.util.helper.HttpHelper
;
import
com.yanzuoguang.util.helper.HttpHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
...
@@ -120,7 +121,7 @@ public class HttpHelperTest {
...
@@ -120,7 +121,7 @@ public class HttpHelperTest {
try
{
try
{
String
s
=
HttpHelper
.
get
(
req
.
url
);
String
s
=
HttpHelper
.
get
(
req
.
url
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
HttpHelperTest
.
class
,
ex
);
isError
=
true
;
isError
=
true
;
}
finally
{
}
finally
{
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
...
...
yzg-util-base/src/test/java/helper/TestDateHelper.java
View file @
951e5ae4
package
helper
;
package
helper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
...
@@ -57,7 +58,7 @@ public class TestDateHelper {
...
@@ -57,7 +58,7 @@ public class TestDateHelper {
Date
date
=
DateHelper
.
getDateTime
(
"00:00:00"
);
Date
date
=
DateHelper
.
getDateTime
(
"00:00:00"
);
System
.
out
.
println
(
"日期转换时间是否相等:"
+
(
date
!=
null
));
System
.
out
.
println
(
"日期转换时间是否相等:"
+
(
date
!=
null
));
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
TestDateHelper
.
class
,
ex
);
}
}
}
}
...
...
yzg-util-base/src/test/java/helper/TestSfzUtil.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package helper;
...
@@ -2,6 +2,7 @@ package helper;
import
base.DemoVo
;
import
base.DemoVo
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.SfzhUtil
;
import
com.yanzuoguang.util.helper.SfzhUtil
;
...
@@ -218,7 +219,7 @@ public class TestSfzUtil {
...
@@ -218,7 +219,7 @@ public class TestSfzUtil {
iArr
[
i
]
=
Integer
.
parseInt
(
String
.
valueOf
(
ca
[
i
]));
iArr
[
i
]
=
Integer
.
parseInt
(
String
.
valueOf
(
ca
[
i
]));
}
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
TestSfzUtil
.
class
,
e
);
}
}
return
iArr
;
return
iArr
;
}
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectLogResult.java
View file @
951e5ae4
...
@@ -90,7 +90,7 @@ public class AspectLogResult {
...
@@ -90,7 +90,7 @@ public class AspectLogResult {
Log
.
error
(
cls
,
resultEx
,
"%s [ %s ] time %d ms, result: %s"
,
tag
,
url
,
time
,
aspectLogBody
.
getMaxString
(
json
));
Log
.
error
(
cls
,
resultEx
,
"%s [ %s ] time %d ms, result: %s"
,
tag
,
url
,
time
,
aspectLogBody
.
getMaxString
(
json
));
logLocal
.
result
(
log
,
responseResult
.
getCode
(),
json
,
isError
);
logLocal
.
result
(
log
,
responseResult
.
getCode
(),
json
,
isError
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
AspectLogResult
.
class
,
e
);
}
finally
{
}
finally
{
if
(
logFlag
)
{
if
(
logFlag
)
{
Log
.
threadCommit
();
Log
.
threadCommit
();
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectLogStart.java
View file @
951e5ae4
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.aop;
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.aop;
import
com.yanzuoguang.cloud.CloudConfig
;
import
com.yanzuoguang.cloud.CloudConfig
;
import
com.yanzuoguang.cloud.aop.log.LogLocal
;
import
com.yanzuoguang.cloud.aop.log.LogLocal
;
import
com.yanzuoguang.log.LogCountTime
;
import
com.yanzuoguang.log.LogCountTime
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.LogVo
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -52,7 +53,7 @@ public class AspectLogStart {
...
@@ -52,7 +53,7 @@ public class AspectLogStart {
Log
.
info
(
cls
,
" %s [ %s ] request: %s"
,
tag
,
url
,
body
);
Log
.
info
(
cls
,
" %s [ %s ] request: %s"
,
tag
,
url
,
body
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
AspectLogStart
.
class
,
ex
);
}
}
}
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/log/LogBase.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.cloud.aop.log;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.cloud.aop.log;
import
com.yanzuoguang.cloud.CloudConfig
;
import
com.yanzuoguang.cloud.CloudConfig
;
import
com.yanzuoguang.cloud.aop.LogFeign
;
import
com.yanzuoguang.cloud.aop.LogFeign
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.thread.ThreadNext
;
import
com.yanzuoguang.util.thread.ThreadNext
;
import
com.yanzuoguang.util.vo.LogVo
;
import
com.yanzuoguang.util.vo.LogVo
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
@@ -89,7 +90,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
...
@@ -89,7 +90,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
try
{
try
{
logFeign
.
save
(
item
);
logFeign
.
save
(
item
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
LogBase
.
class
,
ex
);
}
}
}
}
return
true
;
return
true
;
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/env/YzgEnvironmentPostProcessor.java
View file @
951e5ae4
...
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
...
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.Properties
;
import
java.util.Properties
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.env.EnvironmentPostProcessor
;
import
org.springframework.boot.env.EnvironmentPostProcessor
;
...
@@ -38,9 +39,8 @@ public class YzgEnvironmentPostProcessor implements EnvironmentPostProcessor {
...
@@ -38,9 +39,8 @@ public class YzgEnvironmentPostProcessor implements EnvironmentPostProcessor {
environment
.
getPropertySources
().
addLast
(
propertySource
);
environment
.
getPropertySources
().
addLast
(
propertySource
);
System
.
out
.
println
(
"====加载外部配置文件"
+
property
+
"完毕===="
);
System
.
out
.
println
(
"====加载外部配置文件"
+
property
+
"完毕===="
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
YzgEnvironmentPostProcessor
.
class
,
e
);
}
}
}
}
}
}
\ No newline at end of file
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
View file @
951e5ae4
...
@@ -4,6 +4,7 @@ package com.yanzuoguang.cloud.excel;
...
@@ -4,6 +4,7 @@ package com.yanzuoguang.cloud.excel;
import
com.yanzuoguang.cloud.helper.HttpFileHelper
;
import
com.yanzuoguang.cloud.helper.HttpFileHelper
;
import
com.yanzuoguang.excel.*
;
import
com.yanzuoguang.excel.*
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -132,7 +133,7 @@ public class ExcelHttp<T> extends ExcelConsole<T> {
...
@@ -132,7 +133,7 @@ public class ExcelHttp<T> extends ExcelConsole<T> {
// 等待下载模式,下载文件
// 等待下载模式,下载文件
excel
.
down
(
response
);
excel
.
down
(
response
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ExcelConsole
.
class
,
e
);
throw
YzgError
.
getRuntimeException
(
e
,
"045"
,
e
.
getMessage
());
throw
YzgError
.
getRuntimeException
(
e
,
"045"
,
e
.
getMessage
());
}
finally
{
}
finally
{
// 删除生成的临时文件
// 删除生成的临时文件
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
951e5ae4
...
@@ -4,6 +4,7 @@ import com.yanzuoguang.db.impl.DbRow;
...
@@ -4,6 +4,7 @@ import com.yanzuoguang.db.impl.DbRow;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -533,7 +534,7 @@ public class ExcelConsole<T> implements DbRow<T> {
...
@@ -533,7 +534,7 @@ public class ExcelConsole<T> implements DbRow<T> {
workbook
.
write
(
out
);
workbook
.
write
(
out
);
out
.
flush
();
out
.
flush
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
ExcelConsole
.
class
,
e
);
throw
YzgError
.
getRuntimeException
(
"035"
);
throw
YzgError
.
getRuntimeException
(
"035"
);
}
}
// 判断临时文件是否存在
// 判断临时文件是否存在
...
...
yzg-util-file/src/main/java/com/yanzuoguang/cloud/file/YzgFileConsumer.java
View file @
951e5ae4
...
@@ -66,10 +66,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -66,10 +66,8 @@ public class YzgFileConsumer implements InitializingBean {
try
{
try
{
fileService
.
removeTempFolder
(
tempFolder
);
fileService
.
removeTempFolder
(
tempFolder
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
removeTempFolder
(
tempFolder
);
fileProcedure
.
removeTempFolder
(
tempFolder
);
}
finally
{
}
finally
{
...
@@ -90,10 +88,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -90,10 +88,8 @@ public class YzgFileConsumer implements InitializingBean {
YzgFileMoveReqVo
req
=
JsonHelper
.
deserialize
(
json
,
YzgFileMoveReqVo
.
class
);
YzgFileMoveReqVo
req
=
JsonHelper
.
deserialize
(
json
,
YzgFileMoveReqVo
.
class
);
fileService
.
moveFile
(
req
);
fileService
.
moveFile
(
req
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
moveFile
(
json
,
60
*
1000
);
fileProcedure
.
moveFile
(
json
,
60
*
1000
);
}
finally
{
}
finally
{
...
@@ -129,10 +125,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -129,10 +125,8 @@ public class YzgFileConsumer implements InitializingBean {
fileProcedure
.
convertImage
(
req
);
fileProcedure
.
convertImage
(
req
);
}
}
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
convertImage
(
json
,
60
*
1000
);
fileProcedure
.
convertImage
(
json
,
60
*
1000
);
}
finally
{
}
finally
{
...
@@ -168,10 +162,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -168,10 +162,8 @@ public class YzgFileConsumer implements InitializingBean {
fileProcedure
.
convertVideo
(
req
);
fileProcedure
.
convertVideo
(
req
);
}
}
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
convertVideo
(
json
,
60
*
1000
);
fileProcedure
.
convertVideo
(
json
,
60
*
1000
);
}
finally
{
}
finally
{
...
@@ -196,10 +188,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -196,10 +188,8 @@ public class YzgFileConsumer implements InitializingBean {
}
}
excelService
.
fileCreate
(
json
,
fileReq
);
excelService
.
fileCreate
(
json
,
fileReq
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
fileCreateDelay
(
json
);
fileProcedure
.
fileCreateDelay
(
json
);
}
finally
{
}
finally
{
...
@@ -223,10 +213,8 @@ public class YzgFileConsumer implements InitializingBean {
...
@@ -223,10 +213,8 @@ public class YzgFileConsumer implements InitializingBean {
}
}
excelService
.
updateStatus
(
fileReq
);
excelService
.
updateStatus
(
fileReq
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
Log
.
error
(
YzgFileConsumer
.
class
,
ex
);
fileProcedure
.
fileStatus
(
json
);
fileProcedure
.
fileStatus
(
json
);
}
finally
{
}
finally
{
...
...
yzg-util-image/src/main/java/com/yanzuoguang/media/HlsDownloader.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
media
;
package
com
.
yanzuoguang
.
media
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.HttpHelper
;
import
com.yanzuoguang.util.helper.HttpHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
...
@@ -168,7 +169,7 @@ public class HlsDownloader {
...
@@ -168,7 +169,7 @@ public class HlsDownloader {
content
.
append
(
"\n"
);
content
.
append
(
"\n"
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
HlsDownloader
.
class
,
e
);
}
}
return
content
.
toString
();
return
content
.
toString
();
}
}
...
@@ -213,7 +214,7 @@ public class HlsDownloader {
...
@@ -213,7 +214,7 @@ public class HlsDownloader {
HttpHelper
.
downToLocal
(
serverTsUrl
,
localTs
);
HttpHelper
.
downToLocal
(
serverTsUrl
,
localTs
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// 判断文件是否下载失败
// 判断文件是否下载失败
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
HlsDownloader
.
class
,
e
);
}
}
}
}
...
...
yzg-util-image/src/main/java/com/yanzuoguang/media/MediaFirst.java
View file @
951e5ae4
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.media;
...
@@ -2,6 +2,7 @@ package com.yanzuoguang.media;
import
com.yanzuoguang.util.MediaHelper
;
import
com.yanzuoguang.util.MediaHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
...
@@ -118,7 +119,7 @@ public class MediaFirst {
...
@@ -118,7 +119,7 @@ public class MediaFirst {
break
;
break
;
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
MediaFirst
.
class
,
ex
);
}
}
ThreadHelper
.
sleep
(
res
.
getSplit
());
ThreadHelper
.
sleep
(
res
.
getSplit
());
}
while
(!
isFinish
(
req
));
}
while
(!
isFinish
(
req
));
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/base/MqConfigurable.java
View file @
951e5ae4
...
@@ -68,7 +68,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem
...
@@ -68,7 +68,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem
System
.
out
.
println
(
"丢失消息:"
+
ack
+
" msg:"
+
cause
);
System
.
out
.
println
(
"丢失消息:"
+
ack
+
" msg:"
+
cause
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
MqConfigurable
.
class
,
ex
);
Log
.
error
(
MqConfigurable
.
class
,
ex
);
}
}
}
}
...
@@ -94,7 +93,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem
...
@@ -94,7 +93,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem
// 写入数据库
// 写入数据库
messageSendService
.
onError
(
messageVo
);
messageSendService
.
onError
(
messageVo
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
MqConfigurable
.
class
,
ex
);
Log
.
error
(
MqConfigurable
.
class
,
ex
);
}
}
}
}
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
View file @
951e5ae4
...
@@ -8,6 +8,7 @@ import com.yanzuoguang.mq.vo.MessagePlan;
...
@@ -8,6 +8,7 @@ import com.yanzuoguang.mq.vo.MessagePlan;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.log.Log
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
...
@@ -38,9 +39,9 @@ public class YzgMqConsumer {
...
@@ -38,9 +39,9 @@ public class YzgMqConsumer {
/**
/**
* MQ回调
* MQ回调
*
*
* @param json
* @param json
字符串
* @param message
* @param message
消息
* @param channel
* @param channel
频道
*/
*/
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_SYSTEM_QUEUE
},
concurrency
=
"10"
)
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_SYSTEM_QUEUE
},
concurrency
=
"10"
)
public
void
yzgMqSystemQueue
(
String
json
,
Message
message
,
Channel
channel
)
{
public
void
yzgMqSystemQueue
(
String
json
,
Message
message
,
Channel
channel
)
{
...
@@ -49,10 +50,8 @@ public class YzgMqConsumer {
...
@@ -49,10 +50,8 @@ public class YzgMqConsumer {
req
=
JsonHelper
.
deserialize
(
json
,
MessageVo
.
class
);
req
=
JsonHelper
.
deserialize
(
json
,
MessageVo
.
class
);
yzgMqProcedure
.
send
(
req
,
true
);
yzgMqProcedure
.
send
(
req
,
true
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
// 等待100ms再次执行
// 等待100ms再次执行
yzgMqProcedure
.
sendDelay
(
req
,
100
);
yzgMqProcedure
.
sendDelay
(
req
,
100
);
...
@@ -65,9 +64,9 @@ public class YzgMqConsumer {
...
@@ -65,9 +64,9 @@ public class YzgMqConsumer {
/**
/**
* MQ回调
* MQ回调
*
*
* @param json
* @param json
字符串
* @param message
* @param message
消息
* @param channel
* @param channel
频道
*/
*/
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_SYSTEM_QUEUE_PLAN
},
concurrency
=
"10"
)
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_SYSTEM_QUEUE_PLAN
},
concurrency
=
"10"
)
public
void
yzgMqSystemQueuePlan
(
String
json
,
Message
message
,
Channel
channel
)
{
public
void
yzgMqSystemQueuePlan
(
String
json
,
Message
message
,
Channel
channel
)
{
...
@@ -76,10 +75,8 @@ public class YzgMqConsumer {
...
@@ -76,10 +75,8 @@ public class YzgMqConsumer {
req
=
JsonHelper
.
deserialize
(
json
,
MessagePlan
.
class
);
req
=
JsonHelper
.
deserialize
(
json
,
MessagePlan
.
class
);
yzgMqProcedure
.
sendDelay
(
req
);
yzgMqProcedure
.
sendDelay
(
req
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
// 等待100ms再次执行
// 等待100ms再次执行
yzgMqProcedure
.
sendDelay
(
req
,
100
);
yzgMqProcedure
.
sendDelay
(
req
,
100
);
...
@@ -91,9 +88,9 @@ public class YzgMqConsumer {
...
@@ -91,9 +88,9 @@ public class YzgMqConsumer {
/**
/**
* 删除token回调
* 删除token回调
*
*
* @param json
* @param json
字符串
* @param message
* @param message
消息
* @param channel
* @param channel
频道
*/
*/
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_CLEAR_TOKEN_QUEUE
})
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_MQ_CLEAR_TOKEN_QUEUE
})
public
void
yzgMqClearTokenQueue
(
String
json
,
Message
message
,
Channel
channel
)
{
public
void
yzgMqClearTokenQueue
(
String
json
,
Message
message
,
Channel
channel
)
{
...
@@ -101,10 +98,8 @@ public class YzgMqConsumer {
...
@@ -101,10 +98,8 @@ public class YzgMqConsumer {
RegisterServerTokenReqVo
req
=
JsonHelper
.
deserialize
(
json
,
RegisterServerTokenReqVo
.
class
);
RegisterServerTokenReqVo
req
=
JsonHelper
.
deserialize
(
json
,
RegisterServerTokenReqVo
.
class
);
messageServerService
.
removeServerToken
(
req
);
messageServerService
.
removeServerToken
(
req
);
}
catch
(
CodeException
ex
)
{
}
catch
(
CodeException
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
Log
.
error
(
YzgMqConsumer
.
class
,
ex
);
// 等待100ms再次执行
// 等待100ms再次执行
yzgMqProcedure
.
sendRemove
(
json
,
100
);
yzgMqProcedure
.
sendRemove
(
json
,
100
);
...
@@ -116,9 +111,9 @@ public class YzgMqConsumer {
...
@@ -116,9 +111,9 @@ public class YzgMqConsumer {
/**
/**
* 删除日期
* 删除日期
*
*
* @param day
* @param day
日期
* @param message
* @param message
消息
* @param channel
* @param channel
频道
*/
*/
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_CLEAR_LOG
})
@RabbitListener
(
queues
=
{
YzgMqProcedure
.
YZG_CLEAR_LOG
})
public
void
yzgClearLog
(
String
day
,
Message
message
,
Channel
channel
)
{
public
void
yzgClearLog
(
String
day
,
Message
message
,
Channel
channel
)
{
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageSendServiceImpl.java
View file @
951e5ae4
...
@@ -149,7 +149,6 @@ public class MessageSendServiceImpl implements MessageSendService {
...
@@ -149,7 +149,6 @@ public class MessageSendServiceImpl implements MessageSendService {
channel
.
basicAck
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
channel
.
basicAck
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Log
.
error
(
MessageSendServiceImpl
.
class
,
e
);
Log
.
error
(
MessageSendServiceImpl
.
class
,
e
);
}
}
}
}
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageServeServiceImpl.java
View file @
951e5ae4
...
@@ -192,7 +192,6 @@ public class MessageServeServiceImpl implements MessageServerService, Initializi
...
@@ -192,7 +192,6 @@ public class MessageServeServiceImpl implements MessageServerService, Initializi
});
});
sendServerMessage
(
msg
);
sendServerMessage
(
msg
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
Log
.
error
(
MessageServeServiceImpl
.
class
,
ex
);
Log
.
error
(
MessageServeServiceImpl
.
class
,
ex
);
}
finally
{
}
finally
{
messageSendService
.
basicAck
(
message
,
channel
);
messageSendService
.
basicAck
(
message
,
channel
);
...
@@ -264,7 +263,6 @@ public class MessageServeServiceImpl implements MessageServerService, Initializi
...
@@ -264,7 +263,6 @@ public class MessageServeServiceImpl implements MessageServerService, Initializi
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
Log
.
error
(
MessageServeServiceImpl
.
class
,
ex
);
Log
.
error
(
MessageServeServiceImpl
.
class
,
ex
);
ex
.
printStackTrace
();
}
}
if
(
sendQueueName
.
isEmpty
())
{
if
(
sendQueueName
.
isEmpty
())
{
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
View file @
951e5ae4
...
@@ -132,10 +132,8 @@ public class MqServiceImpl implements MqService {
...
@@ -132,10 +132,8 @@ public class MqServiceImpl implements MqService {
try
{
try
{
consumerMessage
.
accept
(
message
);
consumerMessage
.
accept
(
message
);
}
catch
(
CodeException
e
)
{
}
catch
(
CodeException
e
)
{
e
.
printStackTrace
();
Log
.
error
(
MqServiceImpl
.
class
,
e
);
Log
.
error
(
MqServiceImpl
.
class
,
e
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
error
(
MqServiceImpl
.
class
,
e
);
Log
.
error
(
MqServiceImpl
.
class
,
e
);
if
(
StringHelper
.
isEmpty
(
exchangeName
,
routeKey
))
{
if
(
StringHelper
.
isEmpty
(
exchangeName
,
routeKey
))
{
return
;
return
;
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/QueueServiceImpl.java
View file @
951e5ae4
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.mq.service.impl;
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.mq.service.impl;
import
com.yanzuoguang.mq.dao.BeanDao
;
import
com.yanzuoguang.mq.dao.BeanDao
;
import
com.yanzuoguang.mq.service.QueueService
;
import
com.yanzuoguang.mq.service.QueueService
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -97,7 +98,7 @@ public class QueueServiceImpl implements QueueService {
...
@@ -97,7 +98,7 @@ public class QueueServiceImpl implements QueueService {
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
this
.
queue
.
add
(
vo
);
this
.
queue
.
add
(
vo
);
ex
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
QueueServiceImpl
.
class
,
ex
);
ThreadHelper
.
sleep
(
5000
);
ThreadHelper
.
sleep
(
5000
);
}
}
}
}
...
...
yzg-util-wxxcx/src/main/java/com/yanzuoguang/wxxcx/utils/WeChatUtil.java
View file @
951e5ae4
package
com
.
yanzuoguang
.
wxxcx
.
utils
;
package
com
.
yanzuoguang
.
wxxcx
.
utils
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.util.Arrays
;
import
org.bouncycastle.util.Arrays
;
import
org.bouncycastle.util.encoders.Base64
;
import
org.bouncycastle.util.encoders.Base64
;
...
@@ -58,7 +59,7 @@ public class WeChatUtil {
...
@@ -58,7 +59,7 @@ public class WeChatUtil {
// 初始化cipher
// 初始化cipher
cipher
=
Cipher
.
getInstance
(
ALGORITHM_STR
,
"BC"
);
cipher
=
Cipher
.
getInstance
(
ALGORITHM_STR
,
"BC"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
WeChatUtil
.
class
,
e
);
}
}
}
}
...
@@ -77,7 +78,7 @@ public class WeChatUtil {
...
@@ -77,7 +78,7 @@ public class WeChatUtil {
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
,
new
IvParameterSpec
(
ivs
));
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
,
new
IvParameterSpec
(
ivs
));
encryptedText
=
cipher
.
doFinal
(
encryptedData
);
encryptedText
=
cipher
.
doFinal
(
encryptedData
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
ExceptionHelper
.
PrintError
(
WeChatUtil
.
class
,
e
);
}
}
return
encryptedText
;
return
encryptedText
;
}
}
...
...
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