Commit 6bdd3bf1 by ddx

update token check

parent de0cfb88
......@@ -125,6 +125,8 @@ public class JxSampleController {
private String incomeRequestTestRealTokenIdUrl;
@NacosValue(value = "${income.request.test.real.core.url}", autoRefreshed = true)
private String incomeRequestTestRealCoreUrl;
@NacosValue(value = "${income.request.query.token.url}", autoRefreshed = true)
private String incomeRequestQueryTokenUrl;
@GetMapping("/jx-analysis-hourly")
public String jxAnalysisHourly(String username, String startDate, String endDate) {
......@@ -939,7 +941,7 @@ public class JxSampleController {
}
@GetMapping("/management/test/real/token/createTestRequest")
public String testRealTokenById(String applyId, String rtype) {
public String createTestRequest(String applyId, String rtype) {
RequestConfig requestConfig = RequestConfig.builder()
.contentType("form")
.method("GET")
......@@ -976,6 +978,34 @@ public class JxSampleController {
}
}
@GetMapping("/management/test/token/createTestTokenRequest")
public String createTestTokenRequest(String rtype, String taxno, String userCode, String zoneCode) {
RequestConfig requestConfig = RequestConfig.builder()
.contentType("form")
.method("GET")
.charset(StandardCharsets.UTF_8.toString())
.retryTimes(1)
.build();
try {
String response = ETaxPureNetUtil.postResponseString(incomeRequestQueryTokenUrl + this.appendParamTokenId(taxno, userCode, zoneCode), null, null, requestConfig, new ResponseCarrier());
log.info("test log token createTestTokenRequest with id response:{}", response);
CookieInfoResponse cookieInfoResponse = JSON.parseObject(response, CookieInfoResponse.class);
if(cookieInfoResponse.success && cookieInfoResponse.getErrorCode().equals("0")) {
ManagementTestRealToken managementTestRealToken = ManagementTestRealToken.builder().token(cookieInfoResponse.getData().getCookie())
.taxno(taxno).zoneCode(zoneCode).proxyIp(cookieInfoResponse.getData().getProxyip()).build();
return createTestCaseManager.createReqeustTestParams(managementTestRealToken, rtype);
}
return response;
} catch (Exception e) {
log.error("test log token createTestTokenRequest with id error:", e);
return "{}";
}
}
private String appendParamTokenId(String taxno, String userCode, String zoneCode) {
return String.format("?taxno=%s&userCode=%s&zoneCode=%s", taxno, userCode, zoneCode);
}
@GetMapping("/get-dqdm")
public String getDqdm(String taxno) {
return etaxConfigService.getArea(taxno);
......
package com.sxc.etaxincome.domain.model.report;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ProjectName: etax-income-api
* @Package: com.sxc.etaxincome.domain.model.report
* @ClassName: CookieInfoResponse
* @Author: ddx
* @Description:
* @Date: 2025-04-25 10:53
* @Version: 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CookieInfoResponse {
public boolean success;
public String errorCode;
public String message;
public String retrySecond;
public CookieInfo data;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class CookieInfo {
public String userGroupId;
public String proxyip;
public String authCode;
public String cookie;
public String loginType;
public String session;
public String requestId;
public String userGroupName;
}
}
package com.sxc.etaxincome.domain.model.report;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
......@@ -14,8 +17,10 @@ import java.util.Date;
* @Date: 2025-04-18 14:35
* @Version: 1.0
*/
@Slf4j
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ManagementTestRealToken {
private String taxno;
......
......@@ -78,6 +78,14 @@
<div class="col-sm-4">
<input class="form-control" id="taxno" value="">
</div>
<label class="col-sm-2 control-label">服务种类:</label>
<div class="col-sm-4">
<input class="form-control" id="loginType" value="">
</div>
<label class="col-sm-2 control-label">errorCode:</label>
<div class="col-sm-4">
<input class="form-control" id="errorCode" value="">
</div>
<label class="col-sm-2 control-label">errorMessage:</label>
<div class="col-sm-4">
<input class="form-control" id="errorMessage" value="">
......@@ -177,6 +185,65 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<div class="modal fade" id="paramModal" role="dialog" aria-labelledby="serverModalLabel" aria-hidden="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
</button>
<h4 class="modal-title" id="paramModalLabel">
Api Test
</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="changeRequest('0920')">登录有效性</button>
<button type="button" class="btn btn-primary" onclick="changeRequest('0111')">权限有效性</button>
<button type="button" class="btn btn-info" id="runButton" onclick="executeRequest()">执行</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">关闭</button>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="box-body">
<div class="form-group" id="proxyServerGroup">
<label class="col-sm-3 control-label">代理:</label>
<div class="col-sm-9">
<input class="form-control" id="proxy" value="">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">rtype:</label>
<div class="col-sm-9">
<input class="form-control" id="rtype" value="">
<input type="hidden" id="taxno">
<input type="hidden" id="userCode">
<input type="hidden" id="zoneCode">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">参数:</label>
<div class="col-sm-9">
<textarea class="form-control" id="paramIn" cols="60" rows="8"></textarea>
</div>
</div>
</div>
</form>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="box-body">
<div class="form-group">
<label class="col-sm-3 control-label">返回值:</label>
<div class="col-sm-9">
<textarea class="form-control" id="paramOut" cols="60" rows="16"></textarea>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</body>
</html>
......@@ -299,6 +299,9 @@ function querySmsPageList(cellphone, areaCode, userCode, reqDate) {
function openTestSampleModal(applyId) {
$('#paramModal').modal('show');
$("#proxy").val('');
$("#paramIn").val('');
$("#paramOut").val('');
$("#applyId").val(applyId);
$("#rtype").val('0920');
getRequest();
......@@ -442,9 +445,9 @@ function initDate() {
var tokenStartDate = $("#tokenStartDate").val();
var tokenEndDate = $("#tokenEndDate").val();
if (tokenStartDate === '') {
$("#tokenStartDate").val(getTodayHeadTime());
$("#tokenStartDate").val(getPastNHours(1));
}
if (tokenEndDate === '') {
$("#tokenEndDate").val(getTodayTailTime());
$("#tokenEndDate").val(getPastNHours(-1));
}
}
......@@ -156,6 +156,14 @@ function queryPageList() {
return new Date(createDate).format('yyyy-MM-dd HH:mm:ss');
}
},
{field: '', title: '无权限原因', formatter: function(value, row, index) {
var remarks = row["remarks"];
if (remarks === undefined || row['userStatus'] === '3') {
return '-';
}
return remarks;
}
},
{field: '', title: '停用原因', formatter: function(value, row, index) {
var autoStopMsg = row["autoStopMsg"];
if (autoStopMsg === undefined || row['userStatus'] === '3') {
......
......@@ -77,6 +77,8 @@ function queryPageList() {
var taxno = $("#taxno").val();
var serverNo = $("#serverNo").val();
var userType = $("#userType").val();
var loginType = $("#loginType").val();
var errorCode = $("#errorCode").val();
var errorMessage = $("#errorMessage").val();
$('#queryTaxUserTable').bootstrapTable({
url: 'jxSample/management/query/token/page', //接口地址
......@@ -91,6 +93,8 @@ function queryPageList() {
zoneCode: areaCode,
serverNo: serverNo,
errorMessage: errorMessage,
errorCode: errorCode,
loginType: loginType,
userType: userType,
taxno: taxno
};
......@@ -180,6 +184,15 @@ function queryPageList() {
{field: 'loginType', title: '服务种类'},
{field: 'errorCode', title: '异常码'},
{field: 'errorMessage', title: '异常信息'},
{field: '', title: '检测', formatter: function(value, row, index) {
var taxno = row["taxno"];
var zoneCode = row["zoneCode"];
var userCode = row["userCode"];
var viewButton = '<a class="edit ml10" href="javascript:openTestSampleModal(\'' + taxno + '\',\'' + userCode + '\',\'' + zoneCode + '\');">检测</a>';
return viewButton;
}
},
{field: '', title: '清除缓存', formatter: function(value, row, index) {
var applyId = row["id"];
var secretMd5 = row["secretMd5"];
......@@ -282,6 +295,100 @@ function openSampleModal(applyId) {
}
});
}
function openTestSampleModal(taxno, userCode, zoneCode) {
$('#paramModal').modal('show');
$("#taxno").val(taxno);
$("#userCode").val(userCode);
$("#zoneCode").val(zoneCode);
$("#rtype").val('0920');
getRequest();
}
function getRequest() {
var taxno = $("#taxno").val();
var userCode = $("#userCode").val();
var zoneCode = $("#zoneCode").val();
var rtype = $("#rtype").val();
var url = "jxSample/management/test/token/createTestTokenRequest";
$.ajax({
type: "GET",
url: url,
data: {
"taxno": taxno,
"userCode": userCode,
"zoneCode": zoneCode,
"rtype": rtype
},
dataType: "json",
contentType: "application/json",
async: false,
success: function (response) {
if(response.rtype=== undefined) {
var jsonFormat = JSON.stringify(response, null, '\t');
$('#paramIn').val(jsonFormat);
$('#runButton').attr("disabled", true);
} else {
$('#rtype').val(response.rtype);
$('#proxy').val(response.proxy);
var jsonFormat = JSON.stringify(response.data, null, '\t');
$('#paramIn').val(jsonFormat);
$('#runButton').attr("disabled", false);
}
},
error: function (e) {
alert("操作失败.");
},
complete: function (e) {
;
}
});
}
function changeRequest(rtype) {
$("#rtype").val(rtype);
$("#paramOut").val('');
getRequest();
}
function executeRequest() {
executeHandle();
}
function executeHandle() {
var rtype = $("#rtype").val();
var data = $("#paramIn").val();
var proxyServer = $("#proxy").val();
if (rtype === '' || rtype === null) {
alert("请输入rtype.");
return;
}
$("#paramOut").val("正在处理中...");
$.ajax({
type: "POST",
url: "jxSample/management/test/real/token/testRequest",
data: {
"rtype": rtype,
"data": data,
"proxy": proxyServer,
"signPriority": "jx_ss"
},
dataType: "json",
contentType: "application/x-www-form-urlencoded",
async: false,
success: function (response) {
var jsonFormat = JSON.stringify(response, null, '\t');
$("#paramOut").val(jsonFormat);
},
error: function (e) {
alert("查询失败.");
$("#paramOut").val('');
},
complete: function (e) {
;
}
});
}
function setElapsedMillisRange() {
var endElapsedMillis = $('input[type=radio][name=elapsedMillisRange]:checked').val();
......
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