Commit 1c1e7e49 by ddx

add interface realEtaxLoginByAp

parent 71aaa12d
package com.tax.token.constants;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -246,8 +247,15 @@ public class TokenConstants {
*/
public static final String ZONE_FLAG_YES = "1";
/**99-发票云 01-电子税局 02-快捷登录*/
/**99-发票云 01-电子税局(软证书) 02-快捷登录 03-电子税局(账密)*/
public static final String FUNCTION_NO_FPY = "99";
public static final String FUNCTION_NO_DZSJ = "01";
public static final String FUNCTION_NO_KJDL = "02";
public static final String FUNCTION_NO_DZSJ_BY_AP = "03";
public static Map<String, String> updateByFunctionMap = Maps.newHashMap();
static {
updateByFunctionMap.put(FUNCTION_NO_DZSJ, FUNCTION_NO_DZSJ);
updateByFunctionMap.put(FUNCTION_NO_DZSJ_BY_AP, FUNCTION_NO_DZSJ_BY_AP);
}
}
......@@ -287,7 +287,7 @@ public class TkTokenServiceImpl implements TkTokenService {
}
//target taxno
setTargetTaxnoByLoginInfoJson(uuId, taxUserInfo, taxno, tkToken);
if (updFlag && !functionNo.equals("01")) {
if (updFlag && !TokenConstants.updateByFunctionMap.containsKey(functionNo)) {
TkToken updToken = queryToken(taxno, zoneCode, userCode);
if(null!=updToken) {
tkToken.setId(updToken.getId());
......@@ -316,7 +316,7 @@ public class TkTokenServiceImpl implements TkTokenService {
result.setData(json);
}
} else {
if(functionNo.equals("01")) {
if(TokenConstants.updateByFunctionMap.containsKey(functionNo)) {
JSONObject json = new JSONObject();
json.put("cookie", token);
json.put("authCode", tkToken.getAuthCode());
......
......@@ -104,6 +104,21 @@ public class TokenController extends BaseClientController {
TokenConstants.FUNCTION_NO_DZSJ, cookieReq.getUserInfoJson(), cookieReq.getCheckType(), cookieReq.getSite(), cookieReq.getTarget());
}
@RequestMapping(value ={"/realEtaxLoginByAp"} , method = RequestMethod.POST)
@LogT
public JsonResult<String>getEtaxCookieByAp(@RequestBody CookieReq cookieReq){
CrRpcResult crRpcResult = userClient.isSafe(cookieReq);
if(!checkUserSafe(crRpcResult)){
return JsonResult.errorResult(crRpcResult.getCode(),crRpcResult.getMessage());
}
if(cookieReq.checkParamNull() || !ZoneUtil.dqList.contains(cookieReq.getZoneCode())) {
return JsonResult.errorResult(ResultEnum.param_error.getCode(), ResultEnum.param_error.getMessage());
}
String uuId = UUIDGenerator.generate();
return tokenService.getRealCookie(uuId, cookieReq.getTaxno(), cookieReq.getZoneCode(), cookieReq.getAccessKeyID(), true,
TokenConstants.FUNCTION_NO_DZSJ_BY_AP, cookieReq.getUserInfoJson(), cookieReq.getCheckType(), cookieReq.getSite(), cookieReq.getTarget());
}
@RequestMapping(value ={"/getNowCookie", "/checkIsLogin"} , method = RequestMethod.POST)
@LogT
public JsonResult<String> getNowCookie(@RequestBody CookieReq cookieReq){
......
......@@ -12,11 +12,11 @@ import java.util.Map;
public class TokenUnitTest {
static String host = "http://127.0.0.1:8762";
// static String host = "https://api.taxservices.cn";
// static String host = "http://127.0.0.1:8762";
static String host = "https://pushtoken.invservice.cn/";
// static String host = "https://api.xfapiao.com";
String accessKeyID = "eyongyou";
static String accessKeySecret = "yongyou!@#566ccd";
// String accessKeyID = "eyongyou";
// static String accessKeySecret = "yongyou!@#566ccd";
// String accessKeyID = "esscj";
// static String accessKeySecret = "esscj#@rrab1s";
......@@ -26,8 +26,8 @@ public class TokenUnitTest {
// String accessKeyID = "edonggang";
// static String accessKeySecret = "donggang@PO!#N98";
// String accessKeyID = "youqian";
// static String accessKeySecret = "youqian!@#312bba";
String accessKeyID = "epei";
static String accessKeySecret = "epei@asd%yjt&b5#";
/**
* zone 91430600081385810Q -> 4300 特殊的是4403
*
......@@ -131,21 +131,20 @@ public class TokenUnitTest {
param.put("timeStamp",timeStamp);
param.put("version","1.0");
param.put("signature",getSign(signStr));
param.put("taxno","YBSWY0140075646");
param.put("taxno","91110108MABM7A651D");
param.put("zoneCode","1100");
param.put("checkType","1");
param.put("checkType","2");
Map userparam = new HashMap<>();
userparam.put("nsrsbh","YBSWY0140075646");
userparam.put("username","用友46803661");
userparam.put("password","8221294444559633306");
userparam.put("phone","13411111111");
userparam.put("username","18845135029");
userparam.put("password","hcy829829");
userparam.put("phone","18845135029");
param.put("userInfoJson", userparam);
System.out.println(url);
System.out.println(JSON.toJSONString(param));
ResponseContent ret = HttpHelper.postJsonEntity(url,JSON.toJSONString(param));
System.out.println(ret.getContent());
// ResponseContent ret = HttpHelper.postJsonEntity(url,JSON.toJSONString(param));
// System.out.println(ret.getContent());
}
@Test
......
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