Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloud
Commits
7fa8137a
Commit
7fa8137a
authored
Oct 22, 2018
by
HuangBingGui
Browse files
no commit message
parent
6c859da2
Changes
202
Hide whitespace changes
Inline
Side-by-side
JeeSpringCloud/src/main/java/com/jeespring/common/redis/RedisUtils.java
View file @
7fa8137a
...
@@ -52,17 +52,19 @@ public class RedisUtils {
...
@@ -52,17 +52,19 @@ public class RedisUtils {
private
StringRedisTemplate
stringRedisTemplate
;
private
StringRedisTemplate
stringRedisTemplate
;
public
static
String
getExpire
(){
public
static
String
getExpire
(){
if
(
expireTime
!=
null
)
if
(
expireTime
!=
null
)
{
return
String
.
valueOf
(
expireTime
/
60
)+
"分钟"
;
return
String
.
valueOf
(
expireTime
/
60
)
+
"分钟"
;
else
}
else
{
return
"0分钟"
;
return
"0分钟"
;
}
}
}
public
static
String
getExpireShiro
(){
public
static
String
getExpireShiro
(){
if
(
expireTimeShiro
!=
null
)
if
(
expireTimeShiro
!=
null
)
{
return
String
.
valueOf
(
expireTimeShiro
/
60
)+
"分钟"
;
return
String
.
valueOf
(
expireTimeShiro
/
60
)
+
"分钟"
;
else
}
else
{
return
"0分钟"
;
return
"0分钟"
;
}
}
}
public
static
String
getKey
(
String
className
,
String
keyName
,
String
keyId
){
public
static
String
getKey
(
String
className
,
String
keyName
,
String
keyId
){
...
@@ -147,10 +149,13 @@ public class RedisUtils {
...
@@ -147,10 +149,13 @@ public class RedisUtils {
return
;
return
;
}
}
try
{
try
{
if
(
pattern
==
null
)
pattern
=
""
;
if
(
pattern
==
null
)
{
pattern
=
""
;
}
Set
<
String
>
keys
=
getKyes
(
pattern
);
Set
<
String
>
keys
=
getKyes
(
pattern
);
if
(
keys
.
size
()
>
0
)
if
(
keys
.
size
()
>
0
)
{
redisTemplate
.
delete
(
keys
);
redisTemplate
.
delete
(
keys
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"RedisUtils removePattern:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
logger
.
error
(
"RedisUtils removePattern:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
}
}
...
@@ -162,7 +167,9 @@ public class RedisUtils {
...
@@ -162,7 +167,9 @@ public class RedisUtils {
return
;
return
;
}
}
try
{
try
{
if
(
pattern
==
null
)
pattern
=
""
;
if
(
pattern
==
null
)
{
pattern
=
""
;
}
Set
<
String
>
keys
=
getKyesShiroReids
(
pattern
);
Set
<
String
>
keys
=
getKyesShiroReids
(
pattern
);
if
(
keys
.
size
()
>
0
){
if
(
keys
.
size
()
>
0
){
stringRedisTemplate
.
delete
(
keys
);
stringRedisTemplate
.
delete
(
keys
);
...
@@ -203,10 +210,11 @@ public class RedisUtils {
...
@@ -203,10 +210,11 @@ public class RedisUtils {
Iterator
<
String
>
it
=
keys
.
iterator
();
Iterator
<
String
>
it
=
keys
.
iterator
();
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
String
tr
=
it
.
next
();
String
tr
=
it
.
next
();
if
(
tr
.
contains
(
SHIRO_REDIS
))
if
(
tr
.
contains
(
SHIRO_REDIS
))
{
keysnew
.
add
(
tr
);
keysnew
.
add
(
tr
);
else
if
(
tr
.
contains
(
SHIRO_REDIS_OBJECT
))
}
else
if
(
tr
.
contains
(
SHIRO_REDIS_OBJECT
))
{
keysnew
.
add
(
tr
.
substring
(
8
));
keysnew
.
add
(
tr
.
substring
(
8
));
}
}
}
return
keysnew
;
return
keysnew
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -284,10 +292,11 @@ public class RedisUtils {
...
@@ -284,10 +292,11 @@ public class RedisUtils {
if
(!
run
())
{
return
false
;
}
if
(!
run
())
{
return
false
;
}
boolean
retuslt
=
false
;
boolean
retuslt
=
false
;
try
{
try
{
if
(
key
.
contains
(
SHIRO_REDIS
))
if
(
key
.
contains
(
SHIRO_REDIS
))
{
retuslt
=
stringRedisTemplate
.
hasKey
(
key
);
retuslt
=
stringRedisTemplate
.
hasKey
(
key
);
else
}
else
{
retuslt
=
redisTemplate
.
hasKey
(
key
);
retuslt
=
redisTemplate
.
hasKey
(
key
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"RedisUtils exists:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
logger
.
error
(
"RedisUtils exists:"
+
RUN_MESSAGE
+
e
.
getMessage
(),
RUN_MESSAGE
+
e
.
getMessage
());
}
}
...
@@ -399,8 +408,9 @@ public class RedisUtils {
...
@@ -399,8 +408,9 @@ public class RedisUtils {
}
}
private
boolean
listFlush
(){
private
boolean
listFlush
(){
if
(
Global
.
getConfig
(
"spring.redis.listFlush"
)==
"true"
)
if
(
Global
.
getConfig
(
"spring.redis.listFlush"
)==
"true"
)
{
return
true
;
return
true
;
}
return
false
;
return
false
;
}
}
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/common/security/Digests.java
View file @
7fa8137a
...
@@ -132,14 +132,16 @@ public class Digests {
...
@@ -132,14 +132,16 @@ public class Digests {
char
[]
charArray
=
inStr
.
toCharArray
();
char
[]
charArray
=
inStr
.
toCharArray
();
byte
[]
byteArray
=
new
byte
[
charArray
.
length
];
byte
[]
byteArray
=
new
byte
[
charArray
.
length
];
for
(
int
i
=
0
;
i
<
charArray
.
length
;
i
++)
for
(
int
i
=
0
;
i
<
charArray
.
length
;
i
++)
{
byteArray
[
i
]
=
(
byte
)
charArray
[
i
];
byteArray
[
i
]
=
(
byte
)
charArray
[
i
];
}
byte
[]
md5Bytes
=
md5
.
digest
(
byteArray
);
byte
[]
md5Bytes
=
md5
.
digest
(
byteArray
);
StringBuffer
hexValue
=
new
StringBuffer
();
StringBuffer
hexValue
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
md5Bytes
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
md5Bytes
.
length
;
i
++){
int
val
=
((
int
)
md5Bytes
[
i
])
&
0xff
;
int
val
=
((
int
)
md5Bytes
[
i
])
&
0xff
;
if
(
val
<
16
)
if
(
val
<
16
)
{
hexValue
.
append
(
"0"
);
hexValue
.
append
(
"0"
);
}
hexValue
.
append
(
Integer
.
toHexString
(
val
));
hexValue
.
append
(
Integer
.
toHexString
(
val
));
}
}
return
hexValue
.
toString
();
return
hexValue
.
toString
();
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/security/MD5Tools.java
View file @
7fa8137a
...
@@ -15,8 +15,8 @@ public class MD5Tools
...
@@ -15,8 +15,8 @@ public class MD5Tools
{
{
public
final
static
String
MD5
(
String
pwd
)
{
public
final
static
String
MD5
(
String
pwd
)
{
//用于加密的字符
//用于加密的字符
char
md5String
[]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
char
[]
md5String
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
try
{
try
{
//使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中
//使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中
byte
[]
btInput
=
pwd
.
getBytes
();
byte
[]
btInput
=
pwd
.
getBytes
();
...
@@ -32,7 +32,7 @@ public class MD5Tools
...
@@ -32,7 +32,7 @@ public class MD5Tools
// 把密文转换成十六进制的字符串形式
// 把密文转换成十六进制的字符串形式
int
j
=
md
.
length
;
int
j
=
md
.
length
;
char
str
[]
=
new
char
[
j
*
2
];
char
[]
str
=
new
char
[
j
*
2
];
int
k
=
0
;
int
k
=
0
;
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
// i = 0
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
// i = 0
byte
byte0
=
md
[
i
];
//95
byte
byte0
=
md
[
i
];
//95
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/security/shiro/session/SessionManager.java
View file @
7fa8137a
...
@@ -68,7 +68,8 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -68,7 +68,8 @@ public class SessionManager extends DefaultWebSessionManager {
super
.
validateSessions
();
super
.
validateSessions
();
}
}
protected
Session
retrieveSession
(
SessionKey
sessionKey
)
{
@Override
protected
Session
retrieveSession
(
SessionKey
sessionKey
)
{
try
{
try
{
return
super
.
retrieveSession
(
sessionKey
);
return
super
.
retrieveSession
(
sessionKey
);
}
catch
(
UnknownSessionException
e
)
{
}
catch
(
UnknownSessionException
e
)
{
...
@@ -77,6 +78,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -77,6 +78,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
Date
getStartTimestamp
(
SessionKey
key
)
{
public
Date
getStartTimestamp
(
SessionKey
key
)
{
try
{
try
{
return
super
.
getStartTimestamp
(
key
);
return
super
.
getStartTimestamp
(
key
);
...
@@ -86,6 +88,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -86,6 +88,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
Date
getLastAccessTime
(
SessionKey
key
)
{
public
Date
getLastAccessTime
(
SessionKey
key
)
{
try
{
try
{
return
super
.
getLastAccessTime
(
key
);
return
super
.
getLastAccessTime
(
key
);
...
@@ -95,6 +98,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -95,6 +98,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
long
getTimeout
(
SessionKey
key
){
public
long
getTimeout
(
SessionKey
key
){
try
{
try
{
return
super
.
getTimeout
(
key
);
return
super
.
getTimeout
(
key
);
...
@@ -104,6 +108,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -104,6 +108,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
void
setTimeout
(
SessionKey
key
,
long
maxIdleTimeInMillis
)
{
public
void
setTimeout
(
SessionKey
key
,
long
maxIdleTimeInMillis
)
{
try
{
try
{
super
.
setTimeout
(
key
,
maxIdleTimeInMillis
);
super
.
setTimeout
(
key
,
maxIdleTimeInMillis
);
...
@@ -112,6 +117,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -112,6 +117,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
void
touch
(
SessionKey
key
)
{
public
void
touch
(
SessionKey
key
)
{
try
{
try
{
super
.
touch
(
key
);
super
.
touch
(
key
);
...
@@ -120,6 +126,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -120,6 +126,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
String
getHost
(
SessionKey
key
)
{
public
String
getHost
(
SessionKey
key
)
{
try
{
try
{
return
super
.
getHost
(
key
);
return
super
.
getHost
(
key
);
...
@@ -129,6 +136,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -129,6 +136,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
Collection
<
Object
>
getAttributeKeys
(
SessionKey
key
)
{
public
Collection
<
Object
>
getAttributeKeys
(
SessionKey
key
)
{
try
{
try
{
return
super
.
getAttributeKeys
(
key
);
return
super
.
getAttributeKeys
(
key
);
...
@@ -138,6 +146,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -138,6 +146,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
Object
getAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
)
{
public
Object
getAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
)
{
try
{
try
{
return
super
.
getAttribute
(
sessionKey
,
attributeKey
);
return
super
.
getAttribute
(
sessionKey
,
attributeKey
);
...
@@ -147,6 +156,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -147,6 +156,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
void
setAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
,
Object
value
)
{
public
void
setAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
,
Object
value
)
{
try
{
try
{
super
.
setAttribute
(
sessionKey
,
attributeKey
,
value
);
super
.
setAttribute
(
sessionKey
,
attributeKey
,
value
);
...
@@ -155,6 +165,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -155,6 +165,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
Object
removeAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
)
{
public
Object
removeAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
)
{
try
{
try
{
return
super
.
removeAttribute
(
sessionKey
,
attributeKey
);
return
super
.
removeAttribute
(
sessionKey
,
attributeKey
);
...
@@ -164,6 +175,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -164,6 +175,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
void
stop
(
SessionKey
key
)
{
public
void
stop
(
SessionKey
key
)
{
try
{
try
{
super
.
stop
(
key
);
super
.
stop
(
key
);
...
@@ -172,6 +184,7 @@ public class SessionManager extends DefaultWebSessionManager {
...
@@ -172,6 +184,7 @@ public class SessionManager extends DefaultWebSessionManager {
}
}
}
}
@Override
public
void
checkValid
(
SessionKey
key
)
{
public
void
checkValid
(
SessionKey
key
)
{
try
{
try
{
super
.
checkValid
(
key
);
super
.
checkValid
(
key
);
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/servlet/ValidateCodeServlet.java
View file @
7fa8137a
...
@@ -41,7 +41,8 @@ public class ValidateCodeServlet extends HttpServlet {
...
@@ -41,7 +41,8 @@ public class ValidateCodeServlet extends HttpServlet {
super
();
super
();
}
}
public
void
destroy
()
{
@Override
public
void
destroy
()
{
super
.
destroy
();
super
.
destroy
();
}
}
...
@@ -50,7 +51,8 @@ public class ValidateCodeServlet extends HttpServlet {
...
@@ -50,7 +51,8 @@ public class ValidateCodeServlet extends HttpServlet {
return
validateCode
.
toUpperCase
().
equals
(
code
);
return
validateCode
.
toUpperCase
().
equals
(
code
);
}
}
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
@Override
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
throws
ServletException
,
IOException
{
String
validateCode
=
request
.
getParameter
(
VALIDATE_CODE
);
// AJAX验证,成功返回true
String
validateCode
=
request
.
getParameter
(
VALIDATE_CODE
);
// AJAX验证,成功返回true
if
(
StringUtils
.
isNotBlank
(
validateCode
)){
if
(
StringUtils
.
isNotBlank
(
validateCode
)){
...
@@ -60,7 +62,8 @@ public class ValidateCodeServlet extends HttpServlet {
...
@@ -60,7 +62,8 @@ public class ValidateCodeServlet extends HttpServlet {
}
}
}
}
public
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
@Override
public
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
throws
ServletException
,
IOException
{
createImage
(
request
,
response
);
createImage
(
request
,
response
);
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/AceMenuTag.java
View file @
7fa8137a
...
@@ -34,11 +34,13 @@ public class AceMenuTag extends TagSupport {
...
@@ -34,11 +34,13 @@ public class AceMenuTag extends TagSupport {
this
.
menu
=
menu
;
this
.
menu
=
menu
;
}
}
public
int
doStartTag
()
throws
JspTagException
{
@Override
public
int
doStartTag
()
throws
JspTagException
{
return
EVAL_PAGE
;
return
EVAL_PAGE
;
}
}
public
int
doEndTag
()
throws
JspTagException
{
@Override
public
int
doEndTag
()
throws
JspTagException
{
try
{
try
{
JspWriter
out
=
this
.
pageContext
.
getOut
();
JspWriter
out
=
this
.
pageContext
.
getOut
();
String
menu
=
(
String
)
this
.
pageContext
.
getSession
().
getAttribute
(
String
menu
=
(
String
)
this
.
pageContext
.
getSession
().
getAttribute
(
...
@@ -69,8 +71,9 @@ public class AceMenuTag extends TagSupport {
...
@@ -69,8 +71,9 @@ public class AceMenuTag extends TagSupport {
private
static
String
getChildOfTree
(
Menu
parent
,
int
level
,
List
<
Menu
>
menuList
)
{
private
static
String
getChildOfTree
(
Menu
parent
,
int
level
,
List
<
Menu
>
menuList
)
{
StringBuffer
menuString
=
new
StringBuffer
();
StringBuffer
menuString
=
new
StringBuffer
();
String
href
=
""
;
String
href
=
""
;
if
(!
parent
.
hasPermisson
())
if
(!
parent
.
hasPermisson
())
{
return
""
;
return
""
;
}
ServletContext
context
=
SpringContextHolder
ServletContext
context
=
SpringContextHolder
.
getBean
(
ServletContext
.
class
);
.
getBean
(
ServletContext
.
class
);
...
@@ -88,7 +91,7 @@ public class AceMenuTag extends TagSupport {
...
@@ -88,7 +91,7 @@ public class AceMenuTag extends TagSupport {
if
(
level
>
0
)
{
// level 为0是功能菜单
if
(
level
>
0
)
{
// level 为0是功能菜单
menuString
.
append
(
"<li>"
);
menuString
.
append
(
"<li>"
);
if
((
parent
.
getHref
()
==
null
||
parent
.
getHref
().
trim
().
equals
(
""
))
&&
parent
.
getIsShow
()
.
equals
(
"1"
))
{
if
((
parent
.
getHref
()
==
null
||
""
.
equals
(
parent
.
getHref
().
trim
()
))
&&
"1"
.
equals
(
parent
.
getIsShow
()))
{
menuString
.
append
(
"<a href=\""
+
href
menuString
.
append
(
"<a href=\""
+
href
+
"\" class=\"dropdown-toggle\">"
);
+
"\" class=\"dropdown-toggle\">"
);
}
else
{
}
else
{
...
@@ -98,13 +101,13 @@ public class AceMenuTag extends TagSupport {
...
@@ -98,13 +101,13 @@ public class AceMenuTag extends TagSupport {
menuString
.
append
(
"<i class=\"menu-icon fa "
+
parent
.
getIcon
()
menuString
.
append
(
"<i class=\"menu-icon fa "
+
parent
.
getIcon
()
+
"\"></i>"
);
+
"\"></i>"
);
menuString
.
append
(
"<span class=\"menu-text\">"
+
parent
.
getName
()+
"</span>"
);
menuString
.
append
(
"<span class=\"menu-text\">"
+
parent
.
getName
()+
"</span>"
);
if
((
parent
.
getHref
()
==
null
||
parent
.
getHref
().
trim
().
equals
(
""
))
&&
parent
.
getIsShow
()
.
equals
(
"1"
))
{
if
((
parent
.
getHref
()
==
null
||
""
.
equals
(
parent
.
getHref
().
trim
()
))
&&
"1"
.
equals
(
parent
.
getIsShow
()))
{
menuString
.
append
(
"<b class=\"arrow fa fa-angle-down\"></b>"
);
menuString
.
append
(
"<b class=\"arrow fa fa-angle-down\"></b>"
);
}
}
menuString
.
append
(
"</a>"
);
menuString
.
append
(
"</a>"
);
menuString
.
append
(
"<b class=\"arrow\"></b>"
);
menuString
.
append
(
"<b class=\"arrow\"></b>"
);
}
}
if
((
parent
.
getHref
()
==
null
||
parent
.
getHref
().
trim
().
equals
(
""
))
&&
parent
.
getIsShow
()
.
equals
(
"1"
))
{
if
((
parent
.
getHref
()
==
null
||
""
.
equals
(
parent
.
getHref
().
trim
()
))
&&
"1"
.
equals
(
parent
.
getIsShow
()))
{
if
(
level
==
0
)
{
if
(
level
==
0
)
{
menuString
.
append
(
"<ul class=\"nav nav-list\">"
);
menuString
.
append
(
"<ul class=\"nav nav-list\">"
);
}
else
{
}
else
{
...
@@ -113,7 +116,7 @@ public class AceMenuTag extends TagSupport {
...
@@ -113,7 +116,7 @@ public class AceMenuTag extends TagSupport {
for
(
Menu
child
:
menuList
)
{
for
(
Menu
child
:
menuList
)
{
if
(
child
.
getParentId
().
equals
(
parent
.
getId
())&&
child
.
getIsShow
()
.
equals
(
"1"
))
{
if
(
child
.
getParentId
().
equals
(
parent
.
getId
())&&
"1"
.
equals
(
child
.
getIsShow
()))
{
menuString
.
append
(
getChildOfTree
(
child
,
level
+
1
,
menuList
));
menuString
.
append
(
getChildOfTree
(
child
,
level
+
1
,
menuList
));
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/MenuTag.java
View file @
7fa8137a
...
@@ -35,11 +35,13 @@ public class MenuTag extends TagSupport {
...
@@ -35,11 +35,13 @@ public class MenuTag extends TagSupport {
this
.
menu
=
menu
;
this
.
menu
=
menu
;
}
}
public
int
doStartTag
()
throws
JspTagException
{
@Override
public
int
doStartTag
()
throws
JspTagException
{
return
EVAL_PAGE
;
return
EVAL_PAGE
;
}
}
public
int
doEndTag
()
throws
JspTagException
{
@Override
public
int
doEndTag
()
throws
JspTagException
{
try
{
try
{
JspWriter
out
=
this
.
pageContext
.
getOut
();
JspWriter
out
=
this
.
pageContext
.
getOut
();
String
menu
=
(
String
)
this
.
pageContext
.
getSession
().
getAttribute
(
"menu"
);
String
menu
=
(
String
)
this
.
pageContext
.
getSession
().
getAttribute
(
"menu"
);
...
@@ -68,14 +70,17 @@ public class MenuTag extends TagSupport {
...
@@ -68,14 +70,17 @@ public class MenuTag extends TagSupport {
private
static
String
getChildOfTree
(
Menu
parent
,
int
level
)
{
private
static
String
getChildOfTree
(
Menu
parent
,
int
level
)
{
StringBuffer
menuString
=
new
StringBuffer
();
StringBuffer
menuString
=
new
StringBuffer
();
String
href
=
""
;
String
href
=
""
;
if
(!
parent
.
hasPermisson
())
if
(!
parent
.
hasPermisson
())
{
return
""
;
return
""
;
}
if
(
level
>
0
)
{
//level 为0是功能菜单
if
(
level
>
0
)
{
//level 为0是功能菜单
if
(
parent
.
hasChildren
())
if
(
parent
.
hasChildren
())
//menu-open
//menu-open
menuString
.
append
(
"<li class=\"treeview\">"
);
{
else
menuString
.
append
(
"<li class=\"treeview\">"
);
menuString
.
append
(
"<li>"
);
}
else
{
menuString
.
append
(
"<li>"
);
}
ServletContext
context
=
SpringContextHolder
ServletContext
context
=
SpringContextHolder
.
getBean
(
ServletContext
.
class
);
.
getBean
(
ServletContext
.
class
);
...
@@ -115,7 +120,7 @@ public class MenuTag extends TagSupport {
...
@@ -115,7 +120,7 @@ public class MenuTag extends TagSupport {
menuString
.
append
(
"<ul class=\"nav nav-fifth-level treeview-menu\" >"
);
menuString
.
append
(
"<ul class=\"nav nav-fifth-level treeview-menu\" >"
);
}
}
for
(
Menu
child
:
parent
.
getChildren
())
{
for
(
Menu
child
:
parent
.
getChildren
())
{
if
(
child
.
getIsShow
()
.
equals
(
"1"
))
{
if
(
"1"
.
equals
(
child
.
getIsShow
()))
{
menuString
.
append
(
getChildOfTree
(
child
,
level
+
1
));
menuString
.
append
(
getChildOfTree
(
child
,
level
+
1
));
}
}
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsBarTag.java
View file @
7fa8137a
...
@@ -111,11 +111,13 @@ public class EChartsBarTag extends BodyTagSupport {
...
@@ -111,11 +111,13 @@ public class EChartsBarTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsLineDoubleNumTag.java
View file @
7fa8137a
...
@@ -120,11 +120,13 @@ public class EChartsLineDoubleNumTag extends BodyTagSupport {
...
@@ -120,11 +120,13 @@ public class EChartsLineDoubleNumTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsLineTag.java
View file @
7fa8137a
...
@@ -112,11 +112,13 @@ public class EChartsLineTag extends BodyTagSupport {
...
@@ -112,11 +112,13 @@ public class EChartsLineTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsLineTimeLineTag.java
View file @
7fa8137a
...
@@ -196,11 +196,13 @@ public class EChartsLineTimeLineTag extends BodyTagSupport {
...
@@ -196,11 +196,13 @@ public class EChartsLineTimeLineTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsPieTag.java
View file @
7fa8137a
...
@@ -84,11 +84,13 @@ public class EChartsPieTag extends BodyTagSupport {
...
@@ -84,11 +84,13 @@ public class EChartsPieTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/tag/echarts/EChartsRadarTag.java
View file @
7fa8137a
...
@@ -123,11 +123,13 @@ public class EChartsRadarTag extends BodyTagSupport {
...
@@ -123,11 +123,13 @@ public class EChartsRadarTag extends BodyTagSupport {
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
return
Tag
.
EVAL_PAGE
;
// 继续处理页面
}
}
public
String
getId
()
{
@Override
public
String
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
String
id
)
{
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/Base64ImageUtils.java
View file @
7fa8137a
...
@@ -73,7 +73,9 @@ public class Base64ImageUtils {
...
@@ -73,7 +73,9 @@ public class Base64ImageUtils {
*/
*/
public
static
boolean
saveImage
(
String
imgStr
,
String
imgFilePath
)
{
public
static
boolean
saveImage
(
String
imgStr
,
String
imgFilePath
)
{
if
(
imgStr
==
null
)
// 图像数据为空
if
(
imgStr
==
null
)
// 图像数据为空
{
return
false
;
return
false
;
}
BASE64Decoder
decoder
=
new
BASE64Decoder
();
BASE64Decoder
decoder
=
new
BASE64Decoder
();
try
{
try
{
// Base64解码
// Base64解码
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/Convert.java
View file @
7fa8137a
...
@@ -893,7 +893,7 @@ public class Convert
...
@@ -893,7 +893,7 @@ public class Convert
*/
*/
public
static
String
toSBC
(
String
input
,
Set
<
Character
>
notConvertSet
)
public
static
String
toSBC
(
String
input
,
Set
<
Character
>
notConvertSet
)
{
{
char
c
[]
=
input
.
toCharArray
();
char
[]
c
=
input
.
toCharArray
();
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
{
{
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
...
@@ -935,7 +935,7 @@ public class Convert
...
@@ -935,7 +935,7 @@ public class Convert
*/
*/
public
static
String
toDBC
(
String
text
,
Set
<
Character
>
notConvertSet
)
public
static
String
toDBC
(
String
text
,
Set
<
Character
>
notConvertSet
)
{
{
char
c
[]
=
text
.
toCharArray
();
char
[]
c
=
text
.
toCharArray
();
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
for
(
int
i
=
0
;
i
<
c
.
length
;
i
++)
{
{
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
if
(
null
!=
notConvertSet
&&
notConvertSet
.
contains
(
c
[
i
]))
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/Exceptions.java
View file @
7fa8137a
...
@@ -31,8 +31,9 @@ public class Exceptions {
...
@@ -31,8 +31,9 @@ public class Exceptions {
* 将ErrorStack转化为String.
* 将ErrorStack转化为String.
*/
*/
public
static
String
getStackTraceAsString
(
Throwable
e
)
{
public
static
String
getStackTraceAsString
(
Throwable
e
)
{
if
(
e
==
null
)
if
(
e
==
null
)
{
return
""
;
return
""
;
}
StringWriter
stringWriter
=
new
StringWriter
();
StringWriter
stringWriter
=
new
StringWriter
();
e
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
e
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
return
stringWriter
.
toString
();
return
stringWriter
.
toString
();
...
@@ -45,9 +46,11 @@ public class Exceptions {
...
@@ -45,9 +46,11 @@ public class Exceptions {
public
static
boolean
isCausedBy
(
Exception
ex
,
Class
<?
extends
Exception
>...
causeExceptionClasses
)
{
public
static
boolean
isCausedBy
(
Exception
ex
,
Class
<?
extends
Exception
>...
causeExceptionClasses
)
{
Throwable
cause
=
ex
.
getCause
();
Throwable
cause
=
ex
.
getCause
();
while
(
cause
!=
null
)
{
while
(
cause
!=
null
)
{
for
(
Class
<?
extends
Exception
>
causeClass
:
causeExceptionClasses
)
for
(
Class
<?
extends
Exception
>
causeClass
:
causeExceptionClasses
)
{
if
(
causeClass
.
isInstance
(
cause
))
if
(
causeClass
.
isInstance
(
cause
))
{
return
true
;
return
true
;
}
}
cause
=
cause
.
getCause
();
cause
=
cause
.
getCause
();
}
}
return
false
;
return
false
;
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/FileSizeHelper.java
View file @
7fa8137a
...
@@ -19,7 +19,9 @@ public class FileSizeHelper {
...
@@ -19,7 +19,9 @@ public class FileSizeHelper {
public
static
long
ONE_PB
=
ONE_TB
*
(
long
)
1024
;
public
static
long
ONE_PB
=
ONE_TB
*
(
long
)
1024
;
public
static
String
getHumanReadableFileSize
(
Long
fileSize
)
{
public
static
String
getHumanReadableFileSize
(
Long
fileSize
)
{
if
(
fileSize
==
null
)
return
null
;
if
(
fileSize
==
null
)
{
return
null
;
}
return
getHumanReadableFileSize
(
fileSize
.
longValue
());
return
getHumanReadableFileSize
(
fileSize
.
longValue
());
}
}
...
@@ -52,7 +54,9 @@ public class FileSizeHelper {
...
@@ -52,7 +54,9 @@ public class FileSizeHelper {
}
}
private
static
String
getHumanReadableFileSize
(
long
fileSize
,
long
unit
,
String
unitName
)
{
private
static
String
getHumanReadableFileSize
(
long
fileSize
,
long
unit
,
String
unitName
)
{
if
(
fileSize
==
0
)
return
"0"
;
if
(
fileSize
==
0
)
{
return
"0"
;
}
if
(
fileSize
/
unit
>=
1
)
{
if
(
fileSize
/
unit
>=
1
)
{
double
value
=
fileSize
/
(
double
)
unit
;
double
value
=
fileSize
/
(
double
)
unit
;
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/FileUtils.java
View file @
7fa8137a
...
@@ -612,120 +612,121 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -612,120 +612,121 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
*/
*/
public
static
String
getContentType
(
String
returnFileName
)
{
public
static
String
getContentType
(
String
returnFileName
)
{
String
contentType
=
"application/octet-stream"
;
String
contentType
=
"application/octet-stream"
;
if
(
returnFileName
.
lastIndexOf
(
"."
)
<
0
)
if
(
returnFileName
.
lastIndexOf
(
"."
)
<
0
)
{
return
contentType
;
return
contentType
;
}
returnFileName
=
returnFileName
.
toLowerCase
();
returnFileName
=
returnFileName
.
toLowerCase
();
returnFileName
=
returnFileName
.
substring
(
returnFileName
.
lastIndexOf
(
"."
)
+
1
);
returnFileName
=
returnFileName
.
substring
(
returnFileName
.
lastIndexOf
(
"."
)
+
1
);
if
(
returnFileName
.
equals
(
"html"
)
||
returnFileName
.
equals
(
"htm"
)
||
returnFileName
.
equals
(
"shtml"
))
{
if
(
"html"
.
equals
(
returnFileName
)
||
"htm"
.
equals
(
returnFileName
)
||
"shtml"
.
equals
(
returnFileName
))
{
contentType
=
"text/html"
;
contentType
=
"text/html"
;
}
else
if
(
returnFileName
.
equals
(
"apk"
))
{
}
else
if
(
"apk"
.
equals
(
returnFileName
))
{
contentType
=
"application/vnd.android.package-archive"
;
contentType
=
"application/vnd.android.package-archive"
;
}
else
if
(
returnFileName
.
equals
(
"sis"
))
{
}
else
if
(
"sis"
.
equals
(
returnFileName
))
{
contentType
=
"application/vnd.symbian.install"
;
contentType
=
"application/vnd.symbian.install"
;
}
else
if
(
returnFileName
.
equals
(
"sisx"
))
{
}
else
if
(
"sisx"
.
equals
(
returnFileName
))
{
contentType
=
"application/vnd.symbian.install"
;
contentType
=
"application/vnd.symbian.install"
;
}
else
if
(
returnFileName
.
equals
(
"exe"
))
{
}
else
if
(
"exe"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-msdownload"
;
contentType
=
"application/x-msdownload"
;
}
else
if
(
returnFileName
.
equals
(
"msi"
))
{
}
else
if
(
"msi"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-msdownload"
;
contentType
=
"application/x-msdownload"
;
}
else
if
(
returnFileName
.
equals
(
"css"
))
{
}
else
if
(
"css"
.
equals
(
returnFileName
))
{
contentType
=
"text/css"
;
contentType
=
"text/css"
;
}
else
if
(
returnFileName
.
equals
(
"xml"
))
{
}
else
if
(
"xml"
.
equals
(
returnFileName
))
{
contentType
=
"text/xml"
;
contentType
=
"text/xml"
;
}
else
if
(
returnFileName
.
equals
(
"gif"
))
{
}
else
if
(
"gif"
.
equals
(
returnFileName
))
{
contentType
=
"image/gif"
;
contentType
=
"image/gif"
;
}
else
if
(
returnFileName
.
equals
(
"jpeg"
)
||
returnFileName
.
equals
(
"jpg"
))
{
}
else
if
(
"jpeg"
.
equals
(
returnFileName
)
||
"jpg"
.
equals
(
returnFileName
))
{
contentType
=
"image/jpeg"
;
contentType
=
"image/jpeg"
;
}
else
if
(
returnFileName
.
equals
(
"js"
))
{
}
else
if
(
"js"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-javascript"
;
contentType
=
"application/x-javascript"
;
}
else
if
(
returnFileName
.
equals
(
"atom"
))
{
}
else
if
(
"atom"
.
equals
(
returnFileName
))
{
contentType
=
"application/atom+xml"
;
contentType
=
"application/atom+xml"
;
}
else
if
(
returnFileName
.
equals
(
"rss"
))
{
}
else
if
(
"rss"
.
equals
(
returnFileName
))
{
contentType
=
"application/rss+xml"
;
contentType
=
"application/rss+xml"
;
}
else
if
(
returnFileName
.
equals
(
"mml"
))
{
}
else
if
(
"mml"
.
equals
(
returnFileName
))
{
contentType
=
"text/mathml"
;
contentType
=
"text/mathml"
;
}
else
if
(
returnFileName
.
equals
(
"txt"
))
{
}
else
if
(
"txt"
.
equals
(
returnFileName
))
{
contentType
=
"text/plain"
;
contentType
=
"text/plain"
;
}
else
if
(
returnFileName
.
equals
(
"jad"
))
{
}
else
if
(
"jad"
.
equals
(
returnFileName
))
{
contentType
=
"text/vnd.sun.j2me.app-descriptor"
;
contentType
=
"text/vnd.sun.j2me.app-descriptor"
;
}
else
if
(
returnFileName
.
equals
(
"wml"
))
{
}
else
if
(
"wml"
.
equals
(
returnFileName
))
{
contentType
=
"text/vnd.wap.wml"
;
contentType
=
"text/vnd.wap.wml"
;
}
else
if
(
returnFileName
.
equals
(
"htc"
))
{
}
else
if
(
"htc"
.
equals
(
returnFileName
))
{
contentType
=
"text/x-component"
;
contentType
=
"text/x-component"
;
}
else
if
(
returnFileName
.
equals
(
"png"
))
{
}
else
if
(
"png"
.
equals
(
returnFileName
))
{
contentType
=
"image/png"
;
contentType
=
"image/png"
;
}
else
if
(
returnFileName
.
equals
(
"tif"
)
||
returnFileName
.
equals
(
"tiff"
))
{
}
else
if
(
"tif"
.
equals
(
returnFileName
)
||
"tiff"
.
equals
(
returnFileName
))
{
contentType
=
"image/tiff"
;
contentType
=
"image/tiff"
;
}
else
if
(
returnFileName
.
equals
(
"wbmp"
))
{
}
else
if
(
"wbmp"
.
equals
(
returnFileName
))
{
contentType
=
"image/vnd.wap.wbmp"
;
contentType
=
"image/vnd.wap.wbmp"
;
}
else
if
(
returnFileName
.
equals
(
"ico"
))
{
}
else
if
(
"ico"
.
equals
(
returnFileName
))
{
contentType
=
"image/x-icon"
;
contentType
=
"image/x-icon"
;
}
else
if
(
returnFileName
.
equals
(
"jng"
))
{
}
else
if
(
"jng"
.
equals
(
returnFileName
))
{
contentType
=
"image/x-jng"
;
contentType
=
"image/x-jng"
;
}
else
if
(
returnFileName
.
equals
(
"bmp"
))
{
}
else
if
(
"bmp"
.
equals
(
returnFileName
))
{
contentType
=
"image/x-ms-bmp"
;
contentType
=
"image/x-ms-bmp"
;
}
else
if
(
returnFileName
.
equals
(
"svg"
))
{
}
else
if
(
"svg"
.
equals
(
returnFileName
))
{
contentType
=
"image/svg+xml"
;
contentType
=
"image/svg+xml"
;
}
else
if
(
returnFileName
.
equals
(
"jar"
)
||
returnFileName
.
equals
(
"var"
)
}
else
if
(
"jar"
.
equals
(
returnFileName
)
||
"var"
.
equals
(
returnFileName
)
||
returnFileName
.
equals
(
"ear"
))
{
||
"ear"
.
equals
(
returnFileName
))
{
contentType
=
"application/java-archive"
;
contentType
=
"application/java-archive"
;
}
else
if
(
returnFileName
.
equals
(
"doc"
))
{
}
else
if
(
"doc"
.
equals
(
returnFileName
))
{
contentType
=
"application/msword"
;
contentType
=
"application/msword"
;
}
else
if
(
returnFileName
.
equals
(
"pdf"
))
{
}
else
if
(
"pdf"
.
equals
(
returnFileName
))
{
contentType
=
"application/pdf"
;
contentType
=
"application/pdf"
;
}
else
if
(
returnFileName
.
equals
(
"rtf"
))
{
}
else
if
(
"rtf"
.
equals
(
returnFileName
))
{
contentType
=
"application/rtf"
;
contentType
=
"application/rtf"
;
}
else
if
(
returnFileName
.
equals
(
"xls"
))
{
}
else
if
(
"xls"
.
equals
(
returnFileName
))
{
contentType
=
"application/vnd.ms-excel"
;
contentType
=
"application/vnd.ms-excel"
;
}
else
if
(
returnFileName
.
equals
(
"ppt"
))
{
}
else
if
(
"ppt"
.
equals
(
returnFileName
))
{
contentType
=
"application/vnd.ms-powerpoint"
;
contentType
=
"application/vnd.ms-powerpoint"
;
}
else
if
(
returnFileName
.
equals
(
"7z"
))
{
}
else
if
(
"7z"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-7z-compressed"
;
contentType
=
"application/x-7z-compressed"
;
}
else
if
(
returnFileName
.
equals
(
"rar"
))
{
}
else
if
(
"rar"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-rar-compressed"
;
contentType
=
"application/x-rar-compressed"
;
}
else
if
(
returnFileName
.
equals
(
"swf"
))
{
}
else
if
(
"swf"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-shockwave-flash"
;
contentType
=
"application/x-shockwave-flash"
;
}
else
if
(
returnFileName
.
equals
(
"rpm"
))
{
}
else
if
(
"rpm"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-redhat-package-manager"
;
contentType
=
"application/x-redhat-package-manager"
;
}
else
if
(
returnFileName
.
equals
(
"der"
)
||
returnFileName
.
equals
(
"pem"
)
}
else
if
(
"der"
.
equals
(
returnFileName
)
||
"pem"
.
equals
(
returnFileName
)
||
returnFileName
.
equals
(
"crt"
))
{
||
"crt"
.
equals
(
returnFileName
))
{
contentType
=
"application/x-x509-ca-cert"
;
contentType
=
"application/x-x509-ca-cert"
;
}
else
if
(
returnFileName
.
equals
(
"xhtml"
))
{
}
else
if
(
"xhtml"
.
equals
(
returnFileName
))
{
contentType
=
"application/xhtml+xml"
;
contentType
=
"application/xhtml+xml"
;
}
else
if
(
returnFileName
.
equals
(
"zip"
))
{
}
else
if
(
"zip"
.
equals
(
returnFileName
))
{
contentType
=
"application/zip"
;
contentType
=
"application/zip"
;
}
else
if
(
returnFileName
.
equals
(
"mid"
)
||
returnFileName
.
equals
(
"midi"
)
}
else
if
(
"mid"
.
equals
(
returnFileName
)
||
"midi"
.
equals
(
returnFileName
)
||
returnFileName
.
equals
(
"kar"
))
{
||
"kar"
.
equals
(
returnFileName
))
{
contentType
=
"audio/midi"
;
contentType
=
"audio/midi"
;
}
else
if
(
returnFileName
.
equals
(
"mp3"
))
{
}
else
if
(
"mp3"
.
equals
(
returnFileName
))
{
contentType
=
"audio/mpeg"
;
contentType
=
"audio/mpeg"
;
}
else
if
(
returnFileName
.
equals
(
"ogg"
))
{
}
else
if
(
"ogg"
.
equals
(
returnFileName
))
{
contentType
=
"audio/ogg"
;
contentType
=
"audio/ogg"
;
}
else
if
(
returnFileName
.
equals
(
"m4a"
))
{
}
else
if
(
"m4a"
.
equals
(
returnFileName
))
{
contentType
=
"audio/x-m4a"
;
contentType
=
"audio/x-m4a"
;
}
else
if
(
returnFileName
.
equals
(
"ra"
))
{
}
else
if
(
"ra"
.
equals
(
returnFileName
))
{
contentType
=
"audio/x-realaudio"
;
contentType
=
"audio/x-realaudio"
;
}
else
if
(
returnFileName
.
equals
(
"3gpp"
)
}
else
if
(
"3gpp"
.
equals
(
returnFileName
)
||
returnFileName
.
equals
(
"3gp"
))
{
||
"3gp"
.
equals
(
returnFileName
))
{
contentType
=
"video/3gpp"
;
contentType
=
"video/3gpp"
;
}
else
if
(
returnFileName
.
equals
(
"mp4"
))
{
}
else
if
(
"mp4"
.
equals
(
returnFileName
))
{
contentType
=
"video/mp4"
;
contentType
=
"video/mp4"
;
}
else
if
(
returnFileName
.
equals
(
"mpeg"
)
}
else
if
(
"mpeg"
.
equals
(
returnFileName
)
||
returnFileName
.
equals
(
"mpg"
))
{
||
"mpg"
.
equals
(
returnFileName
))
{
contentType
=
"video/mpeg"
;
contentType
=
"video/mpeg"
;
}
else
if
(
returnFileName
.
equals
(
"mov"
))
{
}
else
if
(
"mov"
.
equals
(
returnFileName
))
{
contentType
=
"video/quicktime"
;
contentType
=
"video/quicktime"
;
}
else
if
(
returnFileName
.
equals
(
"flv"
))
{
}
else
if
(
"flv"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-flv"
;
contentType
=
"video/x-flv"
;
}
else
if
(
returnFileName
.
equals
(
"m4v"
))
{
}
else
if
(
"m4v"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-m4v"
;
contentType
=
"video/x-m4v"
;
}
else
if
(
returnFileName
.
equals
(
"mng"
))
{
}
else
if
(
"mng"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-mng"
;
contentType
=
"video/x-mng"
;
}
else
if
(
returnFileName
.
equals
(
"asx"
)
||
returnFileName
.
equals
(
"asf"
))
{
}
else
if
(
"asx"
.
equals
(
returnFileName
)
||
"asf"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-ms-asf"
;
contentType
=
"video/x-ms-asf"
;
}
else
if
(
returnFileName
.
equals
(
"wmv"
))
{
}
else
if
(
"wmv"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-ms-wmv"
;
contentType
=
"video/x-ms-wmv"
;
}
else
if
(
returnFileName
.
equals
(
"avi"
))
{
}
else
if
(
"avi"
.
equals
(
returnFileName
))
{
contentType
=
"video/x-msvideo"
;
contentType
=
"video/x-msvideo"
;
}
}
return
contentType
;
return
contentType
;
...
@@ -780,7 +781,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
...
@@ -780,7 +781,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
RandomAccessFile
raf
=
null
;
// 负责读取数据
RandomAccessFile
raf
=
null
;
// 负责读取数据
OutputStream
os
=
null
;
// 写出数据
OutputStream
os
=
null
;
// 写出数据
OutputStream
out
=
null
;
// 缓冲
OutputStream
out
=
null
;
// 缓冲
byte
b
[]
=
new
byte
[
1024
];
// 暂存容器
byte
[]
b
=
new
byte
[
1024
];
// 暂存容器
if
(
request
.
getHeader
(
"Range"
)
!=
null
)
{
// 客户端请求的下载的文件块的开始字节
if
(
request
.
getHeader
(
"Range"
)
!=
null
)
{
// 客户端请求的下载的文件块的开始字节
response
.
setStatus
(
HttpServletResponse
.
SC_PARTIAL_CONTENT
);
response
.
setStatus
(
HttpServletResponse
.
SC_PARTIAL_CONTENT
);
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/IdGen.java
View file @
7fa8137a
...
@@ -52,6 +52,7 @@ public class IdGen implements IdGenerator, SessionIdGenerator {
...
@@ -52,6 +52,7 @@ public class IdGen implements IdGenerator, SessionIdGenerator {
* Activiti ID 生成
* Activiti ID 生成
*/
*/
//@Override
//@Override
@Override
public
String
getNextId
()
{
public
String
getNextId
()
{
return
IdGen
.
uuid
();
return
IdGen
.
uuid
();
}
}
...
...
JeeSpringCloud/src/main/java/com/jeespring/common/utils/IdcardUtils.java
View file @
7fa8137a
...
@@ -23,19 +23,25 @@ public class IdcardUtils extends StringUtils {
...
@@ -23,19 +23,25 @@ public class IdcardUtils extends StringUtils {
/** 中国公民身份证号码最大长度。 */
/** 中国公民身份证号码最大长度。 */
public
static
final
int
CHINA_ID_MAX_LENGTH
=
18
;
public
static
final
int
CHINA_ID_MAX_LENGTH
=
18
;
/** 省、直辖市代码表 */
/**
public
static
final
String
cityCode
[]
=
{
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
* 省、直辖市代码表
"21"
,
"22"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
*/
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
public
static
final
String
[]
cityCode
=
{
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"62"
,
"63"
,
"64"
,
"65"
,
"71"
,
"81"
,
"82"
,
"91"
};
"21"
,
"22"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
"62"
,
"63"
,
"64"
,
"65"
,
"71"
,
"81"
,
"82"
,
"91"
};
/** 每位加权因子 */
/**
public
static
final
int
power
[]
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
* 每位加权因子
10
,
5
,
8
,
4
,
2
};
*/
public
static
final
int
[]
power
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
/** 第18位校检码 */
/**
public
static
final
String
verifyCode
[]
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
* 第18位校检码
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
*/
public
static
final
String
[]
verifyCode
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
/** 最低年限 */
/** 最低年限 */
public
static
final
int
MIN
=
1930
;
public
static
final
int
MIN
=
1930
;
public
static
Map
<
String
,
String
>
cityCodes
=
new
HashMap
<
String
,
String
>();
public
static
Map
<
String
,
String
>
cityCodes
=
new
HashMap
<
String
,
String
>();
...
@@ -139,8 +145,9 @@ public class IdcardUtils extends StringUtils {
...
@@ -139,8 +145,9 @@ public class IdcardUtils extends StringUtils {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
if
(
birthDate
!=
null
)
if
(
birthDate
!=
null
)
{
cal
.
setTime
(
birthDate
);
cal
.
setTime
(
birthDate
);
}
// 获取出生年(完全表现形式,如:2010)
// 获取出生年(完全表现形式,如:2010)
String
sYear
=
String
.
valueOf
(
cal
.
get
(
Calendar
.
YEAR
));
String
sYear
=
String
.
valueOf
(
cal
.
get
(
Calendar
.
YEAR
));
idCard18
=
idCard
.
substring
(
0
,
6
)
+
sYear
+
idCard
.
substring
(
8
);
idCard18
=
idCard
.
substring
(
0
,
6
)
+
sYear
+
idCard
.
substring
(
8
);
...
@@ -176,7 +183,7 @@ public class IdcardUtils extends StringUtils {
...
@@ -176,7 +183,7 @@ public class IdcardUtils extends StringUtils {
}
}
String
[]
cardval
=
validateIdCard10
(
card
);
String
[]
cardval
=
validateIdCard10
(
card
);
if
(
cardval
!=
null
)
{
if
(
cardval
!=
null
)
{
if
(
cardval
[
2
].
equals
(
"true"
))
{
if
(
"true"
.
equals
(
cardval
[
2
]
))
{
return
true
;
return
true
;
}
}
}
}
...
@@ -240,8 +247,9 @@ public class IdcardUtils extends StringUtils {
...
@@ -240,8 +247,9 @@ public class IdcardUtils extends StringUtils {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
if
(
birthDate
!=
null
)
if
(
birthDate
!=
null
)
{
cal
.
setTime
(
birthDate
);
cal
.
setTime
(
birthDate
);
}
if
(!
valiDate
(
cal
.
get
(
Calendar
.
YEAR
),
if
(!
valiDate
(
cal
.
get
(
Calendar
.
YEAR
),
Integer
.
valueOf
(
birthCode
.
substring
(
2
,
4
)),
Integer
.
valueOf
(
birthCode
.
substring
(
2
,
4
)),
Integer
.
valueOf
(
birthCode
.
substring
(
4
,
6
))))
{
Integer
.
valueOf
(
birthCode
.
substring
(
4
,
6
))))
{
...
@@ -274,10 +282,10 @@ public class IdcardUtils extends StringUtils {
...
@@ -274,10 +282,10 @@ public class IdcardUtils extends StringUtils {
info
[
0
]
=
"台湾"
;
info
[
0
]
=
"台湾"
;
System
.
out
.
println
(
"11111"
);
System
.
out
.
println
(
"11111"
);
String
char2
=
idCard
.
substring
(
1
,
2
);
String
char2
=
idCard
.
substring
(
1
,
2
);
if
(
char2
.
equals
(
"1"
))
{
if
(
"1"
.
equals
(
char2
))
{
info
[
1
]
=
"M"
;
info
[
1
]
=
"M"
;
System
.
out
.
println
(
"MMMMMMM"
);
System
.
out
.
println
(
"MMMMMMM"
);
}
else
if
(
char2
.
equals
(
"2"
))
{
}
else
if
(
"2"
.
equals
(
char2
))
{
info
[
1
]
=
"F"
;
info
[
1
]
=
"F"
;
System
.
out
.
println
(
"FFFFFFF"
);
System
.
out
.
println
(
"FFFFFFF"
);
}
else
{
}
else
{
...
@@ -359,7 +367,7 @@ public class IdcardUtils extends StringUtils {
...
@@ -359,7 +367,7 @@ public class IdcardUtils extends StringUtils {
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
sum
=
sum
+
Integer
.
valueOf
(
c
+
""
)
*
iflag
;
iflag
--;
iflag
--;
}
}
if
(
end
.
toUpperCase
()
.
equals
(
"A"
))
{
if
(
"A"
.
equals
(
end
.
toUpperCase
()))
{
sum
=
sum
+
10
;
sum
=
sum
+
10
;
}
else
{
}
else
{
sum
=
sum
+
Integer
.
valueOf
(
end
);
sum
=
sum
+
Integer
.
valueOf
(
end
);
...
...
Prev
1
2
3
4
5
6
…
11
Next
Write
Preview
Supports
Markdown
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