|
|
@@ -62,50 +62,53 @@ public class LoginService {
|
|
|
paramsMap.put(paramName,value);
|
|
|
}
|
|
|
}
|
|
|
+ //参数控制签名是否启用
|
|
|
boolean tokenDisable = baseDao.isDBSetting("WMS2UAS","tokenDisable");
|
|
|
- int count = baseDao.getCount("select count(1) from UserDataInfo where udi_token='" + token + "'");
|
|
|
- if (count < 1 && !tokenDisable) {
|
|
|
- resultMap.put("resCode","01");
|
|
|
- resultMap.put("success", false);
|
|
|
- resultMap.put("result", "token错误");
|
|
|
- return resultMap;
|
|
|
- }
|
|
|
- int isExpireTime = baseDao.getCount("select count(1) from UserDataInfo where udi_token='" + token + "' and (sysdate-udi_updatetime)*24 < 1");
|
|
|
- if (isExpireTime < 1 && !tokenDisable) {
|
|
|
- resultMap.put("resCode","02");
|
|
|
- resultMap.put("success", false);
|
|
|
- resultMap.put("result", "token已失效");
|
|
|
- return resultMap;
|
|
|
- }
|
|
|
- Set<String> keysSet = paramsMap.keySet();
|
|
|
- Object[] keys = keysSet.toArray();
|
|
|
- Arrays.sort(keys);
|
|
|
- StringBuffer temp = new StringBuffer();
|
|
|
- boolean first = true;
|
|
|
- for (Object key : keys) {
|
|
|
- if (first) {
|
|
|
- first = false;
|
|
|
- } else {
|
|
|
- temp.append("&");
|
|
|
+ if (!tokenDisable) {
|
|
|
+ int count = baseDao.getCount("select count(1) from UserDataInfo where udi_token='" + token + "'");
|
|
|
+ if (count < 1) {
|
|
|
+ resultMap.put("resCode","01");
|
|
|
+ resultMap.put("success", false);
|
|
|
+ resultMap.put("result", "token错误");
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
- System.out.println("签名参数排序--》"+key);
|
|
|
- temp.append(key).append("=");
|
|
|
- Object value = paramsMap.get(key);
|
|
|
- String valueString = "";
|
|
|
- if (null != value) {
|
|
|
- valueString = String.valueOf(value);
|
|
|
- temp.append(valueString);
|
|
|
+ int isExpireTime = baseDao.getCount("select count(1) from UserDataInfo where udi_token='" + token + "' and (sysdate-udi_updatetime)*24 < 1");
|
|
|
+ if (isExpireTime < 1) {
|
|
|
+ resultMap.put("resCode","02");
|
|
|
+ resultMap.put("success", false);
|
|
|
+ resultMap.put("result", "token已失效");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ Set<String> keysSet = paramsMap.keySet();
|
|
|
+ Object[] keys = keysSet.toArray();
|
|
|
+ Arrays.sort(keys);
|
|
|
+ StringBuffer temp = new StringBuffer();
|
|
|
+ boolean first = true;
|
|
|
+ for (Object key : keys) {
|
|
|
+ if (first) {
|
|
|
+ first = false;
|
|
|
+ } else {
|
|
|
+ temp.append("&");
|
|
|
+ }
|
|
|
+ System.out.println("签名参数排序--》"+key);
|
|
|
+ temp.append(key).append("=");
|
|
|
+ Object value = paramsMap.get(key);
|
|
|
+ String valueString = "";
|
|
|
+ if (null != value) {
|
|
|
+ valueString = String.valueOf(value);
|
|
|
+ temp.append(valueString);
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //若字符中存在中文,则一定要指定编码类型
|
|
|
+ String signStr = DigestUtils.md5DigestAsHex(temp.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
|
|
+ System.out.println(signStr);
|
|
|
+ if (!signStr.equals(sign)) {
|
|
|
+ resultMap.put("resCode","03");
|
|
|
+ resultMap.put("success", false);
|
|
|
+ resultMap.put("result", "sign签名不正确");
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
- }
|
|
|
- //若字符中存在中文,则一定要指定编码类型
|
|
|
- String signStr = DigestUtils.md5DigestAsHex(temp.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
|
|
- System.out.println(signStr);
|
|
|
- if (!signStr.equals(sign) && !tokenDisable) {
|
|
|
- resultMap.put("resCode","03");
|
|
|
- resultMap.put("success", false);
|
|
|
- resultMap.put("result", "sign签名不正确");
|
|
|
- return resultMap;
|
|
|
}
|
|
|
resultMap.put("resCode","00");
|
|
|
resultMap.put("success", true);
|