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
Springboot Plus
Commits
fdbbe4ac
Commit
fdbbe4ac
authored
Jan 15, 2020
by
xiandafu
Browse files
date bug fix
parent
00cdbb49
Changes
3
Hide whitespace changes
Inline
Side-by-side
admin-core/src/main/java/com/ibeetl/admin/core/conf/MVCConf.java
View file @
fdbbe4ac
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.env.Environment
;
import
org.springframework.format.Formatter
;
import
org.springframework.format.FormatterRegistry
;
import
org.springframework.format.datetime.DateFormatter
;
import
org.springframework.http.converter.HttpMessageConverter
;
...
...
@@ -38,9 +39,9 @@ import com.ibeetl.admin.core.util.HttpRequestLocal;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.
util.HashMap
;
import
java.
util.Lis
t
;
import
java.util.
Map
;
import
java.
text.ParseException
;
import
java.
text.SimpleDateForma
t
;
import
java.util.
*
;
@Configuration
public
class
MVCConf
implements
WebMvcConfigurer
,
InitializingBean
{
...
...
@@ -91,8 +92,8 @@ public class MVCConf implements WebMvcConfigurer, InitializingBean {
@Override
public
void
addFormatters
(
FormatterRegistry
registry
)
{
registry
.
addFormatter
(
new
DateFormatter
(
"yyyy-MM-dd HH:mm:ss"
));
registry
.
addFormatter
(
new
DateFormatter
(
"yyyy-MM-dd"
));
registry
.
addFormatter
(
new
My
DateFormatter
());
//
registry.addFormatter(new DateFormatter("yyyy-MM-dd"));
}
...
...
@@ -120,6 +121,36 @@ public class MVCConf implements WebMvcConfigurer, InitializingBean {
}
class
MyDateFormatter
implements
Formatter
<
Date
>{
@Override
public
Date
parse
(
String
text
,
Locale
locale
)
throws
ParseException
{
if
(
text
==
null
){
return
null
;
}
if
(
text
.
trim
().
length
()==
0
){
return
null
;
}
if
(
text
.
length
()<=
10
){
String
format
=
"yyyy-MM-dd"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
,
locale
);
return
sdf
.
parse
(
text
);
}
else
{
String
format
=
"yyyy-MM-dd HH:mm:ss"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
,
locale
);
return
sdf
.
parse
(
text
);
}
}
@Override
public
String
print
(
Date
object
,
Locale
locale
)
{
String
format
=
"yyyy-MM-dd HH:mm:ss"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
,
locale
);
return
sdf
.
format
((
Date
)
object
);
}
}
class
SessionInterceptor
implements
HandlerInterceptor
{
MVCConf
conf
;
...
...
admin-core/src/main/java/com/ibeetl/admin/core/rbac/da/DefaultDataAccessFactory.java
View file @
fdbbe4ac
...
...
@@ -68,7 +68,7 @@ public class DefaultDataAccessFactory implements DataAccessFactory {
@Override
public
OrgItem
getUserOrgTree
(
OrgItem
item
)
{
while
(
item
!=
null
)
{
if
(
item
!=
null
)
{
String
orgType
=
item
.
getOrg
().
getType
();
if
(
orgType
.
equals
(
COMPANY_TYPE
)||
orgType
.
equals
(
PARENT_CORP_TYPE
)||
orgType
.
equals
(
GROUP_TYPE
))
{
return
item
;
...
...
admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java
View file @
fdbbe4ac
...
...
@@ -185,6 +185,7 @@ public class CorePlatformService {
return
root
;
}
OrgItem
current
=
getCurrentOrgItem
();
//搞不懂,忘记了
OrgItem
item
=
dataAccessFactory
.
getUserOrgTree
(
current
);
return
item
;
...
...
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