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
037558c4
Commit
037558c4
authored
Dec 12, 2018
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复相关缺陷
parent
21bf1484
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
272 additions
and
32 deletions
+272
-32
Menu.java
src/main/java/org/sss/presentation/noui/api/model/Menu.java
+50
-0
NoUiPresentation.java
...a/org/sss/presentation/noui/context/NoUiPresentation.java
+44
-1
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+23
-10
PxiController.java
...a/org/sss/presentation/noui/controller/PxiController.java
+55
-2
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+6
-1
eibs.properties
src/main/resources/eibs.properties
+3
-2
eibs_en_US.properties
src/main/resources/eibs_en_US.properties
+3
-2
eibs_zh_CN.properties
src/main/resources/eibs_zh_CN.properties
+3
-4
noUiMapping_pxiadd.properties
src/main/resources/noUiMapping_pxiadd.properties
+10
-10
noUiMapping_pxisel.properties
src/main/resources/noUiMapping_pxisel.properties
+4
-0
HttpTest.java
.../java/org/sss/presentation/noui/api/servlet/HttpTest.java
+71
-0
No files found.
src/main/java/org/sss/presentation/noui/api/model/Menu.java
0 → 100644
View file @
037558c4
package
org
.
sss
.
presentation
.
noui
.
api
.
model
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Menu
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
String
id
;
private
String
label
;
private
String
value
;
public
List
<
Menu
>
subMenu
=
new
ArrayList
<>();
public
String
getId
()
{
return
id
;
}
public
String
getLabel
()
{
return
label
;
}
public
String
getValue
()
{
return
value
;
}
public
List
<
Menu
>
getSubMenu
()
{
return
subMenu
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
void
setSubMenu
(
List
<
Menu
>
subMenu
)
{
this
.
subMenu
=
subMenu
;
}
}
src/main/java/org/sss/presentation/noui/context/NoUiPresentation.java
View file @
037558c4
package
org
.
sss
.
presentation
.
noui
.
context
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.PrintStream
;
import
java.text.MessageFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -53,7 +58,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> requiredList = new
// ArrayList<IAttribute<?>>();
p
ublic
String
message
=
null
;
// 弹出的message
p
rivate
String
message
=
null
;
// 弹出的message
public
IPanel
popupPanel
=
null
;
public
String
transactionName
=
null
;
public
boolean
clearFlag
=
false
;
...
...
@@ -61,6 +66,10 @@ public class NoUiPresentation extends AbstractNullPresentation {
private
boolean
isChain
=
false
;
public
Boolean
logoutFlag
=
null
;
public
String
getMessage
()
{
return
this
.
message
;
}
public
boolean
isChain
()
{
return
isChain
;
}
...
...
@@ -165,6 +174,40 @@ public class NoUiPresentation extends AbstractNullPresentation {
}
public
boolean
message
(
MessageType
paramMessageType
,
String
paramString
,
Object
paramObject
)
throws
ContainerException
{
String
str1
=
""
;
try
{
if
((
paramObject
instanceof
String
))
{
str1
=
(
String
)
paramObject
;
}
else
if
((
paramObject
instanceof
Throwable
))
{
File
localFile
=
new
File
(
getRootPath
(),
"dump"
);
if
(!
localFile
.
exists
())
localFile
.
mkdirs
();
String
str2
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss.SSS"
).
format
(
new
Date
())
+
".log"
;
PrintStream
localPrintStream
=
new
PrintStream
(
new
FileOutputStream
(
new
File
(
localFile
,
str2
)));
((
Throwable
)
paramObject
).
printStackTrace
(
localPrintStream
);
localPrintStream
.
close
();
str1
=
String
.
format
(
getI18nValue
(
"eibs"
,
"error.message"
),
new
Object
[]
{
((
Throwable
)
paramObject
).
getMessage
(),
str2
});
}
else
if
(
paramObject
!=
null
)
{
str1
=
paramObject
.
toString
();
}
if
(
paramString
==
null
)
{
paramString
=
getI18nValue
(
"eibs"
,
"error.title"
);
}
/*
* if (MessageType.ERROR.equals(paramMessageType)) {
* log.error(StringUtils.isEmpty(paramString) ? str1 : str1 + ":" +
* paramString); }
*/
this
.
message
=
str1
;
// log.debug(paramString + "--" + paramObject);
}
catch
(
Exception
e
)
{
if
((
paramObject
instanceof
Throwable
))
{
log
.
error
(
"dump message error"
,
(
Throwable
)
paramObject
);
}
log
.
warn
(
"function message error"
,
e
);
}
return
false
;
}
...
...
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
037558c4
...
...
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.sss.common.model.ILoginContext
;
import
org.sss.common.model.IMenuItem
;
import
org.sss.presentation.noui.api.exception.NoUiException
;
import
org.sss.presentation.noui.api.model.Menu
;
import
org.sss.presentation.noui.api.request.NoUiRequest
;
import
org.sss.presentation.noui.api.response.ErrorCodes
;
import
org.sss.presentation.noui.api.response.ResultUtil
;
...
...
@@ -64,8 +65,11 @@ public class LoginController {
authMap
.
put
(
ILoginContext
.
REQUEST
,
request
);
context
.
getSession
().
auth
(
authMap
);
IMenuItem
menuItem
=
context
.
getAuth
().
getMenu
();
List
<
Map
<
String
,
String
>>
menuList
=
new
ArrayList
<
Map
<
String
,
String
>>();
getMenu
(
menuItem
,
menuList
);
// List<Map<String, String>> menuList = new
// ArrayList<Map<String, String>>();
// getMenu(menuItem, menuList);
List
<
Menu
>
menuList
=
new
ArrayList
<>();
getMenus
(
menuItem
,
menuList
);
Map
<
String
,
Object
>
retDatamap
=
new
HashMap
<
String
,
Object
>();
retDatamap
.
put
(
"token"
,
token
);
...
...
@@ -86,17 +90,26 @@ public class LoginController {
return
ResultUtil
.
result
(
ErrorCodes
.
ERROR
,
"login failed"
,
null
);
}
private
void
getMenu
(
IMenuItem
menuItem
,
List
<
Map
<
String
,
String
>>
menuList
)
{
/*
* private void getMenu(IMenuItem menuItem, List<Map<String, String>>
* menuList) { Iterator<IMenuItem> iterator = menuItem.iterator(); while
* (iterator.hasNext()) { IMenuItem item = iterator.next(); if
* (item.iterator().hasNext()) { getMenu(item, menuList); } else {
* HashMap<String, String> menuMap = new HashMap<>();
* menuMap.put(item.getValue(), item.getLabel()); menuList.add(menuMap); } }
* }
*/
private
void
getMenus
(
IMenuItem
menuItem
,
List
<
Menu
>
menuList
)
{
Iterator
<
IMenuItem
>
iterator
=
menuItem
.
iterator
();
while
(
iterator
.
hasNext
())
{
IMenuItem
item
=
iterator
.
next
();
if
(
item
.
iterator
().
hasNext
())
{
getMenu
(
item
,
menuList
);
}
else
{
HashMap
<
String
,
String
>
menuMap
=
new
HashMap
<>();
menuMap
.
put
(
item
.
getValue
(),
item
.
getLabel
());
menuList
.
add
(
menuMap
);
}
Menu
menu
=
new
Menu
();
menu
.
setValue
(
item
.
getValue
());
menu
.
setLabel
(
item
.
getLabel
());
menuList
.
add
(
menu
);
List
<
Menu
>
subMenuList
=
menu
.
getSubMenu
();
getMenus
(
item
,
subMenuList
);
}
}
}
src/main/java/org/sss/presentation/noui/controller/Pxi
Add
Controller.java
→
src/main/java/org/sss/presentation/noui/controller/PxiController.java
View file @
037558c4
...
...
@@ -28,7 +28,7 @@ import org.sss.presentation.noui.util.RedisUtil;
import
org.sss.presentation.noui.util.StringUtil
;
@Controller
public
class
Pxi
Add
Controller
{
public
class
PxiController
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
LoginController
.
class
);
// Event 事件
...
...
@@ -75,7 +75,60 @@ public class PxiAddController {
redisLoginInfo
.
setSysmod
(
sysmodBytes
);
RedisUtil
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisLoginInfo
);
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
ErrorCodes
.
SUCCESS_INFO
,
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
NoUiPresentationUtil
.
retMsg
(
context
),
NoUiPresentationUtil
.
handleEventReturnData
(
context
,
noUiRequest
,
alias
),
NoUiPresentationUtil
.
handleErrorReturnData
(
context
,
alias
),
NoUiPresentationUtil
.
handleCodeTableReturnData
(
context
,
alias
));
}
catch
(
Exception
e
)
{
log
.
error
(
"OnClick command error"
,
e
);
}
return
ResultUtil
.
result
(
ErrorCodes
.
ERROR
,
"提交处理异常"
,
null
);
}
// Event 事件
@ResponseBody
@RequestMapping
(
value
=
"/pxisel/_sel"
,
method
=
RequestMethod
.
POST
)
public
Object
sel
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
String
mappingUrl
=
"/pxisel/_sel"
;
NoUiRequest
noUiRequest
=
new
NoUiRequest
(
request
,
mappingUrl
,
dataMap
);
NoUiContext
context
=
NoUiContextManager
.
createNoUiContext
(
noUiRequest
);
Alias
alias
=
new
Alias
(
mappingUrl
);
String
trnName
=
alias
.
getTrnName
();
// 交易参数赋值
Map
<
String
,
?>
paramsMap
=
noUiRequest
.
getParamsMap
();
for
(
String
key
:
paramsMap
.
keySet
())
{
context
.
getSession
().
storeData
(
key
,
paramsMap
.
get
(
key
));
}
// 设置old sysmod
RedisLoginInfo
redisLoginInfo
=
(
RedisLoginInfo
)
RedisUtil
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
NoUiPresentationUtil
.
setSysmod
(
context
,
(
byte
[])
redisLoginInfo
.
getSysmod
());
// 交易跳转
context
.
getSession
().
chain
(
true
,
trnName
);
try
{
// 模型赋值
NoUiPresentationUtil
.
hanleInput
(
context
,
noUiRequest
,
alias
);
String
aliasActionUrl
=
alias
.
getAliasActionUrl
();
String
actionUrl
=
alias
.
getRel
().
get
(
aliasActionUrl
);
// context.getRoot().bindEvents(context);
IDatafield
<?>
dataField
=
(
IDatafield
<?>)
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
actionUrl
);
if
(
null
==
dataField
)
throw
new
NoUiException
(
"onClickUrl :"
+
actionUrl
+
"is not exsit"
);
else
{
if
(
dataField
instanceof
IDatafield
)
((
IDatafield
<?>)
dataField
).
invokeEventRules
(
context
,
EventType
.
ON_CLICK
,
null
);
}
// 保存新的RedisLoginInfo
byte
[]
sysmodBytes
=
NoUiPresentationUtil
.
sysmodToBytes
(
context
);
// IBaseObject sysmod =
// context.getSession().getBaseObject(context.getRoot(), "sysmod");
redisLoginInfo
.
setSysmod
(
sysmodBytes
);
RedisUtil
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisLoginInfo
);
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
NoUiPresentationUtil
.
retMsg
(
context
),
NoUiPresentationUtil
.
handleEventReturnData
(
context
,
noUiRequest
,
alias
),
NoUiPresentationUtil
.
handleErrorReturnData
(
context
,
alias
),
NoUiPresentationUtil
.
handleCodeTableReturnData
(
context
,
alias
));
}
catch
(
Exception
e
)
{
...
...
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
037558c4
...
...
@@ -159,6 +159,11 @@ public class NoUiPresentationUtil {
}
}
public
static
String
retMsg
(
NoUiContext
context
)
{
NoUiPresentation
gui
=
(
NoUiPresentation
)
context
.
getGui
();
return
StringUtil
.
isEmpty
(
gui
.
getMessage
())
?
ErrorCodes
.
SUCCESS_INFO
:
gui
.
getMessage
();
}
public
static
Map
<
String
,
Object
>
handleEventReturnData
(
NoUiContext
context
,
NoUiRequest
request
,
Alias
alias
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
NoUiPresentation
gui
=
(
NoUiPresentation
)
context
.
getGui
();
...
...
@@ -174,7 +179,7 @@ public class NoUiPresentationUtil {
}
}
return
null
;
return
data
;
}
private
static
Object
handIBaseObject
(
NoUiContext
context
,
Object
val
,
String
path
)
{
...
...
src/main/resources/eibs.properties
View file @
037558c4
...
...
@@ -30,6 +30,6 @@ menu.parent2=\u6d4b\u8bd5\u4e00\u7ea7\u83dc\u53552
menu.parent11
=
\u
6d4b
\u
8bd5
\u
4e8c
\u
7ea7
\u
83dc
\u5355
menu.office
=
\u
4e3b
\u9875\u
4ea4
\u6613
menu.
tst
sel
=
\u
6d4b
\u
8bd5
\u
67e5
\u
8be2
menu.
tstopn
=
\u
6d4b
\u
8bd5
\u
65b0
\u
5efa
menu.
pxi
sel
=
\u
6d4b
\u
8bd5
\u
67e5
\u
8be2
menu.
pxiadd
=
\u
6d4b
\u
8bd5
\u
65b0
\u
5efa
menu.tstxxx
=
Test
\ No newline at end of file
src/main/resources/eibs_en_US.properties
View file @
037558c4
...
...
@@ -30,6 +30,6 @@ menu.parent2=First level menu2
menu.parent11
=
Second level menu
menu.office
=
Office
menu.
tst
sel
=
Test INFO.
menu.
tstopn
=
Test create
menu.
pxi
sel
=
Test INFO.
menu.
pxiadd
=
Test create
menu.tstxxx
=
Test
\ No newline at end of file
src/main/resources/eibs_zh_CN.properties
View file @
037558c4
...
...
@@ -30,6 +30,6 @@ menu.parent2=\u6d4b\u8bd5\u4e00\u7ea7\u83dc\u53552
menu.parent11
=
\u
6d4b
\u
8bd5
\u
4e8c
\u
7ea7
\u
83dc
\u5355
menu.office
=
\u
4e3b
\u9875\u
4ea4
\u6613
menu.tstsel
=
\u
6d4b
\u
8bd5
\u
67e5
\u
8be2
menu.tstopn
=
\u
6d4b
\u
8bd5
\u
65b0
\u
5efa
menu.tstxxx
=
Test
\ No newline at end of file
menu.pxisel
=
\u
6d4b
\u
8bd5
\u
67e5
\u
8be2
menu.pxiadd
=
\u
6d4b
\u
8bd5
\u
65b0
\u
5efa
menu.tstxxx
=
Test
src/main/resources/noUiMapping_pxiadd.properties
View file @
037558c4
_save
=
pxip
\\
sav
nam
=
pxigrp
\\
rec
\\
nam
sex
=
pxigrp
\\
rec
\\
sex
univer
=
pxigrp
\\
rec
\\
univer
major
=
pxigrp
\\
rec
\\
major
tel
=
pxigrp
\\
rec
\\
tel
headimg
=
pxigrp
\\
rec
\\
headimg
age
=
pxigrp
\\
rec
\\
age
balance
=
pxigrp
\\
rec
\\
balance
\ No newline at end of file
_save
=
\\
pxip
\\
sav
nam
=
\\
pxigrp
\\
rec
\\
nam
sex
=
\\
pxigrp
\\
rec
\\
sex
univer
=
\\
pxigrp
\\
rec
\\
univer
major
=
\\
pxigrp
\\
rec
\\
major
tel
=
\\
pxigrp
\\
rec
\\
tel
headimg
=
\\
pxigrp
\\
rec
\\
headimg
age
=
\\
pxigrp
\\
rec
\\
age
balance
=
\\
pxigrp
\\
rec
\\
balance
\ No newline at end of file
src/main/resources/noUiMapping_pxisel.properties
0 → 100644
View file @
037558c4
_sel
=
\\
pxip
\\
sel
pxilst
=
\\
pxip
\\
pxilst
nam
=
\\
pxip
\\
nam
\ No newline at end of file
src/test/java/org/sss/presentation/noui/api/servlet/HttpTest.java
View file @
037558c4
...
...
@@ -21,9 +21,80 @@ public class HttpTest {
String
token
=
(
String
)
map2
.
get
(
"token"
);
pxiadd
(
token
,
userId
,
terminalType
);
pxisel
(
token
,
userId
,
terminalType
);
}
public
static
void
pxisel
(
String
token
,
String
userId
,
String
terminalType
)
{
PrintWriter
out
=
null
;
BufferedReader
in
=
null
;
String
result
=
""
;
try
{
// "http://172.17.2.100:8080/oauth/token?username=user_1&password=123456&grant_type=password&client_id=client&client_secret=123456"
URL
realUrl
=
new
URL
(
"http://localhost:8080/business/service/pxisel/_sel"
);
// URL realUrl = new
// URL("http://localhost:8080/healthServer/getMacSeq");
// 打开和URL之间的连接
URLConnection
conn
=
realUrl
.
openConnection
();
// 设置通用的请求属性
conn
.
setRequestProperty
(
"accept"
,
"application/json"
);
conn
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json;charset=utf-8"
);
conn
.
addRequestProperty
(
"token"
,
token
);
conn
.
addRequestProperty
(
"userId"
,
userId
);
conn
.
addRequestProperty
(
"terminalType"
,
terminalType
);
// 发送POST请求必须设置如下两行
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
// 获取URLConnection对象对应的输出流
out
=
new
PrintWriter
(
conn
.
getOutputStream
());
// 发送请求参数
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"nam"
,
"gechengyang"
);
/*
* map.put("sex", "F"); map.put("univer", "湖北大学"); map.put("major",
* "计算机"); map.put("headimg", "NO IMAGE"); map.put("age", 20);
* map.put("tel", "18912345678"); map.put("balance", 10000);
*/
Map
<
String
,
Object
>
map2
=
new
HashMap
<
String
,
Object
>();
map2
.
put
(
"data"
,
map
);
// System.out.println(JSON.toJSON(student));
out
.
print
(
new
Gson
().
toJson
(
map2
));
// out.print("abc");
// flush输出流的缓冲
out
.
flush
();
// 定义BufferedReader输入流来读取URL的响应
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
+=
line
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送 POST 请求出现异常!"
+
e
);
e
.
printStackTrace
();
}
// 使用finally块来关闭输出流、输入流
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
System
.
out
.
println
(
"result="
+
result
);
}
public
static
void
pxiadd
(
String
token
,
String
userId
,
String
terminalType
)
{
PrintWriter
out
=
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