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
b490e3f2
Commit
b490e3f2
authored
Dec 13, 2018
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成查询、修改、初始化、CHECK验证
parent
c10662a1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
197 additions
and
43 deletions
+197
-43
Pxisel.java
src/main/java/com/brilliance/eibs/etrade/Pxisel.java
+38
-0
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+1
-0
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+58
-37
PxiController.java
...a/org/sss/presentation/noui/controller/PxiController.java
+9
-1
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+2
-1
noUiMapping_pxisel.properties
src/main/resources/noUiMapping_pxisel.properties
+5
-2
page.properties
src/main/resources/page.properties
+2
-2
pxisel.properties
src/main/resources/pxisel.properties
+5
-0
pxisel_en_US.properties
src/main/resources/pxisel_en_US.properties
+5
-0
HttpTest.java
.../java/org/sss/presentation/noui/api/servlet/HttpTest.java
+72
-0
No files found.
src/main/java/com/brilliance/eibs/etrade/Pxisel.java
View file @
b490e3f2
...
...
@@ -73,6 +73,8 @@ public class Pxisel
{
if
(
isEventBinded
())
return
;
getPxip
().
getNam
().
addCheckRule
(
check100_pxip_nam
);
getPxip
().
getMajor
().
addCheckRule
(
check100_pxip_major
);
ctx
.
getRoot
().
addDefaultRule
(
init100__
);
_pxigrp
.
bindEvents
(
ctx
);
_pxip
.
bindEvents
(
ctx
);
...
...
@@ -114,4 +116,40 @@ public class Pxisel
};
private
final
transient
IRule
check100_pxip_nam
=
new
IRule
()
{
public
final
int
getOrder
()
{
return
100
;
}
@SuppressWarnings
(
value
=
"unchecked"
)
public
final
boolean
invoke
(
IContext
ctx
,
IAttributeValue
evt
)
{
Pxisel
.
this
.
getPxip
().
setEibsMajor
(
"m"
);
ctx
.
getGui
().
setModified
(
Pxisel
.
this
.
getPxip
().
getMajor
());
ctx
.
getGui
().
message
(
MessageType
.
INFORMATION
,
ctx
.
getGui
().
getI18nValue
(
"pxisel"
,
"CT000002"
),
ctx
.
getGui
().
getI18nValue
(
"pxisel"
,
"CT000003"
));
return
true
;
}
};
private
final
transient
IRule
check100_pxip_major
=
new
IRule
()
{
public
final
int
getOrder
()
{
return
100
;
}
@SuppressWarnings
(
value
=
"unchecked"
)
public
final
boolean
invoke
(
IContext
ctx
,
IAttributeValue
evt
)
{
log
.
info
(
getOrder
(),
"check major"
);
Pxisel
.
this
.
getPxip
().
setEibsSex
(
"F"
);
ctx
.
getGui
().
setModified
(
Pxisel
.
this
.
getPxip
().
getSex
());
return
true
;
}
};
}
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
b490e3f2
...
...
@@ -7,4 +7,5 @@ public class Constants {
public
final
static
String
USERNAME
=
"username"
;
public
final
static
String
PASSWORD
=
"password"
;
public
final
static
String
MAPPING_PRE
=
"_"
;
}
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
b490e3f2
...
...
@@ -17,6 +17,7 @@ import org.sss.presentation.noui.api.model.Alias;
import
org.sss.presentation.noui.api.request.NoUiRequest
;
import
org.sss.presentation.noui.api.response.ErrorCodes
;
import
org.sss.presentation.noui.api.response.ResultUtil
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.context.NoUiContext
;
import
org.sss.presentation.noui.context.NoUiContextManager
;
import
org.sss.presentation.noui.context.NoUiPresentation
;
...
...
@@ -33,55 +34,75 @@ public class AbstractCommonController {
protected
static
String
ON_CHECK
=
"ON_CHECK"
;
public
Object
event
(
String
mappingUrl
,
String
eventType
,
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
try
{
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
());
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
);
// 交易跳转
context
.
getSession
().
chain
(
true
,
trnName
);
try
{
// 模型赋值
NoUiPresentationUtil
.
hanleInput
(
context
,
noUiRequest
,
alias
);
// 不为初始化事件
if
(
eventType
!=
null
&&
(!
eventType
.
equals
(
INIT
)))
{
if
(
eventType
.
equals
(
ON_CLICK
))
{
String
aliasActionUrl
=
alias
.
getAliasActionUrl
();
String
actionUrl
=
alias
.
getRel
().
get
(
aliasActionUrl
);
IBaseObject
dataField
=
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
actionUrl
);
if
(
null
==
dataField
)
throw
new
NoUiException
(
"onClickUrl :"
+
actionUrl
+
"is not exsit"
);
((
IDatafield
<?>)
dataField
).
invokeEventRules
(
context
,
EventType
.
ON_CLICK
,
null
);
}
else
if
(
eventType
.
equals
(
ON_CHANGE
))
{
String
aliasActionUrl
=
alias
.
getAliasActionUrl
();
String
actionUrl
=
alias
.
getRel
().
get
(
aliasActionUrl
);
IBaseObject
dataField
=
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
actionUrl
);
if
(
null
==
dataField
)
throw
new
NoUiException
(
"onClickUrl :"
+
actionUrl
+
"is not exsit"
);
else
{
if
(
dataField
instanceof
IDatafield
)
if
(
eventType
.
equals
(
ON_CLICK
))
{
((
IDatafield
<?>)
dataField
).
invokeEventRules
(
context
,
EventType
.
ON_CLICK
,
null
);
}
else
if
(
eventType
.
equals
(
ON_CHANGE
))
{
((
IDatafield
<?>)
dataField
).
invokeEventRules
(
context
,
EventType
.
ON_CHANGE
,
null
);
}
else
if
(
eventType
.
equals
(
ON_CHECK
))
{
for
(
String
aliasKey
:
alias
.
getRel
().
keySet
())
{
if
(
aliasKey
.
startsWith
(
"_"
))
{
continue
;
}
String
realPath
=
alias
.
getRelPath
(
aliasKey
);
IBaseObject
currentDataField
=
(
IDatafield
<?>)
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
realPath
);
if
(
currentDataField
instanceof
IDatafield
<?>)
{
((
IDatafield
<?>)
currentDataField
).
invokeCheckRules
(
context
);
}
}
}
((
IDatafield
<?>)
dataField
).
invokeEventRules
(
context
,
EventType
.
ON_CHANGE
,
null
);
}
else
if
(
eventType
.
equals
(
ON_CHECK
))
{
for
(
String
aliasKey
:
noUiRequest
.
getDataMap
().
keySet
())
{
if
(
aliasKey
.
startsWith
(
Constants
.
MAPPING_PRE
))
{
continue
;
}
String
realPath
=
alias
.
getRelPath
(
aliasKey
);
IBaseObject
currentDataField
=
(
IDatafield
<?>)
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
realPath
);
if
(
currentDataField
instanceof
IDatafield
<?>)
{
((
IDatafield
<?>)
currentDataField
).
invokeCheckRules
(
context
);
}
}
}
// 不为初始化事件
/***
* if (eventType != null && (!eventType.equals(INIT))) { String
* aliasActionUrl = alias.getAliasActionUrl(); String actionUrl =
* alias.getRel().get(aliasActionUrl); IBaseObject dataField =
* context.getSession().getBaseObject(context.getRoot(), actionUrl);
* if (null == dataField) throw new NoUiException("onClickUrl :" +
* actionUrl + "is not exsit"); else { if (dataField instanceof
* IDatafield) if (eventType.equals(ON_CLICK)) { ((IDatafield<?>)
* dataField).invokeEventRules(context, EventType.ON_CLICK, null); }
* else if (eventType.equals(ON_CHANGE)) { ((IDatafield<?>)
* dataField).invokeEventRules(context, EventType.ON_CHANGE, null);
* } else if (eventType.equals(ON_CHECK)) { for (String aliasKey :
* noUiRequest.getDataMap().keySet()) { if
* (aliasKey.startsWith(Constants.MAPPING_PRE)) { continue; } String
* realPath = alias.getRelPath(aliasKey); IBaseObject
* currentDataField = (IDatafield<?>)
* context.getSession().getBaseObject(context.getRoot(), realPath);
* if (currentDataField instanceof IDatafield<?>) { ((IDatafield<?>)
* currentDataField).invokeCheckRules(context); } } } } }
***/
// 保存新的RedisLoginInfo
byte
[]
sysmodBytes
=
NoUiPresentationUtil
.
sysmodToBytes
(
context
);
redisLoginInfo
.
setSysmod
(
sysmodBytes
);
...
...
@@ -102,7 +123,7 @@ public class AbstractCommonController {
// 初始化事件
if
(
eventType
.
equals
(
INIT
))
{
for
(
String
aliasKey
:
alias
.
getRel
().
keySet
())
{
if
(
aliasKey
.
startsWith
(
"_"
))
{
if
(
aliasKey
.
startsWith
(
Constants
.
MAPPING_PRE
))
{
continue
;
}
String
realPath
=
alias
.
getRelPath
(
aliasKey
);
...
...
src/main/java/org/sss/presentation/noui/controller/PxiController.java
View file @
b490e3f2
...
...
@@ -40,8 +40,16 @@ public class PxiController extends AbstractCommonController {
// 初始化 事件
@ResponseBody
@RequestMapping
(
value
=
"/pxiame/init"
,
method
=
RequestMethod
.
POST
)
public
Object
ame
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
public
Object
init
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
String
mappingUrl
=
"/pxiame/init"
;
return
event
(
mappingUrl
,
INIT
,
dataMap
,
request
,
session
);
}
// 初始化 事件
@ResponseBody
@RequestMapping
(
value
=
"/pxisel/check"
,
method
=
RequestMethod
.
POST
)
public
Object
change
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
String
mappingUrl
=
"/pxisel/check"
;
return
event
(
mappingUrl
,
ON_CHECK
,
dataMap
,
request
,
session
);
}
}
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
b490e3f2
...
...
@@ -30,6 +30,7 @@ import org.sss.presentation.noui.api.exception.NoUiException;
import
org.sss.presentation.noui.api.model.Alias
;
import
org.sss.presentation.noui.api.request.NoUiRequest
;
import
org.sss.presentation.noui.api.response.ErrorCodes
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.context.NoUiContext
;
import
org.sss.presentation.noui.context.NoUiPresentation
;
...
...
@@ -40,7 +41,7 @@ public class NoUiPresentationUtil {
Map
<
String
,
?>
dataMap
=
request
.
getDataMap
();
for
(
String
aliasKey
:
dataMap
.
keySet
())
{
if
(
aliasKey
.
startsWith
(
"_"
))
{
if
(
aliasKey
.
startsWith
(
Constants
.
MAPPING_PRE
))
{
continue
;
}
String
url
=
alias
.
getRelPath
(
aliasKey
);
...
...
src/main/resources/noUiMapping_pxisel.properties
View file @
b490e3f2
_sel
=
\\
pxip
\\
sel
pxilst
=
\\
pxip
\\
pxilst
nam
=
\\
pxip
\\
nam
\ No newline at end of file
nam
=
\\
pxip
\\
nam
major
=
\\
pxip
\\
major
univer
=
\\
pxip
\\
univer
sex
=
\\
pxip
\\
sex
\ No newline at end of file
src/main/resources/page.properties
View file @
b490e3f2
#T
ue Dec 11 09:51:2
0 CST 2018
#T
hu Dec 13 09:55:5
0 CST 2018
pxiame
=
pxip.pxiaddmp.zul;
\\
pxip
\\
pxiaddmp
office
=
office.mainp.zul;
\\
mainp
pxisel
=
pxip.pxiselp.zul;
\\
pxip
\\
pxiselp
office
=
office.mainp.zul;
\\
mainp
pxiadd
=
pxip.pxiaddmp.zul;
\\
pxip
\\
pxiaddmp
pxidel
=
pxip.pxidelp.zul;
\\
pxip
\\
pxidelp
src/main/resources/pxisel.properties
0 → 100644
View file @
b490e3f2
#Wed Dec 12 15:58:34 CST 2018
CT000003
=
message
CT000002
=
title
CT000001
=
message
CT000000
=
title
src/main/resources/pxisel_en_US.properties
0 → 100644
View file @
b490e3f2
#Wed Dec 12 15:58:34 CST 2018
CT000003
=
message
CT000002
=
title
CT000001
=
message
CT000000
=
title
src/test/java/org/sss/presentation/noui/api/servlet/HttpTest.java
View file @
b490e3f2
...
...
@@ -23,9 +23,81 @@ public class HttpTest {
pxiadd
(
token
,
userId
,
terminalType
);
pxisel
(
token
,
userId
,
terminalType
);
pxiame
(
token
,
userId
,
terminalType
);
check
(
token
,
userId
,
terminalType
);
}
public
static
void
check
(
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/check"
);
// 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"
,
"gcy"
);
map
.
put
(
"major"
,
"M"
);
/*
* 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
pxisel
(
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