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
ee88dbc8
Commit
ee88dbc8
authored
Jun 19, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL层级处理的支持
parent
168d95a5
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
62 additions
and
89 deletions
+62
-89
ObjectHelper.java
...src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
+2
-3
ByteHelper.java
...src/main/java/com/yanzuoguang/util/helper/ByteHelper.java
+1
-2
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+2
-3
FileHelper.java
...src/main/java/com/yanzuoguang/util/helper/FileHelper.java
+14
-20
HttpHelper.java
...src/main/java/com/yanzuoguang/util/helper/HttpHelper.java
+2
-5
RunHelper.java
.../src/main/java/com/yanzuoguang/util/helper/RunHelper.java
+2
-2
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+5
-3
UrlHelper.java
.../src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
+2
-3
ZipHelper.java
.../src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
+4
-5
RunnableList.java
...c/main/java/com/yanzuoguang/util/thread/RunnableList.java
+2
-3
RunnableListAutoItem.java
...ava/com/yanzuoguang/util/thread/RunnableListAutoItem.java
+1
-2
ResponseResult.java
...src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
+0
-1
TestTypeHelper.java
yzg-util-base/src/test/java/helper/TestTypeHelper.java
+1
-2
TestRunnableListAuto.java
yzg-util-base/src/test/java/thread/TestRunnableListAuto.java
+1
-2
HttpAspectUtil.java
...c/main/java/com/yanzuoguang/cloud/aop/HttpAspectUtil.java
+1
-2
ExcelHttp.java
.../src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
+2
-3
SqlCondBase.java
...b/src/main/java/com/yanzuoguang/dao/cond/SqlCondBase.java
+2
-3
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
+4
-4
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+4
-5
TableSqlCache.java
...src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
+2
-3
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+4
-5
BaseServiceImpl.java
...in/java/com/yanzuoguang/service/impl/BaseServiceImpl.java
+1
-2
MqServiceImpl.java
...n/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
+0
-1
PrinterHelper.java
...int/src/main/java/com/yanzuoguang/util/PrinterHelper.java
+1
-2
FormatCenter.java
...ava/com/yanzuoguang/util/printer/format/FormatCenter.java
+2
-3
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/base/ObjectHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
base
;
package
com
.
yanzuoguang
.
util
.
base
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -184,7 +183,7 @@ public class ObjectHelper {
...
@@ -184,7 +183,7 @@ public class ObjectHelper {
try
{
try
{
setByType
(
vType
,
target
,
field
,
value
);
setByType
(
vType
,
target
,
field
,
value
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
}
}
...
@@ -240,7 +239,7 @@ public class ObjectHelper {
...
@@ -240,7 +239,7 @@ public class ObjectHelper {
writeWithFromClass
(
to
,
from
);
writeWithFromClass
(
to
,
from
);
return
(
T
)
to
;
return
(
T
)
to
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Cod
eException
(
"对象"
+
cls
.
getName
()
+
"不能复制"
,
e
);
throw
new
Runtim
eException
(
"对象"
+
cls
.
getName
()
+
"不能复制"
,
e
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/ByteHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
/**
/**
* 通信格式转换
* 通信格式转换
...
@@ -543,7 +542,7 @@ public class ByteHelper {
...
@@ -543,7 +542,7 @@ public class ByteHelper {
*/
*/
public
static
byte
toBCD
(
int
from
)
{
public
static
byte
toBCD
(
int
from
)
{
if
(
from
>=
BCD_MAX_FLAG
)
{
if
(
from
>=
BCD_MAX_FLAG
)
{
throw
new
Cod
eException
(
"整形转换成字节的PCD码必须小于100"
);
throw
new
Runtim
eException
(
"整形转换成字节的PCD码必须小于100"
);
}
}
byte
bt
=
(
byte
)
((
from
/
BYTE_TEN_UNIT
*
BYTE_HEX_UNIT
)
+
from
%
BYTE_TEN_UNIT
);
byte
bt
=
(
byte
)
((
from
/
BYTE_TEN_UNIT
*
BYTE_HEX_UNIT
)
+
from
%
BYTE_TEN_UNIT
);
return
bt
;
return
bt
;
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
...
@@ -549,7 +548,7 @@ public class DateHelper {
...
@@ -549,7 +548,7 @@ public class DateHelper {
long
mill
=
toMill
-
fromMill
;
long
mill
=
toMill
-
fromMill
;
return
mill
;
return
mill
;
}
catch
(
ParseException
ex
)
{
}
catch
(
ParseException
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
...
@@ -754,7 +753,7 @@ public class DateHelper {
...
@@ -754,7 +753,7 @@ public class DateHelper {
Date
dt
=
format
.
parse
(
from
);
Date
dt
=
format
.
parse
(
from
);
return
format
.
format
(
dt
);
return
format
.
format
(
dt
);
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
throw
new
Cod
eException
(
e
);
throw
new
Runtim
eException
(
e
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/FileHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
java.io.BufferedReader
;
import
java.io.*
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.RandomAccessFile
;
/**
/**
* 登录相关函数
* 登录相关函数
...
@@ -39,7 +33,7 @@ public class FileHelper {
...
@@ -39,7 +33,7 @@ public class FileHelper {
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
return
StringHelper
.
EMPTY
;
return
StringHelper
.
EMPTY
;
}
else
{
}
else
{
throw
new
Cod
eException
(
"文件"
+
file
.
getName
()
+
"已存在文件,不能创建目录"
);
throw
new
Runtim
eException
(
"文件"
+
file
.
getName
()
+
"已存在文件,不能创建目录"
);
}
}
}
}
file
.
mkdirs
();
file
.
mkdirs
();
...
@@ -65,10 +59,10 @@ public class FileHelper {
...
@@ -65,10 +59,10 @@ public class FileHelper {
try
{
try
{
InputStream
inputStream
=
new
FileInputStream
(
file
);
InputStream
inputStream
=
new
FileInputStream
(
file
);
return
readFile
(
inputStream
,
encoding
);
return
readFile
(
inputStream
,
encoding
);
}
catch
(
Cod
eException
e
)
{
}
catch
(
Runtim
eException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Cod
eException
(
e
);
throw
new
Runtim
eException
(
e
);
}
}
}
}
...
@@ -99,10 +93,10 @@ public class FileHelper {
...
@@ -99,10 +93,10 @@ public class FileHelper {
}
finally
{
}
finally
{
inputStream
.
close
();
//关闭输入流
inputStream
.
close
();
//关闭输入流
}
}
}
catch
(
Cod
eException
e
)
{
}
catch
(
Runtim
eException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Cod
eException
(
e
);
throw
new
Runtim
eException
(
e
);
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
}
...
@@ -122,11 +116,11 @@ public class FileHelper {
...
@@ -122,11 +116,11 @@ public class FileHelper {
if
(
parentFile
!=
null
)
{
if
(
parentFile
!=
null
)
{
if
(!
parentFile
.
exists
())
{
if
(!
parentFile
.
exists
())
{
if
(!
parentFile
.
mkdirs
())
{
if
(!
parentFile
.
mkdirs
())
{
throw
new
Cod
eException
(
"创建文件夹失败"
);
throw
new
Runtim
eException
(
"创建文件夹失败"
);
}
}
}
}
if
(!
parentFile
.
exists
())
{
if
(!
parentFile
.
exists
())
{
throw
new
Cod
eException
(
"创建文件夹失败"
);
throw
new
Runtim
eException
(
"创建文件夹失败"
);
}
}
}
}
// 文件不存在则创建
// 文件不存在则创建
...
@@ -138,10 +132,10 @@ public class FileHelper {
...
@@ -138,10 +132,10 @@ public class FileHelper {
raf
.
seek
(
file
.
length
());
raf
.
seek
(
file
.
length
());
raf
.
write
(
content
.
getBytes
(
encoding
));
raf
.
write
(
content
.
getBytes
(
encoding
));
raf
.
close
();
raf
.
close
();
}
catch
(
Cod
eException
e
)
{
}
catch
(
Runtim
eException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Cod
eException
(
e
);
throw
new
Runtim
eException
(
e
);
}
}
}
}
...
@@ -157,17 +151,17 @@ public class FileHelper {
...
@@ -157,17 +151,17 @@ public class FileHelper {
// 删除文件
// 删除文件
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
if
(!
file
.
delete
())
{
if
(!
file
.
delete
())
{
throw
new
Cod
eException
(
"文件删除失败"
);
throw
new
Runtim
eException
(
"文件删除失败"
);
}
}
}
}
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
throw
new
Cod
eException
(
"文件删除失败"
);
throw
new
Runtim
eException
(
"文件删除失败"
);
}
}
writeFileAppend
(
file
,
content
,
encoding
);
writeFileAppend
(
file
,
content
,
encoding
);
}
catch
(
Cod
eException
e
)
{
}
catch
(
Runtim
eException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
Cod
eException
(
e
);
throw
new
Runtim
eException
(
e
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/HttpHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.thread.ProcessData
;
import
com.yanzuoguang.util.thread.ProcessData
;
import
com.yanzuoguang.util.thread.RunProcess
;
import
com.yanzuoguang.util.thread.RunProcess
;
...
@@ -10,7 +8,6 @@ import java.io.*;
...
@@ -10,7 +8,6 @@ import java.io.*;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLConnection
;
import
java.nio.charset.Charset
;
/**
/**
* HTTP请求工具类
* HTTP请求工具类
...
@@ -31,7 +28,7 @@ public class HttpHelper {
...
@@ -31,7 +28,7 @@ public class HttpHelper {
java
.
net
.
HttpURLConnection
httpConn
=
getConn
(
url
);
java
.
net
.
HttpURLConnection
httpConn
=
getConn
(
url
);
return
post
(
httpConn
,
jsonString
);
return
post
(
httpConn
,
jsonString
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
...
@@ -49,7 +46,7 @@ public class HttpHelper {
...
@@ -49,7 +46,7 @@ public class HttpHelper {
httpConn
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
httpConn
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
return
post
(
httpConn
,
jsonString
);
return
post
(
httpConn
,
jsonString
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/RunHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
/**
/**
* 重复执行工具类
* 重复执行工具类
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
RunHelper
{
public
class
RunHelper
{
...
@@ -50,7 +50,7 @@ public class RunHelper {
...
@@ -50,7 +50,7 @@ public class RunHelper {
}
}
}
}
if
(
ex
!=
null
)
{
if
(
ex
!=
null
)
{
throw
new
Cod
eException
(
tag
+
ex
.
getMessage
(),
ex
);
throw
new
Runtim
eException
(
tag
+
ex
.
getMessage
(),
ex
);
}
}
}
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
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.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -910,7 +912,7 @@ public class StringHelper {
...
@@ -910,7 +912,7 @@ public class StringHelper {
*/
*/
public
static
String
getNewMD5Id
(
Date
date
,
Object
...
froms
)
{
public
static
String
getNewMD5Id
(
Date
date
,
Object
...
froms
)
{
if
(
date
==
null
)
{
if
(
date
==
null
)
{
throw
new
Cod
eException
(
"生成时间搓 MD5 ID 时,时间不能为空"
);
throw
new
Runtim
eException
(
"生成时间搓 MD5 ID 时,时间不能为空"
);
}
}
String
tag
=
getNewIdTag
(
date
.
getTime
());
String
tag
=
getNewIdTag
(
date
.
getTime
());
String
id
=
md51
(
getId
(
froms
));
String
id
=
md51
(
getId
(
froms
));
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
View file @
ee88dbc8
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.CodeException
;
import
java.net.*
;
import
java.net.*
;
import
java.util.*
;
import
java.util.*
;
...
@@ -33,7 +32,7 @@ public class UrlHelper {
...
@@ -33,7 +32,7 @@ public class UrlHelper {
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
...
@@ -48,7 +47,7 @@ public class UrlHelper {
...
@@ -48,7 +47,7 @@ public class UrlHelper {
try
{
try
{
return
URLDecoder
.
decode
(
from
,
encoding
);
return
URLDecoder
.
decode
(
from
,
encoding
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
);
throw
new
Runtim
eException
(
ex
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedOutputStream
;
...
@@ -39,10 +38,10 @@ public class ZipHelper {
...
@@ -39,10 +38,10 @@ public class ZipHelper {
*/
*/
public
static
void
zipDirectory
(
File
dirFile
,
File
zipFile
,
boolean
isDir
)
throws
IOException
{
public
static
void
zipDirectory
(
File
dirFile
,
File
zipFile
,
boolean
isDir
)
throws
IOException
{
if
(
dirFile
==
null
)
{
if
(
dirFile
==
null
)
{
throw
new
Cod
eException
(
"压缩时文件夹对象不能为空。"
);
throw
new
Runtim
eException
(
"压缩时文件夹对象不能为空。"
);
}
}
if
(!
dirFile
.
isDirectory
())
{
if
(!
dirFile
.
isDirectory
())
{
throw
new
Cod
eException
(
"["
+
dirFile
.
getName
()
+
"]不是一个文件夹,或者不存在。"
);
throw
new
Runtim
eException
(
"["
+
dirFile
.
getName
()
+
"]不是一个文件夹,或者不存在。"
);
}
}
if
(
zipFile
==
null
)
{
if
(
zipFile
==
null
)
{
zipFile
=
new
File
(
dirFile
.
getAbsolutePath
()
+
".zip"
);
zipFile
=
new
File
(
dirFile
.
getAbsolutePath
()
+
".zip"
);
...
@@ -158,7 +157,7 @@ public class ZipHelper {
...
@@ -158,7 +157,7 @@ public class ZipHelper {
if
(
flag
)
{
if
(
flag
)
{
tempFile
.
renameTo
(
zipTo
);
tempFile
.
renameTo
(
zipTo
);
}
else
{
}
else
{
throw
new
Cod
eException
(
"删除文件失败"
);
throw
new
Runtim
eException
(
"删除文件失败"
);
}
}
}
}
}
}
...
@@ -216,7 +215,7 @@ public class ZipHelper {
...
@@ -216,7 +215,7 @@ public class ZipHelper {
*/
*/
private
static
void
zipFile
(
String
sourcePath
,
File
file
,
ZipOutputStream
zipOutStream
,
BufferedOutputStream
bufferOutStream
)
throws
IOException
{
private
static
void
zipFile
(
String
sourcePath
,
File
file
,
ZipOutputStream
zipOutStream
,
BufferedOutputStream
bufferOutStream
)
throws
IOException
{
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
throw
new
Cod
eException
(
"文件"
+
file
.
getAbsolutePath
()
+
"不存在"
);
throw
new
Runtim
eException
(
"文件"
+
file
.
getAbsolutePath
()
+
"不存在"
);
}
}
// 创建压缩文件实体
// 创建压缩文件实体
ZipEntry
entry
=
new
ZipEntry
(
sourcePath
+
file
.
getName
());
ZipEntry
entry
=
new
ZipEntry
(
sourcePath
+
file
.
getName
());
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableList.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.exception.CodeException
;
/**
/**
* 根据指定的线程数量, 执行多个Runnable对象
* 根据指定的线程数量, 执行多个Runnable对象
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
RunnableList
extends
AbstractThreadList
<
Runnable
>
{
public
class
RunnableList
extends
AbstractThreadList
<
Runnable
>
{
...
@@ -28,7 +27,7 @@ public class RunnableList extends AbstractThreadList<Runnable> {
...
@@ -28,7 +27,7 @@ public class RunnableList extends AbstractThreadList<Runnable> {
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
throw
ex
;
throw
ex
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
ex
.
getMessage
(),
ex
);
throw
new
Runtim
eException
(
ex
.
getMessage
(),
ex
);
}
}
}
}
}
}
yzg-util-base/src/main/java/com/yanzuoguang/util/thread/RunnableListAutoItem.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
thread
;
package
com
.
yanzuoguang
.
util
.
thread
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -158,7 +157,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
...
@@ -158,7 +157,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
if
(
ex
instanceof
RuntimeException
)
{
if
(
ex
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
ex
;
throw
(
RuntimeException
)
ex
;
}
else
{
}
else
{
throw
new
Cod
eException
(
ex
.
getMessage
(),
ex
);
throw
new
Runtim
eException
(
ex
.
getMessage
(),
ex
);
}
}
}
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
View file @
ee88dbc8
...
@@ -3,7 +3,6 @@ package com.yanzuoguang.util.vo;
...
@@ -3,7 +3,6 @@ package com.yanzuoguang.util.vo;
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.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
/**
/**
...
...
yzg-util-base/src/test/java/helper/TestTypeHelper.java
View file @
ee88dbc8
package
helper
;
package
helper
;
import
base.DemoVo
;
import
base.DemoVo
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.TypeHelper
;
import
com.yanzuoguang.util.helper.TypeHelper
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
helper.vo.ResponseDataMainResult
;
import
helper.vo.ResponseDataMainResult
;
...
@@ -24,7 +23,7 @@ public class TestTypeHelper {
...
@@ -24,7 +23,7 @@ public class TestTypeHelper {
TypeHelper
.
printSuperClass
(
returnType
);
TypeHelper
.
printSuperClass
(
returnType
);
boolean
isSub
=
TypeHelper
.
isSubType
(
returnType
,
ResponseResult
.
class
);
boolean
isSub
=
TypeHelper
.
isSubType
(
returnType
,
ResponseResult
.
class
);
if
(!
isSub
)
{
if
(!
isSub
)
{
throw
new
Cod
eException
(
"泛型继承检测错误"
);
throw
new
Runtim
eException
(
"泛型继承检测错误"
);
}
}
}
}
}
}
yzg-util-base/src/test/java/thread/TestRunnableListAuto.java
View file @
ee88dbc8
package
thread
;
package
thread
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.log.Log
;
import
com.yanzuoguang.util.thread.RunnableListAuto
;
import
com.yanzuoguang.util.thread.RunnableListAuto
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -28,7 +27,7 @@ public class TestRunnableListAuto {
...
@@ -28,7 +27,7 @@ public class TestRunnableListAuto {
public
void
test
()
{
public
void
test
()
{
try
{
try
{
runTest
(
true
);
runTest
(
true
);
throw
new
Cod
eException
(
"没有抛出异常"
);
throw
new
Runtim
eException
(
"没有抛出异常"
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
// Log.error(TestRunnableListAuto.class, ex);
// Log.error(TestRunnableListAuto.class, ex);
}
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/HttpAspectUtil.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
cloud
.
aop
;
package
com
.
yanzuoguang
.
cloud
.
aop
;
import
com.yanzuoguang.util.exception.CodeException
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
@@ -20,7 +19,7 @@ public class HttpAspectUtil {
...
@@ -20,7 +19,7 @@ public class HttpAspectUtil {
public
static
HttpServletRequest
getRequest
()
{
public
static
HttpServletRequest
getRequest
()
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
attributes
==
null
)
{
if
(
attributes
==
null
)
{
throw
new
Cod
eException
(
"监视错误"
);
throw
new
Runtim
eException
(
"监视错误"
);
}
}
return
attributes
.
getRequest
();
return
attributes
.
getRequest
();
}
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
View file @
ee88dbc8
...
@@ -6,7 +6,6 @@ import com.yanzuoguang.excel.ExcelConsole;
...
@@ -6,7 +6,6 @@ import com.yanzuoguang.excel.ExcelConsole;
import
com.yanzuoguang.excel.ExcelRow
;
import
com.yanzuoguang.excel.ExcelRow
;
import
com.yanzuoguang.excel.ExportBase
;
import
com.yanzuoguang.excel.ExportBase
;
import
com.yanzuoguang.excel.ExportData
;
import
com.yanzuoguang.excel.ExportData
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -75,7 +74,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
...
@@ -75,7 +74,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
public
static
<
T
extends
Object
,
M
extends
Object
>
void
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
)
{
public
static
<
T
extends
Object
,
M
extends
Object
>
void
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
)
{
ExportData
config
=
req
.
getConfig
();
ExportData
config
=
req
.
getConfig
();
if
(
config
==
null
)
{
if
(
config
==
null
)
{
throw
new
Cod
eException
(
"导出时请传入配置信息"
);
throw
new
Runtim
eException
(
"导出时请传入配置信息"
);
}
}
if
(
StringHelper
.
isEmpty
(
config
.
getServerPath
()))
{
if
(
StringHelper
.
isEmpty
(
config
.
getServerPath
()))
{
config
.
setServerPath
(
"/home/cache/"
);
config
.
setServerPath
(
"/home/cache/"
);
...
@@ -94,7 +93,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
...
@@ -94,7 +93,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
excel
.
down
(
response
);
excel
.
down
(
response
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
Cod
eException
(
"下载失败"
,
e
);
throw
new
Runtim
eException
(
"下载失败"
,
e
);
}
finally
{
}
finally
{
// 删除生成的临时文件
// 删除生成的临时文件
excel
.
remove
();
excel
.
remove
();
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/cond/SqlCondBase.java
View file @
ee88dbc8
...
@@ -4,7 +4,6 @@ import com.yanzuoguang.dao.DaoConst;
...
@@ -4,7 +4,6 @@ import com.yanzuoguang.dao.DaoConst;
import
com.yanzuoguang.dao.impl.SqlData
;
import
com.yanzuoguang.dao.impl.SqlData
;
import
com.yanzuoguang.dao.impl.SqlDataField
;
import
com.yanzuoguang.dao.impl.SqlDataField
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -71,7 +70,7 @@ public abstract class SqlCondBase<T extends SqlCondBase> implements SqlCond<T> {
...
@@ -71,7 +70,7 @@ public abstract class SqlCondBase<T extends SqlCondBase> implements SqlCond<T> {
@Override
@Override
public
String
getSql
(
String
sql
,
SqlData
sqlData
,
SqlDataField
sqlDataField
,
Object
model
,
Map
<
String
,
List
<
String
>>
codeMap
)
{
public
String
getSql
(
String
sql
,
SqlData
sqlData
,
SqlDataField
sqlDataField
,
Object
model
,
Map
<
String
,
List
<
String
>>
codeMap
)
{
if
(
sqlDataField
.
getCond
()
!=
this
)
{
if
(
sqlDataField
.
getCond
()
!=
this
)
{
throw
new
Cod
eException
(
"不能处理非本条件的字段"
);
throw
new
Runtim
eException
(
"不能处理非本条件的字段"
);
}
}
int
condType
=
getCondType
(
model
,
sqlDataField
);
int
condType
=
getCondType
(
model
,
sqlDataField
);
switch
(
condType
)
{
switch
(
condType
)
{
...
@@ -86,7 +85,7 @@ public abstract class SqlCondBase<T extends SqlCondBase> implements SqlCond<T> {
...
@@ -86,7 +85,7 @@ public abstract class SqlCondBase<T extends SqlCondBase> implements SqlCond<T> {
String
fieldName
=
this
.
fields
.
isEmpty
()
?
StringHelper
.
EMPTY
:
this
.
fields
.
get
(
0
);
String
fieldName
=
this
.
fields
.
isEmpty
()
?
StringHelper
.
EMPTY
:
this
.
fields
.
get
(
0
);
// 判断代码片段是否合法
// 判断代码片段是否合法
if
(
sqlDataField
.
getCodes
().
size
()
%
2
==
1
)
{
if
(
sqlDataField
.
getCodes
().
size
()
%
2
==
1
)
{
throw
new
Cod
eException
(
"代码片段"
+
this
.
getClass
().
getSimpleName
()
+
":"
+
sqlData
.
getName
()
+
":"
+
fieldName
+
"为单数"
);
throw
new
Runtim
eException
(
"代码片段"
+
this
.
getClass
().
getSimpleName
()
+
":"
+
sqlData
.
getName
()
+
":"
+
fieldName
+
"为单数"
);
}
}
// 处理代码片段
// 处理代码片段
for
(
int
i
=
0
;
i
<
sqlDataField
.
getCodes
().
size
();
i
=
i
+
DaoConst
.
CODE_UNIT
)
{
for
(
int
i
=
0
;
i
<
sqlDataField
.
getCodes
().
size
();
i
=
i
+
DaoConst
.
CODE_UNIT
)
{
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
View file @
ee88dbc8
...
@@ -45,7 +45,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
...
@@ -45,7 +45,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
*/
*/
protected
String
getKey
()
{
protected
String
getKey
()
{
if
(
this
.
table
==
null
)
{
if
(
this
.
table
==
null
)
{
throw
new
Cod
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
throw
new
Runtim
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
}
}
return
this
.
table
.
getTable
().
getKeyName
();
return
this
.
table
.
getTable
().
getKeyName
();
}
}
...
@@ -165,13 +165,13 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
...
@@ -165,13 +165,13 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
public
String
update
(
Object
model
)
{
public
String
update
(
Object
model
)
{
String
keyString
=
this
.
getKeyString
(
model
);
String
keyString
=
this
.
getKeyString
(
model
);
if
(
StringHelper
.
isEmpty
(
keyString
))
{
if
(
StringHelper
.
isEmpty
(
keyString
))
{
throw
new
Cod
eException
(
"表"
+
this
.
table
.
getTable
().
getName
()
+
"主键值为空时不能更新"
);
throw
new
Runtim
eException
(
"表"
+
this
.
table
.
getTable
().
getName
()
+
"主键值为空时不能更新"
);
}
}
this
.
check
(
DaoConst
.
OPERATOR_TYPE_UPDATE
,
keyString
,
model
);
this
.
check
(
DaoConst
.
OPERATOR_TYPE_UPDATE
,
keyString
,
model
);
SqlData
sqlData
=
this
.
getSql
(
DaoConst
.
UPDATE
);
SqlData
sqlData
=
this
.
getSql
(
DaoConst
.
UPDATE
);
int
ret
=
updateSql
(
sqlData
,
model
);
int
ret
=
updateSql
(
sqlData
,
model
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
throw
new
Cod
eException
(
"修改失败,请确认是否被其他人修改,版本号传入是否正确"
);
throw
new
Runtim
eException
(
"修改失败,请确认是否被其他人修改,版本号传入是否正确"
);
}
}
String
retVal
=
ret
>
0
?
keyString
:
""
;
String
retVal
=
ret
>
0
?
keyString
:
""
;
return
retVal
;
return
retVal
;
...
@@ -851,7 +851,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
...
@@ -851,7 +851,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
try
{
try
{
from
=
cls
.
newInstance
();
from
=
cls
.
newInstance
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
"创建对象"
+
cls
.
getName
()
+
"出错"
,
ex
);
throw
new
Runtim
eException
(
"创建对象"
+
cls
.
getName
()
+
"出错"
,
ex
);
}
}
ObjectHelper
.
writeWithFrom
(
from
,
request
);
ObjectHelper
.
writeWithFrom
(
from
,
request
);
return
this
.
create
(
from
);
return
this
.
create
(
from
);
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
ee88dbc8
...
@@ -7,7 +7,6 @@ import com.yanzuoguang.db.DbExecute;
...
@@ -7,7 +7,6 @@ import com.yanzuoguang.db.DbExecute;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.cache.MemoryCache
;
import
com.yanzuoguang.util.cache.MemoryCache
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.ArrayHelper
;
import
com.yanzuoguang.util.helper.ArrayHelper
;
import
com.yanzuoguang.util.helper.StringFormatHandle
;
import
com.yanzuoguang.util.helper.StringFormatHandle
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -110,7 +109,7 @@ public abstract class BaseDaoSql {
...
@@ -110,7 +109,7 @@ public abstract class BaseDaoSql {
protected
TableSqlCache
register
(
Class
<?>
clsModel
)
{
protected
TableSqlCache
register
(
Class
<?>
clsModel
)
{
TableAnnotation
annotation
=
clsModel
.
getAnnotation
(
TableAnnotation
.
class
);
TableAnnotation
annotation
=
clsModel
.
getAnnotation
(
TableAnnotation
.
class
);
if
(
annotation
==
null
)
{
if
(
annotation
==
null
)
{
throw
new
Cod
eException
(
"该页面未绑定表"
);
throw
new
Runtim
eException
(
"该页面未绑定表"
);
}
}
return
this
.
register
(
annotation
.
value
(),
clsModel
);
return
this
.
register
(
annotation
.
value
(),
clsModel
);
}
}
...
@@ -148,11 +147,11 @@ public abstract class BaseDaoSql {
...
@@ -148,11 +147,11 @@ public abstract class BaseDaoSql {
*/
*/
protected
SqlData
getSql
(
String
name
,
boolean
isThrow
)
{
protected
SqlData
getSql
(
String
name
,
boolean
isThrow
)
{
if
(
this
.
table
==
null
)
{
if
(
this
.
table
==
null
)
{
throw
new
Cod
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
throw
new
Runtim
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
}
}
SqlData
sql
=
this
.
table
.
getNameCache
().
get
(
name
);
SqlData
sql
=
this
.
table
.
getNameCache
().
get
(
name
);
if
(
isThrow
&&
sql
==
null
)
{
if
(
isThrow
&&
sql
==
null
)
{
throw
new
Cod
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现SQL语句"
+
name
);
throw
new
Runtim
eException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现SQL语句"
+
name
);
}
}
return
sql
;
return
sql
;
}
}
...
@@ -760,7 +759,7 @@ public abstract class BaseDaoSql {
...
@@ -760,7 +759,7 @@ public abstract class BaseDaoSql {
sb
.
append
(
"AVG"
);
sb
.
append
(
"AVG"
);
break
;
break
;
default
:
default
:
throw
new
Cod
eException
(
"统计类型["
+
from
.
getGroupType
()
+
"]不支持"
);
throw
new
Runtim
eException
(
"统计类型["
+
from
.
getGroupType
()
+
"]不支持"
);
}
}
sb
.
append
(
"( CASE WHEN "
);
sb
.
append
(
"( CASE WHEN "
);
sb
.
append
(
from
.
getCaseField
());
sb
.
append
(
from
.
getCaseField
());
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
View file @
ee88dbc8
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.dao.impl;
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.dao.impl;
import
com.yanzuoguang.dao.DaoConst
;
import
com.yanzuoguang.dao.DaoConst
;
import
com.yanzuoguang.util.cache.MemoryCache
;
import
com.yanzuoguang.util.cache.MemoryCache
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -170,7 +169,7 @@ public class TableSqlCache {
...
@@ -170,7 +169,7 @@ public class TableSqlCache {
for
(
String
item
:
tableWhereField
.
getFields
())
{
for
(
String
item
:
tableWhereField
.
getFields
())
{
String
name
=
item
.
toLowerCase
();
String
name
=
item
.
toLowerCase
();
if
(!
sqlFieldHas
.
containsKey
(
name
))
{
if
(!
sqlFieldHas
.
containsKey
(
name
))
{
throw
new
Cod
eException
(
"SQL语句"
+
item
+
"不存在纬度"
+
item
);
throw
new
Runtim
eException
(
"SQL语句"
+
item
+
"不存在纬度"
+
item
);
}
}
sqlFieldWhere
.
put
(
name
,
true
);
sqlFieldWhere
.
put
(
name
,
true
);
}
}
...
@@ -196,7 +195,7 @@ public class TableSqlCache {
...
@@ -196,7 +195,7 @@ public class TableSqlCache {
}
else
if
(!
StringHelper
.
isEmpty
(
this
.
table
.
getMD5KeyName
()))
{
}
else
if
(!
StringHelper
.
isEmpty
(
this
.
table
.
getMD5KeyName
()))
{
addString
(
map
,
"{Key}"
,
this
.
table
.
getMD5KeyName
());
addString
(
map
,
"{Key}"
,
this
.
table
.
getMD5KeyName
());
}
else
{
}
else
{
throw
new
Cod
eException
(
"表中未包含MD5字段"
);
throw
new
Runtim
eException
(
"表中未包含MD5字段"
);
}
}
String
lowerKey
=
this
.
table
.
getKeyName
().
toLowerCase
();
String
lowerKey
=
this
.
table
.
getKeyName
().
toLowerCase
();
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
excel
;
package
com
.
yanzuoguang
.
excel
;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.util.exception.CodeException
;
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
;
...
@@ -164,7 +163,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -164,7 +163,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
*/
*/
protected
void
initExcel
(
TableHead
head
)
{
protected
void
initExcel
(
TableHead
head
)
{
if
(
this
.
workbook
!=
null
)
{
if
(
this
.
workbook
!=
null
)
{
throw
new
Cod
eException
(
"Excel已初始化"
);
throw
new
Runtim
eException
(
"Excel已初始化"
);
}
}
// 创建合并对象数据检测
// 创建合并对象数据检测
mergerGroup
=
new
HashMap
<>();
mergerGroup
=
new
HashMap
<>();
...
@@ -379,13 +378,13 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -379,13 +378,13 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
out
.
flush
();
out
.
flush
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
Cod
eException
(
"保存失败"
);
throw
new
Runtim
eException
(
"保存失败"
);
}
finally
{
}
finally
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
Cod
eException
(
"保存失败"
);
throw
new
Runtim
eException
(
"保存失败"
);
}
}
return
this
;
return
this
;
}
}
...
@@ -402,7 +401,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
...
@@ -402,7 +401,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
File
file
=
new
File
(
this
.
getFileName
());
File
file
=
new
File
(
this
.
getFileName
());
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
if
(!
file
.
delete
())
{
if
(!
file
.
delete
())
{
throw
new
Cod
eException
(
"文件删除失败"
);
throw
new
Runtim
eException
(
"文件删除失败"
);
}
}
}
}
return
this
;
return
this
;
...
...
yzg-util-db/src/main/java/com/yanzuoguang/service/impl/BaseServiceImpl.java
View file @
ee88dbc8
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.service.impl;
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.service.impl;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.service.BaseService
;
import
com.yanzuoguang.service.BaseService
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -186,7 +185,7 @@ public abstract class BaseServiceImpl<T> implements BaseService<T> {
...
@@ -186,7 +185,7 @@ public abstract class BaseServiceImpl<T> implements BaseService<T> {
*/
*/
private
void
check
(
String
opTag
,
String
serviceTag
,
Object
id
)
{
private
void
check
(
String
opTag
,
String
serviceTag
,
Object
id
)
{
if
(
StringHelper
.
isEmpty
(
id
))
{
if
(
StringHelper
.
isEmpty
(
id
))
{
throw
new
Cod
eException
(
opTag
+
serviceTag
+
"失败,该数据可能已被修改"
);
throw
new
Runtim
eException
(
opTag
+
serviceTag
+
"失败,该数据可能已被修改"
);
}
}
}
}
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
View file @
ee88dbc8
...
@@ -16,7 +16,6 @@ import com.yanzuoguang.mq.vo.QueueVo;
...
@@ -16,7 +16,6 @@ import com.yanzuoguang.mq.vo.QueueVo;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerMessageReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerMessageReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerQueueReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerQueueReqVo
;
import
com.yanzuoguang.util.exception.CodeException
;
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.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
...
yzg-util-print/src/main/java/com/yanzuoguang/util/PrinterHelper.java
View file @
ee88dbc8
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.util;
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.util;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.StringFormatHandle
;
import
com.yanzuoguang.util.helper.StringFormatHandle
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
...
@@ -68,7 +67,7 @@ public class PrinterHelper {
...
@@ -68,7 +67,7 @@ public class PrinterHelper {
try
{
try
{
pager
=
JsonHelper
.
deserialize
(
from
.
getPager
(),
PrinterPagerData
.
class
);
pager
=
JsonHelper
.
deserialize
(
from
.
getPager
(),
PrinterPagerData
.
class
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
Cod
eException
(
"不能识别模板"
,
ex
);
throw
new
Runtim
eException
(
"不能识别模板"
,
ex
);
}
}
// 设置偏移量
// 设置偏移量
pager
.
setMarginTop
(
pager
.
getMarginTop
()
+
top
);
pager
.
setMarginTop
(
pager
.
getMarginTop
()
+
top
);
...
...
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/format/FormatCenter.java
View file @
ee88dbc8
package
com
.
yanzuoguang
.
util
.
printer
.
format
;
package
com
.
yanzuoguang
.
util
.
printer
.
format
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -53,7 +52,7 @@ public class FormatCenter {
...
@@ -53,7 +52,7 @@ public class FormatCenter {
private
String
format
(
String
command
,
String
formatValue
)
{
private
String
format
(
String
command
,
String
formatValue
)
{
this
.
initDefault
();
this
.
initDefault
();
if
(
StringHelper
.
isEmpty
(
command
))
{
if
(
StringHelper
.
isEmpty
(
command
))
{
throw
new
Cod
eException
(
"你需要格式化的字符串格式为空"
);
throw
new
Runtim
eException
(
"你需要格式化的字符串格式为空"
);
}
}
String
[]
commands
=
command
.
split
(
":"
);
String
[]
commands
=
command
.
split
(
":"
);
String
name
=
commands
[
0
];
String
name
=
commands
[
0
];
...
@@ -63,7 +62,7 @@ public class FormatCenter {
...
@@ -63,7 +62,7 @@ public class FormatCenter {
}
}
FormatHandle
formatHandle
=
cache
.
get
(
name
);
FormatHandle
formatHandle
=
cache
.
get
(
name
);
if
(
formatHandle
==
null
)
{
if
(
formatHandle
==
null
)
{
throw
new
Cod
eException
(
"需要格式化的字符串不支持"
);
throw
new
Runtim
eException
(
"需要格式化的字符串不支持"
);
}
}
return
formatHandle
.
getFormat
(
name
,
format
,
formatValue
);
return
formatHandle
.
getFormat
(
name
,
format
,
formatValue
);
}
}
...
...
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