Commit 05ca45db by ddx

update abc

parent 95465a26
package com.tax.token.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @ProjectName: tax-sys-nacos
* @Package: com.tax.token.model
* @ClassName: CookieResultVo
* @Author: ddx
* @Description: cookie结果
* @Date: 2025-04-11 16:05
* @Version: 1.0
*/
@ToString
@Getter
@Setter
public class CookieResultVo {
private String code;
private String message;
private String proxyip;
private String token;
private String requestId;
private String userName;
private String userCode;
private String loginType;
private String session;
}
...@@ -139,6 +139,13 @@ public class TkRealTokenLog { ...@@ -139,6 +139,13 @@ public class TkRealTokenLog {
private String loginTaxno; private String loginTaxno;
private String secretMd5;
private String errorCode;
private String errorMessage;
private String proxyIp;
private String taxLoginName;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column tk_real_token_log.id * This method returns the value of the database column tk_real_token_log.id
...@@ -554,4 +561,44 @@ public class TkRealTokenLog { ...@@ -554,4 +561,44 @@ public class TkRealTokenLog {
public void setLoginTaxno(String loginTaxno) { public void setLoginTaxno(String loginTaxno) {
this.loginTaxno = loginTaxno; this.loginTaxno = loginTaxno;
} }
public String getSecretMd5() {
return secretMd5;
}
public void setSecretMd5(String secretMd5) {
this.secretMd5 = secretMd5;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getProxyIp() {
return proxyIp;
}
public void setProxyIp(String proxyIp) {
this.proxyIp = proxyIp;
}
public String getTaxLoginName() {
return taxLoginName;
}
public void setTaxLoginName(String taxLoginName) {
this.taxLoginName = taxLoginName;
}
} }
\ No newline at end of file
...@@ -32,5 +32,6 @@ public class TokenReportReq extends SafeModel implements MqMessage { ...@@ -32,5 +32,6 @@ public class TokenReportReq extends SafeModel implements MqMessage {
private String userType; private String userType;
private String serverNo; private String serverNo;
private String taxno; private String taxno;
private String requestType;
} }
...@@ -2,6 +2,8 @@ package com.tax.token.mapper; ...@@ -2,6 +2,8 @@ package com.tax.token.mapper;
import com.tax.token.model.TkRealTokenLog; import com.tax.token.model.TkRealTokenLog;
import com.tax.token.model.TkRealTokenLogExample; import com.tax.token.model.TkRealTokenLogExample;
import com.tax.token.model.TkToken;
import com.tax.token.model.TokenReportReq;
import com.yxcheng.token.common.service.BaseMapper; import com.yxcheng.token.common.service.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -95,4 +97,6 @@ public interface TkRealTokenLogMapper extends BaseMapper<TkRealTokenLogExample,T ...@@ -95,4 +97,6 @@ public interface TkRealTokenLogMapper extends BaseMapper<TkRealTokenLogExample,T
* @mbggenerated Fri Jun 03 17:29:20 CST 2022 * @mbggenerated Fri Jun 03 17:29:20 CST 2022
*/ */
int updateByPrimaryKey(TkRealTokenLog record); int updateByPrimaryKey(TkRealTokenLog record);
List<TkRealTokenLog> selectRealTokenListPage(TokenReportReq tokenReportReq);
} }
\ No newline at end of file
...@@ -23,6 +23,16 @@ ...@@ -23,6 +23,16 @@
<result column="ip_server_no" property="ipServerNo" jdbcType="VARCHAR" /> <result column="ip_server_no" property="ipServerNo" jdbcType="VARCHAR" />
<result column="lost_time" property="lostTime" jdbcType="INTEGER" /> <result column="lost_time" property="lostTime" jdbcType="INTEGER" />
<result column="remarks" property="remarks" jdbcType="VARCHAR" /> <result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="time_flag" property="timeFlag" jdbcType="VARCHAR" />
<result column="res_context" property="resContext" jdbcType="VARCHAR" />
<result column="login_type" property="loginType" jdbcType="VARCHAR" />
<result column="login_taxno" property="loginTaxno" jdbcType="VARCHAR" />
<result column="secret_md5" property="secretMd5" jdbcType="VARCHAR" />
<result column="error_code" property="errorCode" jdbcType="VARCHAR" />
<result column="error_message" property="errorMessage" jdbcType="VARCHAR" />
<result column="proxy_ip" property="proxyIp" jdbcType="VARCHAR" />
<result column="tax_login_name" property="taxLoginName" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause" > <sql id="Example_Where_Clause" >
<!-- <!--
...@@ -99,7 +109,8 @@ ...@@ -99,7 +109,8 @@
This element was generated on Fri Jun 03 17:29:21 CST 2022. This element was generated on Fri Jun 03 17:29:21 CST 2022.
--> -->
id, taxno, token, token_status, req_date, res_date, key_code, secert, zone_code, id, taxno, token, token_status, req_date, res_date, key_code, secert, zone_code,
user_code, server_no, times, is_valid, ip_server_no, lost_time, remarks user_code, server_no, times, is_valid, ip_server_no, lost_time, remarks, time_flag, res_context,
login_type, login_taxno, secret_md5, error_code, error_message, proxy_ip, tax_login_name
</sql> </sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.tax.token.model.TkRealTokenLogExample" > <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.tax.token.model.TkRealTokenLogExample" >
<!-- <!--
...@@ -235,6 +246,21 @@ ...@@ -235,6 +246,21 @@
<if test="timeFlag != null" > <if test="timeFlag != null" >
time_flag, time_flag,
</if> </if>
<if test="secretMd5 != null" >
secret_md5,
</if>
<if test="errorCode != null" >
error_code,
</if>
<if test="errorMessage != null" >
error_message,
</if>
<if test="proxyIp != null" >
proxy_ip,
</if>
<if test="taxLoginName != null" >
tax_login_name,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="taxno != null" > <if test="taxno != null" >
...@@ -294,6 +320,21 @@ ...@@ -294,6 +320,21 @@
<if test="timeFlag != null" > <if test="timeFlag != null" >
#{timeFlag,jdbcType=VARCHAR}, #{timeFlag,jdbcType=VARCHAR},
</if> </if>
<if test="secretMd5 != null" >
#{secretMd5,jdbcType=VARCHAR},
</if>
<if test="errorCode != null" >
#{errorCode},
</if>
<if test="errorMessage != null" >
#{errorMessage},
</if>
<if test="proxyIp != null" >
#{proxyIp},
</if>
<if test="taxLoginName != null" >
#{tax_login_name},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.tax.token.model.TkRealTokenLogExample" resultType="java.lang.Integer" > <select id="countByExample" parameterType="com.tax.token.model.TkRealTokenLogExample" resultType="java.lang.Integer" >
...@@ -475,4 +516,34 @@ ...@@ -475,4 +516,34 @@
remarks = #{remarks,jdbcType=VARCHAR} remarks = #{remarks,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectRealTokenListPage" resultMap="BaseResultMap">
SELECT
*
FROM
tk_real_token_log
WHERE
user_code = #{userCode}
<if test="errorCode != null and errorCode !=''">
and error_code = #{errorCode}
</if>
<if test="zoneCode != null and zoneCode !=''">
and zone_code = #{zoneCode}
</if>
<if test="loginType != null and loginType !=''">
and login_type = #{loginType}
</if>
<if test="taxLoginName != null and taxLoginName !=''">
and tax_login_name = #{taxLoginName}
</if>
<if test="errorMessage != null and errorMessage !=''">
and error_message like concat('%', #{errorMessage}, '%')
</if>
<if test="serverNo != null and serverNo !=''">
and server_no = #{serverNo}
</if>
<if test="taxno != null and taxno !=''">
and taxno = #{taxno}
</if>
order by res_date desc
</select>
</mapper> </mapper>
\ No newline at end of file
package com.tax.token.service.api; package com.tax.token.service.api;
import com.tax.token.model.CleanCookieVo; import com.github.pagehelper.PageInfo;
import com.tax.token.model.CookieReq; import com.tax.token.model.*;
import com.tax.token.model.TkToken;
import com.yxcheng.token.common.model.JsonResult; import com.yxcheng.token.common.model.JsonResult;
import java.util.Date; import java.util.Date;
...@@ -11,4 +10,6 @@ public interface TkRealTokenLogService { ...@@ -11,4 +10,6 @@ public interface TkRealTokenLogService {
void saveRealTokenLog(String uuId, TkToken token, String tokenFrom); void saveRealTokenLog(String uuId, TkToken token, String tokenFrom);
void saveRealTokenLog(String uuId, Date reqDate, CleanCookieVo cleanCookieVo, CookieReq cookieReq, JsonResult result); void saveRealTokenLog(String uuId, Date reqDate, CleanCookieVo cleanCookieVo, CookieReq cookieReq, JsonResult result);
PageInfo<TkRealTokenLog> selectRealTokenListPage(TokenReportReq tokenReportReq);
} }
package com.tax.token.service.impl; package com.tax.token.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tax.token.mapper.TkRealTokenLogMapper; import com.tax.token.mapper.TkRealTokenLogMapper;
import com.tax.token.model.CleanCookieVo; import com.tax.token.model.*;
import com.tax.token.model.CookieReq;
import com.tax.token.model.TkRealTokenLog;
import com.tax.token.model.TkToken;
import com.tax.token.service.api.TkRealTokenLogService; import com.tax.token.service.api.TkRealTokenLogService;
import com.yxcheng.token.common.model.JsonResult; import com.yxcheng.token.common.model.JsonResult;
import com.yxcheng.token.utils.DateUtils; import com.yxcheng.token.utils.DateUtils;
...@@ -18,6 +17,7 @@ import org.springframework.stereotype.Component; ...@@ -18,6 +17,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List;
@Transactional @Transactional
@Component @Component
...@@ -41,14 +41,12 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService { ...@@ -41,14 +41,12 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService {
tokenLog.setSecert(token.getTaxUserInfo()); tokenLog.setSecert(token.getTaxUserInfo());
} }
tokenLog.setUserCode(token.getUserCode()); tokenLog.setUserCode(token.getUserCode());
tokenLog.setRemarks(token.getTokenMessage());
tokenLog.setZoneCode(token.getZoneCode()); tokenLog.setZoneCode(token.getZoneCode());
tokenLog.setServerNo(token.getServerNo()); tokenLog.setServerNo(token.getServerNo());
tokenLog.setResContext(StringUtil.getShortLog(token.getResContext(), 3000)); tokenLog.setResContext(StringUtil.getShortLog(token.getResContext(), 3000));
tokenLog.setIsValid(token.getCheckType()); tokenLog.setIsValid(token.getCheckType());
tokenLog.setIpServerNo(token.getTarget()); tokenLog.setIpServerNo(token.getTarget());
tokenLog.setKeyCode(token.getSite()); tokenLog.setKeyCode(token.getSite());
tokenLog.setLoginType(token.getLoginType());
tokenLog.setLoginTaxno(token.getLoginTaxno()); tokenLog.setLoginTaxno(token.getLoginTaxno());
if(null==token.getResDate()) { if(null==token.getResDate()) {
tokenLog.setResDate(DateUtils.getDate()); tokenLog.setResDate(DateUtils.getDate());
...@@ -57,10 +55,20 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService { ...@@ -57,10 +55,20 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService {
} }
tokenLog.setLostTime(DateUtils.getMillSecondsDiff(tokenLog.getReqDate(),tokenLog.getResDate())); tokenLog.setLostTime(DateUtils.getMillSecondsDiff(tokenLog.getReqDate(),tokenLog.getResDate()));
tokenLog.setTimeFlag(uuId); tokenLog.setTimeFlag(uuId);
if(StringUtil.isNotEmpty(token.getResContext())) {
CookieResultVo cookieResultVo = JSON.parseObject(token.getResContext(), CookieResultVo.class);
tokenLog.setLoginType(cookieResultVo.getLoginType());
tokenLog.setErrorCode(cookieResultVo.getCode());
tokenLog.setErrorMessage(cookieResultVo.getMessage());
tokenLog.setSecretMd5(cookieResultVo.getSession());
tokenLog.setProxyIp(cookieResultVo.getProxyip());
tokenLog.setTaxLoginName(cookieResultVo.getUserName());
}
realTokenLogMapper.insertSelective(tokenLog); realTokenLogMapper.insertSelective(tokenLog);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error(uuId + " saveRealTokenLog taxno " + token.getTaxno() + " is error! " ,e);
logger.error(uuId + " saveRealTokenLog is error! " + e.getMessage());
} }
} }
...@@ -83,7 +91,7 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService { ...@@ -83,7 +91,7 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService {
tokenLog.setResContext(StringUtil.getShortLog(cleanCookieVo.getResponseContext(), 3000)); tokenLog.setResContext(StringUtil.getShortLog(cleanCookieVo.getResponseContext(), 3000));
} }
} }
tokenLog.setIsValid(cookieReq.getCheckType()); tokenLog.setIsValid("9");
tokenLog.setIpServerNo(cookieReq.getTarget()); tokenLog.setIpServerNo(cookieReq.getTarget());
tokenLog.setKeyCode(cookieReq.getSite()); tokenLog.setKeyCode(cookieReq.getSite());
tokenLog.setResDate(DateUtils.getDate()); tokenLog.setResDate(DateUtils.getDate());
...@@ -95,4 +103,13 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService { ...@@ -95,4 +103,13 @@ public class TkRealTokenLogServiceImpl implements TkRealTokenLogService {
logger.error(uuId + " saveRealTokenLog is error! " + e.getMessage()); logger.error(uuId + " saveRealTokenLog is error! " + e.getMessage());
} }
} }
public PageInfo<TkRealTokenLog> selectRealTokenListPage(TokenReportReq tokenReportReq) {
logger.info("selectRealTokenListPage tokenList params is " + tokenReportReq);
PageHelper.startPage(tokenReportReq.getPageNumber(), tokenReportReq.getPageSize());
List<TkRealTokenLog> tokenList = realTokenLogMapper.selectRealTokenListPage(tokenReportReq);
logger.info("selectRealTokenListPage tokenList size is " + tokenList.size());
PageInfo<TkRealTokenLog> pageinfo = new PageInfo<TkRealTokenLog>(tokenList);
return pageinfo;
}
} }
...@@ -190,6 +190,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -190,6 +190,7 @@ public class TkTokenServiceImpl implements TkTokenService {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("cookie", token); json.put("cookie", token);
json.put("proxyIp", tkToken.getProxyIp()); json.put("proxyIp", tkToken.getProxyIp());
json.put("proxyip", tkToken.getProxyIp());
json.put("session", tkToken.getSecretMd5()); json.put("session", tkToken.getSecretMd5());
json.put("requestId", tkToken.getRequestId()); json.put("requestId", tkToken.getRequestId());
json.put("authCode", tkToken.getAuthCode()); json.put("authCode", tkToken.getAuthCode());
...@@ -231,7 +232,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -231,7 +232,7 @@ public class TkTokenServiceImpl implements TkTokenService {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String token = null; String token = null;
logger.info(uuId + " getRealCookie taxno is " + taxno + ",checkType is " + checkType);
//获取地区信息 //获取地区信息
TkZoneInfoExample zoneInfoExample = new TkZoneInfoExample(); TkZoneInfoExample zoneInfoExample = new TkZoneInfoExample();
zoneInfoExample.createCriteria().andZoneCodeEqualTo(zoneCode); zoneInfoExample.createCriteria().andZoneCodeEqualTo(zoneCode);
...@@ -300,6 +301,7 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -300,6 +301,7 @@ public class TkTokenServiceImpl implements TkTokenService {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("cookie", token); json.put("cookie", token);
json.put("proxyIp", tkToken.getProxyIp()); json.put("proxyIp", tkToken.getProxyIp());
json.put("proxyip", tkToken.getProxyIp());
json.put("session", tkToken.getSecretMd5()); json.put("session", tkToken.getSecretMd5());
json.put("requestId", tkToken.getRequestId()); json.put("requestId", tkToken.getRequestId());
json.put("authCode", tkToken.getAuthCode()); json.put("authCode", tkToken.getAuthCode());
...@@ -347,9 +349,9 @@ public class TkTokenServiceImpl implements TkTokenService { ...@@ -347,9 +349,9 @@ public class TkTokenServiceImpl implements TkTokenService {
} }
} }
tkToken.setTaxno(taxno); tkToken.setTaxno(taxno);
tkToken.setLoginType(loginType);
tkToken.setLoginTaxno(loginTaxno); tkToken.setLoginTaxno(loginTaxno);
logger.info(uuId + " getRealCookie loginType is " + loginType + ",loginTaxno is " + loginTaxno + "-->>targetTaxno is " + taxno); logger.info(uuId + " getRealCookie request loginType is " + loginType + ",response loginType is " + tkToken.getLoginType()
+ ",loginTaxno is " + loginTaxno + "-->>targetTaxno is " + taxno);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(uuId + " getRealCookie parse target taxno " + taxno + " is error " + e.getMessage()); logger.error(uuId + " getRealCookie parse target taxno " + taxno + " is error " + e.getMessage());
......
...@@ -4,6 +4,7 @@ package com.tax.token.web.controller; ...@@ -4,6 +4,7 @@ package com.tax.token.web.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.tax.token.model.TokenReportReq; import com.tax.token.model.TokenReportReq;
import com.tax.token.model.TokenReportUpdateReq; import com.tax.token.model.TokenReportUpdateReq;
import com.tax.token.service.api.TkRealTokenLogService;
import com.tax.token.service.api.TkTokenService; import com.tax.token.service.api.TkTokenService;
import com.tax.token.service.api.TkZoneInfoService; import com.tax.token.service.api.TkZoneInfoService;
import com.yxcheng.token.common.model.JsonResult; import com.yxcheng.token.common.model.JsonResult;
...@@ -21,6 +22,8 @@ public class TokenReportController { ...@@ -21,6 +22,8 @@ public class TokenReportController {
@Autowired @Autowired
private TkTokenService tokenService; private TkTokenService tokenService;
@Autowired
private TkRealTokenLogService tkRealTokenLogService;
@RequestMapping(value ="/selectTokenListPage" , method = RequestMethod.POST) @RequestMapping(value ="/selectTokenListPage" , method = RequestMethod.POST)
public String selectTokenListPage(@RequestBody TokenReportReq tokenReportReq){ public String selectTokenListPage(@RequestBody TokenReportReq tokenReportReq){
...@@ -38,4 +41,9 @@ public class TokenReportController { ...@@ -38,4 +41,9 @@ public class TokenReportController {
result.setData(tokenService.updateTokenById(applyId)); result.setData(tokenService.updateTokenById(applyId));
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
@RequestMapping(value ="/selectRealTokenListPage" , method = RequestMethod.POST)
public String selectRealTokenListPage(@RequestBody TokenReportReq tokenReportReq){
return JSON.toJSONString(tkRealTokenLogService.selectRealTokenListPage(tokenReportReq));
}
} }
...@@ -131,19 +131,14 @@ public class TokenUnitTest { ...@@ -131,19 +131,14 @@ 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","92220203MA3R2F3Q03"); param.put("taxno","914404003980391901");
param.put("zoneCode","2200"); param.put("zoneCode","4400");
// param.put("userInfo",Base64Util.encode("刘志怡021323[a%b@q]Lzy672672[a%b@q]")); param.put("userType","2");
Map userparam = new HashMap<>(); Map userparam = new HashMap<>();
// userparam.put("nsrsbh","914404003980391901"); userparam.put("nsrsbh","914404003980391901");
// userparam.put("username","刘志怡021323"); userparam.put("username","刘志怡021323");
// userparam.put("password","Lzy672672"); userparam.put("password","Lzy672672");
//
userparam.put("loginType","b");
userparam.put("username","ZkDxl0731");
userparam.put("password","18561312788");
userparam.put("phone","18561312788");
param.put("userInfoJson",userparam); param.put("userInfoJson",userparam);
System.out.println(url); System.out.println(url);
......
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