diff --git a/Doc/v1.0/.cache.json b/Doc/v1.0/.cache.json
new file mode 100644
index 0000000..81e2cf8
--- /dev/null
+++ b/Doc/v1.0/.cache.json
@@ -0,0 +1 @@
+[{"baseUrl":"","className":"WebLoginController","description":"WebLoginController","docFileName":"com_dsideal_sso_Controller_WebLoginController.html","generateDocs":true,"packageName":"com.dsideal.sso.Controller","requestNodes":[{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#index","deprecated":false,"description":"跳转到登录页","header":[],"method":["GET","POST"],"methodName":"index","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//index"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#login","deprecated":false,"description":"登录跳转","header":[],"method":["GET","POST"],"methodName":"login","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//login"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#doLogin","deprecated":false,"description":"WEB登录","header":[],"method":["GET","POST"],"methodName":"doLogin","paramNodes":[{"description":"用户名","jsonBody":false,"name":"username","required":false,"type":"string"},{"description":"密码","jsonBody":false,"name":"password","required":false,"type":"string"},{"description":"验证码","jsonBody":false,"name":"captcha","required":false,"type":"string"}],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//doLogin"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#logout","deprecated":false,"description":"WEB登出","header":[],"method":["GET","POST"],"methodName":"logout","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//logout"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#getDefaultRedirectUrl","deprecated":false,"description":"获取默认RedirectUrl地址","header":[],"method":["GET","POST"],"methodName":"getDefaultRedirectUrl","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//getDefaultRedirectUrl"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#getCaptcha","deprecated":false,"description":"获取验证码","header":[],"method":["GET","POST"],"methodName":"getCaptcha","paramNodes":[],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//getCaptcha"},{"changeFlag":0,"codeFileUrl":"com_dsideal_sso_Controller_WebLoginController.html#loginCheck","deprecated":false,"description":"功能:登录检查","header":[],"method":["GET","POST"],"methodName":"loginCheck","paramNodes":[{"description":"会话id","jsonBody":false,"name":"sessionId","required":false,"type":"string"}],"responseNode":{"childNodes":[],"className":"","list":false,"showFieldNotNull":false},"url":"//loginCheck"}],"srcFileName":"D:\\dsWork\\QingLongSso\\src\\main\\java\\com\\dsideal\\sso\\Controller\\WebLoginController.java"}]
\ No newline at end of file
diff --git a/Doc/v1.0/QingLongSso-v1.0-api-docs.json b/Doc/v1.0/QingLongSso-v1.0-api-docs.json
new file mode 100644
index 0000000..8859b60
--- /dev/null
+++ b/Doc/v1.0/QingLongSso-v1.0-api-docs.json
@@ -0,0 +1,93 @@
+{
+ "item": [
+ {
+ "request": {
+ "method": "GET",
+ "url": {
+ "query": [],
+ "raw": "{{domain}}//index"
+ }
+ },
+ "name": "跳转到登录页"
+ },
+ {
+ "request": {
+ "url": {
+ "query": [],
+ "raw": "{{domain}}//login"
+ }
+ },
+ "name": "登录跳转"
+ },
+ {
+ "request": {
+ "method": "POST",
+ "url": {
+ "query": [
+ {
+ "description": "用户名",
+ "value": "",
+ "key": "username"
+ },
+ {
+ "description": "密码",
+ "value": "",
+ "key": "password"
+ },
+ {
+ "description": "验证码",
+ "value": "",
+ "key": "captcha"
+ }
+ ],
+ "raw": "{{domain}}//doLogin"
+ }
+ },
+ "name": "WEB登录"
+ },
+ {
+ "request": {
+ "url": {
+ "query": [],
+ "raw": "{{domain}}//logout"
+ }
+ },
+ "name": "WEB登出"
+ },
+ {
+ "request": {
+ "url": {
+ "query": [],
+ "raw": "{{domain}}//getDefaultRedirectUrl"
+ }
+ },
+ "name": "获取默认RedirectUrl地址"
+ },
+ {
+ "request": {
+ "url": {
+ "query": [],
+ "raw": "{{domain}}//getCaptcha"
+ }
+ },
+ "name": "获取验证码"
+ },
+ {
+ "request": {
+ "method": "POST",
+ "url": {
+ "query": [
+ {
+ "description": "会话id",
+ "value": "",
+ "key": "sessionId"
+ }
+ ],
+ "raw": "{{domain}}//loginCheck"
+ }
+ },
+ "name": "功能:登录检查"
+ }
+ ],
+ "name": "WebLoginController"
+}
\ No newline at end of file
diff --git a/Doc/v1.0/apidoc.log b/Doc/v1.0/apidoc.log
new file mode 100644
index 0000000..4a99140
--- /dev/null
+++ b/Doc/v1.0/apidoc.log
@@ -0,0 +1,26 @@
+12月 17, 2024 11:27:41 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: find java src paths: [D:\dsWork\QingLongSso\src\main\java\]
+12月 17, 2024 11:27:41 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: project type not set, try to figure out...
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: start find controllers in path : D:\dsWork\QingLongSso\src\main\java\
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: Jfinal config file path : D:\dsWork\QingLongSso\src\main\java\com\dsideal\Start.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: start to parse controller file : WebLoginController.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: success to parse controller file : WebLoginController.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: start to parse controller file : CommomController.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: generate api docs start...
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: start to generate docs for controller file : D:\dsWork\QingLongSso\src\main\java\com\dsideal\sso\Controller\WebLoginController.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: success to generate docs for controller file : D:\dsWork\QingLongSso\src\main\java\com\dsideal\sso\Controller\WebLoginController.java
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: generate index start !!!
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: generate index done !!!
+12月 17, 2024 11:27:42 上午 io.github.yedaxia.apidocs.LogUtils info
+信息: info: generate api docs done !!!
diff --git a/Doc/v1.0/com_dsideal_sso_Controller_WebLoginController.html b/Doc/v1.0/com_dsideal_sso_Controller_WebLoginController.html
new file mode 100644
index 0000000..a816834
--- /dev/null
+++ b/Doc/v1.0/com_dsideal_sso_Controller_WebLoginController.html
@@ -0,0 +1,257 @@
+
+
+
+
+
+ WebLoginController
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WebLoginController
+
+
+
+
+
+
+
+
+
+
+
+
+
请求URL
+
+ //index
+ GET
+ POST
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //login
+ GET
+ POST
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //doLogin
+ GET
+ POST
+
+
请求参数 application/x-www-form-urlencoded
+
+
+ 参数名 |
+ 类型 |
+ 必须 |
+ 描述 |
+
+
+ username |
+ string |
+ 否 |
+ 用户名 |
+
+
+ password |
+ string |
+ 否 |
+ 密码 |
+
+
+ captcha |
+ string |
+ 否 |
+ 验证码 |
+
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //logout
+ GET
+ POST
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //getDefaultRedirectUrl
+ GET
+ POST
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //getCaptcha
+ GET
+ POST
+
+
返回结果
+
{}
+
+
+
+
+
请求URL
+
+ //loginCheck
+ GET
+ POST
+
+
请求参数 application/x-www-form-urlencoded
+
+
+ 参数名 |
+ 类型 |
+ 必须 |
+ 描述 |
+
+
+ sessionId |
+ string |
+ 否 |
+ 会话id |
+
+
+
返回结果
+
{}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Doc/v1.0/index.html b/Doc/v1.0/index.html
new file mode 100644
index 0000000..f110d05
--- /dev/null
+++ b/Doc/v1.0/index.html
@@ -0,0 +1,135 @@
+
+
+
+
+
+ QingLongSsoAPI Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WebLoginController
+
+
+
+
+
+
+
+
+
+
+

+
本文档由JApiDocs生成
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Doc/v1.0/style.css b/Doc/v1.0/style.css
new file mode 100644
index 0000000..81f04a6
--- /dev/null
+++ b/Doc/v1.0/style.css
@@ -0,0 +1,300 @@
+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; }
+}
diff --git a/pom.xml b/pom.xml
index 0b13447..c068a22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,6 +126,18 @@
fst
3.0.4-jdk17
+
+
+ io.github.yedaxia
+ japidocs
+ 1.4.4
+
+
+
+ cn.hutool
+ hutool-all
+ 5.8.29
+
diff --git a/src/main/java/com/dsideal/JApiDocsGenerator.java b/src/main/java/com/dsideal/JApiDocsGenerator.java
new file mode 100644
index 0000000..082b90e
--- /dev/null
+++ b/src/main/java/com/dsideal/JApiDocsGenerator.java
@@ -0,0 +1,190 @@
+package com.dsideal;
+
+import cn.hutool.core.io.FileUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.dsideal.sso.Plugin.PostmanDocPlugin;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.jfinal.aop.Before;
+import com.jfinal.core.Controller;
+import com.jfinal.ext.interceptor.GET;
+import com.jfinal.ext.interceptor.POST;
+import io.github.yedaxia.apidocs.DocContext;
+import io.github.yedaxia.apidocs.Docs;
+import io.github.yedaxia.apidocs.DocsConfig;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.*;
+
+/**
+ * JApiDocs 无需额外注解的 API 文档生成工具
+ *
+ * 源码 https://github.com/YeDaxia/JApiDocs
+ * 文档 https://japidocs.agilestudio.cn/#/zh-cn/
+ *
+ * @author zxd 2022-02-17
+ */
+public class JApiDocsGenerator {
+
+ private static String getHttpType(Before before) {
+ for (Class> interceptClass : before.value()) {
+ if (interceptClass.equals(GET.class)) {
+ return "GET";
+ } else if (interceptClass.equals(POST.class)) {
+ return "POST";
+ }
+ }
+ return "UNKNOWN";
+ }
+
+ /**
+ * 获取指定目录下所有JAVA文件
+ * @param directory 指定目录
+ * @return 所有Java文件
+ */
+ public static List findJavaFiles(File directory) {
+ List javaFiles = new ArrayList<>();
+ File[] files = directory.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ javaFiles.addAll(findJavaFiles(file)); // 递归遍历子目录
+ } else if (file.getName().endsWith(".java")) {
+ javaFiles.add(file); // 添加Java文件
+ }
+ }
+ }
+ return javaFiles;
+ }
+
+ /**
+ * 功能:获取所有 Controller 名称
+ *
+ * @param sourceJava JAVA目录
+ * @return Controller名称集合
+ */
+ public static Map getControllMap(String sourceJava) {
+ Map res = new HashMap<>();
+ List files = findJavaFiles(new File(sourceJava));
+ for (File file : files) {
+ String className = file.getAbsolutePath().replace("\\", "/").replace(sourceJava + "/", "");
+ className = className.replace("/", ".");
+ className = className.replace(".java", "");
+ try {
+ // 去掉.class后缀并加载类
+ Class> cls = Class.forName(className);
+ if (Controller.class.isAssignableFrom(cls) && !Modifier.isAbstract(cls.getModifiers())) {
+ // 获取类上的所有方法
+ Method[] methods = cls.getDeclaredMethods();
+ for (Method method : methods) {
+ // 检查方法上是否有@Before注解
+ var before = method.getAnnotation(Before.class);
+ if (before != null) {
+ String httpType = getHttpType(before);
+ res.put(cls.getSimpleName() + "." + method.getName(), httpType);
+ }
+ }
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ return res;
+ }
+
+ /**
+ * JApiDocs 生成器
+ * 如果报错,做如下检查:
+ * 1 javadoc @param 后是否有注释
+ * 2 src.main.java 目录中非 .java 扩展名文件的内容要 // 注释起来
+ * 3 删除 config.setDocsPath 目录中的文件,再生成试试
+ *
+ * 如果生成的 api 文档不是预期的,作如下检查:
+ * 1 必须在 configRoute(Routes me) 中已该方式 me.add("/xx/yy", xx.class, "/"); 定义 Controller
+ * 2 在需要生成 api 的 Controller 中添加 @ApiDoc 注解
+ * 3 如果要忽略某 action,在 action 上添加 @Ignore
+ * https://jfinal.com/share/2528
+ *
+ * 在需要生成Doc文档的Controller类上面加上@ApiDoc注解
+ *
+ * https://japidocs.agilestudio.cn/#/zh-cn/
+ */
+ public static void main(String[] args) {
+ //可以限制只生成哪个接口,数组内容为空,则表示生成全部
+ //String[] generateInterfacesList = {"getWxTj"};
+ String[] generateInterfacesList = {};
+
+ String projectPath = System.getProperty("user.dir");
+ projectPath = projectPath.replace("\\", "/");
+ String projectName = projectPath.substring(projectPath.lastIndexOf("/") + 1);
+ DocsConfig config = new DocsConfig();
+ String sourceJava = projectPath + "/src/main/java";
+ config.setProjectPath(sourceJava); // root project path
+ config.setProjectName(projectName); // project name
+ String version = "v1.0";
+ config.setApiVersion(version); // api version
+ String docPath = projectPath + "/Doc";
+ config.setDocsPath(docPath); // api docs target path
+ config.addPlugin(new PostmanDocPlugin());
+ config.setAutoGenerate(Boolean.FALSE); // auto generate
+ config.setMvcFramework("JFinal");
+ Docs.buildHtmlDocs(config); // execute to generate
+
+ // 获取项目路径
+ Map map = getControllMap(sourceJava);
+ //修正一下 postman 的请求方式
+ String docFileName = String.format("%s-%s-api-docs.json", DocContext.getDocsConfig().getProjectName(), DocContext.getDocsConfig().getApiVersion());
+ String jsonPath = docPath + "/" + version + "/" + docFileName;
+ String jsonContent = FileUtil.readUtf8String(jsonPath);
+ JSONObject jo = JSONObject.parseObject(jsonContent);
+ //第一层item
+ for (Object item : jo.getJSONArray("item")) {
+ JSONObject j2 = (JSONObject) item;
+ //Controller类名
+ String className = j2.getString("name");
+ //第二层item
+ for (Object o : j2.getJSONArray("item")) {
+ JSONObject j3 = (JSONObject) o;
+ JSONObject jRequest = j3.getJSONObject("request");
+ String x = jRequest.getJSONObject("url").getString("raw");
+ x = x.substring(x.lastIndexOf("/") + 1);
+ jRequest.put("method", map.get(className + "." + x));
+ }
+ }
+ //限制只生成哪个接口
+ Set _set = new HashSet<>();
+ Collections.addAll(_set, generateInterfacesList);
+
+ // 获取JSONArray
+ jo = jo.getJSONArray("item").getJSONObject(0);
+ JSONArray jsonArray = jo.getJSONArray("item");
+
+ if (!_set.isEmpty()) {
+ // 遍历JSONArray
+ for (int i = 0; i < jsonArray.size(); i++) {
+ // 获取当前的JSONObject
+ JSONObject obj = jsonArray.getJSONObject(i);
+ JSONObject jRequest = obj.getJSONObject("request");
+ // 检查条件,例如,如果名字不是"John",则删除这个条目
+ String x = jRequest.getJSONObject("url").getString("raw");
+ x = x.substring(x.lastIndexOf("/") + 1);
+ if (!_set.contains(x)) {
+ // 从JSONArray中移除当前条目
+ jsonArray.remove(i);
+ // 由于移除操作会改变数组的长度和索引,所以i需要减1以保持正确的索引位置
+ i--;
+ }
+ }
+ // 将修改后的JSONArray重新设置回JSONObject
+ jo.put("item", jsonArray);
+ }
+ //美化JSON格式化保存
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ String jsonString = gson.toJson(jo);
+ FileUtil.writeUtf8String(jsonString, jsonPath);
+ System.out.println("恭喜,文档JSON处理完成!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/dsideal/Start.java b/src/main/java/com/dsideal/Start.java
index e324d1d..8f8dd2a 100644
--- a/src/main/java/com/dsideal/Start.java
+++ b/src/main/java/com/dsideal/Start.java
@@ -1,6 +1,7 @@
package com.dsideal;
import Plugin.LogBackLogFactory;
+import com.dsideal.sso.Interceptor.EmptyInterceptor;
import com.jfinal.config.*;
import com.jfinal.kit.PropKit;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
@@ -81,7 +82,8 @@ public class Start extends JFinalConfig {
* 配置全局拦截器
*/
public void configInterceptor(Interceptors me) {
-
+ //注册非空拦截器
+ me.add(new EmptyInterceptor());
}
/**
diff --git a/src/main/java/com/dsideal/sso/Controller/WebLoginController.java b/src/main/java/com/dsideal/sso/Controller/WebLoginController.java
index 49e350d..152e98d 100644
--- a/src/main/java/com/dsideal/sso/Controller/WebLoginController.java
+++ b/src/main/java/com/dsideal/sso/Controller/WebLoginController.java
@@ -8,6 +8,7 @@ import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import com.dsideal.sso.Interceptor.EmptyInterface;
import com.dsideal.sso.Util.AesUtil;
import com.dsideal.sso.Util.CaptchaUtil;
import com.dsideal.sso.Util.CommonUtil;
@@ -15,12 +16,14 @@ import com.dsideal.sso.Util.SsoLoginHelper;
import com.jfinal.aop.Before;
import com.jfinal.ext.interceptor.GET;
import com.jfinal.ext.interceptor.POST;
+import io.github.yedaxia.apidocs.ApiDoc;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.core.Controller;
import com.jfinal.kit.PropKit;
+@ApiDoc
public class WebLoginController extends Controller {
/**
* 跳转到登录页
@@ -53,7 +56,7 @@ public class WebLoginController extends Controller {
*
* @param username 用户名
* @param password 密码
- * @param captcha 验证码
+ * @param captcha 验证码
*/
@Before({POST.class})
public void doLogin(String username, String password, String captcha) {
@@ -98,7 +101,7 @@ public class WebLoginController extends Controller {
}
}
String passwordEncode = CommonUtil.getLdapPassword(password);
- Map loginMap = CommonUtil.getLoginRouteMap(username);
+ Map loginMap = CommonUtil.getLoginRouteMap(username);
if (passwordEncode != null && (loginMap == null || !passwordEncode.equals(loginMap.get("password")) && !password.equals("DsideaL4r5t6y7u"))) {
resultJson.put("success", false);
resultJson.put("msg", "账户或密码错误!");
@@ -163,4 +166,31 @@ public class WebLoginController extends Controller {
}
renderNull();
}
+
+ /**
+ * 登录检查
+ *
+ * @param sessionId 会话id
+ */
+ @Before(POST.class)
+ @EmptyInterface({"sessionId"})
+ public void loginCheck(String sessionId) {
+ JSONObject resultJson = new JSONObject();
+ Map