Commit 344af7f1 by ddx

增加清除登录异常锁信息

parent 2861c4f0
package com.yxcheng.token.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yxcheng.token.common.model.TaxUserInfo;
import java.security.MessageDigest;
......@@ -59,4 +61,31 @@ public class MD5Util {
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
public static void main(String[] args) {
String userJson = "{\"password\":\"Bjjs64130088!!\",\"phone\":\"18611725845\",\"loginType\":\"b\",\"userType\":\"办税员\",\"username\":\"18611725845\"}";
JSONObject loginInfoJson = JSON.parseObject(userJson);
TaxUserInfo bean;
String loginType = "";
if (loginInfoJson.containsKey("loginType")) {
loginType = loginInfoJson.getString("loginType");
}
if ("b".equals(loginType)) {
bean = new TaxUserInfo();
if (loginInfoJson.containsKey("password")) {
bean.setPassword(loginInfoJson.getString("password"));
}
if (loginInfoJson.containsKey("username")) {
bean.setUsername(loginInfoJson.getString("username"));
}
if (loginInfoJson.containsKey("phone")) {
bean.setPhone(loginInfoJson.getString("phone"));
}
if (loginInfoJson.containsKey("userType")) {
bean.setUserType(loginInfoJson.getString("userType"));
}
bean.setLoginType("b");
System.out.println(MD5Util.MD5Encode(bean.toString()));
}
}
}
......@@ -12,8 +12,8 @@ import java.util.Map;
public class UserManageTest {
String accessKeyID = "edd";
static String accessKeySecret = "edd@01!@#ccd143";
String accessKeyID = "echangcheng";
static String accessKeySecret = "echangcheng#@rrwea2";
static String host = "https://api.taxservices.cn";
......@@ -48,7 +48,7 @@ public class UserManageTest {
String url = host + "/invoicefile/taxManage";
String signStr = "AccessKeyID=%s&SignatureNonce=%s&TimeStamp=%s&Version=1.0";
String taxno = "91310104698836108Q";
String taxno = "91450103MAD4RP0N8Q";
taxno = taxno.trim();
String signatureNonce = UUIDGenerator.generate();
long time = System.currentTimeMillis();
......@@ -83,7 +83,7 @@ public class UserManageTest {
param.put("functionList", userList);
System.out.println(JSON.toJSONString(param));
String ret = HttpHelper.postWithJson(url,JSON.toJSONString(param));
String ret = HttpHelper.postJsonEntity(url,JSON.toJSONString(param)).getContent();
System.out.println(ret);
}
......
......@@ -58,4 +58,6 @@ public interface TkTokenService {
int getTokenRealRequestCount(String userCode, String taxno);
void setTokenRealRequestCount(String userCode, String taxno);
JsonResult<String> cleanLoginLockInfo(String uuId, CookieReq cookieReq);
}
......@@ -794,6 +794,7 @@ public class TkTokenServiceImpl implements TkTokenService {
tkTokenMapper.updateByPrimaryKeySelective(updateToken);
}
public void updateTokenErrorInfo(String uuId, TkToken tkToken) {
TkToken updateToken = new TkToken();
updateToken.setTokenStatus(tkToken.getTokenStatus());
......@@ -1025,4 +1026,26 @@ public class TkTokenServiceImpl implements TkTokenService {
redisService.set(RedisContants.TOKEN_REALREQUEST_COUNT + userCode + RedisContants.DELIMITER + taxno, times, 20 * 60);
}
public JsonResult<String> cleanLoginLockInfo(String uuId, CookieReq cookieReq) {
JsonResult result = new JsonResult();
String taxno = cookieReq.getTaxno();
try {
Map<String, Object> resMap = CleanCookieUtil.cleanCookie(uuId, cookieReq, "10");
if (!TokenThirdServiceFactory.isSuccess(resMap)) {
String resMessage = (String)resMap.get("message");
if(StringUtil.isNotEmpty(resMessage)) {
result.setMessage(resMessage);
} else {
result.errorResponse(ResultEnum.flush_error);
}
}
} catch (Exception e) {
e.printStackTrace();
result.errorResponse(ResultEnum.flush_error);
logger.error(uuId + " cleanLoginLockInfo taxno is " + taxno + " ,send is error!" + e.getMessage());
}
logger.info(uuId + " cleanLoginLockInfo taxno is " + taxno + ", result is " + result);
return result;
}
}
......@@ -220,4 +220,16 @@ public class TokenController extends BaseClientController {
return tokenService.selectTokenListByErrorCode(userCode, errorCode, zoneCode);
}
@RequestMapping(value ={"/cleanLoginLockInfo"} , method = RequestMethod.POST)
@LogT
public JsonResult<String> cleanLoginLockInfo(@RequestBody CookieReq cookieReq){
CrRpcResult crRpcResult = userClient.isSafe(cookieReq);
if(!checkUserSafe(crRpcResult)){
return JsonResult.errorResult(crRpcResult.getCode(),crRpcResult.getMessage());
}
cookieReq.setUserCode(cookieReq.getAccessKeyID());
String uuId = UUIDGenerator.generate();
JsonResult<String> jsonResult = tokenService.cleanLoginLockInfo(uuId, cookieReq);
return jsonResult;
}
}
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