Commit fd65819c by gechengyang

A

parent 0e1e726e
......@@ -6,7 +6,13 @@ public class ErrorCodes {
public static final String SUCCESS_INFO = "success";
public static final String NOT_LOGIN = "R0001";
// public static final String NO_SESSION = "R0002";
public static final String LOGIN_ERROR = "R0003";
public static final String LOGIN_ID_ISNULL = "L0001";
public static final String LOGIN_TOKEN_ISNULL = "L0002";
public static final String LOGIN_TOKEN_CHECKERROR = "L0003";
public static final String LOGIN_TIMEOUT = "L0004";
public static final String LOGIN_ERROR = "L0005";
public static final String NOT_FOUND_DATA = "R0004";
public static final String DATA_TYPE_ERROR = "R0005";
public static final String CHAIN_ERROR = "R0006";
......
package org.sss.presentation.noui.controller;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
......@@ -105,9 +107,10 @@ public class AbstractCommonController {
redisLoginInfo.setSysmod(sysmodBytes);
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
return ResultUtil.result(ErrorCodes.SUCCESS, NoUiPresentationUtil.retMsg(context),
handleReturnData(eventType, context, noUiRequest, alias), NoUiPresentationUtil.handleErrorReturnData(context, alias),
NoUiPresentationUtil.handleCodeTableReturnData(context, alias));
Map<String, Object> afterReturnData = handleReturnData(eventType, context, noUiRequest, alias);
return ResultUtil.result(ErrorCodes.SUCCESS, NoUiPresentationUtil.retMsg(context), afterReturnData,
NoUiPresentationUtil.handleErrorReturnData(context, alias), NoUiPresentationUtil.handleCodeTableReturnData(context, alias));
} catch (Exception e) {
log.error("OnClick command error", e);
}
......@@ -141,6 +144,7 @@ public class AbstractCommonController {
NoUiPresentation gui = (NoUiPresentation) context.getGui();
Map<String, Object> modifyMap = gui.getModifyMap();
List<String> containsKeys = new ArrayList<String>();
for (Map.Entry<String, Object> modifyEntry : modifyMap.entrySet()) {
for (Map.Entry<String, String> aliasEntry : alias.getRel().entrySet()) {
String aliasKey = aliasEntry.getKey();
......@@ -148,10 +152,18 @@ public class AbstractCommonController {
if (aliasPath.startsWith(modifyEntry.getKey())) {
Object val = modifyEntry.getValue();
data.put(aliasKey, NoUiPresentationUtil.handIBaseObject(context, val, aliasEntry.getValue()));
containsKeys.add(modifyEntry.getKey());
}
}
}
for (String key : modifyMap.keySet()) {
if (!containsKeys.contains(key)) {
data.put(key, modifyMap.get(key));
}
}
return data;
}
}
......@@ -34,35 +34,35 @@ public class TokenInterceptor implements HandlerInterceptor {
String terminalType = noUiRequest.getTerminalType(); // APP WEB
// token不存在
if (StringUtil.isEmpty(token)) {
Result rt = new Result(ErrorCodes.ERROR, "登录token不能为空", null);
Result rt = new Result(ErrorCodes.LOGIN_TOKEN_ISNULL, "登录token不能为空", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
// userId不存在
if (StringUtil.isEmpty(userId)) {
Result rt = new Result(ErrorCodes.ERROR, "用户id不能为空", null);
Result rt = new Result(ErrorCodes.LOGIN_ID_ISNULL, "用户id不能为空", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
JwtLogin login = JWT.unsign(token, JwtLogin.class);
if (login == null || (!userId.equals((login.getUserId())))) {
Result rt = new Result(ErrorCodes.ERROR, "用户token或ID验证不通过", null);
Result rt = new Result(ErrorCodes.LOGIN_TOKEN_CHECKERROR, "用户token或ID验证不通过", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
RedisLoginInfo redisLoginInfo = (RedisLoginInfo) RedisUtil.get(StringUtil.userUniqueId(noUiRequest));
if (redisLoginInfo == null) {
Result rt = new Result(ErrorCodes.ERROR, "登陆异常", null);
Result rt = new Result(ErrorCodes.LOGIN_ERROR, "登陆异常", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
// 验证登录时间
if (System.currentTimeMillis() > redisLoginInfo.getExpiredTime()) {
Result rt = new Result(ErrorCodes.ERROR, "登录时间超长,请重新登录", null);
Result rt = new Result(ErrorCodes.LOGIN_TIMEOUT, "登录时间超长,请重新登录", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
......
......@@ -236,6 +236,8 @@ public class NoUiPresentationUtil {
String realKey = alias.getRevertRel().get(key);
if (!StringUtils.isEmpty(realKey))
errorMap.put(realKey, errorEntity.getValue());
else
errorMap.put(key, errorEntity.getValue());
}
return errorMap;
}
......
......@@ -8,10 +8,11 @@
<property name="hibernate.connection.autocommit">false</property>
<property name="use_outer_join">false</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="connection.url">jdbc:oracle:thin:@172.17.2.108:1521:xe</property>
<property name="connection.url">jdbc:oracle:thin:@172.17.2.4:1521:ORCL</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">pxi</property>
<property name="connection.password">pxi</property>
<property name="connection.username">gcy</property>
<property name="connection.password">gcy</property>
<property name="connection.autocommit">false</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
......
......@@ -20,8 +20,8 @@ public class HttpTest {
Map<String, Object> map2 = (Map<String, Object>) map1.get("data");
String token = (String) map2.get("token");
pxiadd(token, userId, terminalType);
// pxisel(token, userId, terminalType);
// pxiadd(token, userId, terminalType);
pxisel(token, userId, terminalType);
// pxiame(token, userId, terminalType);
// check(token, userId, terminalType);
// upload(token, userId, terminalType);
......@@ -179,7 +179,7 @@ public class HttpTest {
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/business/service/pxisel/sel");
// URL realUrl = new
// URL("http://localhost:8080/healthServer/getMacSeq");
......@@ -341,14 +341,15 @@ public class HttpTest {
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
Map<String, Object> map = new HashMap<String, Object>();
map.put("nam", "2121");
map.put("nam", "gggeeeccc");
map.put("sex", "");
map.put("univer", "2121");
map.put("major", "2121");
map.put("headimg", "");
map.put("age", "21212");
map.put("tel", "1212");
map.put("tel", "12999998899");
map.put("balance", "");
map.put("balance1", "");
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("data", map);
......
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