main
黄海 9 months ago
parent b032f72140
commit bca700ba89

@ -1 +0,0 @@
[{"baseUrl":"","className":"DataEaseController","description":"DataEaseController","docFileName":"com_dsideal_base_DataEase_Controller_DataEaseController.html","generateDocs":true,"packageName":"com.dsideal.base.DataEase.Controller","requestNodes":[{"changeFlag":0,"codeFileUrl":"com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSet","deprecated":false,"description":"根据当前登录人员的identity_id,获取此人员可以维护的数据集名称","header":[],"method":["GET","POST"],"methodName":"getDataSet","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"/dataease/getDataSet"},{"changeFlag":0,"codeFileUrl":"com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSetTable","deprecated":false,"description":"获取数据集下的数据表","header":[],"method":["GET","POST"],"methodName":"getDataSetTable","paramNodes":[{"description":"数据集id","jsonBody":false,"name":"dataset_id","required":false,"type":"int"}],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"/dataease/getDataSetTable"},{"changeFlag":0,"codeFileUrl":"com_dsideal_base_DataEase_Controller_DataEaseController.html#saveDataSetTable","deprecated":false,"description":"保存数据集下的数据表","header":[],"method":["GET","POST"],"methodName":"saveDataSetTable","paramNodes":[{"description":"数据集id","jsonBody":false,"name":"dataset_id","required":false,"type":"int"},{"description":"保存的数据","jsonBody":false,"name":"data","required":false,"type":"string"}],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"/dataease/saveDataSetTable"}],"srcFileName":"D:\\dsWork\\YunNanDsBase\\src\\main\\java\\com\\dsideal\\base\\DataEase\\Controller\\DataEaseController.java"}]

@ -1,59 +0,0 @@
{
"info": {
"_postman_id": "",
"name": "YunNanDsBase",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "DataEaseController",
"item": [
{
"name": "根据当前登录人员的identity_id,获取此人员可以维护的数据集名称",
"request": {
"url": {
"raw": "{{domain}}/dataease/getDataSet",
"query": [
]
}
}
},
{
"name": "获取数据集下的数据表",
"request": {
"url": {
"raw": "{{domain}}/dataease/getDataSetTable",
"query": [
{
"key": "dataset_id",
"value": "",
"description": "数据集id"
}
]
}
}
},
{
"name": "保存数据集下的数据表",
"request": {
"url": {
"raw": "{{domain}}/dataease/saveDataSetTable",
"query": [
{
"key": "dataset_id",
"value": "",
"description": "数据集id"
},
{
"key": "data",
"value": "",
"description": "保存的数据"
}
]
}
}
}
]
}
]
}

@ -42,6 +42,9 @@
<i class="glyphicon glyphicon-align-justify"></i> DataEaseController
</div>
<div id="collapse0" class="collapse in " aria-labelledby="heading0">
<a class="catalog-item" href="com_dsideal_base_DataEase_Controller_DataEaseController.html#route">
路由跳转
</a>
<a class="catalog-item" href="com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSet">
根据当前登录人员的identity_id,获取此人员可以维护的数据集名称
</a>
@ -53,6 +56,23 @@
</a>
</div>
</div>
<div class="panel">
<div id="heading1" data-parent="#accordion" class="catalog-title" data-toggle="collapse"
aria-expanded="true" data-target="#collapse1" aria-controls="collapse1">
<i class="glyphicon glyphicon-align-justify"></i> ResourceController
</div>
<div id="collapse1" class="collapse " aria-labelledby="heading1">
<a class="catalog-item" href="com_dsideal_base_Res_Controller_ResourceController.html#getZskPage">
获取知识库分页数据
</a>
<a class="catalog-item" href="com_dsideal_base_Res_Controller_ResourceController.html#uploadZskDocument">
上传知识库文档
</a>
<a class="catalog-item" href="com_dsideal_base_Res_Controller_ResourceController.html#delZskDocument">
删除知识库文档
</a>
</div>
</div>
</div> </div>
<div class="book-body">
<div class="body-inner">
@ -66,6 +86,33 @@
<div class="page-inner">
<div class="action-list">
<div class="action-item">
<h2 id="route"><a href="#">路由跳转 </a></h2>
<p><strong>请求URL</strong></p>
<p>
<code>/dataease/route</code>
<span class="label label-default">GET</span>
<span class="label label-default">POST</span>
</p>
<p><strong>请求参数</strong> <span class="badge">application/x-www-form-urlencoded</span></p>
<table class="table table-bordered">
<tr>
<th>参数名</th>
<th>类型</th>
<th>必须</th>
<th>描述</th>
</tr>
<tr>
<td>city_name</td>
<td>string</td>
<td></td>
<td>城市名称</td>
</tr>
</table>
<p><strong>返回结果</strong></p>
<pre class="prettyprint lang-json">{}</pre>
</div>
<hr>
<div class="action-item">
<h2 id="getDataSet"><a href="#">根据当前登录人员的identity_id,获取此人员可以维护的数据集名称 </a></h2>
<p><strong>请求URL</strong></p>
<p>
@ -150,9 +197,13 @@
<script>
var search_source_data = [
{name: 'DataEaseController.路由跳转', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#route'},
{name: 'DataEaseController.根据当前登录人员的identity_id,获取此人员可以维护的数据集名称', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSet'},
{name: 'DataEaseController.获取数据集下的数据表', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSetTable'},
{name: 'DataEaseController.保存数据集下的数据表', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#saveDataSetTable'},
{name: 'ResourceController.获取知识库分页数据', url: 'com_dsideal_base_Res_Controller_ResourceController.html#getZskPage'},
{name: 'ResourceController.上传知识库文档', url: 'com_dsideal_base_Res_Controller_ResourceController.html#uploadZskDocument'},
{name: 'ResourceController.删除知识库文档', url: 'com_dsideal_base_Res_Controller_ResourceController.html#delZskDocument'},
];

@ -1,119 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>YunNanDsBaseAPI Documentation</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/google-code-prettify@1.0.5/bin/prettify.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body onload="PR.prettyPrint()">
<nav class="navbar">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">
YunNanDsBase
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/YeDaxia/JApiDocs" target="_blank">GitHub</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v1.0<span class="caret"></span></a>
<ul class="dropdown-menu">
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="book with-summary">
<div class="book-summary">
<div class="search-box form-group">
<input type="text" class="form-control" id="inputSearch" placeholder="搜索接口">
<span class="glyphicon glyphicon-search form-control-feedback" aria-hidden="true"></span>
</div>
<div id="accordion" class="catalog">
<div class="panel">
<div id="heading0" data-parent="#accordion" class="catalog-title" data-toggle="collapse"
aria-expanded="true" data-target="#collapse0" aria-controls="collapse0">
<i class="glyphicon glyphicon-align-justify"></i> DataEaseController
</div>
<div id="collapse0" class="collapse in " aria-labelledby="heading0">
<a class="catalog-item" href="com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSet">
根据当前登录人员的identity_id,获取此人员可以维护的数据集名称
</a>
<a class="catalog-item" href="com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSetTable">
获取数据集下的数据表
</a>
<a class="catalog-item" href="com_dsideal_base_DataEase_Controller_DataEaseController.html#saveDataSetTable">
保存数据集下的数据表
</a>
</div>
</div>
</div> </div>
<div class="book-body">
<div class="body-inner">
<div class="book-header">
<div class="d-flex justify-content-between">
<a class="header-menu toggle-catalog" href="javascript:void(0)"><i
class="glyphicon glyphicon-align-justify"></i> 目录</a>
</div>
</div>
<div class="page-wrapper">
<div class="page-inner">
<div class="main-content">
<img src="http://static.nowait.xin/pic/japidocs-logo.png" width="200" height="200">
<h4 style="margin: 20px">本文档由JApiDocs生成</h4>
<div class="list-group" style="min-width: 200px">
<a href="com_dsideal_base_DataEase_Controller_DataEaseController.html" class="list-group-item">DataEaseController</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/google-code-prettify@1.0.5/bin/prettify.min.js"></script>
<script>
var search_source_data = [
{name: 'DataEaseController.根据当前登录人员的identity_id,获取此人员可以维护的数据集名称', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSet'},
{name: 'DataEaseController.获取数据集下的数据表', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#getDataSetTable'},
{name: 'DataEaseController.保存数据集下的数据表', url: 'com_dsideal_base_DataEase_Controller_DataEaseController.html#saveDataSetTable'},
];
$('.toggle-catalog').click(function () {
$('.book').toggleClass('with-summary');
});
$('#inputSearch').autocomplete({hint: false}, [
{
source: function (query, callback) {
var result = [];
for(var i = 0; i !== search_source_data.length; i++){
if(search_source_data[i].name.indexOf(query) !== -1){
result.push(search_source_data[i]);
}
}
callback(result);
},
displayKey: 'name',
templates: {
suggestion: function (suggestion) {
return suggestion.name;
}
}
}
]).on('autocomplete:selected', function (event, suggestion, dataset, context) {
self.location = suggestion.url;
});
</script>
</body>
</html>

@ -1,300 +0,0 @@
body, html {
height: 100%;
}
.book{
position: relative;
width: 100%;
height: 100%;
}
.book.with-summary .book-summary {
left: 0;
}
.book-summary {
position: absolute;
top: 0;
left: -300px;
bottom: 0;
z-index: 1;
overflow-y: auto;
width: 300px;
color: #364149;
background: #fafafa;
border-right: 1px solid rgba(0,0,0,.07);
-webkit-transition: left 250ms ease;
-moz-transition: left 250ms ease;
-o-transition: left 250ms ease;
transition: left 250ms ease;
}
.book-body {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
overflow-y: auto;
color: #333;
background: #fff;
-webkit-transition: left 250ms ease;
-moz-transition: left 250ms ease;
-o-transition: left 250ms ease;
transition: left 250ms ease;
}
.book-body .body-inner {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
overflow-y: auto;
padding-top: 10px;
}
.book-header {
overflow: visible;
height: 50px;
z-index: 2;
font-size: .85em;
color: #7e888b;
background: 0 0;
}
.book-header a.header-menu{
font-size: 18px;
color: #555555;
padding: 10px;
text-decoration: none;
}
.book-header a.header-menu:hover{
text-decoration: none;
color: #5cb85c;
}
.page-wrapper {
position: relative;
outline: 0;
}
.book .book-body .page-wrapper .page-inner {
position: relative;
left: 0px;
transition: 300ms ease left;
}
.page-inner {
position: relative;
max-width: 900px;
margin: 0 auto;
padding: 20px 15px 40px 15px;
}
@media (min-width: 600px){
.book.with-summary .book-body {
left: 300px;
}
}
@media (max-width: 600px){
.book-summary {
width: calc(100% - 60px);
bottom: 0;
left: -100%;
}
.book.with-summary .book-body {
-webkit-transform: translate(calc(100% - 60px),0);
-moz-transform: translate(calc(100% - 60px),0);
-ms-transform: translate(calc(100% - 60px),0);
-o-transform: translate(calc(100% - 60px),0);
transform: translate(calc(100% - 60px),0);
}
}
@media (max-width: 1240px){
.book-body {
-webkit-transition: -webkit-transform 250ms ease;
-moz-transition: -moz-transform 250ms ease;
-o-transition: -o-transform 250ms ease;
transition: transform 250ms ease;
padding-bottom: 20px;
}
}
@media (max-width: 1240px){
.book-body .body-inner {
position: static;
min-height: calc(100% - 50px);
}
}
.navbar{
background: #5cb85c;
color: #FFF;
}
.navbar a{
color: #FFF;
}
.navbar-brand{
font-weight: 600;
}
@media (min-width: 768px){
.navbar {
border-radius: 0;
}
}
.catalog .panel{
margin-bottom: 0;
border-radius: 0;
border: none;
box-shadow: none;
-webkit-box-shadow: none;
}
.catalog .catalog-title {
border-bottom: 1px solid #EAEAEA;
padding: 1rem 1.25rem;
background: rgba(0, 0, 0, .03);
cursor: pointer;
color: #333;
font-weight: 600;
font-size: 16px;
}
.catalog-item{
padding: 8px 15px;
margin-left: 15px;
color: #888;
border-bottom: solid #EEE 1px;
display: block;
}
.action-item h2 a{
color: #5cb85c;
}
a:hover{
color: #449d44;
}
.search-box{
position: relative;
margin: 10px;
}
.navbar{
margin-bottom: 0;
}
.main-content{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.text-bold{
font-weight: bold;
}
/**third part*/
.algolia-autocomplete {
width: 100%;
}
.algolia-autocomplete .aa-input, .algolia-autocomplete .aa-hint {
width: 100%;
}
.algolia-autocomplete .aa-hint {
color: #888;
}
.algolia-autocomplete .aa-dropdown-menu {
width: 100%;
background-color: #fff;
border: 1px solid #EEE;
border-top: none;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion {
cursor: pointer;
padding: 5px 4px;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion.aa-cursor {
background-color: #449d44;
color: #FFF;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion em {
font-weight: bold;
font-style: normal;
}
/* Doxy pretty-printing styles. Used with prettify.js. */
pre .str, code .str { color: #fec243; } /* string - eggyolk gold */
pre .kwd, code .kwd { color: #8470FF; } /* keyword - light slate blue */
pre .com, code .com { color: #32cd32; font-style: italic; } /* comment - green */
pre .typ, code .typ { color: #6ecbcc; } /* type - turq green */
pre .lit, code .lit { color: #d06; } /* literal - cherry red */
pre .pun, code .pun { color: #8B8970; } /* punctuation - lemon chiffon4 */
pre .pln, code .pln { color: #f0f0f0; } /* plaintext - white */
pre .tag, code .tag { color: #9c9cff; } /* html/xml tag (bluey) */
pre .htm, code .htm { color: #dda0dd; } /* html tag light purply*/
pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag light purply*/
pre .atn, code .atn { color: #46eeee; font-weight: normal;} /* html/xml attribute name - lt turquoise */
pre .atv, code .atv { color: #EEB4B4; } /* html/xml attribute value - rosy brown2 */
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
a {
text-decoration: none;
}
pre.prettyprint, code.prettyprint {
font-family:'Droid Sans Mono','CPMono_v07 Bold','Droid Sans';
font-weight: bold;
font-size: 11pt;
background-color: #0f0f0f;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-o-border-radius: 8px;
-ms-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
} /* background is black (well, just a tad less dark ) */
pre.prettyprint {
padding: 1em;
white-space: pre-wrap;
}
pre.prettyprint a, code.prettyprint a {
text-decoration:none;
}
/* Specify class=linenums on a pre to get line numbering; line numbers themselves are the same color as punctuation */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #8B8970; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
/* print is mostly unchanged from default at present */
@media print {
pre.prettyprint, code.prettyprint { background-color: #fff; }
pre .str, code .str { color: #088; }
pre .kwd, code .kwd { color: #006; font-weight: bold; }
pre .com, code .com { color: #oc3; font-style: italic; }
pre .typ, code .typ { color: #404; font-weight: bold; }
pre .lit, code .lit { color: #044; }
pre .pun, code .pun { color: #440; }
pre .pln, code .pln { color: #000; }
pre .tag, code .tag { color: #b66ff7; font-weight: bold; }
pre .htm, code .htm { color: #606; font-weight: bold; }
pre .xsl, code .xsl { color: #606; font-weight: bold; }
pre .atn, code .atn { color: #c71585; font-weight: normal; }
pre .atv, code .atv { color: #088; font-weight: normal; }
}

@ -343,18 +343,13 @@ public class LoginPersonModel {
CookieUtil.set(response, "person_id", loginMap.get("person_id").toString(), false, true);
CookieUtil.set(response, "bureau_id", loginMap.get("bureau_id").toString(), false, true);
CookieUtil.set(response, "token", token, false, true);
//添加返回的Token JWT
String jwtToken = JwtUtil.generateToken(Integer.parseInt(loginMap.get("identity_id").toString()), loginMap.get("person_id").toString(), loginMap.get("bureau_id").toString());
resultJson.put("success", true);
resultJson.put("identity_id", loginMap.get("identity_id").toString());
resultJson.put("person_id", loginMap.get("person_id").toString());
resultJson.put("bureau_id", loginMap.get("bureau_id").toString());
resultJson.put("person_name", loginMap.get("person_name").toString());
resultJson.put("jwt", jwtToken);
//将此人员的权限信息写入Pika,如果后面的要求登录互踢,可以用来处理互踢
//处理逻辑就是检查此jwt是不是在Pika中存在存在就是系统派发出去并且是最后一次用户在此平台登录的TOKEN
//如果不存在就表示此token已过期踢出即可。
RedisKit.set("jwt_" + platform + "_" + loginMap.get("person_id").toString(), jwtToken);
//根据人员id,获取所有单位信息
Record r = bm.getBureauInfoByPersonId(loginMap.get("person_id").toString());
if (r != null) resultJson.put("bureau_name", r.getStr("bureau_name"));

@ -6,7 +6,6 @@ import com.dsideal.base.Base.Model.BaseModel;
import com.dsideal.base.Interceptor.*;
import com.dsideal.base.Util.CommonUtil;
import com.dsideal.base.Menu.Model.MenuModel;
import com.dsideal.base.Util.JwtUtil;
import com.dsideal.base.Util.RetKit;
import com.dsideal.base.fay.tree.domain.MenuBean;
import com.dsideal.base.fay.tree.service.IFayTreeNode;
@ -232,28 +231,4 @@ public class MenuController extends Controller {
renderJson(kv);
}
/**
*
*/
@Before({GET.class})
public void getPersonMenu() {
//当前登录的人员是谁?
String token = getRequest().getHeader("Authorization");
if (token == null) {
renderJson(RetKit.renderFail("请先登录!"));
return;
}
Claims claims = JwtUtil.getClaims(token);
String person_id = claims.get("person_id").toString();
//可见菜单
List<Record> recordList = model.selectMenuByPersonId(person_id);
Set<Integer> menuIdSet = new HashSet<>();
for (Record record : recordList) {
menuIdSet.add(record.getInt("menu_id"));
}
//需要根据所有可见菜单,递归处理,生成树形菜单
List<MenuModel.Menu> menuList = model.fetchMenu(1, menuIdSet);
renderJson(RetKit.renderSuccess(JSONUtil.parseArray(menuList)));
}
}

@ -1,73 +0,0 @@
package com.dsideal.base.Util;
import cn.hutool.core.date.DateTime;
import com.dsideal.base.BaseApplication;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class JwtUtil {
public static final String AUTHORIZATION_STARTER = "Bearer ";
public static final String SECRET = BaseApplication.PropKit.get("SECRET");
/**
* JWT
*
* @param identity_id ID
* @param person_id ID
* @param bureau_id ID
* @return JWT
*/
public static String generateToken(int identity_id, String person_id, String bureau_id) {
// 获取当前日期和时间
Date now = new Date();
// 格式化日期
Map<String, Object> claims = new HashMap<>();
claims.put("create_time", now.toString());
claims.put("identity_id", identity_id);
claims.put("person_id", person_id);
claims.put("bureau_id", bureau_id);
return AUTHORIZATION_STARTER + Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS256, SECRET).compact();
}
public static Claims getClaims(String token) {
if (token.contains(AUTHORIZATION_STARTER)) {
token = token.replace(AUTHORIZATION_STARTER, "");
}
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(SECRET)
.parseClaimsJws(token)
.getBody();
} catch (Exception e) {
try {
claims = Jwts.parser()
.setSigningKey(SECRET.getBytes(StandardCharsets.UTF_8))
.parseClaimsJws(token)
.getBody();
} catch (Exception err) {
claims = null;
}
}
return claims;
}
public static void main(String[] args) {
//GwApplication gw = new GwApplication();
String token = generateToken(4, "0b64e31e-a85e-43eb-ba5f-3088d986a8da", "3f7f4c90-645a-4fb9-9902-447846cf1dcc");
/**
1JWTidentity_id,person_idbureau_id
*/
Claims claims = getClaims(token);
System.out.println(claims.get("identity_id"));
System.out.println(claims.get("person_id"));
System.out.println(claims.get("bureau_id"));
}
}
Loading…
Cancel
Save