Commit aab18314 by ddx

add real log function

parent 7728ae5a
...@@ -110,6 +110,12 @@ public class JxSampleController { ...@@ -110,6 +110,12 @@ public class JxSampleController {
private String incomeRequestUpdateTokenListUrl; private String incomeRequestUpdateTokenListUrl;
@NacosValue(value = "${income.request.clean.token.list.url}", autoRefreshed = true) @NacosValue(value = "${income.request.clean.token.list.url}", autoRefreshed = true)
private String incomeRequestCleanTokenListUrl; private String incomeRequestCleanTokenListUrl;
@NacosValue(value = "${income.request.query.real.token.list.url}", autoRefreshed = true)
private String incomeRequestQueryRealTokenListUrl;
@NacosValue(value = "${income.request.query.real.token.id.url}", autoRefreshed = true)
private String incomeRequestQueryRealTokenIdUrl;
@NacosValue(value = "${income.request.clean.real.token.id.url}", autoRefreshed = true)
private String incomeRequestCleanRealTokenIdUrl;
@GetMapping("/jx-analysis-hourly") @GetMapping("/jx-analysis-hourly")
public String jxAnalysisHourly(String username, String startDate, String endDate) { public String jxAnalysisHourly(String username, String startDate, String endDate) {
...@@ -846,6 +852,60 @@ public class JxSampleController { ...@@ -846,6 +852,60 @@ public class JxSampleController {
} }
} }
@PostMapping("/management/query/real/token/page")
public String queryRealTokenPage(@RequestBody ManagementQueryToken managementQueryToken) {
try {
if (managementQueryToken.getPageSize() > 100) {
managementQueryToken.setPageSize(100);
}
String reqUrl = incomeRequestQueryRealTokenListUrl;
log.info("query real token request url {} page param:{}", reqUrl, JSONUtil.toString(managementQueryToken));
String response = HttpUtil.createPost(reqUrl).contentType("application/json")
.body(JSON.toJSONString(managementQueryToken)).execute().body();
log.info("query real token request page response:{}", response);
return this.handlePageResult(response);
} catch (Exception e) {
log.error("query real token request page error:", e);
return "{}";
}
}
@GetMapping("/management/query/real/token/tokenId")
public String queryRealTokenById(String applyId) {
RequestConfig requestConfig = RequestConfig.builder()
.contentType("form")
.method("GET")
.charset(StandardCharsets.UTF_8.toString())
.retryTimes(1)
.build();
try {
String response = ETaxPureNetUtil.postResponseString(incomeRequestQueryRealTokenIdUrl + this.appendParamTokenId(applyId), null, null, requestConfig, new ResponseCarrier());
log.info("query real log token with id response:{}", response);
return response;
} catch (Exception e) {
log.error("query real log token with id error:", e);
return "{}";
}
}
@GetMapping("/management/clean/real/token/tokenId")
public String cleanRealTokenById(String applyId) {
RequestConfig requestConfig = RequestConfig.builder()
.contentType("form")
.method("GET")
.charset(StandardCharsets.UTF_8.toString())
.retryTimes(1)
.build();
try {
String response = ETaxPureNetUtil.postResponseString(incomeRequestCleanRealTokenIdUrl + this.appendParamTokenId(applyId), null, null, requestConfig, new ResponseCarrier());
log.info("query real log token with id response:{}", response);
return response;
} catch (Exception e) {
log.error("query real log token with id error:", e);
return "{}";
}
}
@GetMapping("/get-dqdm") @GetMapping("/get-dqdm")
public String getDqdm(String taxno) { public String getDqdm(String taxno) {
return etaxConfigService.getArea(taxno); return etaxConfigService.getArea(taxno);
......
...@@ -18,4 +18,5 @@ public class ManagementQueryToken { ...@@ -18,4 +18,5 @@ public class ManagementQueryToken {
private String userType; private String userType;
private String serverNo; private String serverNo;
private String taxno; private String taxno;
private String requestType;
} }
...@@ -34,4 +34,8 @@ ...@@ -34,4 +34,8 @@
"index": 9, "index": 9,
"api": "token配置列表", "api": "token配置列表",
"url": "management-query-token-page.html" "url": "management-query-token-page.html"
},{
"index": 10,
"api": "token实时登录日志列表",
"url": "management-query-real-token-page.html"
}] }]
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- debug disable cache -->
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Management Query Token Page</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link type="image/x-ico" href="/etax-income/favicon.ico" rel="shortcut icon"/>
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="/etax-income/plugins/bootstrap/css/bootstrap.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="css/bootstrap-table.min.css">
<link rel="stylesheet" href="css/bootstrap-table-editable.css">
<link rel="stylesheet" href="/etax-income/plugins/font-awesome-4.5.0/css/font-awesome.min.css">
</head>
<script src="/etax-income/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="/etax-income/plugins/jQueryUI/jquery-ui.min.js"></script>
<script src="/etax-income/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/etax-income/plugins/datatables/bootstrap-table.min.js"></script>
<script src="/etax-income/plugins/echarts/echarts.min.js"></script>
<script src="/etax-income/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="/etax-income/plugins/fileDownload/jquery.fileDownload.js"></script>
<script src="/etax-income/scripts/common.js"></script>
<script src="/etax-income/scripts/management-query-real-token-page.js"></script>
<script>
$(document).ready(function () {
$.widget.bridge('uibutton', $.ui.button);
initAll();
});
</script>
<body>
<div class="box-body">
<div class="toolbar" style="float: right;">
<a class="btn btn-info" onclick="refreshPageList()">
<i class="fa fa-search" style="font-size: 15px; color: white;"></i> 查询
</a>
</div>
<form class="form-inline">
<div class="box-body">
<div class="form-group" role="form">
<label class="col-sm-2 control-label">userCode:</label>
<div class="col-sm-4">
<select class="form-control" id="userCode">
<option value="">请选择</option>
</select>
</div>
<label class="col-sm-2 control-label">areaCode:</label>
<div class="col-sm-4">
<select class="form-control" id="areaCode">
<option value="">请选择</option>
</select>
</div>
<label class="col-sm-2 control-label">请求类型:</label>
<div class="col-sm-4">
<select class="form-control" id="requestType">
<option value="">请选择</option>
<option value="1">登录</option>
<option value="2">检测</option>
<option value="9">清除</option>
</select>
</div>
<label class="col-sm-2 control-label">登录类型:</label>
<div class="col-sm-4">
<select class="form-control" id="serverNo">
<option value="">请选择</option>
<option value="E00004">页面登录</option>
<option value="E00005">快捷登录</option>
</select>
</div>
<label class="col-sm-2 control-label">taxno:</label>
<div class="col-sm-4">
<input class="form-control" id="taxno" value="">
</div>
<label class="col-sm-2 control-label">errorMessage:</label>
<div class="col-sm-4">
<input class="form-control" id="errorMessage" value="">
</div>
</div>
</div>
</form>
<div class="col-xs-12">
<table id="queryTaxUserTable"></table>
</div>
</div><!-- /.box-body -->
<div class="modal fade" id="incomeTokenSampleModal" role="dialog" aria-labelledby="incomeTokenSampleModalModalLabel" 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="incomeTokenCompletePeriodModalLabel">
income token sample
</h4>
</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="simulateParam" cols="60" rows="3"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求值:</label>
<div class="col-sm-9">
<textarea class="form-control" id="incomeTokenSampleRequest" cols="60" rows="3"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回值:</label>
<div class="col-sm-9">
<textarea class="form-control" id="incomeTokenSampleResponse" cols="60" rows="5"></textarea>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<div class="modal fade" id="cleanTokenSampleModal" role="dialog" aria-labelledby="cleanTokenSampleModalLabel" 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="cleanTokenSampleModalLabel">
clean token cache
</h4>
</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-12">
<textarea class="form-control" id="cleanTokenResult" cols="46" rows="16"></textarea>
</div>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</body>
</html>
function initAll() {
initAllUsernameList("userCode");
initAllAreaCodeList("areaCode");
queryPageList();
}
function refreshPageList() {
// first destroy, then reload
$('#queryTaxUserTable').bootstrapTable('destroy');
queryPageList();
}
function queryPageList() {
var userCode = $("#userCode").val();
var areaCode = $("#areaCode").val();
var taxno = $("#taxno").val();
var serverNo = $("#serverNo").val();
var errorMessage = $("#errorMessage").val();
$('#queryTaxUserTable').bootstrapTable({
url: 'jxSample/management/query/real/token/page', //接口地址
method: 'post',
contentType:"application/json",
dataType: 'json',
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.limit, //每页多少条数据
pageNumber: (params.offset / params.limit) + 1, //计算当前页码
userCode: userCode,
zoneCode: areaCode,
serverNo: serverNo,
errorMessage: errorMessage,
taxno: taxno
};
return param;
},
height: 560,
striped: true, //是否显示行间隔色
pagination: true, //是否显示分页(*)
maintainSelected: true, //设置为 true 在点击分页按钮或搜索按钮时,将记住checkbox的选择项
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端
strictSearch: true, //设置为 true启用 全匹配搜索,否则为模糊搜索
showRefresh: true, //是否显示刷新按钮
minimumCountColumns: 2, //最少允许的列数
uniqueId: "id", //每一行的唯一标识,一般为主键列
sortStable: true,
columns: [
{field: 'id', title: 'id'},
{field: 'taxno', title: '税号'},
{field: 'zoneCode', title: '地区'},
{field: '', title: 'token状态', formatter: function(value, row, index) {
var tokenStatus = row['tokenStatus'];
if (tokenStatus === '1') {
return '正常';
} else {
return '--';
}
}
},
{field: '', title: '请求类型', formatter: function(value, row, index) {
var isValid = row['isValid'];
if (isValid === '1') {
return '登录';
} else if (isValid === '2') {
return '检测';
} else if (isValid === '9') {
return '清除';
} else {
return '--';
}
}
},
{field: '', title: '登录类型', formatter: function(value, row, index) {
var serverNo = row['serverNo'];
if (serverNo === 'E00004') {
return '页面登录';
} else if (serverNo === 'E00005') {
return '快捷登录';
} else {
return '--';
}
}
},
{field: '', title: '请求时间', formatter: function(value, row, index) {
var reqDate = row["reqDate"];
if (reqDate === undefined) {
return '--';
}
return new Date(reqDate).format('yyyy-MM-dd HH:mm:ss');
}
},
{field: '', title: '返回时间', formatter: function(value, row, index) {
var resDate = row["resDate"];
if (resDate === undefined) {
return '--';
}
return new Date(resDate).format('yyyy-MM-dd HH:mm:ss');
}
},
{field: 'secretMd5', title: 'md5'},
{field: 'loginType', title: '服务种类'},
{field: 'errorCode', title: '异常码'},
{field: 'errorMessage', title: '异常信息'},
{field: '', title: '详情', formatter: function(value, row, index) {
var applyId = row["id"];
var viewButton = '<a class="edit ml10" href="javascript:openTokenSampleModal(\'' + applyId + '\');">详情</a>';
return viewButton;
}
},
{field: '', title: '清除', formatter: function(value, row, index) {
var applyId = row["id"];
var secretMd5 = row["secretMd5"];
if (applyId > 0 && secretMd5 != "") {
var viewButton = '<a class="edit ml10" href="javascript:openSampleModal(\'' + applyId + '\');">清除</a>';
return viewButton;
} else {
return "--";
}
}
}
]
});
}
function openTokenSampleModal(applyId) {
if (applyId === '' || applyId === null) {
alert("请输入applyId.");
return;
}
$('#incomeTokenSampleModal').modal('show');
var url = "jxSample/management/query/real/token/tokenId";
$.ajax({
type: "GET",
url: url,
data: {
"applyId": applyId
},
dataType: "json",
contentType: "application/json",
async: false,
success: function (response) {
$('#incomeTokenSampleRequest').val(response.reqContext);
$("#incomeTokenSampleResponse").val(response.resContext);
$("#simulateParam").val(JSON.stringify(response.requestParam, null, '\t'));
},
error: function (e) {
alert("操作失败.");
},
complete: function (e) {
;
}
});
}
function openSampleModal(applyId) {
if (applyId === '' || applyId === null) {
alert("请输入applyId.");
return;
}
var url = "jxSample/management/clean/real/token/tokenId";
$.ajax({
type: "GET",
url: url,
data: {
"applyId": applyId
},
dataType: "json",
contentType: "application/json",
async: false,
success: function (response) {
var jsonFormat = JSON.stringify(response, null, '\t');
$('#cleanTokenResult').val(jsonFormat);
$('#cleanTokenSampleModal').modal('show');
},
error: function (e) {
alert("操作失败.");
},
complete: function (e) {
;
}
});
}
function initAllUsernameList(usernameId) {
var username = $("#" + usernameId).val();
if (username == "") {
$.ajax({
type: "GET",
url: "/etax-income/jxSample/jx-query-tax-user-list",
data: {
},
dataType: "json",
contentType: "application/x-www-form-urlencoded",
async: false,
success: function (response) {
$("#" + usernameId).empty();
$("#" + usernameId).append("<option value=''>请选择</option>");
$.each(response, function(index, value) {
var selected = (value.userCode === 'echangcheng' ? "selected" : "");
var showName = value.userCode;
$("#" + usernameId).append("<option value='" + value.userCode + "' " + selected + ">" + showName + "</option>");
});
},
error: function (e) {
alert("查询用户信息失败.");
},
complete: function (e) {
;
}
});
}
}
function initAllAreaCodeList(areaCodeId) {
var areaCode = $("#" + areaCodeId).val();
if (areaCode == "") {
$.ajax({
type: "GET",
url: "/etax-income/jxSample/dqdm-list",
data: {
},
dataType: "json",
contentType: "application/x-www-form-urlencoded",
async: false,
success: function (response) {
$("#" + areaCodeId).empty();
$("#" + areaCodeId).append("<option value=''>请选择</option>");
$.each(response, function(index, value) {
$("#" + areaCodeId).append("<option value='" + value.dqdm + "'>" + value.dqdm + "-" + value.dqmc + "</option>");
});
},
error: function (e) {
alert("查询地区信息失败.");
},
complete: function (e) {
;
}
});
}
}
function setElapsedMillisRange() {
var endElapsedMillis = $('input[type=radio][name=elapsedMillisRange]:checked').val();
$("#startElapsedMillis").val(0);
$("#endElapsedMillis").val(endElapsedMillis);
}
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