Commit 7728ae5a by ddx

增加token管理页面

parent 9a6560be
...@@ -104,6 +104,12 @@ public class JxSampleController { ...@@ -104,6 +104,12 @@ public class JxSampleController {
private String incomeSmsSendRequestQueryListUrl; private String incomeSmsSendRequestQueryListUrl;
@NacosValue(value = "${income.upassword}", autoRefreshed = true) @NacosValue(value = "${income.upassword}", autoRefreshed = true)
private String incomeUpassword; private String incomeUpassword;
@NacosValue(value = "${income.request.query.token.list.url}", autoRefreshed = true)
private String incomeRequestQueryTokenListUrl;
@NacosValue(value = "${income.request.update.token.list.url}", autoRefreshed = true)
private String incomeRequestUpdateTokenListUrl;
@NacosValue(value = "${income.request.clean.token.list.url}", autoRefreshed = true)
private String incomeRequestCleanTokenListUrl;
@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) {
...@@ -792,6 +798,54 @@ public class JxSampleController { ...@@ -792,6 +798,54 @@ public class JxSampleController {
} }
} }
@PostMapping("/management/query/token/page")
public String queryTokenPage(@RequestBody ManagementQueryToken managementQueryToken) {
try {
if (managementQueryToken.getPageSize() > 100) {
managementQueryToken.setPageSize(100);
}
String reqUrl = incomeRequestQueryTokenListUrl;
log.info("query 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 token request page response:{}", response);
return this.handlePageResult(response);
} catch (Exception e) {
log.error("query token request page error:", e);
return "{}";
}
}
@PostMapping("/management/start/income/token/token-ids")
public String startIncomeTokenByIds(ManagementUpdateToken managementUpdateToken) {
try {
String response = HttpUtil.post(incomeRequestUpdateTokenListUrl, JSONUtil.toString(managementUpdateToken));
log.info("get income start token with ids response:{}", response);
return "{}";
} catch (Exception e) {
log.error("get income start token with ids error:", e);
return "{}";
}
}
@GetMapping("/management/start/income/token/token-id")
public String startIncomeTokenById(String applyId) {
RequestConfig requestConfig = RequestConfig.builder()
.contentType("form")
.method("GET")
.charset(StandardCharsets.UTF_8.toString())
.retryTimes(1)
.build();
try {
String response = ETaxPureNetUtil.postResponseString(incomeRequestCleanTokenListUrl + this.appendParamTokenId(applyId), null, null, requestConfig, new ResponseCarrier());
log.info("get income start token with ids response:{}", response);
return response;
} catch (Exception e) {
log.error("get income start token with ids 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);
...@@ -801,6 +855,10 @@ public class JxSampleController { ...@@ -801,6 +855,10 @@ public class JxSampleController {
return String.format("?taxnoIds=%s&userCode=%s", taxnoIds, userCode); return String.format("?taxnoIds=%s&userCode=%s", taxnoIds, userCode);
} }
private String appendParamTokenId(String applyId) {
return String.format("?applyId=%s", applyId);
}
private String appendParamInvoiceIds(String invoiceIds, String userCode, String taxno) { private String appendParamInvoiceIds(String invoiceIds, String userCode, String taxno) {
return String.format("?invoiceIds=%s&userCode=%s&taxno=%s", invoiceIds, userCode, taxno); return String.format("?invoiceIds=%s&userCode=%s&taxno=%s", invoiceIds, userCode, taxno);
} }
......
package com.sxc.etaxincome.domain.model.report;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Data
public class ManagementQueryToken {
private Integer pageSize;
private Integer pageNumber;
private String userCode;
private String errorCode;
private String zoneCode;
private String loginType;
private String taxLoginName;
private String errorMessage;
private String userType;
private String serverNo;
private String taxno;
}
package com.sxc.etaxincome.domain.model.report;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Data
public class ManagementUpdateToken {
private String tokenIds;
private String userCode;
private String serverNo;
private String userType;
}
...@@ -30,4 +30,8 @@ ...@@ -30,4 +30,8 @@
"index": 8, "index": 8,
"api": "登录短信列表", "api": "登录短信列表",
"url": "management-query-smsSend-page.html" "url": "management-query-smsSend-page.html"
},{
"index": 9,
"api": "token配置列表",
"url": "management-query-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-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="serverNo">
<option value="">请选择</option>
<option value="E00004">页面登录</option>
<option value="E00005">快捷登录</option>
</select>
</div>
<label class="col-sm-2 control-label">用户类型:</label>
<div class="col-sm-4">
<select class="form-control" id="userType">
<option value="">请选择</option>
<option value="1">自动</option>
<option value="2">人工</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">
<div id="toolbar">
<button id="startServer" class="btn btn-danger" disabled>
<i class="fa fa-unlock"></i> 配置
</button>
</div>
<table id="queryTaxUserTable"></table>
</div>
</div><!-- /.box-body -->
<div class="modal fade" id="openTokenConfigModal" role="dialog" aria-labelledby="openTokenConfigModalLabel" 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="openTokenConfigModalLabel">
income token update
</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-3">
<select class="form-control" id="serverNoRequest">
<option value="E00004">页面登录</option>
<option value="E00005">快捷登录</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户类型:</label>
<div class="col-sm-3">
<select class="form-control" id="userTypeRequest">
<option value="1">自动</option>
<option value="2">人工</option>
</select>
</div>
</div>
<div class="form-group text-center">
<button type="button" class="btn btn-info" onclick="submitLoginInfo()">提交</button>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="confirmModalLabel">启用操作</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<p>您确定要执行此操作吗?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="confirm-action">确认</button>
</div>
</div>
</div>
</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();
flushCheck();
$('#startServer').on('click', function() {
$('#openTokenConfigModal').modal('show');
});
$('#confirm-action').on('click', function() {
startServer();
$('#confirmModal').modal('hide');
$('#openTokenConfigModal').modal('hide');
});
}
function submitLoginInfo() {
$('#confirmModal').modal('show');
}
function flushCheck() {
$('#queryTaxUserTable').on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
$('#startServer').prop('disabled', !$('#queryTaxUserTable').bootstrapTable('getSelections').length)
})
}
function getIdSelections() {
return $.map($('#queryTaxUserTable').bootstrapTable('getSelections'), function (row) {
return row.id
})
}
function startServer() {
var tokenIds = getIdSelections();
var userCode = $("#userCode").val();
var serverNo = $("#serverNoRequest").val();
var userType = $("#userTypeRequest").val();
console.log("tokenIds=" + tokenIds)
if (tokenIds != "" || userCode!="") {
$.ajax({
type: "POST",
url: "/etax-income/jxSample/management/start/income/token/token-ids",
data: {
"tokenIds": tokenIds,
"userCode": userCode,
"serverNo": serverNo,
"userType": userType
},
dataType: "json",
contentType: "application/x-www-form-urlencoded",
async: false,
success: function (response) {
refreshPageList();
},
error: function (e) {
alert("查询token失败.");
},
complete: function (e) {
;
}
});
} else {
alert("用户和记录必选");
return;
}
}
function refreshPageList() {
// first destroy, then reload
$('#queryTaxUserTable').bootstrapTable('destroy');
$('#startServer').prop('disabled', true);
queryPageList();
}
function queryPageList() {
var userCode = $("#userCode").val();
var areaCode = $("#areaCode").val();
var taxno = $("#taxno").val();
var serverNo = $("#serverNo").val();
var userType = $("#userType").val();
var errorMessage = $("#errorMessage").val();
$('#queryTaxUserTable').bootstrapTable({
url: 'jxSample/management/query/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,
userType: userType,
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: 'state',
checkbox: true,
formatter: function(value, row, index) {
return value;
}
},
{field: 'taxno', title: '税号'},
{field: 'zoneCode', title: '地区'},
{field: '', title: 'token状态', formatter: function(value, row, index) {
var type = row['tokenStatus'];
if (type === '0') {
return '初始';
} else if (type === '1') {
return '正常';
} else if (type === '2') {
return '异步';
} else {
return '未知';
}
}
},
{field: '', title: '有效标志', formatter: function(value, row, index) {
var isValid = row['isValid'];
if (isValid === '1') {
return '是';
} else {
return '否';
}
}
},
{field: '', title: '用户类型', formatter: function(value, row, index) {
var userType = row['userType'];
if (userType === '1') {
return '自动';
} else {
return '人工';
}
}
},
{field: '', title: '登录类型', formatter: function(value, row, index) {
var serverNo = row['serverNo'];
if (serverNo === 'E00004') {
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 secretMd5 = row["secretMd5"];
if (applyId > 0 && secretMd5 != "") {
var viewButton = '<a class="edit ml10" href="javascript:openSampleModal(\'' + applyId + '\');">清除缓存</a>';
return viewButton;
} else {
return "--";
}
}
}
]
});
}
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 openSampleModal(applyId) {
if (applyId === '' || applyId === null) {
alert("请输入applyId.");
return;
}
var url = "jxSample/management/start/income/token/token-id";
$.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 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