Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
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
gechengyang
nouiWithSpringMVC
Commits
b6598e9d
Commit
b6598e9d
authored
Apr 15, 2019
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
4392b123
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
4 deletions
+66
-4
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+66
-4
No files found.
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
b6598e9d
...
...
@@ -180,7 +180,7 @@ public class NoUiPresentationUtil {
}
String
realPath
=
alias
.
getRelPath
(
aliasKey
);
IBaseObject
baseObject
=
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
realPath
);
data
.
put
(
aliasKey
,
NoUiPresentationUtil
.
handIBaseObject
(
context
,
baseObject
,
realPath
));
data
.
put
(
aliasKey
,
handIBaseObject
(
context
,
baseObject
,
realPath
));
}
return
data
;
}
...
...
@@ -201,6 +201,68 @@ public class NoUiPresentationUtil {
return
data
;
}
private
static
String
handle
(
Object
value
,
IDatafield
<
Object
>
dataField
)
{
if
(
null
==
value
)
return
null
;
Class
<?>
dataType
=
dataField
.
getDataType
();
if
(
dataType
.
equals
(
String
.
class
))
{
String
valStr
=
value
.
toString
();
return
valStr
;
}
if
(
dataType
.
equals
(
Integer
.
TYPE
)
||
dataType
.
equals
(
Integer
.
class
))
{
String
data
=
value
.
toString
().
trim
();
return
data
;
}
if
(
dataType
.
equals
(
Double
.
TYPE
)
||
dataType
.
equals
(
Double
.
class
))
{
java
.
text
.
NumberFormat
nf
=
java
.
text
.
NumberFormat
.
getInstance
();
nf
.
setGroupingUsed
(
false
);
// 设置数的小数部分所允许的最小位数
nf
.
setMinimumFractionDigits
(
0
);
// 设置数的小数部分所允许的最大位数
nf
.
setMaximumFractionDigits
(
2
);
return
nf
.
format
(
value
);
}
if
(
dataType
.
equals
(
BigDecimal
.
class
))
{
String
data
=
value
.
toString
().
trim
();
return
data
;
}
if
(
dataType
.
equals
(
Date
.
class
))
{
Date
date
=
(
Date
)
value
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
sdf
.
format
(
date
);
}
if
(
dataType
.
equals
(
Long
.
TYPE
)
||
dataType
.
equals
(
Long
.
class
))
{
String
data
=
value
.
toString
().
trim
();
return
data
;
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy/MM/dd HH:mm:ss"
);
try
{
Date
d
=
sdf
.
parse
(
"2018/11/11 11:11:11"
);
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
System
.
out
.
println
(
sdf1
.
format
(
d
));
System
.
out
.
println
(
new
BigDecimal
(
"999999999999.99"
).
toString
());
long
b
=
999999999
;
String
bb
=
b
+
""
;
System
.
out
.
println
(
String
.
valueOf
(
b
));
java
.
text
.
NumberFormat
nf
=
java
.
text
.
NumberFormat
.
getInstance
();
nf
.
setGroupingUsed
(
false
);
// 设置数的小数部分所允许的最小位数
nf
.
setMinimumFractionDigits
(
0
);
// 设置数的小数部分所允许的最大位数
nf
.
setMaximumFractionDigits
(
2
);
System
.
out
.
println
(
nf
.
format
(
999999999999.0
));
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
public
static
Object
handIBaseObject
(
NoUiContext
context
,
Object
val
,
String
path
)
{
if
(
val
==
null
)
return
null
;
...
...
@@ -211,8 +273,8 @@ public class NoUiPresentationUtil {
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
IModule
module
=
moduleList
.
get
(
index
);
Collection
<
IDatafield
>
datafields
=
module
.
getDatafields
();
for
(
IDatafield
<
?
>
datafield
:
datafields
)
{
map
.
put
(
datafield
.
getName
(),
datafield
.
getValue
(
));
for
(
IDatafield
<
Object
>
datafield
:
datafields
)
{
map
.
put
(
datafield
.
getName
(),
handle
(
datafield
.
getValue
(),
datafield
));
}
list
.
add
(
map
);
}
...
...
@@ -222,7 +284,7 @@ public class NoUiPresentationUtil {
return
handIBaseObject
(
context
,
val
,
path
);
}
else
if
(
val
instanceof
IDatafield
)
{
IDatafield
datafield
=
(
IDatafield
)
val
;
return
datafield
.
getValue
(
);
return
handle
(
datafield
.
getValue
(),
datafield
);
}
return
null
;
}
...
...
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