Commit b490e3f2 by gechengyang

完成查询、修改、初始化、CHECK验证

parent c10662a1
......@@ -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;
}
};
}
......@@ -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 = "_";
}
......@@ -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,7 +34,7 @@ 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);
......@@ -49,27 +50,27 @@ public class AbstractCommonController {
// 交易跳转
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");
else {
if (dataField instanceof IDatafield)
if (eventType.equals(ON_CLICK)) {
((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");
((IDatafield<?>) dataField).invokeEventRules(context, EventType.ON_CHANGE, null);
} else if (eventType.equals(ON_CHECK)) {
for (String aliasKey : alias.getRel().keySet()) {
if (aliasKey.startsWith("_")) {
for (String aliasKey : noUiRequest.getDataMap().keySet()) {
if (aliasKey.startsWith(Constants.MAPPING_PRE)) {
continue;
}
String realPath = alias.getRelPath(aliasKey);
......@@ -79,8 +80,28 @@ public class AbstractCommonController {
}
}
}
}
}
// 不为初始化事件
/***
* 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);
......@@ -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);
......
......@@ -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);
}
}
......@@ -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);
......
_sel=\\pxip\\sel
pxilst=\\pxip\\pxilst
nam=\\pxip\\nam
major=\\pxip\\major
univer=\\pxip\\univer
sex=\\pxip\\sex
\ No newline at end of file
#Tue Dec 11 09:51:20 CST 2018
#Thu Dec 13 09:55:50 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
#Wed Dec 12 15:58:34 CST 2018
CT000003=message
CT000002=title
CT000001=message
CT000000=title
#Wed Dec 12 15:58:34 CST 2018
CT000003=message
CT000002=title
CT000001=message
CT000000=title
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment