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
decb74c4
Commit
decb74c4
authored
Sep 26, 2020
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
list数据处理,自动加入安全码
parent
bdc44684
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+14
-0
NoUiUtils.java
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
+24
-0
No files found.
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
decb74c4
...
...
@@ -239,13 +239,27 @@ public class NoUiPresentationUtil {
if
(
val
instanceof
IModuleList
<?>)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
IModuleList
<?>
moduleList
=
(
IModuleList
<?>)
val
;
for
(
int
index
=
0
;
index
<
moduleList
.
size
();
index
++)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
IModule
module
=
moduleList
.
get
(
index
);
Collection
<
IDatafield
>
datafields
=
module
.
getDatafields
();
String
[]
paramsKey
=
(
String
[])
moduleList
.
getAttribute
(
"KEY_PARAMS"
);
if
(
paramsKey
!=
null
)
paramsKey
=
new
String
[]{
"inr"
,
"$objtyp"
};
for
(
IDatafield
<
Object
>
datafield
:
datafields
)
{
map
.
put
(
changeForELCS
(
datafield
.
getName
()),
handle
(
datafield
.
getValue
(),
datafield
));
}
String
[]
keyParams
=
new
String
[
paramsKey
.
length
];
for
(
int
i
=
0
;
i
<
paramsKey
.
length
;
i
++)
{
if
(
"$objtyp"
.
equals
(
paramsKey
[
i
]))
keyParams
[
i
]
=
module
.
getClass
().
getSimpleName
().
toLowerCase
();
//module type
else
keyParams
[
i
]
=
map
.
get
(
paramsKey
[
i
]).
toString
();
}
String
safeCode
=
NoUiUtils
.
genSafeCode
(
keyParams
);
map
.
put
(
"safeCode"
,
safeCode
);
list
.
add
(
map
);
}
return
list
;
...
...
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
View file @
decb74c4
...
...
@@ -2,6 +2,7 @@ package org.sss.presentation.noui.util;
import
log.Log
;
import
log.LogFactory
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.sss.common.impl.DefaultLoginContext
;
import
org.sss.common.impl.ServiceThread
;
import
org.sss.common.model.*
;
...
...
@@ -142,4 +143,27 @@ public class NoUiUtils {
{
return
tl
.
get
().
getTerminalType
();
}
public
final
static
String
salt
=
"706798214808651@;RHxC"
;
/**
*
* @param keyParams 要素
* @return
*/
public
static
String
genSafeCode
(
String
[]
keyParams
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
=
sb
.
append
(
tl
.
get
().
getUserId
()).
reverse
();
for
(
String
item
:
keyParams
)
{
sb
.
append
(
item
);
}
sb
.
append
(
getToken
());
sb
.
append
(
salt
);
return
DigestUtils
.
md5Hex
(
sb
.
toString
());
}
public
static
boolean
verfyParams
(
String
[]
keyParams
,
String
safeCode
)
{
return
safeCode
.
equals
(
genSafeCode
(
keyParams
));
}
}
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