Commit fd47310c by ddx

修改登录传参为json

parent 5d0ec99c
...@@ -18,7 +18,7 @@ public class CookieReq extends SafeModel implements MqMessage { ...@@ -18,7 +18,7 @@ public class CookieReq extends SafeModel implements MqMessage {
private String checkType; private String checkType;
private String site; private String site;
private String target; private String target;
private TaxUserInfo userInfoJson; private Object userInfoJson;
@Override @Override
public String toString() { public String toString() {
......
package com.tax.token.model; package com.tax.token.model;
import com.alibaba.fastjson.JSON;
import com.yxcheng.token.common.model.TaxUserInfo;
import com.yxcheng.token.utils.StringUtil; import com.yxcheng.token.utils.StringUtil;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
...@@ -75,7 +73,7 @@ public class TkToken { ...@@ -75,7 +73,7 @@ public class TkToken {
private Date updateDate; private Date updateDate;
private boolean jsonFlag = false; private boolean jsonFlag = false;
private TaxUserInfo taxUserInfo; private String taxUserInfo;
private String proxyIp; private String proxyIp;
...@@ -110,9 +108,9 @@ public class TkToken { ...@@ -110,9 +108,9 @@ public class TkToken {
'}'; '}';
} }
public TaxUserInfo parseTaxUserInfo() { public String parseTaxUserInfo() {
if(StringUtil.isNotEmpty(getSecert()) && StringUtil.isJSON(getSecert())) { if(StringUtil.isNotEmpty(getSecert()) && StringUtil.isJSON(getSecert())) {
taxUserInfo = JSON.parseObject(getSecert(), TaxUserInfo.class); taxUserInfo = getSecert();
} }
return taxUserInfo; return taxUserInfo;
} }
......
...@@ -40,8 +40,8 @@ public class GetTokenFromEleJsonTax implements TokenThirdServiceI { ...@@ -40,8 +40,8 @@ public class GetTokenFromEleJsonTax implements TokenThirdServiceI {
json.put("site", tokenEntity.getSite()); json.put("site", tokenEntity.getSite());
json.put("target", tokenEntity.getTarget()); json.put("target", tokenEntity.getTarget());
json.put("requestId", uuIdFlag); json.put("requestId", uuIdFlag);
if(null!=tokenEntity.getTaxUserInfo()) { if(StringUtil.isNotEmpty(tokenEntity.getTaxUserInfo())) {
json.put("loginInfoJson", JSON.toJSON(tokenEntity.getTaxUserInfo())); json.put("loginInfoJson", JSON.parse(tokenEntity.getTaxUserInfo()));
} }
json.put("loginInfoMd5", StringUtil.transNullToEmpty(tokenEntity.getSecretMd5())); json.put("loginInfoMd5", StringUtil.transNullToEmpty(tokenEntity.getSecretMd5()));
......
...@@ -36,7 +36,7 @@ public interface TkTokenService { ...@@ -36,7 +36,7 @@ public interface TkTokenService {
JsonResult<TkTokenRemarkLog> queryTokenErrorInfo(TkToken tkToken); JsonResult<TkTokenRemarkLog> queryTokenErrorInfo(TkToken tkToken);
JsonResult<String> getRealCookie(String uuId, String taxno, String zoneCode, String userCode, boolean showData, JsonResult<String> getRealCookie(String uuId, String taxno, String zoneCode, String userCode, boolean showData,
String functionNo, TaxUserInfo taxUserInfo, String checkType, String site, String target); String functionNo, Object taxUserInfo, String checkType, String site, String target);
boolean updateTokenFrom(String uuId, CookieReq cookieReq, JsonResult<String> jsonResult); boolean updateTokenFrom(String uuId, CookieReq cookieReq, JsonResult<String> jsonResult);
......
...@@ -221,7 +221,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -221,7 +221,7 @@ public class TkTokenServiceImpl implements TkTokenService {
@Override @Override
public JsonResult<String> getRealCookie(String uuId, String taxno, String zoneCode, String userCode, boolean showData, public JsonResult<String> getRealCookie(String uuId, String taxno, String zoneCode, String userCode, boolean showData,
String functionNo, TaxUserInfo taxUserInfo, String checkType, String site, String target) { String functionNo, Object taxUserInfo, String checkType, String site, String target) {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String token = null; String token = null;
...@@ -253,7 +253,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -253,7 +253,7 @@ public class TkTokenServiceImpl implements TkTokenService {
tkToken.setUserType("1"); tkToken.setUserType("1");
} }
tkToken.setFunctionNo(functionNo); tkToken.setFunctionNo(functionNo);
tkToken.setTaxUserInfo(taxUserInfo); tkToken.setTaxUserInfo(null!=taxUserInfo?JSON.toJSONString(taxUserInfo):null);
tkToken.setSite(site); tkToken.setSite(site);
tkToken.setTarget(target); tkToken.setTarget(target);
...@@ -275,7 +275,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -275,7 +275,7 @@ public class TkTokenServiceImpl implements TkTokenService {
} else { } else {
updFlag = true; updFlag = true;
} }
if (updFlag) { if (updFlag && !tkToken.getFunctionNo().equals("01")) {
TkToken updToken = queryToken(taxno, zoneCode, userCode); TkToken updToken = queryToken(taxno, zoneCode, userCode);
if(null!=updToken) { if(null!=updToken) {
tkToken.setId(updToken.getId()); tkToken.setId(updToken.getId());
...@@ -626,22 +626,6 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -626,22 +626,6 @@ public class TkTokenServiceImpl implements TkTokenService {
List<TkToken> queryList = tkTokenMapper.selectByExample(example); List<TkToken> queryList = tkTokenMapper.selectByExample(example);
Date curDate = DateUtils.getDate(); Date curDate = DateUtils.getDate();
String secert = null;
boolean jsonFlag = false;
if(tkUser.getIsCheckToken().equals("0")) {
if(null != tkToken.getTaxUserInfo()) {
secert = JSON.toJSONString(tkToken.getTaxUserInfo());
jsonFlag = true;
} else {
if(StringUtils.isNotEmpty(tkToken.getSecert())) {
try {
secert = new String(Base64Util.decode(tkToken.getSecert()), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
}
if(queryList!=null && queryList.size()>0){ if(queryList!=null && queryList.size()>0){
boolean updateFlag = false; boolean updateFlag = false;
TkToken updateEntity = queryList.get(0); TkToken updateEntity = queryList.get(0);
...@@ -649,27 +633,12 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -649,27 +633,12 @@ public class TkTokenServiceImpl implements TkTokenService {
if(!tkToken.getZoneCode().equals(updateEntity.getZoneCode())){ if(!tkToken.getZoneCode().equals(updateEntity.getZoneCode())){
updateFlag = true; updateFlag = true;
} }
//用户信息有变化修改
if(jsonFlag) {
if(null==updateEntity.parseTaxUserInfo() || !tkToken.getTaxUserInfo().toString().equals(updateEntity.parseTaxUserInfo().toString())) {
updateFlag = true;
}
} else {
String oldSecert = StringUtils.isEmpty(updateEntity.getSecert())?"":updateEntity.getSecert();
String newSecert = StringUtils.isEmpty(secert)?"":secert;
if(!oldSecert.equals(newSecert)) {
updateFlag = true;
}
}
//检测token信息 //检测token信息
if(!updateEntity.getIsValid().equals(tkToken.getIsValid()) || !updateEntity.getUserType().equals(tkToken.getUserType())) { if(!updateEntity.getIsValid().equals(tkToken.getIsValid()) || !updateEntity.getUserType().equals(tkToken.getUserType())) {
updateFlag = true; updateFlag = true;
} }
if(updateFlag) { if(updateFlag) {
if(!tkToken.getUserType().equals("9")) { if(!tkToken.getUserType().equals("9")) {
updateEntity.setJsonFlag(jsonFlag);
updateEntity.setSecert(secert);
updateEntity.setZoneCode(tkToken.getZoneCode()); updateEntity.setZoneCode(tkToken.getZoneCode());
updateEntity.setUserType(tkToken.getUserType()); updateEntity.setUserType(tkToken.getUserType());
} }
...@@ -696,7 +665,6 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -696,7 +665,6 @@ public class TkTokenServiceImpl implements TkTokenService {
entity.setZoneCode(tkToken.getZoneCode()); entity.setZoneCode(tkToken.getZoneCode());
entity.setUserCode(userCode); entity.setUserCode(userCode);
entity.setServerNo(tkUser.getServerNo()); entity.setServerNo(tkUser.getServerNo());
entity.setSecert(secert);
entity.setReqDate(curDate); entity.setReqDate(curDate);
entity.setCreateDate(curDate); entity.setCreateDate(curDate);
entity.setUpdateDate(curDate); entity.setUpdateDate(curDate);
......
...@@ -14,17 +14,17 @@ public class TokenUnitTest { ...@@ -14,17 +14,17 @@ public class TokenUnitTest {
// static String host = "http://47.94.208.133:8762"; // static String host = "http://47.94.208.133:8762";
static String host = "http://127.0.0.1:8762"; 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"; String accessKeyID = "eyongyou";
// static String accessKeySecret = "yongyou!@#566ccd"; static String accessKeySecret = "yongyou!@#566ccd";
// String accessKeyID = "esscj"; // String accessKeyID = "esscj";
// static String accessKeySecret = "esscj#@rrab1s"; // static String accessKeySecret = "esscj#@rrab1s";
// String accessKeyID = "echangchen"; // String accessKeyID = "echangchen";
// static String accessKeySecret = "echangchen#@rrwea1"; // static String accessKeySecret = "echangchen#@rrwea1";
String accessKeyID = "edonggang"; // String accessKeyID = "edonggang";
static String accessKeySecret = "donggang@PO!#N98"; // static String accessKeySecret = "donggang@PO!#N98";
// String accessKeyID = "youqian"; // String accessKeyID = "youqian";
// static String accessKeySecret = "youqian!@#312bba"; // static String accessKeySecret = "youqian!@#312bba";
...@@ -148,13 +148,13 @@ public class TokenUnitTest { ...@@ -148,13 +148,13 @@ public class TokenUnitTest {
param.put("userInfoJson",userparam); param.put("userInfoJson",userparam);
System.out.println(url); System.out.println(url);
System.out.println(JSON.toJSONString(param)); System.out.println(JSON.toJSONString(param));
String ret = HttpHelper.postWithJson(url,JSON.toJSONString(param)); ResponseContent ret = HttpHelper.postJsonEntity(url,JSON.toJSONString(param));
System.out.println(ret); System.out.println(ret.getContent());
} }
@Test @Test
public void testGetEtaxCookie() throws Exception{ public void testGetEtaxCookie() throws Exception{
String url = host + "/client/getEtaxCookie"; String url = host + "/client/checkEtaxLoginInfo";
String signStr = "AccessKeyID=%s&SignatureNonce=%s&TimeStamp=%s&Version=1.0"; String signStr = "AccessKeyID=%s&SignatureNonce=%s&TimeStamp=%s&Version=1.0";
String signatureNonce = UUIDGenerator.generate(); String signatureNonce = UUIDGenerator.generate();
...@@ -170,20 +170,25 @@ public class TokenUnitTest { ...@@ -170,20 +170,25 @@ public class TokenUnitTest {
param.put("timeStamp",timeStamp); param.put("timeStamp",timeStamp);
param.put("version","1.0"); param.put("version","1.0");
param.put("signature",getSign(signStr)); param.put("signature",getSign(signStr));
param.put("taxno","911201030796150230"); param.put("taxno","91440101MA5CRHH33W");
param.put("zoneCode","1200"); param.put("zoneCode","4400");
// param.put("loginType","c");
// param.put("userInfo",Base64Util.encode("15928206518[a%b@q]@778899abcdABCD[a%b@q]15928206518[a%b@q]办税员")); param.put("site","4400");
param.put("target","4400");
Map userparam = new HashMap<>(); Map userparam = new HashMap<>();
userparam.put("username","120102197801310541");
userparam.put("password","aa111111");
userparam.put("loginType","b"); userparam.put("loginType","b");
userparam.put("nsrsbh","91440101MA5CRHH33W");
userparam.put("username","Fanny123456");
userparam.put("userType","办税人");
userparam.put("password","Fanny123456");
param.put("userInfoJson",userparam); // param.put("userInfoJson",userparam);
System.out.println(url); System.out.println(url);
System.out.println(JSON.toJSONString(param)); System.out.println(JSON.toJSONString(param));
String ret = HttpHelper.postWithJson(url,JSON.toJSONString(param)); ResponseContent ret = HttpHelper.postJsonEntity(url,JSON.toJSONString(param));
System.out.println(ret); System.out.println(ret.getContent());
} }
@Test @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