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
113b921b
Commit
113b921b
authored
Aug 11, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化支持渠道类型判断方式
优化部分分页日志记录
parent
bb0f7d02
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
58 deletions
+64
-58
ELoginContext.java
src/main/java/cn/com/brilliance/eibs/auth/ELoginContext.java
+10
-4
PreHandle.java
src/main/java/org/sss/module/pojo/PreHandle.java
+0
-3
NoUiRequest.java
...va/org/sss/presentation/noui/api/request/NoUiRequest.java
+1
-1
AbstractCache.java
...n/java/org/sss/presentation/noui/cache/AbstractCache.java
+47
-44
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+1
-0
NoUiContextManager.java
...org/sss/presentation/noui/context/NoUiContextManager.java
+3
-4
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+1
-1
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+1
-1
No files found.
src/main/java/cn/com/brilliance/eibs/auth/ELoginContext.java
View file @
113b921b
...
...
@@ -2,6 +2,8 @@ package cn.com.brilliance.eibs.auth;
import
org.sss.common.impl.AbstractLoginContext
;
import
org.sss.common.model.IMenuItem
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.util.StringUtil
;
import
java.sql.Connection
;
import
java.util.Map
;
...
...
@@ -12,10 +14,13 @@ import java.util.Map;
public
class
ELoginContext
extends
AbstractLoginContext
{
private
String
userId
;
private
String
needSign
=
"no"
;
private
String
needSign
=
"no"
;
private
String
terminalType
;
public
ELoginContext
(
String
userId
)
{
public
ELoginContext
(
String
userId
,
String
terminalType
)
{
this
.
userId
=
userId
;
//区别app还是zk版本
this
.
terminalType
=
StringUtil
.
isEmpty
(
terminalType
)
?
"APP"
:
terminalType
;
}
@Override
...
...
@@ -54,9 +59,10 @@ public class ELoginContext extends AbstractLoginContext {
public
Object
getValue
(
String
key
)
{
if
(
"usrinr"
.
equals
(
key
))
{
return
userId
;
}
if
(
"needSign"
.
equals
(
key
)){
}
else
if
(
"needSign"
.
equals
(
key
))
{
return
needSign
;
}
else
if
(
Constants
.
TERMINAL_TYPE
.
equals
(
key
))
{
return
terminalType
;
}
return
null
;
}
...
...
src/main/java/org/sss/module/pojo/PreHandle.java
View file @
113b921b
...
...
@@ -58,9 +58,6 @@ public class PreHandle {
}
public
static
void
preHandle
(
String
trnName
,
Map
<
String
,
?>
paramsMap
,
NoUiContext
context
)
throws
Exception
{
//区别app还是zk版本
String
terminalType
=
StringUtil
.
isEmpty
(
context
.
getNoUiRequest
().
getTerminalType
())
?
"APP"
:
context
.
getNoUiRequest
().
getTerminalType
();
context
.
getSession
().
storeData
(
"__terminalType"
,
terminalType
);
if
(
paramsMap
.
containsKey
(
"__sptinr"
))
{
loadSpt
(
context
,
paramsMap
);
}
...
...
src/main/java/org/sss/presentation/noui/api/request/NoUiRequest.java
View file @
113b921b
...
...
@@ -36,7 +36,7 @@ public class NoUiRequest {
public
NoUiRequest
(
HttpServletRequest
request
,
String
mappingUrl
,
Map
<
String
,
?>
requestData
)
{
String
tokenId
=
request
.
getHeader
(
"token"
);
String
userId
=
request
.
getHeader
(
"userId"
);
String
terminalType
=
request
.
getHeader
(
"terminalType"
);
String
terminalType
=
request
.
getHeader
(
Constants
.
TERMINAL_TYPE
);
String
security
=
request
.
getHeader
(
"security"
);
//光大e结算改造
this
.
cid
=
request
.
getHeader
(
Constants
.
CIFNO
);
...
...
src/main/java/org/sss/presentation/noui/cache/AbstractCache.java
View file @
113b921b
package
org
.
sss
.
presentation
.
noui
.
cache
;
import
log.Log
;
import
log.LogFactory
;
import
org.hibernate.Criteria
;
import
org.hibernate.query.Query
;
import
org.hibernate.query.internal.QueryImpl
;
...
...
@@ -18,6 +20,7 @@ import java.util.Map;
public
abstract
class
AbstractCache
implements
CacheController
{
public
static
final
ThreadLocal
paginationMap
=
new
ThreadLocal
();
protected
static
final
Log
log
=
LogFactory
.
getLog
(
AbstractCache
.
class
);
protected
final
String
cacheName
;
final
String
SPLIT
=
"__"
;
final
String
NULL
=
"NULL"
;
...
...
@@ -26,6 +29,43 @@ public abstract class AbstractCache implements CacheController {
this
.
cacheName
=
redis_cache
;
}
public
static
Map
<
String
,
Object
>
getPageInfo
(
IModuleList
moduleList
)
{
Map
<
String
,
Map
<
String
,
Integer
>>
paginationCache
=
(
Map
<
String
,
Map
<
String
,
Integer
>>)
paginationMap
.
get
();
if
(
paginationCache
==
null
||
paginationCache
.
isEmpty
())
{
return
null
;
}
Map
<
String
,
Integer
>
paginationItem
=
paginationCache
.
remove
(
moduleList
.
getUrl
());
if
(
paginationCache
.
size
()
==
0
)
{
paginationMap
.
remove
();
}
if
(
paginationItem
==
null
||
paginationItem
.
isEmpty
())
{
return
null
;
}
Map
<
String
,
Object
>
paginationInfo
=
new
HashMap
<>();
int
total
=
moduleList
.
fullSize
();
int
index
=
paginationItem
.
get
(
Constants
.
PAGINATION_INDEX
);
int
pageSize
=
paginationItem
.
get
(
Constants
.
PAGINATION_PAGESIZE
);
index
=
getPage
(
index
,
pageSize
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_TOTAL
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_INDEX
,
index
);
return
paginationInfo
;
}
private
static
int
getPage
(
int
index
,
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
index
=
index
>=
1
?
(
index
<=
getPages
(
pageSize
,
total
)
?
index
:
getPages
(
pageSize
,
total
))
:
1
;
return
index
;
}
private
static
int
getPages
(
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
return
total
%
pageSize
==
0
?
total
/
pageSize
:
total
/
pageSize
+
1
;
}
@Override
public
CacheList
cacheRead
(
CacheKey
cacheKey
,
long
keepAlive
,
int
maxSize
,
int
offset
)
{
Object
o
=
cacheKey
.
getKey
();
...
...
@@ -112,18 +152,18 @@ public abstract class AbstractCache implements CacheController {
if
(
o
instanceof
EibsResultSet
)
{
sb
.
append
(((
EibsResultSet
)
o
).
getSql
());
}
else
if
(
o
instanceof
Query
)
{
sb
.
append
(((
Query
)
o
).
getQueryString
());
sb
.
append
(((
Query
)
o
).
getQueryString
());
}
else
{
sb
.
append
(
o
.
toString
());
}
if
(
o
instanceof
EibsResultSet
||
o
instanceof
QueryImpl
)
{
Object
[]
values
=((
EibsResultSet
)
o
).
getArgs
();
Object
[]
values
=
((
EibsResultSet
)
o
).
getArgs
();
sb
.
append
(
appendKeyByPara
(
values
));
}
return
sb
.
toString
();
}
private
StringBuffer
appendKeyByPara
(
Object
[]
values
){
private
StringBuffer
appendKeyByPara
(
Object
[]
values
)
{
StringBuffer
sb
=
new
StringBuffer
();
if
(
values
!=
null
)
{
for
(
Object
val
:
values
)
{
...
...
@@ -140,11 +180,13 @@ public abstract class AbstractCache implements CacheController {
@Override
public
void
prepareReadset
(
IModuleList
moduleList
)
{
Map
<
String
,
Map
<
String
,
Integer
>>
paginationCache
=
(
Map
<
String
,
Map
<
String
,
Integer
>>)
paginationMap
.
get
();
if
(
paginationCache
==
null
||
paginationCache
.
isEmpty
()){
if
(
paginationCache
==
null
||
paginationCache
.
isEmpty
())
{
log
.
warn
(
"未发现请求中包含分页信息"
);
return
;
}
Map
<
String
,
Integer
>
paginationItem
=
paginationCache
.
get
(
moduleList
.
getUrl
());
if
(
paginationItem
==
null
||
paginationItem
.
isEmpty
()){
if
(
paginationItem
==
null
||
paginationItem
.
isEmpty
())
{
log
.
warn
(
"未找到["
+
moduleList
.
getUrl
()
+
"]模型对应的分页信息。可能原因:nouiMapping_xxx.properties未配置该模型映射关系"
);
return
;
}
moduleList
.
setPaging
(
true
);
...
...
@@ -152,46 +194,7 @@ public abstract class AbstractCache implements CacheController {
moduleList
.
setPage
(
paginationItem
.
get
(
Constants
.
PAGINATION_INDEX
));
}
protected
abstract
Object
doCacheRead
(
String
key
);
protected
abstract
void
doCacheWrite
(
String
key
,
Object
lst
,
long
keepAlive
);
public
static
Map
<
String
,
Object
>
getPageInfo
(
IModuleList
moduleList
)
{
Map
<
String
,
Map
<
String
,
Integer
>>
paginationCache
=
(
Map
<
String
,
Map
<
String
,
Integer
>>)
paginationMap
.
get
();
if
(
paginationCache
==
null
||
paginationCache
.
isEmpty
()){
return
null
;
}
Map
<
String
,
Integer
>
paginationItem
=
paginationCache
.
remove
(
moduleList
.
getUrl
());
if
(
paginationCache
.
size
()
==
0
){
paginationMap
.
remove
();
}
if
(
paginationItem
==
null
||
paginationItem
.
isEmpty
()){
return
null
;
}
Map
<
String
,
Object
>
paginationInfo
=
new
HashMap
<>();
int
total
=
moduleList
.
fullSize
();
int
index
=
paginationItem
.
get
(
Constants
.
PAGINATION_INDEX
);
int
pageSize
=
paginationItem
.
get
(
Constants
.
PAGINATION_PAGESIZE
);
index
=
getPage
(
index
,
pageSize
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_TOTAL
,
total
);
paginationInfo
.
put
(
Constants
.
PAGINATION_INDEX
,
index
);
return
paginationInfo
;
}
private
static
int
getPage
(
int
index
,
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
index
=
index
>=
1
?
(
index
<=
getPages
(
pageSize
,
total
)
?
index
:
getPages
(
pageSize
,
total
))
:
1
;
return
index
;
}
private
static
int
getPages
(
int
pageSize
,
int
total
)
{
if
(
pageSize
<=
0
)
{
return
0
;
}
return
total
%
pageSize
==
0
?
total
/
pageSize
:
total
/
pageSize
+
1
;
}
}
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
113b921b
...
...
@@ -27,6 +27,7 @@ public class Constants {
public
static
final
String
PAGINATION_PAGESIZE
=
"pageSize"
;
public
static
final
String
PAGINATION_TOTAL
=
"total"
;
public
static
final
String
SIGNLE_LST
=
"__lst"
;
public
static
final
String
TERMINAL_TYPE
=
"__terminalType"
;
//光大e结算新增常量
public
static
final
String
CIFNO
=
"cifno"
;
...
...
src/main/java/org/sss/presentation/noui/context/NoUiContextManager.java
View file @
113b921b
...
...
@@ -30,10 +30,9 @@ public class NoUiContextManager {
ILoginContext
loginContext
=
null
;
if
(
noUiRequest
.
isOpenSource
())
{
loginContext
=
new
EmptyLoginContext
(
everybody
);
}
else
if
(!
StringUtil
.
isEmpty
(
noUiRequest
.
getCid
())
&&
!
StringUtil
.
isEmpty
(
noUiRequest
.
getOid
())){
loginContext
=
new
ELoginContext
(
noUiRequest
.
getUserId
());
}
else
if
(
StringUtils
.
isEmpty
(
noUiRequest
.
getToken
()))
{
}
else
if
(!
StringUtil
.
isEmpty
(
noUiRequest
.
getCid
())
&&
!
StringUtil
.
isEmpty
(
noUiRequest
.
getOid
()))
{
loginContext
=
new
ELoginContext
(
noUiRequest
.
getUserId
(),
noUiRequest
.
getTerminalType
());
}
else
if
(
StringUtils
.
isEmpty
(
noUiRequest
.
getToken
()))
{
try
{
loginContext
=
(
ILoginContext
)
Class
.
forName
(
loginContextName
).
newInstance
();
}
catch
(
InstantiationException
|
IllegalAccessException
|
ClassNotFoundException
e
)
{
...
...
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
113b921b
...
...
@@ -95,7 +95,7 @@ public abstract class AbstractCommonController {
mainPanel
.
invokeDefaultRules
(
context
);
}
// 模型赋值
NoUiPresentationUtil
.
hanleInput
(
context
,
noUiRequest
,
alias
);
NoUiPresentationUtil
.
han
d
leInput
(
context
,
noUiRequest
,
alias
);
//数据安全性拦截-篡改数据拦截
if
(
DataSecurityUtil
.
isSafeMode
()
&&
noUiRequest
.
isSecurity
())
{
...
...
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
113b921b
...
...
@@ -27,7 +27,7 @@ import java.util.*;
public
class
NoUiPresentationUtil
{
protected
static
final
Log
log
=
LogFactory
.
getLog
(
NoUiPresentationUtil
.
class
);
public
static
void
hanleInput
(
NoUiContext
context
,
NoUiRequest
request
,
Alias
alias
)
{
public
static
void
han
d
leInput
(
NoUiContext
context
,
NoUiRequest
request
,
Alias
alias
)
{
Map
<
String
,
?>
dataMap
=
request
.
getDataMap
();
for
(
String
aliasKey
:
dataMap
.
keySet
())
{
...
...
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