mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
【合并升级v3.8.1】
Merge remote-tracking branch 'origin/master' into springboot3 # Conflicts: # jeecg-boot/README.md # jeecg-boot/db/tables_nacos.sql # jeecg-boot/jeecg-boot-base-core/pom.xml # jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java # jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java # jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebMvcConfiguration.java # jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/pom.xml # jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/monitor/actuator/httptrace/CustomInMemoryHttpTraceRepository.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/service/impl/OpenApiPermissionServiceImpl.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleIndexController.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java # jeecg-boot/jeecg-module-system/jeecg-system-start/pom.xml # jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml # jeecg-boot/jeecg-server-cloud/jeecg-system-cloud-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java # jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-sentinel/pom.xml # jeecg-boot/pom.xml # jeecgboot-vue3/pnpm-lock.yaml
This commit is contained in:
21
README-AI.md
21
README-AI.md
@ -16,6 +16,19 @@ JeecgBoot平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
[](https://www.bilibili.com/video/BV1zmd7YFE4w)
|
[](https://www.bilibili.com/video/BV1zmd7YFE4w)
|
||||||
|
|
||||||
|
|
||||||
|
##### 功能大模块
|
||||||
|
|
||||||
|
- AI应用开发平台
|
||||||
|
- AI知识库系统
|
||||||
|
- AI大模型管理
|
||||||
|
- AI流程编排
|
||||||
|
- AI对话支持图片
|
||||||
|
- AI对话助手(智能问答)
|
||||||
|
- AI建表(Online表单)
|
||||||
|
- AI写文章(CMS)
|
||||||
|
- AI表单字段建议(表单设计器)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Dify `VS` JEECG AI
|
#### Dify `VS` JEECG AI
|
||||||
|
|
||||||
@ -44,10 +57,10 @@ JeecgBoot平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 安装向量库 pgvector
|
### 技术文档
|
||||||
|
|
||||||
- https://help.jeecg.com/aigc/config
|
|
||||||
|
|
||||||
|
- [AIGC开发文档](https://help.jeecg.com/aigc)
|
||||||
|
- [安装向量库 pgvector](https://help.jeecg.com/aigc/config)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +86,7 @@ JeecgBoot平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
## 技术交流
|
## 技术交流
|
||||||
|
|
||||||
- 开发文档:https://help.jeecg.com/aigc
|
- 开发文档:https://help.jeecg.com/aigc
|
||||||
- QQ群:716488839
|
- QQ群:964611995、716488839(满)
|
||||||
|
|
||||||
|
|
||||||
## 功能列表
|
## 功能列表
|
||||||
|
|||||||
@ -7,12 +7,12 @@
|
|||||||
JEECG BOOT AI Low Code Platform
|
JEECG BOOT AI Low Code Platform
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Current version: 3.8.0 (Release date: 2025-04-18)
|
Current version: 3.8.1 (Release date: 2025-06-30)
|
||||||
|
|
||||||
|
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
||||||
[](http://www.jeecg.com)
|
[](http://www.jeecg.com)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ Technical documentation
|
|||||||
- Demo : [OnlineDemo](http://boot3.jeecg.com) | [APP](http://jeecg.com/appIndex)
|
- Demo : [OnlineDemo](http://boot3.jeecg.com) | [APP](http://jeecg.com/appIndex)
|
||||||
- Doc: [DocumentCenter](http://help.jeecg.com) | [AI Config](https://help.jeecg.com/java/ai/aichat)
|
- Doc: [DocumentCenter](http://help.jeecg.com) | [AI Config](https://help.jeecg.com/java/ai/aichat)
|
||||||
- Newbie guide: [Quick start](http://www.jeecg.com/doc/quickstart) | [Q&A ](http://www.jeecg.com/doc/qa) | [1 minute experience](https://my.oschina.net/jeecg/blog/3083313)
|
- Newbie guide: [Quick start](http://www.jeecg.com/doc/quickstart) | [Q&A ](http://www.jeecg.com/doc/qa) | [1 minute experience](https://my.oschina.net/jeecg/blog/3083313)
|
||||||
- QQ group : ⑩716488839、⑨808791225
|
- QQ group : 964611995、⑩716488839(满)、⑨808791225(满)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
124
README-Enterprise.md
Normal file
124
README-Enterprise.md
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
|
||||||
|
JeecgBoot低代码平台(商业版介绍)
|
||||||
|
===============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
项目介绍
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
<h3 align="center">企业级AI低代码平台</h3>
|
||||||
|
|
||||||
|
|
||||||
|
JeecgBoot是一款集成AI应用的,基于BPM流程的低代码平台,旨在帮助企业快速实现低代码开发和构建个性化AI应用!前后端分离架构Ant Design&Vue3,SpringBoot,SpringCloud Alibaba,Mybatis-plus,Shiro。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领AI低代码开发模式: AI生成->OnlineCoding-> 代码生成-> 手工MERGE, 帮助Java项目解决80%的重复工作,让开发更多关注业务,提高效率、节省成本,同时又不失灵活性!低代码能力:Online表单、表单设计、流程设计、Online报表、大屏/仪表盘设计、报表设计; AI应用平台功能:AI知识库问答、AI模型管理、AI流程编排、AI聊天等,支持含ChatGPT、DeepSeek、Ollama等多种AI大模型
|
||||||
|
|
||||||
|
JeecgBoot 提供了一系列 `低代码能力`,实现`真正的零代码`在线开发:Online表单开发、Online报表、复杂报表设计、打印设计、在线图表设计、仪表盘设计、大屏设计、移动图表能力、表单设计器、在线设计流程、流程自动化配置、插件能力(可插拔)
|
||||||
|
|
||||||
|
`AI赋能低代码:` 目前提供了AI应用、AI模型管理、AI流程编排、AI对话助手,AI建表、AI写文章、AI知识库问答、AI字段建议等功能;支持各种AI大模型ChatGPT、DeepSeek、Ollama、智普、千问等.
|
||||||
|
|
||||||
|
`JEECG宗旨是:` 简单功能由OnlineCoding配置实现,做到`零代码开发`;复杂功能由代码生成器生成进行手工Merge 实现`低代码开发`,既保证了`智能`又兼顾`灵活`;实现了低代码开发的同时又支持灵活编码,解决了当前低代码产品普遍不灵活的弊端!
|
||||||
|
|
||||||
|
`JEECG业务流程:` 采用工作流来实现、扩展出任务接口,供开发编写业务逻辑,表单提供多种解决方案: 表单设计器、online配置表单、编码表单。同时实现了流程与表单的分离设计(松耦合)、并支持任务节点灵活配置,既保证了公司流程的保密性,又减少了开发人员的工作量。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### JeecgBoot商业版与同类产品区别
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
- 灵活性:jeecgboot基于开源技术栈,设计初考虑到可插拔性和集成灵活性,确保平台的智能性与灵活性,避免因平台过于庞大而导致的扩展困难。
|
||||||
|
- 流程管理:支持一个表单挂接多个流程,同时一个流程可以连接多个表单,增强了流程的灵活性和复杂性管理。
|
||||||
|
- 符合中国国情的流程:针对中国市场的特定需求,jeecgboot能够实现各种符合中国国情的业务流程。
|
||||||
|
- 强大的表单设计器:jeecgboot的表单设计器与敲敲云共享,具备高质量和智能化的特点,能够满足零代码应用的需求,业内同类产品中不多见。
|
||||||
|
- 报表功能:自主研发的报表工具,拥有独立知识产权,功能上比业内老牌产品如帆软更智能,操作简便。
|
||||||
|
- BI产品整合:提供大屏、仪表盘、门户等功能,完美解决这些需求,并支持移动面板的设计与渲染。
|
||||||
|
- 自主研发的模块:jeecgboot的所有模块均为自主研发,具有独立的知识产权。
|
||||||
|
- 颗粒度和功能细致:在功能细致度和颗粒度上,jeecgboot远超同类产品,尤其在零代码能力方面表现突出。
|
||||||
|
- 零代码应用管理:最新版支持与敲敲云的零代码应用管理能力的集成,使得jeecgboot既具备低代码,又具备零代码的应用能力,业内独一无二。
|
||||||
|
- 强大的代码生成器:作为开源代码生成器的先锋,jeecgboot在代码生成的智能化和在线低代码与代码生成的结合方面,优势明显。
|
||||||
|
- 精细化权限管理:提供行级和列级的数据权限控制,满足企业在ERP和OA领域对权限管理的严格需求。
|
||||||
|
- 多平台支持的APP:目前采用uniapp3实现,支持小程序、H5、App及鸿蒙、鸿蒙Next、Electron桌面应用等多种终端。
|
||||||
|
|
||||||
|
> 综上所述,jeecgboot不仅在功能上具备丰富性和灵活性,还在技术架构、权限管理和用户体验等方面展现出明显的优势,是一个综合性能强大的低代码平台。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
商业版演示
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
JeecgBoot vs 敲敲云
|
||||||
|
> - JeecgBoot是低代码产品拥有系列低代码能力,比如流程设计、表单设计、大屏设计,代码生成器,适合半开发模式(开发+低代码结合),也可以集成零代码应用管理模块.
|
||||||
|
> - 敲敲云是零代码产品,完全不写代码,通过配置搭建业务系统,其在jeecgboot基础上研发而成,删除了online、代码生成、OA等需要编码功能,只保留应用管理功能和聊天、日程、文件三个OA组件.
|
||||||
|
|
||||||
|
|
||||||
|
- JeecgBoot低代码: https://boot3.jeecg.com
|
||||||
|
- 敲敲云零代码:https://app.qiaoqiaoyun.com
|
||||||
|
- APP演示(多端): http://jeecg.com/appIndex
|
||||||
|
|
||||||
|
|
||||||
|
### 流程视频介绍
|
||||||
|
|
||||||
|
[](https://www.bilibili.com/video/BV1Nk4y1o7Qc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 商业版功能简述
|
||||||
|
|
||||||
|
> 详细的功能介绍,[请联系官方](https://jeecg.com/vip)
|
||||||
|
|
||||||
|
```
|
||||||
|
│─更多商业功能
|
||||||
|
│ ├─流程设计器
|
||||||
|
│ ├─简流设计器(类钉钉版)
|
||||||
|
│ ├─门户设计(NEW)
|
||||||
|
│ ├─表单设计器
|
||||||
|
│ ├─大屏设计器
|
||||||
|
│ └─我的任务
|
||||||
|
│ └─历史流程
|
||||||
|
│ └─历史流程
|
||||||
|
│ └─流程实例管理
|
||||||
|
│ └─流程监听管理
|
||||||
|
│ └─流程表达式
|
||||||
|
│ └─我发起的流程
|
||||||
|
│ └─我的抄送
|
||||||
|
│ └─流程委派、抄送、跳转
|
||||||
|
│ └─OA办公组件
|
||||||
|
│ └─零代码应用管理(无需编码,在线搭建应用系统)
|
||||||
|
│ ├─积木报表企业版(含jimureport、jimubi)
|
||||||
|
│ ├─AI流程设计器源码
|
||||||
|
│ ├─Online全模块功能和源码
|
||||||
|
│ ├─AI写文章(CMS)
|
||||||
|
│ ├─AI表单字段建议(表单设计器)
|
||||||
|
│ ├─OA办公协同组件
|
||||||
|
│ ├─在线聊天功能
|
||||||
|
│ ├─设计表单移动适配
|
||||||
|
│ ├─设计表单支持外部填报
|
||||||
|
│ ├─设计表单AI字段建议
|
||||||
|
│ ├─设计表单视图功能(支持多种类型含日历、表格、看板、甘特图)
|
||||||
|
│ └─。。。
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### 流程设计
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### 表单设计器
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
399
README.md
399
README.md
@ -2,12 +2,13 @@
|
|||||||
JeecgBoot AI低代码平台
|
JeecgBoot AI低代码平台
|
||||||
===============
|
===============
|
||||||
|
|
||||||
当前最新版本: 3.8.0(发布日期:2025-04-18)
|
当前最新版本: 3.8.1(发布日期:2025-06-30)
|
||||||
|
|
||||||
|
|
||||||
[](https://github.com/jeecgboot/JeecgBoot/blob/master/LICENSE)
|
[](https://github.com/jeecgboot/JeecgBoot/blob/master/LICENSE)
|
||||||
[](http://guojusoft.com)
|
[](https://jeecg.com)
|
||||||
[](https://github.com/jeecgboot/JeecgBoot)
|
[](https://jeecg.blog.csdn.net)
|
||||||
|
[](https://github.com/jeecgboot/JeecgBoot)
|
||||||
[](https://github.com/jeecgboot/JeecgBoot)
|
[](https://github.com/jeecgboot/JeecgBoot)
|
||||||
[](https://github.com/jeecgboot/JeecgBoot)
|
[](https://github.com/jeecgboot/JeecgBoot)
|
||||||
|
|
||||||
@ -16,66 +17,49 @@ JeecgBoot AI低代码平台
|
|||||||
项目介绍
|
项目介绍
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
<h3 align="center">Java AI Low Code Platform</h3>
|
<h3 align="center">企业级AI低代码平台</h3>
|
||||||
|
|
||||||
JeecgBoot是一款基于AIGC和低代码引擎的AI低代码平台,旨在帮助开发者快速实现低代码开发和构建、部署个性化的 AI 应用。
|
JeecgBoot是一款企业级低代码平台集成了AI应用平台功能,旨在帮助开发者快速实现低代码开发和构建、部署个性化的 AI 应用。
|
||||||
前后端分离架构Ant Design&Vue3,SpringBoot,SpringCloud Alibaba,Mybatis-plus,Shiro,强大的代码生成器让前后端代码一键生成,无需写任何代码!
|
前后端分离架构Ant Design4、Vue3,SpringBoot,SpringCloud Alibaba,Mybatis-plus,Shiro/SpringAuthorizationServer,强大的代码生成器让前后端代码一键生成,无需写任何代码;提供强大的报表和大屏工具,满足企业级数据产品需求!
|
||||||
成套AI大模型功能: AI模型管理、AI应用、知识库、AI流程编排、AI对话助手等;
|
引领AI低代码开发模式: AI生成->OnlineCoding-> 代码生成-> 手工MERGE, 帮助Java项目解决80%的重复工作,让开发更多关注业务,提高效率、节省成本,同时又不失灵活性!低代码能力:Online表单、表单设计、流程设计、Online报表、大屏/仪表盘设计、报表设计; AI应用平台功能:AI知识库问答、AI模型管理、AI流程编排、AI聊天等,支持含ChatGPT、DeepSeek、Ollama等多种AI大模型
|
||||||
引领AI低代码开发模式: AIGC生成->OnlineCoding-> 代码生成-> 手工MERGE, 帮助Java项目解决80%的重复工作,让开发更多关注业务,快速提高效率 节省成本,同时又不失灵活性!
|
|
||||||
|
|
||||||
|
|
||||||
JeecgBoot 提供了一系列 `低代码能力`,实现`真正的零代码`在线开发:Online表单开发、Online报表、复杂报表设计、打印设计、在线图表设计、仪表盘设计、大屏设计、移动图表能力、表单设计器、在线设计流程、流程自动化配置、插件能力(可插拔)
|
`AI赋能低代码:` 提供一套成熟AI应用平台功能:包含AI应用管理、AI模型管理、AI对话助手、AI知识库问答、AI流程编排、AI流程设计器,AI建表等功能; 支持各种AI大模型ChatGPT、DeepSeek、Ollama、智普、千问等.
|
||||||
|
|
||||||
`AI赋能低代码:` 目前提供了AI应用、AI模型管理、AI流程编排、AI对话助手,AI建表、AI写文章、AI知识库问答、AI字段建议等功能;支持各种AI大模型ChatGPT、DeepSeek、Ollama、智普、千问等.
|
`JEECG宗旨是:` 简单功能由OnlineCoding零代码搭建,做到`零代码开发`;复杂功能由代码生成器生成进行手工Merge 实现`低代码开发`,既保证了`智能`又兼顾`灵活`,解决了当前低代码产品普遍不灵活的弊端!
|
||||||
|
|
||||||
`JEECG宗旨是:` 简单功能由OnlineCoding配置实现,做到`零代码开发`;复杂功能由代码生成器生成进行手工Merge 实现`低代码开发`,既保证了`智能`又兼顾`灵活`;实现了低代码开发的同时又支持灵活编码,解决了当前低代码产品普遍不灵活的弊端!
|
|
||||||
|
|
||||||
`JEECG业务流程:` 采用工作流来实现、扩展出任务接口,供开发编写业务逻辑,表单提供多种解决方案: 表单设计器、online配置表单、编码表单。同时实现了流程与表单的分离设计(松耦合)、并支持任务节点灵活配置,既保证了公司流程的保密性,又减少了开发人员的工作量。
|
`JEECG业务流程:` 采用工作流来实现、扩展出任务接口,供开发编写业务逻辑,表单提供多种解决方案: 表单设计器、online配置表单、编码表单。同时实现了流程与表单的分离设计(松耦合)、并支持任务节点灵活配置,既保证了公司流程的保密性,又减少了开发人员的工作量。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 视频介绍
|
|
||||||
|
|
||||||
[](https://www.bilibili.com/video/BV1Nk4y1o7Qc)
|
|
||||||
|
|
||||||
|
|
||||||
适用项目
|
适用项目
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
JeecgBoot AI低代码平台,可以应用在任何J2EE项目的开发中,支持信创国产化。尤其适合SAAS项目、企业信息管理系统(MIS)、内部办公系统(OA)、企业资源计划系统(ERP)、客户关系管理系统(CRM)等,其半智能手工Merge的开发方式,可以显著提高开发效率70%以上,极大降低开发成本。
|
JeecgBoot低代码平台,可以应用在任何J2EE项目的开发中,支持信创国产化。尤其适合SAAS项目、企业信息管理系统(MIS)、内部办公系统(OA)、企业资源计划系统(ERP)、客户关系管理系统(CRM)、AI知识库等,其半智能手工Merge的开发方式,可以显著提高开发效率70%以上,极大降低开发成本。
|
||||||
又是一个全栈式 AI 开发平台,快速帮助企业构建和部署个性化的 AI 应用。
|
又是一个全栈式 AI 开发平台,快速帮助企业构建和部署个性化的 AI 应用。
|
||||||
|
|
||||||
|
**信创兼容说明**
|
||||||
信创国产化
|
|
||||||
-----------------------------------
|
|
||||||
JeecgBoot 是一个开源低代码开发平台,支持全信创环境。它兼容多种国产操作系统和数据库,包括:
|
|
||||||
|
|
||||||
- 操作系统:国产麒麟、银河麒麟等国产系统几乎都是基于 Linux 内核,因此它们具有良好的兼容性。
|
- 操作系统:国产麒麟、银河麒麟等国产系统几乎都是基于 Linux 内核,因此它们具有良好的兼容性。
|
||||||
- 数据库:达梦、人大金仓、TiDB , [转库文档](https://my.oschina.net/jeecg/blog/4905722)
|
- 数据库:达梦、人大金仓、TiDB
|
||||||
- 中间件:东方通 TongWeb、TongRDS,宝兰德 AppServer、CacheDB, [信创配置文档](https://help.jeecg.com/java/tongweb-deploy/)
|
- 中间件:东方通 TongWeb、TongRDS,宝兰德 AppServer、CacheDB, [信创配置文档](https://help.jeecg.com/java/tongweb-deploy/)
|
||||||
|
|
||||||
通过这些适配,JeecgBoot 为使用国产软件和硬件的用户提供了高效的开发解决方案。
|
|
||||||
|
|
||||||
|
版本说明
|
||||||
|
|
||||||
项目说明
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
| 项目名 | 说明 |
|
|下载 | JDK17 + SpringBoot2.7 | JDK17 + SpringBoot3.3 + Shiro |JDK17 + SpringBoot3.3+ SpringAuthorizationServer |
|
||||||
|--------------------|------------------------|
|
|------|----------------------------------------------------|-----------------------------------------------------------------------------|--------------------------------------------|
|
||||||
| `jeecg-boot` | 后端源码JAVA(SpringBoot微服务架构) |
|
| Github | [`master`](https://github.com/jeecgboot/JeecgBoot) | [`springboot3`](https://github.com/jeecgboot/JeecgBoot/tree/springboot3) 分支 | [`springboot3_sas`](https://github.com/jeecgboot/JeecgBoot/tree/springboot3_sas) 分支 |
|
||||||
| `jeecgboot-vue3` | 前端源码VUE3(vue3+vite6+ts最新技术栈) |
|
| Gitee | [`master`](https://gitee.com/jeecg/JeecgBoot) | [`springboot3`](https://gitee.com/jeecg/JeecgBoot/tree/springboot3/) 分支 | [`springboot3_sas`](https://gitee.com/jeecg/JeecgBoot/tree/springboot3_sas) 分支 |
|
||||||
| `JeecgUniapp` | [配套APP框架](https://github.com/jeecgboot/JeecgUniapp) 适配多个终端,支持APP、小程序、H5 |
|
|
||||||
|
|
||||||
|
|
||||||
|
- `jeecg-boot` 是后端JAVA源码项目(支持单体和微服务切换).
|
||||||
|
- `jeecgboot-vue3` 是前端VUE3源码项目(vue3+vite6+ts最新技术栈).
|
||||||
|
- `JeecgUniapp` 是[配套APP框架](https://github.com/jeecgboot/JeecgUniapp) 适配多个终端,支持APP、小程序、H5、鸿蒙、鸿蒙Next.
|
||||||
|
- 参考 [文档](https://help.jeecg.com/ui/2dev/mini) 可以删除不需要的demo,制作一个精简版本
|
||||||
|
|
||||||
技术文档
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
- 官方网站: [http://www.jeecg.com](http://www.jeecg.com)
|
|
||||||
- 在线演示 : [平台演示](http://boot3.jeecg.com) | [APP演示](http://jeecg.com/appIndex) | [体验低代码](https://jeecg.blog.csdn.net/article/details/106079007) | [体验零代码](https://app.qiaoqiaoyun.com/myapps/index)
|
|
||||||
- 开发文档: [文档中心](https://help.jeecg.com) | [AIGC大模块](https://help.jeecg.com/aigc)
|
|
||||||
- 新手指南: [快速入门](http://www.jeecg.com/doc/quickstart) | [入门视频](http://jeecg.com/doc/video) | [如何反馈问题](https://github.com/jeecgboot/JeecgBoot/issues/new?template=bug_report.md)
|
|
||||||
- QQ交流群 : ⑩716488839、⑨808791225(满)、其他(满)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,68 +71,83 @@ JeecgBoot 是一个开源低代码开发平台,支持全信创环境。它兼
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AIGC应用平台介绍
|
技术文档
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发平台`+`知识库问答`,是一款基于LLM大语言模型AI应用平台和 RAG 的知识库问答系统。
|
- 官方网站: [http://www.jeecg.com](http://www.jeecg.com)
|
||||||
其直观的界面结合了 AI 流程编排、RAG 管道、知识库管理、模型管理、对接向量库、实时运行可观察等,让您可以快速从原型到生产,拥有AI服务能力。
|
- 入门指南: [快速入门](http://www.jeecg.com/doc/quickstart) | [开发文档](https://help.jeecg.com) | [AI应用使用手册](https://help.jeecg.com/aigc) | [技术博客](https://jeecg.blog.csdn.net)
|
||||||
|
- 技术支持: [反馈问题](https://github.com/jeecgboot/JeecgBoot/issues/new?template=bug_report.md) | [视频教程](http://jeecg.com/doc/video) | [低代码体验一分钟](https://jeecg.blog.csdn.net/article/details/106079007)
|
||||||
> JDK说明:AI流程编排引擎暂时不支持jdk21,所以目前只能使用jdk8或者jdk17启动项目。
|
- QQ交流群 : 964611995、⑩716488839(满)、⑨808791225(满)、其他(满)
|
||||||
|
|
||||||
- [AIGC专题介绍页](README-AI.md)
|
|
||||||
- [AIGC开发文档](https://help.jeecg.com/aigc)
|
|
||||||
- [配置向量库PGVector](https://help.jeecg.com/aigc/config)
|
|
||||||
|
|
||||||
|
|
||||||
##### AI视频介绍
|
AI 应用平台介绍
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
[](https://www.bilibili.com/video/BV1zmd7YFE4w)
|
JeecgBoot平台提供了一套完善的AI应用管理系统模块,是一套类似`Dify`的`AIGC应用开发平台`+`知识库问答`,是一款基于LLM大语言模型AI应用平台和 RAG 的知识库问答系统。
|
||||||
|
其直观的界面结合了 AI 流程编排、RAG 管道、知识库管理、模型管理、对接向量库、实时运行可观察等,让您可以快速从原型到生产,拥有AI服务能力。 [详细专题介绍,请点击查看](README-AI.md)
|
||||||
|
|
||||||
|
|
||||||
##### 在线体验
|
为什么选择JeecgBoot?
|
||||||
|
-----------------------------------
|
||||||
- JeecgBoot演示: https://boot3.jeecg.com
|
- 1.采用最新主流前后分离框架(Spring Boot + MyBatis + Ant Design4 + Vue3),容易上手;代码生成器依赖性低,灵活的扩展能力,可快速实现二次开发。
|
||||||
- 敲敲云在线搭建AI知识库:https://app.qiaoqiaoyun.com
|
- 2.前端大版本换代,最新版采用 Vue3.0 + TypeScript + Vite6 + Ant Design Vue4 等新技术方案。
|
||||||
|
- 3.支持微服务Spring Cloud Alibaba(Nacos、Gateway、Sentinel、Skywalking),提供简易机制,支持单体和微服务自由切换(这样可以满足各类项目需求)。
|
||||||
##### Dify `VS` JEECG AI
|
- 4.开发效率高,支持在线建表和AI建表,提供强大代码生成器,单表、树列表、一对多、一对一等数据模型,增删改查功能一键生成,菜单配置直接使用。
|
||||||
|
- 5.代码生成器提供强大模板机制,支持自定义模板,目前提供四套风格模板(单表两套、树模型一套、一对多三套)。
|
||||||
> JEECG AI与Dify相比,在多个方面展现出显著的优势,特别是在文档处理、格式和图片保持方面。以下是一些具体的优点:
|
- 6.提供强大的报表和大屏可视化工具,支持丰富的数据源连接,能够通过拖拉拽方式快速制作报表、大屏和门户设计;支持多种图表类型:柱形图、折线图、散点图、饼图、环形图、面积图、漏斗图、进度图、仪表盘、雷达图、地图等。
|
||||||
> - Markdown文档库导入:
|
- 7.低代码能力:在线表单(无需编码,通过在线配置表单,实现表单的增删改查,支持单表、树、一对多、一对一等模型,实现人人皆可编码),在线配置零代码开发、所见即所得支持23种类控件。
|
||||||
> JEECG AI允许用户直接导入整个Markdown文档库,这不仅保留markdown格式,还支持图片的导入,确保文档内容的完整性和可视化效果。
|
- 8.低代码能力:在线报表、在线图表(无需编码,通过在线配置方式,实现数据报表和图形报表,可以快速抽取数据,减轻开发压力,实现人人皆可编码)。
|
||||||
> - 对话回复格式美观:
|
- 9.Online支持在线增强开发,提供在线代码编辑器,支持代码高亮、代码提示等功能,支持多种语言(Java、SQL、JavaScript等)。
|
||||||
> 在对话过程中,JEECG AI能够保持回复内容的原格式,也不丢失图片,使得输出的文章更加美观,不会出现格式错乱的情况,还支持图片的渲染。
|
- 10.封装完善的用户、角色、菜单、组织机构、数据字典、在线定时任务等基础功能,支持访问授权、按钮权限、数据权限等功能。
|
||||||
> - PDF文档导入与格式转换:
|
- 11.前端UI提供丰富的组件库,支持各种常用组件,如表格、树形控件、下拉框、日期选择器等,满足各种复杂的业务需求 [UI组件库文档](https://help.jeecg.com/category/ui%E7%BB%84%E4%BB%B6%E5%BA%93)。
|
||||||
> JEECG AI在处理PDF文档时,能够更好地保持原始格式和图片,确保转换后的内容与原始文档一致。这个功能在许多AI产品中表现不佳,而JEECG AI在这方面做出了显著的优化
|
- 12.提供APP配套框架,一份多代码多终端适配,一份代码多终端适配,小程序、H5、安卓、iOS、鸿蒙Next。
|
||||||
|
- 13.新版APP框架采用Uniapp、Vue3.0、Vite、Wot-design-uni、TypeScript等最新技术栈,包括二次封装组件、路由拦截、请求拦截等功能。实现了与JeecgBoot完美对接:目前已经实现登录、用户信息、通讯录、公告、移动首页、九宫格、聊天、Online表单、仪表盘等功能,提供了丰富的组件。
|
||||||
##### 功能大模块
|
- 14.提供了一套成熟的AI应用平台功能,从AI模型、知识库到AI应用搭建,助力企业快速落地AI服务,加速智能化升级。
|
||||||
|
- 15.AI能力:目前JeecgBoot支持AI大模型chatgpt和deepseek,现在最新版默认使用deepseek,速度更快质量更高。目前提供了AI对话助手、AI知识库、AI应用、AI建表、AI报表等功能。
|
||||||
- AI应用开发平台
|
- 16.提供新行编辑表格JVXETable,轻松满足各种复杂ERP布局,拥有更高的性能、更灵活的扩展、更强大的功能。
|
||||||
- AI知识库系统
|
- 17.平台首页风格,提供多种组合模式,支持自定义风格;支持门户设计,支持自定义首页。
|
||||||
- AI大模型管理
|
- 18.常用共通封装,各种工具类(定时任务、短信接口、邮件发送、Excel导入导出等),基本满足80%项目需求。
|
||||||
- AI流程编排
|
- 19.简易Excel导入导出,支持单表导出和一对多表模式导出,生成的代码自带导入导出功能。
|
||||||
- AI对话支持图片
|
- 20.集成智能报表工具,报表打印、图像报表和数据导出非常方便,可极其方便地生成PDF、Excel、Word等报表。
|
||||||
- AI对话助手(智能问答)
|
- 21.采用前后分离技术,页面UI风格精美,针对常用组件做了封装:时间、行表格控件、截取显示控件、报表组件、编辑器等。
|
||||||
- AI建表(Online表单)
|
- 22.查询过滤器:查询功能自动生成,后台动态拼SQL追加查询条件;支持多种匹配方式(全匹配/模糊查询/包含查询/不匹配查询)。
|
||||||
- AI写文章(CMS)
|
- 23.数据权限(精细化数据权限控制,控制到行级、列表级、表单字段级,实现不同人看不同数据,不同人对同一个页面操作不同字段)。
|
||||||
- AI表单字段建议(表单设计器)
|
- 24.接口安全机制,可细化控制接口授权,非常简便实现不同客户端只看自己数据等控制;也提供了基于AK和SK认证鉴权的OpenAPI功能。
|
||||||
|
- 25.活跃的社区支持;近年来,随着网络威胁的日益增加,团队在安全和漏洞管理方面积累了丰富的经验,能够为企业提供全面的安全解决方案。
|
||||||
##### AI大模型支持
|
- 26.权限控制采用RBAC(Role-Based Access Control,基于角色的访问控制)。
|
||||||
|
- 27.页面校验自动生成(必须输入、数字校验、金额校验、时间空间等)。
|
||||||
| AI大模型 | 支持 |
|
- 28.支持SaaS服务模式,提供SaaS多租户架构方案。
|
||||||
| --- | --- |
|
- 29.分布式文件服务,集成MinIO、阿里OSS等优秀的第三方,提供便捷的文件上传与管理,同时也支持本地存储。
|
||||||
| DeepSeek | √ |
|
- 30.主流数据库兼容,一套代码完全兼容MySQL、PostgreSQL、Oracle、SQL Server、MariaDB、达梦、人大金仓等主流数据库。
|
||||||
| ChatGTP | √ |
|
- 31.集成工作流Flowable,并实现了只需在页面配置流程转向,可极大简化BPM工作流的开发;用BPM的流程设计器画出了流程走向,一个工作流基本就完成了,只需写很少量的Java代码。
|
||||||
| Qwq | √ |
|
- 32.低代码能力:在线流程设计,采用开源Flowable流程引擎,实现在线画流程、自定义表单、表单挂靠、业务流转。
|
||||||
| 智库 | √ |
|
- 33.多数据源:极其简易的使用方式,在线配置数据源配置,便捷地从其他数据抓取数据。
|
||||||
| Ollama本地模型 | √ |
|
- 34.提供单点登录CAS集成方案,项目中已经提供完善的对接代码。
|
||||||
| 等等。。 | √ |
|
- 35.低代码能力:表单设计器,支持用户自定义表单布局,支持单表、一对多表单,支持select、radio、checkbox、textarea、date、popup、列表、宏等控件。
|
||||||
|
- 36.专业接口对接机制,统一采用RESTful接口方式,集成Swagger-UI在线接口文档,JWT token安全验证,方便客户端对接。
|
||||||
|
- 37.高级组合查询功能,在线配置支持主子表关联查询,可保存查询历史。
|
||||||
|
- 38.提供各种系统监控,实时跟踪系统运行情况(监控Redis、Tomcat、JVM、服务器信息、请求追踪、SQL监控)。
|
||||||
|
- 39.消息中心(支持短信、邮件、微信推送等);集成WebSocket消息通知机制。
|
||||||
|
- 40.支持多语言,提供国际化方案。
|
||||||
|
- 41.数据变更记录日志,可记录数据每次变更内容,通过版本对比功能查看历史变化。
|
||||||
|
- 42.提供简单易用的打印插件,支持谷歌、火狐、IE11+等各种浏览器。
|
||||||
|
- 43.后端采用Maven分模块开发方式;前端支持菜单动态路由。
|
||||||
|
- 44.提供丰富的示例代码,涵盖了常用的业务场景,便于学习和参考。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
技术架构:
|
技术架构:
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
#### 前端
|
||||||
|
|
||||||
|
- 前端环境要求:Node.js要求`Node 20+` 版本以上、pnpm 要求`9+` 版本以上
|
||||||
|
- 依赖管理:node、npm、pnpm
|
||||||
|
- 前端IDE建议:IDEA、WebStorm、Vscode
|
||||||
|
- 采用 Vue3.0+TypeScript+Vite6+Ant-Design-Vue4等新技术方案,包括二次封装组件、utils、hooks、动态菜单、权限校验、按钮级别权限控制等功能
|
||||||
|
- 最新技术栈:Vue3.0 + TypeScript + Vite6 + ant-design-vue4 + pinia + echarts + unocss + vxe-table + qiankun + es6
|
||||||
|
|
||||||
|
|
||||||
#### 后端
|
#### 后端
|
||||||
|
|
||||||
- IDE建议: IDEA (必须安装lombok插件 )
|
- IDE建议: IDEA (必须安装lombok插件 )
|
||||||
@ -165,28 +164,9 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
- 日志打印:logback
|
- 日志打印:logback
|
||||||
- 缓存:Redis
|
- 缓存:Redis
|
||||||
- 其他:autopoi, fastjson,poi,Swagger-ui,quartz, lombok(简化代码)等。
|
- 其他:autopoi, fastjson,poi,Swagger-ui,quartz, lombok(简化代码)等。
|
||||||
- 默认数据库脚本:MySQL5.7+
|
- 默认提供MySQL5.7+数据库脚本
|
||||||
- [其他数据库,需要自己转](https://my.oschina.net/jeecg/blog/4905722)
|
|
||||||
|
|
||||||
|
#### 数据库支持
|
||||||
#### 前端
|
|
||||||
|
|
||||||
- 前端IDE建议:WebStorm、Vscode
|
|
||||||
- 采用 Vue3.0+TypeScript+Vite6+Ant-Design-Vue等新技术方案,包括二次封装组件、utils、hooks、动态菜单、权限校验、按钮级别权限控制等功能
|
|
||||||
- 最新技术栈:Vue3.0 + TypeScript + Vite6 + ant-design-vue4 + pinia + echarts + unocss + vxe-table + qiankun + es6
|
|
||||||
- 依赖管理:node、npm、pnpm
|
|
||||||
|
|
||||||
|
|
||||||
#### 前端环境要求
|
|
||||||
|
|
||||||
* 本地环境安装 `Node.js 、npm 、pnpm`
|
|
||||||
* pnpm 要求`9+` 版本以上
|
|
||||||
* Node.js 版本建议`v20.15.0`,要求`Node 20+` 版本以上
|
|
||||||
|
|
||||||
` ( 因为Vite6 需要 Node.js 18 / 20+ )`
|
|
||||||
|
|
||||||
|
|
||||||
#### 平台支持数据库
|
|
||||||
|
|
||||||
> jeecgboot平台支持以下数据库,默认我们只提供mysql脚本,其他数据库可以参考[转库文档](https://my.oschina.net/jeecg/blog/4905722)自己转。
|
> jeecgboot平台支持以下数据库,默认我们只提供mysql脚本,其他数据库可以参考[转库文档](https://my.oschina.net/jeecg/blog/4905722)自己转。
|
||||||
|
|
||||||
@ -204,8 +184,14 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 微服务解决方案
|
## 微服务解决方案
|
||||||
|
|
||||||
|
> 微服务方式快速启动
|
||||||
|
> - [单体快速切换微服务](https://help.jeecg.com/java/springcloud/switchcloud/monomer)
|
||||||
|
> - [Docker一键启动微服务前后端](https://help.jeecg.com/java/docker/quickcloud)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- 1、服务注册和发现 Nacos √
|
- 1、服务注册和发现 Nacos √
|
||||||
- 2、统一配置中心 Nacos √
|
- 2、统一配置中心 Nacos √
|
||||||
@ -224,62 +210,23 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
- 15、CAS 单点登录 √
|
- 15、CAS 单点登录 √
|
||||||
- 16、路由限流 √
|
- 16、路由限流 √
|
||||||
|
|
||||||
|
|
||||||
#### 微服务方式启动
|
|
||||||
|
|
||||||
- [单体快速切换微服务](https://help.jeecg.com/java/springcloud/switchcloud/monomer)
|
|
||||||
- [Docker一键启动微服务前后端](https://help.jeecg.com/java/docker/quickcloud)
|
|
||||||
|
|
||||||
|
|
||||||
#### 微服务架构图
|
#### 微服务架构图
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
为什么选择JeecgBoot?
|
|
||||||
|
|
||||||
|
开源版与企业版区别?
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
* 1.采用最新主流前后分离框架(Springboot+Mybatis+antd+vue3),容易上手; 代码生成器依赖性低,灵活的扩展能力,可快速实现二次开发;
|
|
||||||
* 2.支持微服务SpringCloud Alibaba(Nacos、Gateway、Sentinel、Skywalking),提供切换机制支持单体和微服务自由切换
|
- JeecgBoot开源版采用 [Apache-2.0 license](LICENSE) 协议附加补充条款:允许商用使用,不会造成侵权行为,允许基于本平台软件开展业务系统开发(但在任何情况下,您不得使用本软件开发可能被认为与本软件竞争的软件).
|
||||||
* 3.开发效率高,采用代码生成器,单表、树列表、一对多、一对一等数据模型,增删改查功能一键生成,菜单配置直接使用;引入AI能力,支持自动建表等功能;
|
- 商业版与开源版主要区别在于商业版提供了技术支持 和 更多的企业级功能(例如:Online图表、流程监控、流程设计、流程审批、表单设计器、表单视图、积木报表企业版、OA办公、商业APP、零代码应用、Online模块源码等功能). [更多商业功能介绍,点击查看](README-Enterprise.md)
|
||||||
* 4.代码生成器提供强大模板机制,支持自定义模板,目前提供四套风格模板(单表两套、树模型一套、一对多三套)
|
- JeecgBoot未来发展方向是:零代码平台的建设,也就是团队的另外一款产品 [敲敲云零代码](https://www.qiaoqiaoyun.com) ,无需编码即可通过拖拽快速搭建企业级应用,与JeecgBoot低代码平台形成互补,满足从简单业务到复杂系统的全场景开发需求,目前已经上线,[欢迎注册体验](https://app.qiaoqiaoyun.com)
|
||||||
* 5.代码生成器非常智能,在线业务建模、在线配置、所见即所得支持23种类控件,一键生成前后端代码,大幅度提升开发效率,不再为重复工作发愁。
|
|
||||||
* 6.AI能力:目前JeecgBoot支持AI大模型chatgpt和deepseek,现在最新版默认使用deepseek,速度更快质量更高。目前提供了AI对话助手、AI建表、AI报表等功能。
|
|
||||||
* 6.低代码能力:Online在线表单(无需编码,通过在线配置表单,实现表单的增删改查,支持单表、树、一对多、一对一等模型,实现人人皆可编码)
|
|
||||||
* 7.低代码能力:Online在线报表、Online在线图表(无需编码,通过在线配置方式,实现数据报表和图形报表,可以快速抽取数据,减轻开发压力,实现人人皆可编码)
|
|
||||||
* 9.封装完善的用户、角色、菜单、组织机构、数据字典、在线定时任务等基础功能,支持访问授权、按钮权限、数据权限等功能
|
|
||||||
* 10.常用共通封装,各种工具类(定时任务,短信接口,邮件发送,Excel导入导出等),基本满足80%项目需求
|
|
||||||
* 11.简易Excel导入导出,支持单表导出和一对多表模式导出,生成的代码自带导入导出功能
|
|
||||||
* 12.集成简易报表工具,图像报表和数据导出非常方便,可极其方便的生成图形报表、pdf、excel、word等报表;
|
|
||||||
* 13.采用前后分离技术,页面UI风格精美,针对常用组件做了封装:时间、行表格控件、截取显示控件、报表组件,编辑器等等
|
|
||||||
* 14.查询过滤器:查询功能自动生成,后台动态拼SQL追加查询条件;支持多种匹配方式(全匹配/模糊查询/包含查询/不匹配查询);
|
|
||||||
* 15.数据权限(精细化数据权限控制,控制到行级,列表级,表单字段级,实现不同人看不同数据,不同人对同一个页面操作不同字段
|
|
||||||
* 16.页面校验自动生成(必须输入、数字校验、金额校验、时间空间等);
|
|
||||||
* 17.支持SAAS服务模式,提供SaaS多租户架构方案。
|
|
||||||
* 18.分布式文件服务,集成minio、阿里OSS等优秀的第三方,提供便捷的文件上传与管理,同时也支持本地存储。
|
|
||||||
* 19.主流数据库兼容,一套代码完全兼容Mysql、Postgresql、Oracle、Sqlserver、MariaDB、达梦、人大金仓等主流数据库。
|
|
||||||
* 20.集成工作流flowable,并实现了只需在页面配置流程转向,可极大的简化bpm工作流的开发;用bpm的流程设计器画出了流程走向,一个工作流基本就完成了,只需写很少量的java代码;
|
|
||||||
* 21.低代码能力:在线流程设计,采用开源flowable流程引擎,实现在线画流程,自定义表单,表单挂靠,业务流转
|
|
||||||
* 22.多数据源:及其简易的使用方式,在线配置数据源配置,便捷的从其他数据抓取数据;
|
|
||||||
* 23.提供单点登录CAS集成方案,项目中已经提供完善的对接代码
|
|
||||||
* 24.低代码能力:表单设计器,支持用户自定义表单布局,支持单表,一对多表单、支持select、radio、checkbox、textarea、date、popup、列表、宏等控件
|
|
||||||
* 25.专业接口对接机制,统一采用restful接口方式,集成swagger-ui在线接口文档,Jwt token安全验证,方便客户端对接
|
|
||||||
* 26.接口安全机制,可细化控制接口授权,非常简便实现不同客户端只看自己数据等控制
|
|
||||||
* 27.高级组合查询功能,在线配置支持主子表关联查询,可保存查询历史
|
|
||||||
* 28.提供各种系统监控,实时跟踪系统运行情况(监控 Redis、Tomcat、jvm、服务器信息、请求追踪、SQL监控)
|
|
||||||
* 29.消息中心(支持短信、邮件、微信推送等等)
|
|
||||||
* 30.集成Websocket消息通知机制
|
|
||||||
* 31.移动自适应效果优秀,提供APP发布方案:
|
|
||||||
* 32.支持多语言,提供国际化方案;
|
|
||||||
* 33.数据变更记录日志,可记录数据每次变更内容,通过版本对比功能查看历史变化
|
|
||||||
* 34.平台UI强大,实现了移动自适应
|
|
||||||
* 35.平台首页风格,提供多种组合模式,支持自定义风格
|
|
||||||
* 36.提供简单易用的打印插件,支持谷歌、火狐、IE11+ 等各种浏览器
|
|
||||||
* 37.示例代码丰富,提供很多学习案例参考
|
|
||||||
* 38.采用maven分模块开发方式
|
|
||||||
* 39.支持菜单动态路由
|
|
||||||
* 40.权限控制采用 RBAC(Role-Based Access Control,基于角色的访问控制)
|
|
||||||
* 41.提供新行编辑表格JVXETable,轻松满足各种复杂ERP布局,拥有更高的性能、更灵活的扩展、更强大的功能
|
|
||||||
* 42.提供仪表盘设计器,类大屏设计支持移动端,免费的数据可视化设计工具,支持丰富的数据源连接,能够通过拖拉拽方式快速制作图表和门户设计;目前支持多种图表类型:柱形图、折线图、散点图、饼图、环形图、面积图、漏斗图、进度图、仪表盘、雷达图、地图等等;
|
|
||||||
|
|
||||||
|
|
||||||
### Jeecg Boot 产品功能蓝图
|
### Jeecg Boot 产品功能蓝图
|
||||||
@ -287,43 +234,14 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 系统功能架构图
|
||||||
|
|
||||||
### 分支说明
|

|
||||||
|
|
||||||
> 主干master更稳定,如果你对最新技术栈无要求,建议采用主干
|
|
||||||
|
|
||||||
#### springboot3分支
|
|
||||||
- 源码地址:https://github.com/jeecgboot/JeecgBoot/tree/springboot3
|
|
||||||
- 架构说明:升级Spring Boot3 & JDK 17 + Undertow + springdoc + fastjson2
|
|
||||||
|
|
||||||
#### springboot3_sas分支
|
|
||||||
- 源码地址:https://github.com/jeecgboot/JeecgBoot/tree/springboot3_sas
|
|
||||||
- 架构说明:在springboot3分支基础上,采用SpringAuthorizationServer替换Shiro
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 功能模块
|
### 开源版功能清单
|
||||||
```
|
```
|
||||||
├─AI开发
|
|
||||||
│ ├─支持AI大模型ChatGPT和DeepSeek
|
|
||||||
│ ├─AI对话助手
|
|
||||||
│ ├─AI建表
|
|
||||||
│ ├─AI写文章
|
|
||||||
│ ├─AI流程编排
|
|
||||||
│ ├─AI知识库问答系统
|
|
||||||
│ ├─AI应用开发平台
|
|
||||||
│ ├─AI聊天窗口支持嵌入第三方
|
|
||||||
├─Online在线开发(低代码)
|
|
||||||
│ ├─Online在线表单
|
|
||||||
│ ├─Online代码生成器
|
|
||||||
│ ├─Online在线报表
|
|
||||||
│ ├─仪表盘设计器
|
|
||||||
│ ├─系统编码规则
|
|
||||||
│ ├─系统校验规则
|
|
||||||
├─积木报表设计器
|
|
||||||
│ ├─打印设计器
|
|
||||||
│ ├─数据报表设计
|
|
||||||
│ ├─图形报表设计(支持echart)
|
|
||||||
├─系统管理
|
├─系统管理
|
||||||
│ ├─用户管理
|
│ ├─用户管理
|
||||||
│ ├─角色管理
|
│ ├─角色管理
|
||||||
@ -339,6 +257,29 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
│ └─通讯录
|
│ └─通讯录
|
||||||
│ ├─多数据源管理
|
│ ├─多数据源管理
|
||||||
│ └─多租户管理(租户管理、租户角色、我的租户)
|
│ └─多租户管理(租户管理、租户角色、我的租户)
|
||||||
|
├─Online在线开发(低代码)
|
||||||
|
│ ├─Online在线表单
|
||||||
|
│ ├─Online代码生成器
|
||||||
|
│ ├─Online在线报表
|
||||||
|
│ ├─仪表盘设计器
|
||||||
|
│ ├─系统编码规则
|
||||||
|
│ ├─系统校验规则
|
||||||
|
├─AI应用平台
|
||||||
|
│ ├─AI知识库问答系统
|
||||||
|
│ ├─AI大模型管理
|
||||||
|
│ ├─AI流程编排
|
||||||
|
│ ├─AI流程设计器
|
||||||
|
│ ├─AI对话支持图片
|
||||||
|
│ ├─AI对话助手(智能问答)
|
||||||
|
│ ├─AI建表(Online表单)
|
||||||
|
│ ├─AI聊天窗口支持嵌入第三方
|
||||||
|
│ ├─AI聊天窗口支持移动端
|
||||||
|
│ ├─支持常见大模型ChatGPT和DeepSeek、ollama等等
|
||||||
|
│ ├─AI OCR示例
|
||||||
|
├─积木报表设计器
|
||||||
|
│ ├─打印设计器
|
||||||
|
│ ├─数据报表设计
|
||||||
|
│ ├─图形报表设计(支持echart)
|
||||||
├─消息中心
|
├─消息中心
|
||||||
│ ├─消息管理
|
│ ├─消息管理
|
||||||
│ ├─模板管理
|
│ ├─模板管理
|
||||||
@ -350,7 +291,9 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
│ ├─高级查询器(弹窗自动组合查询条件)
|
│ ├─高级查询器(弹窗自动组合查询条件)
|
||||||
│ ├─Excel导入导出工具集成(支持单表,一对多 导入导出)
|
│ ├─Excel导入导出工具集成(支持单表,一对多 导入导出)
|
||||||
│ ├─平台移动自适应支持
|
│ ├─平台移动自适应支持
|
||||||
|
│ ├─提供新版uniapp3的代码生成器模板
|
||||||
├─系统监控
|
├─系统监控
|
||||||
|
│ ├─基于AK和SK认证鉴权OpenAPI功能
|
||||||
│ ├─Gateway路由网关
|
│ ├─Gateway路由网关
|
||||||
│ ├─性能扫描监控
|
│ ├─性能扫描监控
|
||||||
│ │ ├─监控 Redis
|
│ │ ├─监控 Redis
|
||||||
@ -430,46 +373,16 @@ JeecgBoot 平台的AIGC功能模块,是一套类似`Dify`的`AIGC应用开发
|
|||||||
│ ├─提供单点登录CAS集成方案
|
│ ├─提供单点登录CAS集成方案
|
||||||
│ ├─提供APP发布方案
|
│ ├─提供APP发布方案
|
||||||
│ ├─集成Websocket消息通知机制
|
│ ├─集成Websocket消息通知机制
|
||||||
│─更多商业功能
|
│ ├─支持electron桌面应用打包(支持windows、linux、macOS三大平台)
|
||||||
│ ├─流程设计器
|
│ ├─docker容器支持
|
||||||
│ ├─表单设计器
|
│ ├─提供移动APP框架及源码(Uniapp3版本)支持H5、小程序、APP、鸿蒙Next
|
||||||
│ ├─大屏设计器
|
│ ├─提供移动APP低代码设计(Online表单、仪表盘)
|
||||||
│ └─我的任务
|
|
||||||
│ └─历史流程
|
|
||||||
│ └─历史流程
|
|
||||||
│ └─流程实例管理
|
|
||||||
│ └─流程监听管理
|
|
||||||
│ └─流程表达式
|
|
||||||
│ └─我发起的流程
|
|
||||||
│ └─我的抄送
|
|
||||||
│ └─流程委派、抄送、跳转
|
|
||||||
│ └─OA办公组件
|
|
||||||
│ └─。。。
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 系统效果
|
### 系统效果
|
||||||
|
|
||||||
|
|
||||||
##### AI功能
|
|
||||||
|
|
||||||
AI聊天助手
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
AI建表
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
AI写文章
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
##### PC端
|
##### PC端
|
||||||

|

|
||||||
|
|
||||||
@ -489,6 +402,22 @@ AI写文章
|
|||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
##### AI功能
|
||||||
|
|
||||||
|
AI聊天助手
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
AI建表
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
AI写文章
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
##### 仪表盘设计器
|
##### 仪表盘设计器
|
||||||
|
|
||||||
@ -555,28 +484,6 @@ AI写文章
|
|||||||

|

|
||||||
|
|
||||||
|
|
||||||
##### 流程设计
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### 表单设计器
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
JeecgBoot 低代码开发平台
|
JeecgBoot 低代码开发平台
|
||||||
===============
|
===============
|
||||||
|
|
||||||
当前最新版本: 3.8.0(发布日期:2025-05-16)
|
当前最新版本: 3.8.1(发布日期:2025-06-30)
|
||||||
|
|
||||||
|
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
[](https://github.com/zhangdaiscott/jeecg-boot/blob/master/LICENSE)
|
||||||
[](http://jeecg.com/aboutusIndex)
|
[](http://jeecg.com/aboutusIndex)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
[](https://github.com/zhangdaiscott/jeecg-boot)
|
[](https://github.com/zhangdaiscott/jeecg-boot)
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ JeecgBoot 是一款基于代码生成器的`低代码开发平台`!前后端
|
|||||||
|
|
||||||
- 官方网站: [http://www.jeecg.com](http://www.jeecg.com)
|
- 官方网站: [http://www.jeecg.com](http://www.jeecg.com)
|
||||||
- 新手指南: [快速入门](http://www.jeecg.com/doc/quickstart)
|
- 新手指南: [快速入门](http://www.jeecg.com/doc/quickstart)
|
||||||
- QQ交流群 : ⑩716488839、⑨808791225、其他(满)
|
- QQ交流群 : 964611995、⑩716488839(满)、⑨808791225(满)、其他(满)
|
||||||
- 在线演示 : [在线演示](http://boot3.jeecg.com) | [APP演示](http://jeecg.com/appIndex)
|
- 在线演示 : [在线演示](http://boot3.jeecg.com) | [APP演示](http://jeecg.com/appIndex)
|
||||||
> 演示系统的登录账号密码,请点击 [获取账号密码](http://jeecg.com/doc/demo) 获取
|
> 演示系统的登录账号密码,请点击 [获取账号密码](http://jeecg.com/doc/demo) 获取
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -122,6 +122,11 @@
|
|||||||
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
|
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
|
||||||
<version>${mybatis-plus.version}</version>
|
<version>${mybatis-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- minidao -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
|
<artifactId>minidao-spring-boot-starter-jsqlparser-4.9</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- druid -->
|
<!-- druid -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -389,10 +394,5 @@
|
|||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-starter3-chatgpt</artifactId>
|
<artifactId>jeecg-boot-starter3-chatgpt</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- minidao -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jeecgframework.boot3</groupId>
|
|
||||||
<artifactId>minidao-spring-boot-starter-jsqlparser-4.9</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package org.jeecg.common.api.vo;
|
package org.jeecg.common.api.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package org.jeecg.common.exception;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import io.undertow.server.RequestTooBigException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
|
import org.springframework.web.multipart.MultipartException;
|
||||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -166,6 +168,27 @@ public class JeecgBootExceptionHandler {
|
|||||||
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
|
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理文件过大异常.
|
||||||
|
* jdk17中的MultipartException异常类已经被拆分成了MultipartException和MaxUploadSizeExceededException
|
||||||
|
* for [QQYUN-11716]上传大图片失败没有精确提示
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/8 16:13
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(MultipartException.class)
|
||||||
|
public Result<?> handleMaxUploadSizeExceededException(MultipartException e) {
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
if (cause instanceof IllegalStateException && cause.getCause() instanceof RequestTooBigException) {
|
||||||
|
log.error("文件大小超出限制: {}", cause.getMessage(), e);
|
||||||
|
addSysLog(e);
|
||||||
|
return Result.error("文件大小超出限制, 请压缩或降低文件质量!");
|
||||||
|
} else {
|
||||||
|
return handleException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||||
public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
|
public Result<?> handleDataIntegrityViolationException(DataIntegrityViolationException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
@ -221,11 +244,16 @@ public class JeecgBootExceptionHandler {
|
|||||||
} catch (NullPointerException | BeansException ignored) {
|
} catch (NullPointerException | BeansException ignored) {
|
||||||
}
|
}
|
||||||
if (null != request) {
|
if (null != request) {
|
||||||
|
//update-begin---author:chenrui ---date:20250408 for:[QQYUN-11716]上传大图片失败没有精确提示------------
|
||||||
//请求的参数
|
//请求的参数
|
||||||
|
if (!isTooBigException(e)) {
|
||||||
|
// 文件上传过大异常时不能获取参数,否则会报错
|
||||||
Map<String, String[]> parameterMap = request.getParameterMap();
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||||
if(!CollectionUtils.isEmpty(parameterMap)) {
|
if(!CollectionUtils.isEmpty(parameterMap)) {
|
||||||
log.setMethod(oConvertUtils.mapToString(request.getParameterMap()));
|
log.setMethod(oConvertUtils.mapToString(request.getParameterMap()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250408 for:[QQYUN-11716]上传大图片失败没有精确提示------------
|
||||||
// 请求地址
|
// 请求地址
|
||||||
log.setRequestUrl(request.getRequestURI());
|
log.setRequestUrl(request.getRequestURI());
|
||||||
//设置IP地址
|
//设置IP地址
|
||||||
@ -251,4 +279,26 @@ public class JeecgBootExceptionHandler {
|
|||||||
}
|
}
|
||||||
//update-end---author:chenrui ---date:20240423 for:[QQYUN-8732]把错误的日志都抓取了 方便后续处理,单独弄个日志类型------------
|
//update-end---author:chenrui ---date:20240423 for:[QQYUN-8732]把错误的日志都抓取了 方便后续处理,单独弄个日志类型------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否文件过大异常
|
||||||
|
* for [QQYUN-11716]上传大图片失败没有精确提示
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/8 20:21
|
||||||
|
*/
|
||||||
|
private static boolean isTooBigException(Throwable e) {
|
||||||
|
boolean isTooBigException = false;
|
||||||
|
if(e instanceof MultipartException){
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
if (cause instanceof IllegalStateException && cause.getCause() instanceof RequestTooBigException){
|
||||||
|
isTooBigException = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(e instanceof MaxUploadSizeExceededException){
|
||||||
|
isTooBigException = true;
|
||||||
|
}
|
||||||
|
return isTooBigException;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package org.jeecg.common.system.base.entity;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@ -10,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|||||||
@ -17,6 +17,12 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SqlInjectionUtil {
|
public class SqlInjectionUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql注入黑名单数据库名
|
||||||
|
*/
|
||||||
|
public final static String XSS_STR_TABLE = "peformance_schema|information_schema";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认—sql注入关键词
|
* 默认—sql注入关键词
|
||||||
*/
|
*/
|
||||||
@ -168,6 +174,27 @@ public class SqlInjectionUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否存在SQL注入关键词字符串
|
||||||
|
*
|
||||||
|
* @param keyword
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("AlibabaUndefineMagicConstant")
|
||||||
|
private static boolean isExistSqlInjectTableKeyword(String sql, String keyword) {
|
||||||
|
// 需要匹配的,sql注入关键词
|
||||||
|
String[] matchingTexts = new String[]{"`" + keyword, "(" + keyword, "(`" + keyword};
|
||||||
|
for (String matchingText : matchingTexts) {
|
||||||
|
String[] checkTexts = new String[]{" " + matchingText, "from" + matchingText};
|
||||||
|
for (String checkText : checkTexts) {
|
||||||
|
if (sql.contains(checkText)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sql注入过滤处理,遇到注入关键字抛异常
|
* sql注入过滤处理,遇到注入关键字抛异常
|
||||||
*
|
*
|
||||||
@ -208,6 +235,14 @@ public class SqlInjectionUtil {
|
|||||||
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String[] xssTableArr = XSS_STR_TABLE.split("\\|");
|
||||||
|
for (String xssTableStr : xssTableArr) {
|
||||||
|
if (isExistSqlInjectTableKeyword(value, xssTableStr)) {
|
||||||
|
log.error(SqlInjectionUtil.SQL_INJECTION_KEYWORD_TIP, xssTableStr);
|
||||||
|
log.error(SqlInjectionUtil.SQL_INJECTION_TIP_VARIABLE, value);
|
||||||
|
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 三、SQL注入检测存在绕过风险 (正则校验)
|
// 三、SQL注入检测存在绕过风险 (正则校验)
|
||||||
for (String regularOriginal : XSS_REGULAR_STR_ARRAY) {
|
for (String regularOriginal : XSS_REGULAR_STR_ARRAY) {
|
||||||
@ -244,6 +279,14 @@ public class SqlInjectionUtil {
|
|||||||
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String[] xssTableArr = XSS_STR_TABLE.split("\\|");
|
||||||
|
for (String xssTableStr : xssTableArr) {
|
||||||
|
if (isExistSqlInjectTableKeyword(value, xssTableStr)) {
|
||||||
|
log.error(SqlInjectionUtil.SQL_INJECTION_KEYWORD_TIP, xssTableStr);
|
||||||
|
log.error(SqlInjectionUtil.SQL_INJECTION_TIP_VARIABLE, value);
|
||||||
|
throw new JeecgSqlInjectionException(SqlInjectionUtil.SQL_INJECTION_TIP + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 三、SQL注入检测存在绕过风险 (正则校验)
|
// 三、SQL注入检测存在绕过风险 (正则校验)
|
||||||
for (String regularOriginal : XSS_REGULAR_STR_ARRAY) {
|
for (String regularOriginal : XSS_REGULAR_STR_ARRAY) {
|
||||||
|
|||||||
@ -68,6 +68,13 @@ public class DbTypeUtils {
|
|||||||
return dbTypeIf(dbType, DbType.ORACLE, DbType.ORACLE_12C, DbType.DM);
|
return dbTypeIf(dbType, DbType.ORACLE, DbType.ORACLE_12C, DbType.DM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是达梦
|
||||||
|
*/
|
||||||
|
public static boolean dbTypeIsDm(DbType dbType) {
|
||||||
|
return dbTypeIf(dbType, DbType.DM);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean dbTypeIsSqlServer(DbType dbType) {
|
public static boolean dbTypeIsSqlServer(DbType dbType) {
|
||||||
return dbTypeIf(dbType, DbType.SQL_SERVER, DbType.SQL_SERVER2005);
|
return dbTypeIf(dbType, DbType.SQL_SERVER, DbType.SQL_SERVER2005);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import org.apache.commons.io.IOUtils;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -1134,4 +1135,13 @@ public class oConvertUtils {
|
|||||||
return isIn(obj, objs);
|
return isIn(obj, objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断租户ID是否有效
|
||||||
|
* @param tenantId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isEffectiveTenant(String tenantId) {
|
||||||
|
return MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL && isNotEmpty(tenantId) && !("0").equals(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package org.jeecg.common.util.security;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.exception.JeecgSqlInjectionException;
|
import org.jeecg.common.exception.JeecgSqlInjectionException;
|
||||||
|
import org.jeecg.common.util.SqlInjectionUtil;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -66,6 +68,8 @@ public abstract class AbstractQueryBlackListHandler {
|
|||||||
if(flag == false){
|
if(flag == false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Set<String> xssTableSet = new HashSet<>(Arrays.asList(SqlInjectionUtil.XSS_STR_TABLE.split("\\|")));
|
||||||
|
|
||||||
for (QueryTable table : list) {
|
for (QueryTable table : list) {
|
||||||
String name = table.getName();
|
String name = table.getName();
|
||||||
String fieldRule = ruleMap.get(name);
|
String fieldRule = ruleMap.get(name);
|
||||||
@ -81,6 +85,16 @@ public abstract class AbstractQueryBlackListHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 判断是否调用了黑名单数据库
|
||||||
|
String dbName = table.getDbName();
|
||||||
|
if (oConvertUtils.isNotEmpty(dbName)) {
|
||||||
|
dbName = dbName.toLowerCase().trim();
|
||||||
|
if (xssTableSet.contains(dbName)) {
|
||||||
|
flag = false;
|
||||||
|
log.warn("sql黑名单校验,数据库【" + dbName + "】禁止查询");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回黑名单校验结果(不合法直接抛出异常)
|
// 返回黑名单校验结果(不合法直接抛出异常)
|
||||||
@ -135,6 +149,8 @@ public abstract class AbstractQueryBlackListHandler {
|
|||||||
* 查询的表的信息
|
* 查询的表的信息
|
||||||
*/
|
*/
|
||||||
protected class QueryTable {
|
protected class QueryTable {
|
||||||
|
//数据库名
|
||||||
|
private String dbName;
|
||||||
//表名
|
//表名
|
||||||
private String name;
|
private String name;
|
||||||
//表的别名
|
//表的别名
|
||||||
@ -158,6 +174,14 @@ public abstract class AbstractQueryBlackListHandler {
|
|||||||
this.fields.add(field);
|
this.fields.add(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDbName() {
|
||||||
|
return dbName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbName(String dbName) {
|
||||||
|
this.dbName = dbName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
//package org.jeecg.config;
|
//package org.jeecg.config;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
//import io.swagger.v3.oas.annotations.Operation;
|
||||||
//import org.jeecg.common.constant.CommonConstant;
|
//import org.jeecg.common.constant.CommonConstant;
|
||||||
|
//import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
//import org.springframework.beans.BeansException;
|
//import org.springframework.beans.BeansException;
|
||||||
//import org.springframework.beans.factory.config.BeanPostProcessor;
|
//import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
//import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Bean;
|
||||||
@ -18,15 +19,13 @@
|
|||||||
//import springfox.documentation.builders.ParameterBuilder;
|
//import springfox.documentation.builders.ParameterBuilder;
|
||||||
//import springfox.documentation.builders.PathSelectors;
|
//import springfox.documentation.builders.PathSelectors;
|
||||||
//import springfox.documentation.builders.RequestHandlerSelectors;
|
//import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
//import springfox.documentation.oas.annotations.EnableOpenApi;
|
|
||||||
//import springfox.documentation.schema.ModelRef;
|
//import springfox.documentation.schema.ModelRef;
|
||||||
//import springfox.documentation.service.*;
|
//import springfox.documentation.service.*;
|
||||||
//import springfox.documentation.spi.DocumentationType;
|
//import springfox.documentation.spi.DocumentationType;
|
||||||
//import springfox.documentation.spi.service.contexts.SecurityContext;
|
//import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
//import springfox.documentation.spring.web.plugins.Docket;
|
//import springfox.documentation.spring.web.plugins.Docket;
|
||||||
//import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
|
|
||||||
//import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
|
//import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
|
||||||
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
//import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||||
//
|
//
|
||||||
//import java.lang.reflect.Field;
|
//import java.lang.reflect.Field;
|
||||||
//import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
@ -38,8 +37,7 @@
|
|||||||
// * @Author scott
|
// * @Author scott
|
||||||
// */
|
// */
|
||||||
//@Configuration
|
//@Configuration
|
||||||
//@EnableSwagger2 //开启 Swagger2
|
//@EnableSwagger2WebMvc
|
||||||
//@EnableKnife4j //开启 knife4j,可以不写
|
|
||||||
//@Import(BeanValidatorPluginsConfiguration.class)
|
//@Import(BeanValidatorPluginsConfiguration.class)
|
||||||
//public class Swagger2Config implements WebMvcConfigurer {
|
//public class Swagger2Config implements WebMvcConfigurer {
|
||||||
//
|
//
|
||||||
@ -97,6 +95,14 @@
|
|||||||
// List<Parameter> pars = new ArrayList<>();
|
// List<Parameter> pars = new ArrayList<>();
|
||||||
// tokenPar.name(CommonConstant.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
// tokenPar.name(CommonConstant.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||||
// pars.add(tokenPar.build());
|
// pars.add(tokenPar.build());
|
||||||
|
// //update-begin-author:liusq---date:2024-08-15--for: 开启多租户时,全局参数增加租户id
|
||||||
|
// if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||||
|
// ParameterBuilder tenantPar = new ParameterBuilder();
|
||||||
|
// tenantPar.name(CommonConstant.TENANT_ID).description("租户ID").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||||
|
// pars.add(tenantPar.build());
|
||||||
|
// }
|
||||||
|
// //update-end-author:liusq---date:2024-08-15--for: 开启多租户时,全局参数增加租户id
|
||||||
|
//
|
||||||
// return pars;
|
// return pars;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -151,7 +157,7 @@
|
|||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
// public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||||
// if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
|
// if (bean instanceof WebMvcRequestHandlerProvider) {
|
||||||
// customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
|
// customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
|
||||||
// }
|
// }
|
||||||
// return bean;
|
// return bean;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class Swagger3Config implements WebMvcConfigurer {
|
|||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
.info(new Info()
|
.info(new Info()
|
||||||
.title("JeecgBoot 后台服务API接口文档")
|
.title("JeecgBoot 后台服务API接口文档")
|
||||||
.version("3.8.0")
|
.version("3.8.1")
|
||||||
.contact(new Contact().name("北京国炬信息技术有限公司").url("www.jeccg.com").email("jeecgos@163.com"))
|
.contact(new Contact().name("北京国炬信息技术有限公司").url("www.jeccg.com").email("jeecgos@163.com"))
|
||||||
.description( "后台API接口")
|
.description( "后台API接口")
|
||||||
.termsOfService("NO terms of service")
|
.termsOfService("NO terms of service")
|
||||||
|
|||||||
@ -15,15 +15,15 @@ import jakarta.annotation.Resource;
|
|||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.ObjectProvider;
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.boot.autoconfigure.jackson.JacksonProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.http.CacheControl;
|
import org.springframework.http.CacheControl;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
@ -61,6 +61,14 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private PrometheusMeterRegistry prometheusMeterRegistry;
|
private PrometheusMeterRegistry prometheusMeterRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meterRegistryPostProcessor
|
||||||
|
* for [QQYUN-12558]【监控】系统监控的头两个tab不好使,接口404
|
||||||
|
*/
|
||||||
|
@Autowired(required = false)
|
||||||
|
@Qualifier("meterRegistryPostProcessor")
|
||||||
|
private BeanPostProcessor meterRegistryPostProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
|
* 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
|
||||||
*/
|
*/
|
||||||
@ -149,12 +157,17 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解决metrics端点不显示jvm信息的问题(zyf)
|
* 监听应用启动完成事件,确保 PrometheusMeterRegistry 已经初始化
|
||||||
|
* for [QQYUN-12558]【监控】系统监控的头两个tab不好使,接口404
|
||||||
|
* @param event
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/5/26 16:46
|
||||||
*/
|
*/
|
||||||
@Bean
|
@EventListener
|
||||||
@ConditionalOnBean(name = "meterRegistryPostProcessor")
|
public void onApplicationReady(ApplicationReadyEvent event) {
|
||||||
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor) {
|
if(null != meterRegistryPostProcessor){
|
||||||
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(prometheusMeterRegistry, "");
|
meterRegistryPostProcessor.postProcessAfterInitialization(prometheusMeterRegistry, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|||||||
@ -8,12 +8,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class LowCodeModeConfiguration implements WebMvcConfigurer {
|
public class LowCodeModeConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
public LowCodeModeInterceptor payInterceptor() {
|
private final LowCodeModeInterceptor lowCodeModeInterceptor;
|
||||||
return new LowCodeModeInterceptor();
|
|
||||||
|
public LowCodeModeConfiguration(LowCodeModeInterceptor lowCodeModeInterceptor) {
|
||||||
|
this.lowCodeModeInterceptor = lowCodeModeInterceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(payInterceptor()).addPathPatterns(LowCodeUrlsEnum.getLowCodeInterceptUrls());
|
registry.addInterceptor(lowCodeModeInterceptor).addPathPatterns(LowCodeUrlsEnum.getLowCodeInterceptUrls());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import org.jeecg.common.util.CommonUtils;
|
|||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.config.JeecgBaseConfig;
|
import org.jeecg.config.JeecgBaseConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -38,6 +39,7 @@ import java.util.Set;
|
|||||||
* @date 20230904
|
* @date 20230904
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Component
|
||||||
public class LowCodeModeInterceptor implements HandlerInterceptor {
|
public class LowCodeModeInterceptor implements HandlerInterceptor {
|
||||||
/**
|
/**
|
||||||
* 低代码开发模式
|
* 低代码开发模式
|
||||||
@ -47,7 +49,8 @@ public class LowCodeModeInterceptor implements HandlerInterceptor {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private JeecgBaseConfig jeecgBaseConfig;
|
private JeecgBaseConfig jeecgBaseConfig;
|
||||||
@Autowired
|
|
||||||
|
@Autowired(required = false)
|
||||||
private CommonAPI commonAPI;
|
private CommonAPI commonAPI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,10 +58,15 @@ public class LowCodeModeInterceptor implements HandlerInterceptor {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
|
log.info("低代码模式,拦截请求路径:" + request.getRequestURI());
|
||||||
|
|
||||||
//1、验证是否开启低代码开发模式控制
|
//1、验证是否开启低代码开发模式控制
|
||||||
if (jeecgBaseConfig == null) {
|
if (jeecgBaseConfig == null) {
|
||||||
jeecgBaseConfig = SpringContextUtils.getBean(JeecgBaseConfig.class);
|
jeecgBaseConfig = SpringContextUtils.getBean(JeecgBaseConfig.class);
|
||||||
}
|
}
|
||||||
|
if (commonAPI == null) {
|
||||||
|
commonAPI = SpringContextUtils.getBean(CommonAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
if (jeecgBaseConfig.getFirewall()!=null && LowCodeModeInterceptor.LOW_CODE_MODE_PROD.equals(jeecgBaseConfig.getFirewall().getLowCodeMode())) {
|
if (jeecgBaseConfig.getFirewall()!=null && LowCodeModeInterceptor.LOW_CODE_MODE_PROD.equals(jeecgBaseConfig.getFirewall().getLowCodeMode())) {
|
||||||
String requestURI = request.getRequestURI().substring(request.getContextPath().length());
|
String requestURI = request.getRequestURI().substring(request.getContextPath().length());
|
||||||
|
|||||||
@ -221,6 +221,7 @@ public class ShiroConfig {
|
|||||||
registration.addUrlPatterns("/airag/flow/debug");
|
registration.addUrlPatterns("/airag/flow/debug");
|
||||||
registration.addUrlPatterns("/airag/chat/send");
|
registration.addUrlPatterns("/airag/chat/send");
|
||||||
registration.addUrlPatterns("/airag/app/debug");
|
registration.addUrlPatterns("/airag/app/debug");
|
||||||
|
registration.addUrlPatterns("/airag/app/prompt/generate");
|
||||||
//支持异步
|
//支持异步
|
||||||
registration.setAsyncSupported(true);
|
registration.setAsyncSupported(true);
|
||||||
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
|
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
springdoc.auto-tag-classes: false
|
springdoc.auto-tag-classes: false
|
||||||
springdoc.packages-to-scan: org.jeecg
|
springdoc.packages-to-scan: org.jeecg
|
||||||
|
springdoc.default-flat-param-object: true
|
||||||
@ -53,19 +53,29 @@
|
|||||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||||
</dependency>-->
|
</dependency>-->
|
||||||
|
|
||||||
|
<!-- aiflow依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot3</groupId>
|
<groupId>org.jeecgframework.boot3</groupId>
|
||||||
<artifactId>jeecg-aiflow</artifactId>
|
<artifactId>jeecg-aiflow</artifactId>
|
||||||
<version>1.0.5</version>
|
<version>1.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- aiflow 脚本依赖 -->
|
<!-- beigin 这两个依赖太多每个包50M左右,如果你发布需要使用,请把<scope>provided</scope>删掉 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-scripting-jsr223</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>liteflow-script-graaljs</artifactId>
|
<artifactId>liteflow-script-graaljs</artifactId>
|
||||||
<version>${liteflow.version}</version>
|
<version>${liteflow.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- end 这两个依赖太多每个包50M左右,如果你发布需要使用,请把<scope>provided</scope>删掉 -->
|
||||||
|
|
||||||
|
<!-- aiflow 脚本依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>liteflow-script-groovy</artifactId>
|
<artifactId>liteflow-script-groovy</artifactId>
|
||||||
|
|||||||
@ -16,6 +16,10 @@ public class AiAppConsts {
|
|||||||
* 状态:禁用
|
* 状态:禁用
|
||||||
*/
|
*/
|
||||||
public static final String STATUS_DISABLE = "disable";
|
public static final String STATUS_DISABLE = "disable";
|
||||||
|
/**
|
||||||
|
* 状态:发布
|
||||||
|
*/
|
||||||
|
public static final String STATUS_RELEASE = "release";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.util.AssertUtils;
|
import org.jeecg.common.util.AssertUtils;
|
||||||
|
import org.jeecg.common.util.TokenUtils;
|
||||||
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
import org.jeecg.config.shiro.IgnoreAuth;
|
import org.jeecg.config.shiro.IgnoreAuth;
|
||||||
import org.jeecg.modules.airag.app.consts.AiAppConsts;
|
import org.jeecg.modules.airag.app.consts.AiAppConsts;
|
||||||
import org.jeecg.modules.airag.app.entity.AiragApp;
|
import org.jeecg.modules.airag.app.entity.AiragApp;
|
||||||
@ -64,6 +67,7 @@ public class AiragAppController extends JeecgController<AiragApp, IAiragAppServi
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
@RequiresPermissions("airag:app:edit")
|
||||||
public Result<String> edit(@RequestBody AiragApp airagApp) {
|
public Result<String> edit(@RequestBody AiragApp airagApp) {
|
||||||
AssertUtils.assertNotEmpty("参数异常", airagApp);
|
AssertUtils.assertNotEmpty("参数异常", airagApp);
|
||||||
AssertUtils.assertNotEmpty("请输入应用名称", airagApp.getName());
|
AssertUtils.assertNotEmpty("请输入应用名称", airagApp.getName());
|
||||||
@ -73,6 +77,28 @@ public class AiragAppController extends JeecgController<AiragApp, IAiragAppServi
|
|||||||
return Result.OK("保存完成!", airagApp.getId());
|
return Result.OK("保存完成!", airagApp.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布应用
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/release", method = RequestMethod.POST)
|
||||||
|
public Result<String> release(@RequestParam(name = "id") String id, @RequestParam(name = "release") Boolean release) {
|
||||||
|
AssertUtils.assertNotEmpty("id必须填写", id);
|
||||||
|
if (release == null) {
|
||||||
|
release = true;
|
||||||
|
}
|
||||||
|
AiragApp airagApp = new AiragApp();
|
||||||
|
airagApp.setId(id);
|
||||||
|
if (release) {
|
||||||
|
airagApp.setStatus(AiAppConsts.STATUS_RELEASE);
|
||||||
|
} else {
|
||||||
|
airagApp.setStatus(AiAppConsts.STATUS_ENABLE);
|
||||||
|
}
|
||||||
|
airagAppService.updateById(airagApp);
|
||||||
|
return Result.OK(release ? "发布成功" : "取消发布成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
*
|
||||||
@ -80,23 +106,23 @@ public class AiragAppController extends JeecgController<AiragApp, IAiragAppServi
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
@RequiresPermissions("airag:app:delete")
|
||||||
|
public Result<String> delete(HttpServletRequest request,@RequestParam(name = "id", required = true) String id) {
|
||||||
|
//update-begin---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||||
|
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||||
|
AiragApp app = airagAppService.getById(id);
|
||||||
|
//获取当前租户
|
||||||
|
String currentTenantId = TokenUtils.getTenantIdByRequest(request);
|
||||||
|
if (null == app || !app.getTenantId().equals(currentTenantId)) {
|
||||||
|
return Result.error("删除AI应用失败,不能删除其他租户的AI应用!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
airagAppService.removeById(id);
|
airagAppService.removeById(id);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
|
||||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
||||||
this.airagAppService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,16 +1,24 @@
|
|||||||
package org.jeecg.modules.airag.app.controller;
|
package org.jeecg.modules.airag.app.controller;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.util.CommonUtils;
|
||||||
import org.jeecg.config.shiro.IgnoreAuth;
|
import org.jeecg.config.shiro.IgnoreAuth;
|
||||||
import org.jeecg.modules.airag.app.service.IAiragChatService;
|
import org.jeecg.modules.airag.app.service.IAiragChatService;
|
||||||
import org.jeecg.modules.airag.app.vo.ChatConversation;
|
import org.jeecg.modules.airag.app.vo.ChatConversation;
|
||||||
import org.jeecg.modules.airag.app.vo.ChatSendParams;
|
import org.jeecg.modules.airag.app.vo.ChatSendParams;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* airag应用-chat
|
* airag应用-chat
|
||||||
*
|
*
|
||||||
@ -25,6 +33,15 @@ public class AiragChatController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
IAiragChatService chatService;
|
IAiragChatService chatService;
|
||||||
|
|
||||||
|
@Value(value = "${jeecg.path.upload}")
|
||||||
|
private String uploadpath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地:local minio:minio 阿里:alioss
|
||||||
|
*/
|
||||||
|
@Value(value="${jeecg.uploadType}")
|
||||||
|
private String uploadType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
@ -59,6 +76,19 @@ public class AiragChatController {
|
|||||||
return chatService.send(chatSendParams);
|
return chatService.send(chatSendParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有对话
|
||||||
|
*
|
||||||
|
* @return 返回一个Result对象,包含所有对话的信息
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/2/25 11:42
|
||||||
|
*/
|
||||||
|
@IgnoreAuth
|
||||||
|
@GetMapping(value = "/init")
|
||||||
|
public Result<?> initChat(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
return chatService.initChat(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有对话
|
* 获取所有对话
|
||||||
*
|
*
|
||||||
@ -141,4 +171,36 @@ public class AiragChatController {
|
|||||||
return chatService.stop(requestId);
|
return chatService.stop(requestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件
|
||||||
|
* for [QQYUN-12135]AI聊天,上传图片提示非法token
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/25 11:04
|
||||||
|
*/
|
||||||
|
@IgnoreAuth
|
||||||
|
@PostMapping(value = "/upload")
|
||||||
|
public Result<?> upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
String bizPath = "airag";
|
||||||
|
|
||||||
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||||
|
// 获取上传文件对象
|
||||||
|
MultipartFile file = multipartRequest.getFile("file");
|
||||||
|
String savePath;
|
||||||
|
if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
|
||||||
|
savePath = CommonUtils.uploadLocal(file, bizPath, uploadpath);
|
||||||
|
} else {
|
||||||
|
savePath = CommonUtils.upload(file, bizPath, uploadType);
|
||||||
|
}
|
||||||
|
Result<?> result = new Result<>();
|
||||||
|
result.setMessage(savePath);
|
||||||
|
result.setSuccess(true);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,12 +39,13 @@ public class AiragApp implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@Schema(description = "主键")
|
@Schema(description = "主键")
|
||||||
private String id;
|
private java.lang.String id;
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String createBy;
|
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||||
|
private java.lang.String createBy;
|
||||||
/**
|
/**
|
||||||
* 创建日期
|
* 创建日期
|
||||||
*/
|
*/
|
||||||
@ -56,7 +57,7 @@ public class AiragApp implements Serializable {
|
|||||||
* 更新人
|
* 更新人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "更新人")
|
@Schema(description = "更新人")
|
||||||
private String updateBy;
|
private java.lang.String updateBy;
|
||||||
/**
|
/**
|
||||||
* 更新日期
|
* 更新日期
|
||||||
*/
|
*/
|
||||||
@ -68,95 +69,95 @@ public class AiragApp implements Serializable {
|
|||||||
* 所属部门
|
* 所属部门
|
||||||
*/
|
*/
|
||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
private String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
/**
|
/**
|
||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
@Excel(name = "租户id", width = 15)
|
@Excel(name = "租户id", width = 15)
|
||||||
@Schema(description = "租户id")
|
@Schema(description = "租户id")
|
||||||
private String tenantId;
|
private java.lang.String tenantId;
|
||||||
/**
|
/**
|
||||||
* 应用名称
|
* 应用名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "应用名称", width = 15)
|
@Excel(name = "应用名称", width = 15)
|
||||||
@Schema(description = "应用名称")
|
@Schema(description = "应用名称")
|
||||||
private String name;
|
private java.lang.String name;
|
||||||
/**
|
/**
|
||||||
* 应用描述
|
* 应用描述
|
||||||
*/
|
*/
|
||||||
@Excel(name = "应用描述", width = 15)
|
@Excel(name = "应用描述", width = 15)
|
||||||
@Schema(description = "应用描述")
|
@Schema(description = "应用描述")
|
||||||
private String descr;
|
private java.lang.String descr;
|
||||||
/**
|
/**
|
||||||
* 应用图标
|
* 应用图标
|
||||||
*/
|
*/
|
||||||
@Excel(name = "应用图标", width = 15)
|
@Excel(name = "应用图标", width = 15)
|
||||||
@Schema(description = "应用图标")
|
@Schema(description = "应用图标")
|
||||||
private String icon;
|
private java.lang.String icon;
|
||||||
/**
|
/**
|
||||||
* 应用类型
|
* 应用类型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "应用类型", width = 15, dicCode = "ai_app_type")
|
@Excel(name = "应用类型", width = 15, dicCode = "ai_app_type")
|
||||||
@Dict(dicCode = "ai_app_type")
|
@Dict(dicCode = "ai_app_type")
|
||||||
@Schema(description = "应用类型")
|
@Schema(description = "应用类型")
|
||||||
private String type;
|
private java.lang.String type;
|
||||||
/**
|
/**
|
||||||
* 开场白
|
* 开场白
|
||||||
*/
|
*/
|
||||||
@Excel(name = "开场白", width = 15)
|
@Excel(name = "开场白", width = 15)
|
||||||
@Schema(description = "开场白")
|
@Schema(description = "开场白")
|
||||||
private String prologue;
|
private java.lang.String prologue;
|
||||||
/**
|
/**
|
||||||
* 预设问题
|
* 预设问题
|
||||||
*/
|
*/
|
||||||
@Excel(name = "预设问题", width = 15)
|
@Excel(name = "预设问题", width = 15)
|
||||||
@Schema(description = "预设问题")
|
@Schema(description = "预设问题")
|
||||||
private String presetQuestion;
|
private java.lang.String presetQuestion;
|
||||||
/**
|
/**
|
||||||
* 提示词
|
* 提示词
|
||||||
*/
|
*/
|
||||||
@Excel(name = "提示词", width = 15)
|
@Excel(name = "提示词", width = 15)
|
||||||
@Schema(description = "提示词")
|
@Schema(description = "提示词")
|
||||||
private String prompt;
|
private java.lang.String prompt;
|
||||||
/**
|
/**
|
||||||
* 模型配置
|
* 模型配置
|
||||||
*/
|
*/
|
||||||
@Excel(name = "模型配置", width = 15, dictTable = "airag_model where model_type = 'LLM' ", dicText = "name", dicCode = "id")
|
@Excel(name = "模型配置", width = 15, dictTable = "airag_model where model_type = 'LLM' ", dicText = "name", dicCode = "id")
|
||||||
@Dict(dictTable = "airag_model where model_type = 'LLM' ", dicText = "name", dicCode = "id")
|
@Dict(dictTable = "airag_model where model_type = 'LLM' ", dicText = "name", dicCode = "id")
|
||||||
@Schema(description = "模型配置")
|
@Schema(description = "模型配置")
|
||||||
private String modelId;
|
private java.lang.String modelId;
|
||||||
/**
|
/**
|
||||||
* 历史消息数
|
* 历史消息数
|
||||||
*/
|
*/
|
||||||
@Excel(name = "历史消息数", width = 15)
|
@Excel(name = "历史消息数", width = 15)
|
||||||
@Schema(description = "历史消息数")
|
@Schema(description = "历史消息数")
|
||||||
private Integer msgNum;
|
private java.lang.Integer msgNum;
|
||||||
/**
|
/**
|
||||||
* 知识库
|
* 知识库
|
||||||
*/
|
*/
|
||||||
@Excel(name = "知识库", width = 15, dictTable = "airag_knowledge where status = 'enable'", dicText = "name", dicCode = "id")
|
@Excel(name = "知识库", width = 15, dictTable = "airag_knowledge where status = 'enable'", dicText = "name", dicCode = "id")
|
||||||
@Dict(dictTable = "airag_knowledge where status = 'enable'", dicText = "name", dicCode = "id")
|
@Dict(dictTable = "airag_knowledge where status = 'enable'", dicText = "name", dicCode = "id")
|
||||||
@Schema(description = "知识库")
|
@Schema(description = "知识库")
|
||||||
private String knowledgeIds;
|
private java.lang.String knowledgeIds;
|
||||||
/**
|
/**
|
||||||
* 流程
|
* 流程
|
||||||
*/
|
*/
|
||||||
@Excel(name = "流程", width = 15, dictTable = "airag_flow where status = 'enable' ", dicText = "name", dicCode = "id")
|
@Excel(name = "流程", width = 15, dictTable = "airag_flow where status = 'enable' ", dicText = "name", dicCode = "id")
|
||||||
@Dict(dictTable = "airag_flow where status = 'enable' ", dicText = "name", dicCode = "id")
|
@Dict(dictTable = "airag_flow where status = 'enable' ", dicText = "name", dicCode = "id")
|
||||||
@Schema(description = "流程")
|
@Schema(description = "流程")
|
||||||
private String flowId;
|
private java.lang.String flowId;
|
||||||
/**
|
/**
|
||||||
* 快捷指令
|
* 快捷指令
|
||||||
*/
|
*/
|
||||||
@Excel(name = "快捷指令", width = 15)
|
@Excel(name = "快捷指令", width = 15)
|
||||||
@Schema(description = "快捷指令")
|
@Schema(description = "快捷指令")
|
||||||
private String quickCommand;
|
private java.lang.String quickCommand;
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态(enable=启用、disable=禁用、release=发布)
|
||||||
*/
|
*/
|
||||||
@Excel(name = "状态", width = 15)
|
@Excel(name = "状态", width = 15)
|
||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private String status;
|
private java.lang.String status;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +165,7 @@ public class AiragApp implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "元数据", width = 15)
|
@Excel(name = "元数据", width = 15)
|
||||||
@Schema(description = "元数据")
|
@Schema(description = "元数据")
|
||||||
private String metadata;
|
private java.lang.String metadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 知识库ids
|
* 知识库ids
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.jeecg.modules.airag.app.mapper;
|
package org.jeecg.modules.airag.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.jeecg.modules.airag.app.entity.AiragApp;
|
import org.jeecg.modules.airag.app.entity.AiragApp;
|
||||||
|
|
||||||
@ -11,4 +12,14 @@ import org.jeecg.modules.airag.app.entity.AiragApp;
|
|||||||
*/
|
*/
|
||||||
public interface AiragAppMapper extends BaseMapper<AiragApp> {
|
public interface AiragAppMapper extends BaseMapper<AiragApp> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询app信息(忽略租户)
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/21 16:03
|
||||||
|
*/
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
AiragApp getByIdIgnoreTenant(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,4 +2,8 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.airag.app.mapper.AiragAppMapper">
|
<mapper namespace="org.jeecg.modules.airag.app.mapper.AiragAppMapper">
|
||||||
|
|
||||||
|
<select id="getByIdIgnoreTenant" resultType="org.jeecg.modules.airag.app.entity.AiragApp">
|
||||||
|
SELECT * FROM airag_app WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -92,4 +92,14 @@ public interface IAiragChatService {
|
|||||||
* @date 2025/3/3 19:49
|
* @date 2025/3/3 19:49
|
||||||
*/
|
*/
|
||||||
Result<?> clearMessage(String conversationId);
|
Result<?> clearMessage(String conversationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化聊天(忽略租户)
|
||||||
|
* [QQYUN-12113]分享之后的聊天,应用、模型、知识库不根据租户查询
|
||||||
|
* @param appId
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/21 14:17
|
||||||
|
*/
|
||||||
|
Result<?> initChat(String appId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import org.jeecg.common.system.util.JwtUtil;
|
|||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
import org.jeecg.modules.airag.app.consts.AiAppConsts;
|
import org.jeecg.modules.airag.app.consts.AiAppConsts;
|
||||||
import org.jeecg.modules.airag.app.entity.AiragApp;
|
import org.jeecg.modules.airag.app.entity.AiragApp;
|
||||||
|
import org.jeecg.modules.airag.app.mapper.AiragAppMapper;
|
||||||
import org.jeecg.modules.airag.app.service.IAiragAppService;
|
import org.jeecg.modules.airag.app.service.IAiragAppService;
|
||||||
import org.jeecg.modules.airag.app.service.IAiragChatService;
|
import org.jeecg.modules.airag.app.service.IAiragChatService;
|
||||||
import org.jeecg.modules.airag.app.vo.AppDebugParams;
|
import org.jeecg.modules.airag.app.vo.AppDebugParams;
|
||||||
@ -63,7 +64,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
RedisTemplate redisTemplate;
|
RedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IAiragAppService airagAppService;
|
AiragAppMapper airagAppMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IAiragFlowService airagFlowService;
|
IAiragFlowService airagFlowService;
|
||||||
@ -85,7 +86,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
// 获取app信息
|
// 获取app信息
|
||||||
AiragApp app = null;
|
AiragApp app = null;
|
||||||
if (oConvertUtils.isNotEmpty(chatSendParams.getAppId())) {
|
if (oConvertUtils.isNotEmpty(chatSendParams.getAppId())) {
|
||||||
app = airagAppService.getById(chatSendParams.getAppId());
|
app = airagAppMapper.getByIdIgnoreTenant(chatSendParams.getAppId());
|
||||||
}
|
}
|
||||||
ChatConversation chatConversation = getOrCreateChatConversation(app, conversationId);
|
ChatConversation chatConversation = getOrCreateChatConversation(app, conversationId);
|
||||||
// 更新标题
|
// 更新标题
|
||||||
@ -146,13 +147,19 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
try {
|
try {
|
||||||
// 发送完成事件
|
// 发送完成事件
|
||||||
emitter.send(SseEmitter.event().data(eventData));
|
emitter.send(SseEmitter.event().data(eventData));
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
log.error("终止会话时发生错误", e);
|
log.error("终止会话时发生错误", e);
|
||||||
|
try {
|
||||||
|
// 防止异常冒泡
|
||||||
|
emitter.completeWithError(e);
|
||||||
|
} catch (Exception ignore) {}
|
||||||
} finally {
|
} finally {
|
||||||
// 从缓存中移除emitter
|
// 从缓存中移除emitter
|
||||||
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE, eventData.getRequestId());
|
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE, eventData.getRequestId());
|
||||||
// 关闭emitter
|
// 关闭emitter
|
||||||
|
try {
|
||||||
emitter.complete();
|
emitter.complete();
|
||||||
|
} catch (Exception ignore) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +244,12 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> initChat(String appId) {
|
||||||
|
AiragApp app = airagAppMapper.getByIdIgnoreTenant(appId);
|
||||||
|
return Result.ok(app);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<?> deleteConversation(String conversationId) {
|
public Result<?> deleteConversation(String conversationId) {
|
||||||
AssertUtils.assertNotEmpty("请选择要删除的会话", conversationId);
|
AssertUtils.assertNotEmpty("请选择要删除的会话", conversationId);
|
||||||
@ -414,8 +427,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
case AiragConsts.MESSAGE_ROLE_USER:
|
case AiragConsts.MESSAGE_ROLE_USER:
|
||||||
List<Content> contents = new ArrayList<>();
|
List<Content> contents = new ArrayList<>();
|
||||||
List<MessageHistory.ImageHistory> images = history.getImages();
|
List<MessageHistory.ImageHistory> images = history.getImages();
|
||||||
if (oConvertUtils.isObjectNotEmpty(images)
|
if (oConvertUtils.isObjectNotEmpty(images) && !images.isEmpty()) {
|
||||||
&& !images.isEmpty()) {
|
|
||||||
contents.addAll(images.stream().map(imageHistory -> {
|
contents.addAll(images.stream().map(imageHistory -> {
|
||||||
if (oConvertUtils.isNotEmpty(imageHistory.getUrl())) {
|
if (oConvertUtils.isNotEmpty(imageHistory.getUrl())) {
|
||||||
return ImageContent.from(imageHistory.getUrl());
|
return ImageContent.from(imageHistory.getUrl());
|
||||||
@ -452,8 +464,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/2/25 19:05
|
* @date 2025/2/25 19:05
|
||||||
*/
|
*/
|
||||||
private void appendMessage(List<ChatMessage> messages, ChatMessage message, ChatConversation
|
private void appendMessage(List<ChatMessage> messages, ChatMessage message, ChatConversation chatConversation, String topicId) {
|
||||||
chatConversation, String topicId) {
|
|
||||||
|
|
||||||
if (message.type().equals(ChatMessageType.SYSTEM)) {
|
if (message.type().equals(ChatMessageType.SYSTEM)) {
|
||||||
// 系统消息,放到消息列表最前面,并且不记录历史
|
// 系统消息,放到消息列表最前面,并且不记录历史
|
||||||
@ -467,11 +478,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
histories = new ArrayList<>();
|
histories = new ArrayList<>();
|
||||||
}
|
}
|
||||||
// 消息记录
|
// 消息记录
|
||||||
MessageHistory historyMessage = MessageHistory.builder()
|
MessageHistory historyMessage = MessageHistory.builder().conversationId(chatConversation.getId()).topicId(topicId).datetime(DateUtils.now()).build();
|
||||||
.conversationId(chatConversation.getId())
|
|
||||||
.topicId(topicId)
|
|
||||||
.datetime(DateUtils.now())
|
|
||||||
.build();
|
|
||||||
if (message.type().equals(ChatMessageType.USER)) {
|
if (message.type().equals(ChatMessageType.USER)) {
|
||||||
historyMessage.setRole(AiragConsts.MESSAGE_ROLE_USER);
|
historyMessage.setRole(AiragConsts.MESSAGE_ROLE_USER);
|
||||||
StringBuilder textContent = new StringBuilder();
|
StringBuilder textContent = new StringBuilder();
|
||||||
@ -516,8 +523,21 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
// 每次会话都生成一个新的,用来缓存emitter
|
// 每次会话都生成一个新的,用来缓存emitter
|
||||||
String requestId = UUIDGenerator.generate();
|
String requestId = UUIDGenerator.generate();
|
||||||
SseEmitter emitter = new SseEmitter(-0L);
|
SseEmitter emitter = new SseEmitter(-0L);
|
||||||
|
emitter.onError(throwable -> {
|
||||||
|
log.warn("SEE向客户端发送消息失败: {}", throwable.getMessage());
|
||||||
|
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE, requestId);
|
||||||
|
try {
|
||||||
|
emitter.complete();
|
||||||
|
} catch (Exception ignore) {}
|
||||||
|
});
|
||||||
|
EventData eventRequestId = new EventData(requestId, null, EventData.EVENT_INIT_REQUEST_ID, chatConversation.getId(), topicId);
|
||||||
|
eventRequestId.setData(EventMessageData.builder().message("").build());
|
||||||
|
sendMessage2Client(emitter, eventRequestId);
|
||||||
// 缓存emitter
|
// 缓存emitter
|
||||||
AiragLocalCache.put(AiragConsts.CACHE_TYPE_SSE, requestId, emitter);
|
AiragLocalCache.put(AiragConsts.CACHE_TYPE_SSE, requestId, emitter);
|
||||||
|
// 缓存开始发送时间
|
||||||
|
log.info("[AI-CHAT]开始发送消息,requestId:{}", requestId);
|
||||||
|
AiragLocalCache.put(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId, System.currentTimeMillis());
|
||||||
try {
|
try {
|
||||||
// 组装用户消息
|
// 组装用户消息
|
||||||
UserMessage userMessage = aiChatHandler.buildUserMessage(sendParams.getContent(), sendParams.getImages());
|
UserMessage userMessage = aiChatHandler.buildUserMessage(sendParams.getContent(), sendParams.getImages());
|
||||||
@ -589,7 +609,12 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
||||||
flowRunParams.setEventCallback(eventData -> {
|
flowRunParams.setEventCallback(eventData -> {
|
||||||
if (EventData.EVENT_FLOW_FINISHED.equals(eventData.getEvent())) {
|
if (EventData.EVENT_FLOW_FINISHED.equals(eventData.getEvent())) {
|
||||||
|
// 打印耗时日志
|
||||||
|
printChatDuration(requestId, "流程执行完毕");
|
||||||
|
// 已经执行完了,删除时间缓存
|
||||||
|
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId);
|
||||||
EventFlowData data = (EventFlowData) eventData.getData();
|
EventFlowData data = (EventFlowData) eventData.getData();
|
||||||
|
if(data.isSuccess()) {
|
||||||
Object outputs = data.getOutputs();
|
Object outputs = data.getOutputs();
|
||||||
if (oConvertUtils.isObjectNotEmpty(outputs)) {
|
if (oConvertUtils.isObjectNotEmpty(outputs)) {
|
||||||
AiMessage aiMessage;
|
AiMessage aiMessage;
|
||||||
@ -602,23 +627,33 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
aiMessage = new AiMessage(JSONObject.toJSONString(outputs));
|
aiMessage = new AiMessage(JSONObject.toJSONString(outputs));
|
||||||
}
|
}
|
||||||
EventData msgEventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
EventData msgEventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
||||||
EventMessageData messageEventData = EventMessageData.builder()
|
EventMessageData messageEventData = EventMessageData.builder().message(aiMessage.text()).build();
|
||||||
.message(aiMessage.text())
|
|
||||||
.build();
|
|
||||||
msgEventData.setData(messageEventData);
|
msgEventData.setData(messageEventData);
|
||||||
try {
|
msgEventData.setRequestId(requestId);
|
||||||
String eventStr = JSONObject.toJSONString(msgEventData);
|
sendMessage2Client(emitter, msgEventData);
|
||||||
log.debug("[AI应用]接收FLOW返回消息:{}", eventStr);
|
|
||||||
emitter.send(SseEmitter.event().data(eventStr));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
appendMessage(messages, aiMessage, chatConversation, topicId);
|
appendMessage(messages, aiMessage, chatConversation, topicId);
|
||||||
// 保存会话
|
// 保存会话
|
||||||
saveChatConversation(chatConversation, false, httpRequest);
|
saveChatConversation(chatConversation, false, httpRequest);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
//update-begin---author:chenrui ---date:20250425 for:[QQYUN-12203]AI 聊天,超时或者服务器报错,给个友好提示------------
|
||||||
|
// 失败
|
||||||
|
String message = data.getMessage();
|
||||||
|
if (message != null && message.contains(FlowConsts.FLOW_ERROR_MSG_LLM_TIMEOUT)) {
|
||||||
|
message = "当前用户较多,排队中,请稍后再试!";
|
||||||
|
EventData errEventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
||||||
|
errEventData.setData(EventMessageData.builder().message("\n" + message).build());
|
||||||
|
sendMessage2Client(emitter, errEventData);
|
||||||
|
errEventData = new EventData(requestId, null, EventData.EVENT_MESSAGE_END, chatConversation.getId(), topicId);
|
||||||
|
// 如果是超时,主动关闭SSE,防止流程切面中返回异常消息导致前端不能正常展示上面的{普通消息}.
|
||||||
|
closeSSE(emitter, errEventData);
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250425 for:[QQYUN-12203]AI 聊天,超时或者服务器报错,给个友好提示------------
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// 打印流程耗时日志
|
||||||
|
printChatDuration(requestId, "开始执行流程");
|
||||||
airagFlowService.runFlow(flowRunParams);
|
airagFlowService.runFlow(flowRunParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,19 +689,21 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
aiChatParams.setTemperature(metadata.getDouble("temperature"));
|
aiChatParams.setTemperature(metadata.getDouble("temperature"));
|
||||||
}
|
}
|
||||||
if (metadata.containsKey("topP")) {
|
if (metadata.containsKey("topP")) {
|
||||||
aiChatParams.setTopP(metadata.getDouble("temperature"));
|
aiChatParams.setTopP(metadata.getDouble("topP"));
|
||||||
}
|
}
|
||||||
if (metadata.containsKey("presencePenalty")) {
|
if (metadata.containsKey("presencePenalty")) {
|
||||||
aiChatParams.setPresencePenalty(metadata.getDouble("temperature"));
|
aiChatParams.setPresencePenalty(metadata.getDouble("presencePenalty"));
|
||||||
}
|
}
|
||||||
if (metadata.containsKey("frequencyPenalty")) {
|
if (metadata.containsKey("frequencyPenalty")) {
|
||||||
aiChatParams.setFrequencyPenalty(metadata.getDouble("temperature"));
|
aiChatParams.setFrequencyPenalty(metadata.getDouble("frequencyPenalty"));
|
||||||
}
|
}
|
||||||
if (metadata.containsKey("maxTokens")) {
|
if (metadata.containsKey("maxTokens")) {
|
||||||
aiChatParams.setMaxTokens(metadata.getInteger("temperature"));
|
aiChatParams.setMaxTokens(metadata.getInteger("maxTokens"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 打印流程耗时日志
|
||||||
|
printChatDuration(requestId, "构造应用自定义参数完成");
|
||||||
// 发消息
|
// 发消息
|
||||||
sendWithDefault(requestId, chatConversation, topicId, modelId, messages, aiChatParams);
|
sendWithDefault(requestId, chatConversation, topicId, modelId, messages, aiChatParams);
|
||||||
}
|
}
|
||||||
@ -683,8 +720,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/2/25 19:24
|
* @date 2025/2/25 19:24
|
||||||
*/
|
*/
|
||||||
private void sendWithDefault(String requestId, ChatConversation chatConversation, String topicId, String modelId,
|
private void sendWithDefault(String requestId, ChatConversation chatConversation, String topicId, String modelId, List<ChatMessage> messages, AIChatParams aiChatParams) {
|
||||||
List<ChatMessage> messages,AIChatParams aiChatParams) {
|
|
||||||
// 调用ai聊天
|
// 调用ai聊天
|
||||||
if (null == aiChatParams) {
|
if (null == aiChatParams) {
|
||||||
aiChatParams = new AIChatParams();
|
aiChatParams = new AIChatParams();
|
||||||
@ -694,6 +730,8 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
HttpServletRequest httpRequest = SpringContextUtils.getHttpServletRequest();
|
HttpServletRequest httpRequest = SpringContextUtils.getHttpServletRequest();
|
||||||
TokenStream chatStream;
|
TokenStream chatStream;
|
||||||
try {
|
try {
|
||||||
|
// 打印流程耗时日志
|
||||||
|
printChatDuration(requestId, "开始向LLM发送消息");
|
||||||
if (oConvertUtils.isNotEmpty(modelId)) {
|
if (oConvertUtils.isNotEmpty(modelId)) {
|
||||||
chatStream = aiChatHandler.chat(modelId, messages, aiChatParams);
|
chatStream = aiChatHandler.chat(modelId, messages, aiChatParams);
|
||||||
} else {
|
} else {
|
||||||
@ -724,25 +762,20 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
||||||
EventMessageData messageEventData = EventMessageData.builder()
|
EventMessageData messageEventData = EventMessageData.builder().message(resMessage).build();
|
||||||
.message(resMessage)
|
|
||||||
.build();
|
|
||||||
eventData.setData(messageEventData);
|
eventData.setData(messageEventData);
|
||||||
|
eventData.setRequestId(requestId);
|
||||||
// sse
|
// sse
|
||||||
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
||||||
if (null == emitter) {
|
if (null == emitter) {
|
||||||
log.warn("[AI应用]接收LLM返回会话已关闭");
|
log.warn("[AI应用]接收LLM返回会话已关闭");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
sendMessage2Client(emitter, eventData);
|
||||||
String eventStr = JSONObject.toJSONString(eventData);
|
}).onComplete((responseMessage) -> {
|
||||||
log.debug("[AI应用]接收LLM返回消息:{}", eventStr);
|
// 打印流程耗时日志
|
||||||
emitter.send(SseEmitter.event().data(eventStr));
|
printChatDuration(requestId, "LLM输出消息完成");
|
||||||
} catch (IOException e) {
|
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.onComplete((responseMessage) -> {
|
|
||||||
// 记录ai的回复
|
// 记录ai的回复
|
||||||
AiMessage aiMessage = responseMessage.content();
|
AiMessage aiMessage = responseMessage.content();
|
||||||
FinishReason finishReason = responseMessage.finishReason();
|
FinishReason finishReason = responseMessage.finishReason();
|
||||||
@ -756,12 +789,6 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
if (FinishReason.STOP.equals(finishReason) || null == finishReason) {
|
if (FinishReason.STOP.equals(finishReason) || null == finishReason) {
|
||||||
// 正常结束
|
// 正常结束
|
||||||
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE_END, chatConversation.getId(), topicId);
|
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE_END, chatConversation.getId(), topicId);
|
||||||
try {
|
|
||||||
log.debug("[AI应用]接收LLM返回消息完成:{}", respText);
|
|
||||||
emitter.send(SseEmitter.event().data(eventData));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
appendMessage(messages, aiMessage, chatConversation, topicId);
|
appendMessage(messages, aiMessage, chatConversation, topicId);
|
||||||
// 保存会话
|
// 保存会话
|
||||||
saveChatConversation(chatConversation, false, httpRequest);
|
saveChatConversation(chatConversation, false, httpRequest);
|
||||||
@ -769,6 +796,14 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
} else if (FinishReason.TOOL_EXECUTION.equals(finishReason)) {
|
} else if (FinishReason.TOOL_EXECUTION.equals(finishReason)) {
|
||||||
// 需要执行工具
|
// 需要执行工具
|
||||||
// TODO author: chenrui for: date:2025/3/7
|
// TODO author: chenrui for: date:2025/3/7
|
||||||
|
} else if (FinishReason.LENGTH.equals(finishReason)) {
|
||||||
|
// 上下文长度超过限制
|
||||||
|
log.error("调用模型异常:上下文长度超过限制:{}", responseMessage.tokenUsage());
|
||||||
|
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
||||||
|
eventData.setData(EventMessageData.builder().message("\n上下文长度超过限制,请调整模型最大Tokens").build());
|
||||||
|
sendMessage2Client(emitter, eventData);
|
||||||
|
eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE_END, chatConversation.getId(), topicId);
|
||||||
|
closeSSE(emitter, eventData);
|
||||||
} else {
|
} else {
|
||||||
// 异常结束
|
// 异常结束
|
||||||
log.error("调用模型异常:" + respText);
|
log.error("调用模型异常:" + respText);
|
||||||
@ -779,21 +814,53 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
eventData.setData(EventFlowData.builder().success(false).message(respText).build());
|
eventData.setData(EventFlowData.builder().success(false).message(respText).build());
|
||||||
closeSSE(emitter, eventData);
|
closeSSE(emitter, eventData);
|
||||||
}
|
}
|
||||||
})
|
}).onError((Throwable error) -> {
|
||||||
.onError((Throwable error) -> {
|
// 打印流程耗时日志
|
||||||
|
printChatDuration(requestId, "LLM输出消息异常");
|
||||||
|
AiragLocalCache.remove(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId);
|
||||||
// sse
|
// sse
|
||||||
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
SseEmitter emitter = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE, requestId);
|
||||||
if (null == emitter) {
|
if (null == emitter) {
|
||||||
log.warn("[AI应用]接收LLM返回会话已关闭");
|
log.warn("[AI应用]接收LLM返回会话已关闭{}", requestId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String errMsg = "调用大模型接口失败:" + error.getMessage();
|
log.error(error.getMessage(), error);
|
||||||
log.error(errMsg, error);
|
String errMsg = error.getMessage();
|
||||||
|
if (errMsg != null && errMsg.contains("timeout")) {
|
||||||
|
//update-begin---author:chenrui ---date:20250425 for:[QQYUN-12203]AI 聊天,超时或者服务器报错,给个友好提示------------
|
||||||
|
errMsg = "当前用户较多,排队中,请稍后再试!";
|
||||||
|
EventData eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE, chatConversation.getId(), topicId);
|
||||||
|
eventData.setData(EventMessageData.builder().message("\n" + errMsg).build());
|
||||||
|
sendMessage2Client(emitter, eventData);
|
||||||
|
eventData = new EventData(requestId, null, EventData.EVENT_MESSAGE_END, chatConversation.getId(), topicId);
|
||||||
|
closeSSE(emitter, eventData);
|
||||||
|
//update-end---author:chenrui ---date:20250425 for:[QQYUN-12203]AI 聊天,超时或者服务器报错,给个友好提示------------
|
||||||
|
} else {
|
||||||
|
errMsg = "调用大模型接口失败:" + errMsg;
|
||||||
EventData eventData = new EventData(requestId, null, EventData.EVENT_FLOW_ERROR, chatConversation.getId(), topicId);
|
EventData eventData = new EventData(requestId, null, EventData.EVENT_FLOW_ERROR, chatConversation.getId(), topicId);
|
||||||
eventData.setData(EventFlowData.builder().success(false).message(errMsg).build());
|
eventData.setData(EventFlowData.builder().success(false).message(errMsg).build());
|
||||||
closeSSE(emitter, eventData);
|
closeSSE(emitter, eventData);
|
||||||
})
|
}
|
||||||
.start();
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息到客户端
|
||||||
|
*
|
||||||
|
* @param emitter
|
||||||
|
* @param eventData
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/22 19:58
|
||||||
|
*/
|
||||||
|
private static void sendMessage2Client(SseEmitter emitter, EventData eventData) {
|
||||||
|
try {
|
||||||
|
log.info("发送消息:{}", eventData.getRequestId());
|
||||||
|
String eventStr = JSONObject.toJSONString(eventData);
|
||||||
|
log.debug("[AI应用]接收LLM返回消息:{}", eventStr);
|
||||||
|
emitter.send(SseEmitter.event().data(eventStr));
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("发送消息失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -837,12 +904,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
}
|
}
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
List<ChatMessage> messages = new LinkedList<>();
|
List<ChatMessage> messages = new LinkedList<>();
|
||||||
String systemMsgStr = "根据用户的问题,总结会话标题.\n" +
|
String systemMsgStr = "根据用户的问题,总结会话标题.\n" + "要求如下:\n" + "1. 使用中文回答.\n" + "2. 标题长度控制在5个汉字10个英文字符以内\n" + "3. 直接回复会话标题,不要有其他任何无关描述\n" + "4. 如果无法总结,回复不知道\n";
|
||||||
"要求如下:\n" +
|
|
||||||
"1. 使用中文回答.\n" +
|
|
||||||
"2. 标题长度控制在5个汉字10个英文字符以内\n" +
|
|
||||||
"3. 直接回复会话标题,不要有其他任何无关描述\n" +
|
|
||||||
"4. 如果无法总结,回复不知道\n";
|
|
||||||
messages.add(new SystemMessage(systemMsgStr));
|
messages.add(new SystemMessage(systemMsgStr));
|
||||||
messages.add(new UserMessage(question));
|
messages.add(new UserMessage(question));
|
||||||
String summaryTitle;
|
String summaryTitle;
|
||||||
@ -876,6 +938,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户名
|
* 获取用户名
|
||||||
|
*
|
||||||
* @param httpRequest
|
* @param httpRequest
|
||||||
* @return
|
* @return
|
||||||
* @author chenrui
|
* @author chenrui
|
||||||
@ -898,4 +961,19 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印耗时
|
||||||
|
* @param requestId
|
||||||
|
* @param message
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/28 15:15
|
||||||
|
*/
|
||||||
|
private static void printChatDuration(String requestId,String message) {
|
||||||
|
Long beginTime = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId);
|
||||||
|
if (null != beginTime) {
|
||||||
|
log.info("[AI-CHAT]{},requestId:{},耗时:{}s", message, requestId, (System.currentTimeMillis() - beginTime) / 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package org.jeecg.modules.airag.demo;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.exception.JeecgBootBizTipException;
|
||||||
|
import org.jeecg.modules.airag.flow.component.enhance.IAiRagEnhanceJava;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Java增强Demo: Excel数据读取器
|
||||||
|
* for [QQYUN-11718]【AI】积木报表对接AI流程编排接口展示报表
|
||||||
|
* @Author: chenrui
|
||||||
|
* @Date: 2025/4/29 16:51
|
||||||
|
*/
|
||||||
|
@Component("jimuDataReader")
|
||||||
|
@Slf4j
|
||||||
|
public class JimuDataReader implements IAiRagEnhanceJava {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> process(Map<String, Object> inputParams) {
|
||||||
|
// inputParams: {"bizData":"/xxxx/xxxx/xxxx/xxxx.xls"}
|
||||||
|
try {
|
||||||
|
String filePath = (String) inputParams.get("bizData");
|
||||||
|
if (filePath == null || filePath.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("File path is empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
File excelFile = new File(filePath);
|
||||||
|
if (!excelFile.exists() || !excelFile.isFile()) {
|
||||||
|
throw new IllegalArgumentException("File not found: " + filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we don't know the target entity class, we'll read the Excel generically
|
||||||
|
return readExcelData(excelFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error processing Excel file", e);
|
||||||
|
throw new JeecgBootBizTipException("调用java增强失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel导入工具方法,基于ExcelImportUtil
|
||||||
|
*
|
||||||
|
* @param file Excel文件
|
||||||
|
* @return Excel读取结果,包含字段和数据
|
||||||
|
* @throws Exception 导入过程中的异常
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> readExcelData(File file) throws Exception {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
|
// 设置导入参数
|
||||||
|
ImportParams params = new ImportParams();
|
||||||
|
params.setTitleRows(0); // 没有标题
|
||||||
|
params.setHeadRows(1); // 第一行是表头
|
||||||
|
|
||||||
|
// 读取Excel数据
|
||||||
|
List<Map<String, Object>> dataList = ExcelImportUtil.importExcel(file, Map.class, params);
|
||||||
|
|
||||||
|
// 如果没有数据,返回空结果
|
||||||
|
if (dataList == null || dataList.isEmpty()) {
|
||||||
|
result.put("fields", new ArrayList<>());
|
||||||
|
result.put("datas", new ArrayList<>());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从第一行数据中获取字段名
|
||||||
|
List<String> fieldNames = new ArrayList<>(dataList.get(0).keySet());
|
||||||
|
|
||||||
|
result.put("fields", fieldNames);
|
||||||
|
result.put("datas", dataList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package org.jeecg.modules.airag.demo;
|
||||||
|
|
||||||
|
import org.jeecg.modules.airag.flow.component.enhance.IAiRagEnhanceJava;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: Java增强节点示例类
|
||||||
|
* @Author: chenrui
|
||||||
|
* @Date: 2025/3/6 11:42
|
||||||
|
*/
|
||||||
|
@Component("testAiragEnhance")
|
||||||
|
public class TestAiragEnhance implements IAiRagEnhanceJava {
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> process(Map<String, Object> inputParams) {
|
||||||
|
Object arg1 = inputParams.get("arg1");
|
||||||
|
Object arg2 = inputParams.get("arg2");
|
||||||
|
return Collections.singletonMap("result",arg1.toString()+"java拼接"+arg2.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -35,6 +35,11 @@ public class LLMConsts {
|
|||||||
*/
|
*/
|
||||||
public static final String MODEL_TYPE_LLM = "LLM";
|
public static final String MODEL_TYPE_LLM = "LLM";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向量模型:默认维度
|
||||||
|
*/
|
||||||
|
public static final Integer EMBED_MODEL_DEFAULT_DIMENSION = 1536;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 知识库:文档状态:草稿
|
* 知识库:文档状态:草稿
|
||||||
*/
|
*/
|
||||||
@ -47,7 +52,10 @@ public class LLMConsts {
|
|||||||
* 知识库:文档状态:构建完成
|
* 知识库:文档状态:构建完成
|
||||||
*/
|
*/
|
||||||
public static final String KNOWLEDGE_DOC_STATUS_COMPLETE = "complete";
|
public static final String KNOWLEDGE_DOC_STATUS_COMPLETE = "complete";
|
||||||
|
/**
|
||||||
|
* 知识库:文档状态:构建失败
|
||||||
|
*/
|
||||||
|
public static final String KNOWLEDGE_DOC_STATUS_FAILED = "failed";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 知识库:文档类型:文本
|
* 知识库:文档类型:文本
|
||||||
|
|||||||
@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.util.AssertUtils;
|
import org.jeecg.common.util.AssertUtils;
|
||||||
|
import org.jeecg.common.util.TokenUtils;
|
||||||
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
import org.jeecg.modules.airag.common.vo.knowledge.KnowledgeSearchResult;
|
import org.jeecg.modules.airag.common.vo.knowledge.KnowledgeSearchResult;
|
||||||
import org.jeecg.modules.airag.llm.consts.LLMConsts;
|
import org.jeecg.modules.airag.llm.consts.LLMConsts;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
||||||
@ -74,6 +77,7 @@ public class AiragKnowledgeController {
|
|||||||
* @date 2025/2/18 17:09
|
* @date 2025/2/18 17:09
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
|
@RequiresPermissions("airag:knowledge:add")
|
||||||
public Result<String> add(@RequestBody AiragKnowledge airagKnowledge) {
|
public Result<String> add(@RequestBody AiragKnowledge airagKnowledge) {
|
||||||
airagKnowledge.setStatus(LLMConsts.STATUS_ENABLE);
|
airagKnowledge.setStatus(LLMConsts.STATUS_ENABLE);
|
||||||
airagKnowledgeService.save(airagKnowledge);
|
airagKnowledgeService.save(airagKnowledge);
|
||||||
@ -90,6 +94,7 @@ public class AiragKnowledgeController {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
@RequiresPermissions("airag:knowledge:edit")
|
||||||
public Result<String> edit(@RequestBody AiragKnowledge airagKnowledge) {
|
public Result<String> edit(@RequestBody AiragKnowledge airagKnowledge) {
|
||||||
AiragKnowledge airagKnowledgeEntity = airagKnowledgeService.getById(airagKnowledge.getId());
|
AiragKnowledge airagKnowledgeEntity = airagKnowledgeService.getById(airagKnowledge.getId());
|
||||||
if (airagKnowledgeEntity == null) {
|
if (airagKnowledgeEntity == null) {
|
||||||
@ -113,6 +118,7 @@ public class AiragKnowledgeController {
|
|||||||
* @date 2025/3/12 17:05
|
* @date 2025/3/12 17:05
|
||||||
*/
|
*/
|
||||||
@PutMapping(value = "/rebuild")
|
@PutMapping(value = "/rebuild")
|
||||||
|
@RequiresPermissions("airag:knowledge:rebuild")
|
||||||
public Result<?> rebuild(@RequestParam("knowIds") String knowIds) {
|
public Result<?> rebuild(@RequestParam("knowIds") String knowIds) {
|
||||||
String[] knowIdArr = knowIds.split(",");
|
String[] knowIdArr = knowIds.split(",");
|
||||||
for (String knowId : knowIdArr) {
|
for (String knowId : knowIdArr) {
|
||||||
@ -131,29 +137,24 @@ public class AiragKnowledgeController {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
@RequiresPermissions("airag:knowledge:delete")
|
||||||
|
public Result<String> delete(HttpServletRequest request, @RequestParam(name = "id", required = true) String id) {
|
||||||
|
//update-begin---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||||
|
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||||
|
AiragKnowledge know = airagKnowledgeService.getById(id);
|
||||||
|
//获取当前租户
|
||||||
|
String currentTenantId = TokenUtils.getTenantIdByRequest(request);
|
||||||
|
if (null == know || !know.getTenantId().equals(currentTenantId)) {
|
||||||
|
return Result.error("删除AI知识库失败,不能删除其他租户的AI知识库!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
airagKnowledgeDocService.removeByKnowIds(Collections.singletonList(id));
|
airagKnowledgeDocService.removeByKnowIds(Collections.singletonList(id));
|
||||||
airagKnowledgeService.removeById(id);
|
airagKnowledgeService.removeById(id);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除知识库
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
* @author chenrui
|
|
||||||
* @date 2025/2/18 17:09
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
|
||||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
||||||
List<String> idsList = Arrays.asList(ids.split(","));
|
|
||||||
airagKnowledgeDocService.removeByKnowIds(idsList);
|
|
||||||
airagKnowledgeService.removeByIds(idsList);
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询知识库
|
* 通过id查询知识库
|
||||||
*
|
*
|
||||||
@ -203,6 +204,7 @@ public class AiragKnowledgeController {
|
|||||||
* @date 2025/2/18 15:47
|
* @date 2025/2/18 15:47
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/doc/edit")
|
@PostMapping(value = "/doc/edit")
|
||||||
|
@RequiresPermissions("airag:knowledge:doc:edit")
|
||||||
public Result<?> addDocument(@RequestBody AiragKnowledgeDoc airagKnowledgeDoc) {
|
public Result<?> addDocument(@RequestBody AiragKnowledgeDoc airagKnowledgeDoc) {
|
||||||
return airagKnowledgeDocService.editDocument(airagKnowledgeDoc);
|
return airagKnowledgeDocService.editDocument(airagKnowledgeDoc);
|
||||||
}
|
}
|
||||||
@ -215,6 +217,7 @@ public class AiragKnowledgeController {
|
|||||||
* @date 2025/3/20 11:29
|
* @date 2025/3/20 11:29
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/doc/import/zip")
|
@PostMapping(value = "/doc/import/zip")
|
||||||
|
@RequiresPermissions("airag:knowledge:doc:zip")
|
||||||
public Result<?> importDocumentFromZip(@RequestParam(name = "knowId", required = true) String knowId,
|
public Result<?> importDocumentFromZip(@RequestParam(name = "knowId", required = true) String knowId,
|
||||||
@RequestParam(name = "file", required = true) MultipartFile file) {
|
@RequestParam(name = "file", required = true) MultipartFile file) {
|
||||||
return airagKnowledgeDocService.importDocumentFromZip(knowId,file);
|
return airagKnowledgeDocService.importDocumentFromZip(knowId,file);
|
||||||
@ -241,6 +244,7 @@ public class AiragKnowledgeController {
|
|||||||
* @date 2025/2/18 15:47
|
* @date 2025/2/18 15:47
|
||||||
*/
|
*/
|
||||||
@PutMapping(value = "/doc/rebuild")
|
@PutMapping(value = "/doc/rebuild")
|
||||||
|
@RequiresPermissions("airag:knowledge:doc:rebuild")
|
||||||
public Result<?> rebuildDocument(@RequestParam("docIds") String docIds) {
|
public Result<?> rebuildDocument(@RequestParam("docIds") String docIds) {
|
||||||
return airagKnowledgeDocService.rebuildDocument(docIds);
|
return airagKnowledgeDocService.rebuildDocument(docIds);
|
||||||
}
|
}
|
||||||
@ -255,12 +259,49 @@ public class AiragKnowledgeController {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@DeleteMapping(value = "/doc/deleteBatch")
|
@DeleteMapping(value = "/doc/deleteBatch")
|
||||||
public Result<String> deleteDocumentBatch(@RequestParam(name = "ids", required = true) String ids) {
|
@RequiresPermissions("airag:knowledge:doc:deleteBatch")
|
||||||
|
public Result<String> deleteDocumentBatch(HttpServletRequest request, @RequestParam(name = "ids", required = true) String ids) {
|
||||||
List<String> idsList = Arrays.asList(ids.split(","));
|
List<String> idsList = Arrays.asList(ids.split(","));
|
||||||
|
//update-begin---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||||
|
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||||
|
List<AiragKnowledgeDoc> docList = airagKnowledgeDocService.listByIds(idsList);
|
||||||
|
//获取当前租户
|
||||||
|
String currentTenantId = TokenUtils.getTenantIdByRequest(request);
|
||||||
|
docList.forEach(airagKnowledgeDoc -> {
|
||||||
|
if (null == airagKnowledgeDoc || !airagKnowledgeDoc.getTenantId().equals(currentTenantId)) {
|
||||||
|
throw new IllegalArgumentException("删除AI知识库文档失败,不能删除其他租户的AI知识库文档!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
airagKnowledgeDocService.removeDocByIds(idsList);
|
airagKnowledgeDocService.removeDocByIds(idsList);
|
||||||
return Result.OK("批量删除成功!");
|
return Result.OK("批量删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空知识库文档
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@DeleteMapping(value = "/doc/deleteAll")
|
||||||
|
@RequiresPermissions("airag:knowledge:doc:deleteAll")
|
||||||
|
public Result<?> deleteDocumentAll(HttpServletRequest request, @RequestParam(name = "knowId") String knowId) {
|
||||||
|
//update-begin---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||||
|
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||||
|
AiragKnowledge know = airagKnowledgeService.getById(knowId);
|
||||||
|
//获取当前租户
|
||||||
|
String currentTenantId = TokenUtils.getTenantIdByRequest(request);
|
||||||
|
if (null == know || !know.getTenantId().equals(currentTenantId)) {
|
||||||
|
return Result.error("删除AI知识库失败,不能删除其他租户的AI知识库!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
return airagKnowledgeDocService.deleteAllByKnowId(knowId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命中测试
|
* 命中测试
|
||||||
|
|||||||
@ -3,12 +3,23 @@ package org.jeecg.modules.airag.llm.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import dev.langchain4j.data.message.UserMessage;
|
||||||
|
import dev.langchain4j.model.embedding.EmbeddingModel;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.ai.factory.AiModelFactory;
|
||||||
|
import org.jeecg.ai.factory.AiModelOptions;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.util.AssertUtils;
|
||||||
|
import org.jeecg.common.util.TokenUtils;
|
||||||
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
|
import org.jeecg.modules.airag.llm.consts.LLMConsts;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
||||||
|
import org.jeecg.modules.airag.llm.handler.AIChatHandler;
|
||||||
|
import org.jeecg.modules.airag.llm.handler.EmbeddingHandler;
|
||||||
import org.jeecg.modules.airag.llm.service.IAiragModelService;
|
import org.jeecg.modules.airag.llm.service.IAiragModelService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -17,6 +28,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: AiRag模型配置
|
* @Description: AiRag模型配置
|
||||||
@ -32,6 +44,8 @@ public class AiragModelController extends JeecgController<AiragModel, IAiragMode
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAiragModelService airagModelService;
|
private IAiragModelService airagModelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AIChatHandler aiChatHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@ -57,7 +71,12 @@ public class AiragModelController extends JeecgController<AiragModel, IAiragMode
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
|
@RequiresPermissions("airag:model:add")
|
||||||
public Result<String> add(@RequestBody AiragModel airagModel) {
|
public Result<String> add(@RequestBody AiragModel airagModel) {
|
||||||
|
// 验证 模型名称/模型类型/基础模型
|
||||||
|
AssertUtils.assertNotEmpty("模型名称不能为空", airagModel.getName());
|
||||||
|
AssertUtils.assertNotEmpty("模型类型不能为空", airagModel.getModelType());
|
||||||
|
AssertUtils.assertNotEmpty("基础模型不能为空", airagModel.getModelName());
|
||||||
airagModelService.save(airagModel);
|
airagModelService.save(airagModel);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
@ -69,6 +88,7 @@ public class AiragModelController extends JeecgController<AiragModel, IAiragMode
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
@RequiresPermissions("airag:model:edit")
|
||||||
public Result<String> edit(@RequestBody AiragModel airagModel) {
|
public Result<String> edit(@RequestBody AiragModel airagModel) {
|
||||||
airagModelService.updateById(airagModel);
|
airagModelService.updateById(airagModel);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
@ -81,23 +101,23 @@ public class AiragModelController extends JeecgController<AiragModel, IAiragMode
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
@RequiresPermissions("airag:model:delete")
|
||||||
|
public Result<String> delete(HttpServletRequest request, @RequestParam(name = "id", required = true) String id) {
|
||||||
|
//update-begin---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
|
//如果是saas隔离的情况下,判断当前租户id是否是当前租户下的
|
||||||
|
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||||
|
AiragModel model = airagModelService.getById(id);
|
||||||
|
//获取当前租户
|
||||||
|
String currentTenantId = TokenUtils.getTenantIdByRequest(request);
|
||||||
|
if (null == model || !model.getTenantId().equals(currentTenantId)) {
|
||||||
|
return Result.error("删除AI模型失败,不能删除其他租户的AI模型!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:chenrui ---date:20250606 for:[issues/8337]关于ai工作列表的数据权限问题 #8337------------
|
||||||
airagModelService.removeById(id);
|
airagModelService.removeById(id);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
|
||||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
||||||
this.airagModelService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
@ -136,4 +156,25 @@ public class AiragModelController extends JeecgController<AiragModel, IAiragMode
|
|||||||
return super.importExcel(request, response, AiragModel.class);
|
return super.importExcel(request, response, AiragModel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/test")
|
||||||
|
public Result<?> test(@RequestBody AiragModel airagModel) {
|
||||||
|
// 验证 模型名称/模型类型/基础模型
|
||||||
|
AssertUtils.assertNotEmpty("模型名称不能为空", airagModel.getName());
|
||||||
|
AssertUtils.assertNotEmpty("模型类型不能为空", airagModel.getModelType());
|
||||||
|
AssertUtils.assertNotEmpty("基础模型不能为空", airagModel.getModelName());
|
||||||
|
try {
|
||||||
|
if(LLMConsts.MODEL_TYPE_LLM.equals(airagModel.getModelType())){
|
||||||
|
aiChatHandler.completions(airagModel, Collections.singletonList(UserMessage.from("test connection")), null);
|
||||||
|
}else{
|
||||||
|
AiModelOptions aiModelOptions = EmbeddingHandler.buildModelOptions(airagModel);
|
||||||
|
EmbeddingModel embeddingModel = AiModelFactory.createEmbeddingModel(aiModelOptions);
|
||||||
|
embeddingModel.embed("test text");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("测试模型连接失败", e);
|
||||||
|
return Result.error("测试模型连接失败" + e.getMessage());
|
||||||
|
}
|
||||||
|
return Result.OK("测试模型连接成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,13 +30,14 @@ public class AiragKnowledge implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@Schema(description = "主键")
|
@Schema(description = "主键")
|
||||||
private String id;
|
private java.lang.String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String createBy;
|
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||||
|
private java.lang.String createBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建日期
|
* 创建日期
|
||||||
@ -50,7 +51,7 @@ public class AiragKnowledge implements Serializable {
|
|||||||
* 更新人
|
* 更新人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "更新人")
|
@Schema(description = "更新人")
|
||||||
private String updateBy;
|
private java.lang.String updateBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新日期
|
* 更新日期
|
||||||
@ -64,21 +65,21 @@ public class AiragKnowledge implements Serializable {
|
|||||||
* 所属部门
|
* 所属部门
|
||||||
*/
|
*/
|
||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
private String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
@Excel(name = "租户id", width = 15)
|
@Excel(name = "租户id", width = 15)
|
||||||
@Schema(description = "租户id")
|
@Schema(description = "租户id")
|
||||||
private String tenantId;
|
private java.lang.String tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 知识库名称
|
* 知识库名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "知识库名称", width = 15)
|
@Excel(name = "知识库名称", width = 15)
|
||||||
@Schema(description = "知识库名称")
|
@Schema(description = "知识库名称")
|
||||||
private String name;
|
private java.lang.String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向量模型id
|
* 向量模型id
|
||||||
@ -86,19 +87,19 @@ public class AiragKnowledge implements Serializable {
|
|||||||
@Excel(name = "向量模型id", width = 15, dictTable = "airag_model where model_type = 'EMBED'", dicText = "name", dicCode = "id")
|
@Excel(name = "向量模型id", width = 15, dictTable = "airag_model where model_type = 'EMBED'", dicText = "name", dicCode = "id")
|
||||||
@Dict(dictTable = "airag_model where model_type = 'EMBED'", dicText = "name", dicCode = "id")
|
@Dict(dictTable = "airag_model where model_type = 'EMBED'", dicText = "name", dicCode = "id")
|
||||||
@Schema(description = "向量模型id")
|
@Schema(description = "向量模型id")
|
||||||
private String embedId;
|
private java.lang.String embedId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
@Excel(name = "描述", width = 15)
|
@Excel(name = "描述", width = 15)
|
||||||
@Schema(description = "描述")
|
@Schema(description = "描述")
|
||||||
private String descr;
|
private java.lang.String descr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
@Excel(name = "状态", width = 15)
|
@Excel(name = "状态", width = 15)
|
||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private String status;
|
private java.lang.String status;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package org.jeecg.modules.airag.llm.entity;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
import org.jeecg.common.constant.ProvinceCityArea;
|
import org.jeecg.common.constant.ProvinceCityArea;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -40,6 +41,7 @@ public class AiragKnowledgeDoc implements Serializable {
|
|||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
|
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,9 +121,4 @@ public class AiragKnowledgeDoc implements Serializable {
|
|||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务器基础路径
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String baseUrl;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public class AiragModel implements Serializable {
|
|||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
|
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**
|
/**
|
||||||
* 创建日期
|
* 创建日期
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import org.jeecg.modules.airag.common.handler.AIChatParams;
|
|||||||
import org.jeecg.modules.airag.common.handler.IAIChatHandler;
|
import org.jeecg.modules.airag.common.handler.IAIChatHandler;
|
||||||
import org.jeecg.modules.airag.llm.consts.LLMConsts;
|
import org.jeecg.modules.airag.llm.consts.LLMConsts;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
||||||
import org.jeecg.modules.airag.llm.service.IAiragModelService;
|
import org.jeecg.modules.airag.llm.mapper.AiragModelMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -38,7 +38,7 @@ import java.util.regex.Matcher;
|
|||||||
public class AIChatHandler implements IAIChatHandler {
|
public class AIChatHandler implements IAIChatHandler {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IAiragModelService airagModelService;
|
AiragModelMapper airagModelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EmbeddingHandler embeddingHandler;
|
EmbeddingHandler embeddingHandler;
|
||||||
@ -82,7 +82,7 @@ public class AIChatHandler implements IAIChatHandler {
|
|||||||
AssertUtils.assertNotEmpty("至少发送一条消息", messages);
|
AssertUtils.assertNotEmpty("至少发送一条消息", messages);
|
||||||
AssertUtils.assertNotEmpty("请选择模型", modelId);
|
AssertUtils.assertNotEmpty("请选择模型", modelId);
|
||||||
|
|
||||||
AiragModel airagModel = airagModelService.getById(modelId);
|
AiragModel airagModel = airagModelMapper.getByIdIgnoreTenant(modelId);
|
||||||
return completions(airagModel, messages, params);
|
return completions(airagModel, messages, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public class AIChatHandler implements IAIChatHandler {
|
|||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/2/24 17:30
|
* @date 2025/2/24 17:30
|
||||||
*/
|
*/
|
||||||
private String completions(AiragModel airagModel, List<ChatMessage> messages, AIChatParams params) {
|
public String completions(AiragModel airagModel, List<ChatMessage> messages, AIChatParams params) {
|
||||||
params = mergeParams(airagModel, params);
|
params = mergeParams(airagModel, params);
|
||||||
String resp = llmHandler.completions(messages, params);
|
String resp = llmHandler.completions(messages, params);
|
||||||
if (resp.contains("</think>")
|
if (resp.contains("</think>")
|
||||||
@ -150,7 +150,7 @@ public class AIChatHandler implements IAIChatHandler {
|
|||||||
AssertUtils.assertNotEmpty("至少发送一条消息", messages);
|
AssertUtils.assertNotEmpty("至少发送一条消息", messages);
|
||||||
AssertUtils.assertNotEmpty("请选择模型", modelId);
|
AssertUtils.assertNotEmpty("请选择模型", modelId);
|
||||||
|
|
||||||
AiragModel airagModel = airagModelService.getById(modelId);
|
AiragModel airagModel = airagModelMapper.getByIdIgnoreTenant(modelId);
|
||||||
return chat(airagModel, messages, params);
|
return chat(airagModel, messages, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ public class AIChatHandler implements IAIChatHandler {
|
|||||||
params.setMaxTokens(modelParams.getInteger("maxTokens"));
|
params.setMaxTokens(modelParams.getInteger("maxTokens"));
|
||||||
}
|
}
|
||||||
if (oConvertUtils.isObjectEmpty(params.getTimeout())) {
|
if (oConvertUtils.isObjectEmpty(params.getTimeout())) {
|
||||||
params.setMaxTokens(modelParams.getInteger("timeout"));
|
params.setTimeout(modelParams.getInteger("timeout"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +237,16 @@ public class AIChatHandler implements IAIChatHandler {
|
|||||||
params.setQueryRouter(queryRouter);
|
params.setQueryRouter(queryRouter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置确保maxTokens值正确
|
||||||
|
if (oConvertUtils.isObjectNotEmpty(params.getMaxTokens()) && params.getMaxTokens() <= 0) {
|
||||||
|
params.setMaxTokens(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认超时时间
|
||||||
|
if(oConvertUtils.isObjectEmpty(params.getTimeout())){
|
||||||
|
params.setTimeout(60);
|
||||||
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,9 @@ import org.jeecg.modules.airag.llm.document.TikaDocumentParser;
|
|||||||
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragKnowledgeDoc;
|
import org.jeecg.modules.airag.llm.entity.AiragKnowledgeDoc;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
||||||
|
import org.jeecg.modules.airag.llm.mapper.AiragKnowledgeMapper;
|
||||||
|
import org.jeecg.modules.airag.llm.mapper.AiragModelMapper;
|
||||||
import org.jeecg.modules.airag.llm.service.IAiragKnowledgeService;
|
import org.jeecg.modules.airag.llm.service.IAiragKnowledgeService;
|
||||||
import org.jeecg.modules.airag.llm.service.IAiragModelService;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -69,13 +70,15 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
EmbedStoreConfigBean embedStoreConfigBean;
|
EmbedStoreConfigBean embedStoreConfigBean;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
private AiragModelMapper airagModelMapper;
|
||||||
private IAiragModelService airagModelService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private IAiragKnowledgeService airagKnowledgeService;
|
private IAiragKnowledgeService airagKnowledgeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AiragKnowledgeMapper airagKnowledgeMapper;
|
||||||
|
|
||||||
@Value(value = "${jeecg.path.upload:}")
|
@Value(value = "${jeecg.path.upload:}")
|
||||||
private String uploadpath;
|
private String uploadpath;
|
||||||
|
|
||||||
@ -112,6 +115,13 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
*/
|
*/
|
||||||
private static final ConcurrentHashMap<String, EmbeddingStore<TextSegment>> EMBED_STORE_CACHE = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<String, EmbeddingStore<TextSegment>> EMBED_STORE_CACHE = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正则匹配: md图片
|
||||||
|
* "!\\[(.*?)]\\((.*?)(\\s*=\\d+)?\\)"
|
||||||
|
*/
|
||||||
|
private static final Pattern PATTERN_MD_IMAGE = Pattern.compile("!\\[(.*?)]\\((.*?)\\)");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向量化文档
|
* 向量化文档
|
||||||
*
|
*
|
||||||
@ -183,6 +193,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/2/18 16:52
|
* @date 2025/2/18 16:52
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public KnowledgeSearchResult embeddingSearch(List<String> knowIds, String queryText, Integer topNumber, Double similarity) {
|
public KnowledgeSearchResult embeddingSearch(List<String> knowIds, String queryText, Integer topNumber, Double similarity) {
|
||||||
AssertUtils.assertNotEmpty("请选择知识库", knowIds);
|
AssertUtils.assertNotEmpty("请选择知识库", knowIds);
|
||||||
AssertUtils.assertNotEmpty("请填写查询内容", queryText);
|
AssertUtils.assertNotEmpty("请填写查询内容", queryText);
|
||||||
@ -223,7 +234,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> searchEmbedding(String knowId, String queryText, Integer topNumber, Double similarity) {
|
public List<Map<String, Object>> searchEmbedding(String knowId, String queryText, Integer topNumber, Double similarity) {
|
||||||
AssertUtils.assertNotEmpty("请选择知识库", knowId);
|
AssertUtils.assertNotEmpty("请选择知识库", knowId);
|
||||||
AiragKnowledge knowledge = airagKnowledgeService.getById(knowId);
|
AiragKnowledge knowledge = airagKnowledgeMapper.getByIdIgnoreTenant(knowId);
|
||||||
AssertUtils.assertNotEmpty("知识库不存在", knowledge);
|
AssertUtils.assertNotEmpty("知识库不存在", knowledge);
|
||||||
AssertUtils.assertNotEmpty("请填写查询内容", queryText);
|
AssertUtils.assertNotEmpty("请填写查询内容", queryText);
|
||||||
AiragModel model = getEmbedModelData(knowledge.getEmbedId());
|
AiragModel model = getEmbedModelData(knowledge.getEmbedId());
|
||||||
@ -268,6 +279,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/2/20 21:03
|
* @date 2025/2/20 21:03
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public QueryRouter getQueryRouter(List<String> knowIds, Integer topNumber, Double similarity) {
|
public QueryRouter getQueryRouter(List<String> knowIds, Integer topNumber, Double similarity) {
|
||||||
AssertUtils.assertNotEmpty("请选择知识库", knowIds);
|
AssertUtils.assertNotEmpty("请选择知识库", knowIds);
|
||||||
List<ContentRetriever> retrievers = Lists.newArrayList();
|
List<ContentRetriever> retrievers = Lists.newArrayList();
|
||||||
@ -275,7 +287,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
if (oConvertUtils.isEmpty(knowId)) {
|
if (oConvertUtils.isEmpty(knowId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AiragKnowledge knowledge = airagKnowledgeService.getById(knowId);
|
AiragKnowledge knowledge = airagKnowledgeMapper.getByIdIgnoreTenant(knowId);
|
||||||
AssertUtils.assertNotEmpty("知识库不存在", knowledge);
|
AssertUtils.assertNotEmpty("知识库不存在", knowledge);
|
||||||
AiragModel model = getEmbedModelData(knowledge.getEmbedId());
|
AiragModel model = getEmbedModelData(knowledge.getEmbedId());
|
||||||
AiModelOptions modelOptions = buildModelOptions(model);
|
AiModelOptions modelOptions = buildModelOptions(model);
|
||||||
@ -345,7 +357,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
*/
|
*/
|
||||||
private AiragModel getEmbedModelData(String modelId) {
|
private AiragModel getEmbedModelData(String modelId) {
|
||||||
AssertUtils.assertNotEmpty("向量模型不能为空", modelId);
|
AssertUtils.assertNotEmpty("向量模型不能为空", modelId);
|
||||||
AiragModel model = airagModelService.getById(modelId);
|
AiragModel model = airagModelMapper.getByIdIgnoreTenant(modelId);
|
||||||
AssertUtils.assertNotEmpty("向量模型不存在", model);
|
AssertUtils.assertNotEmpty("向量模型不存在", model);
|
||||||
AssertUtils.assertEquals("仅支持向量模型", LLMConsts.MODEL_TYPE_EMBED, model.getModelType());
|
AssertUtils.assertEquals("仅支持向量模型", LLMConsts.MODEL_TYPE_EMBED, model.getModelType());
|
||||||
return model;
|
return model;
|
||||||
@ -371,6 +383,18 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
|
|
||||||
AiModelOptions modelOp = buildModelOptions(model);
|
AiModelOptions modelOp = buildModelOptions(model);
|
||||||
EmbeddingModel embeddingModel = AiModelFactory.createEmbeddingModel(modelOp);
|
EmbeddingModel embeddingModel = AiModelFactory.createEmbeddingModel(modelOp);
|
||||||
|
|
||||||
|
String tableName = embedStoreConfigBean.getTable();
|
||||||
|
|
||||||
|
// update-begin---author:sunjianlei ---date:20250509 for:【QQYUN-12345】向量模型维度不一致问题
|
||||||
|
// 如果该模型不是默认的向量维度
|
||||||
|
int dimension = embeddingModel.dimension();
|
||||||
|
if (!LLMConsts.EMBED_MODEL_DEFAULT_DIMENSION.equals(dimension)) {
|
||||||
|
// 就加上维度后缀,防止因维度不一致导致保存失败
|
||||||
|
tableName += ("_" + dimension);
|
||||||
|
}
|
||||||
|
// update-end-----author:sunjianlei ---date:20250509 for:【QQYUN-12345】向量模型维度不一致问题
|
||||||
|
|
||||||
EmbeddingStore<TextSegment> embeddingStore = PgVectorEmbeddingStore.builder()
|
EmbeddingStore<TextSegment> embeddingStore = PgVectorEmbeddingStore.builder()
|
||||||
// Connection and table parameters
|
// Connection and table parameters
|
||||||
.host(embedStoreConfigBean.getHost())
|
.host(embedStoreConfigBean.getHost())
|
||||||
@ -378,7 +402,7 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
.database(embedStoreConfigBean.getDatabase())
|
.database(embedStoreConfigBean.getDatabase())
|
||||||
.user(embedStoreConfigBean.getUser())
|
.user(embedStoreConfigBean.getUser())
|
||||||
.password(embedStoreConfigBean.getPassword())
|
.password(embedStoreConfigBean.getPassword())
|
||||||
.table(embedStoreConfigBean.getTable())
|
.table(tableName)
|
||||||
// Embedding dimension
|
// Embedding dimension
|
||||||
// Required: Must match the embedding model’s output dimension
|
// Required: Must match the embedding model’s output dimension
|
||||||
.dimension(embeddingModel.dimension())
|
.dimension(embeddingModel.dimension())
|
||||||
@ -449,16 +473,20 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
String fileType = FilenameUtils.getExtension(docFile.getName());
|
String fileType = FilenameUtils.getExtension(docFile.getName());
|
||||||
if ("md".contains(fileType)) {
|
if ("md".contains(fileType)) {
|
||||||
// 如果是md文件,查找所有图片语法,如果是本地图片,替换成网络图片
|
// 如果是md文件,查找所有图片语法,如果是本地图片,替换成网络图片
|
||||||
String baseUrl = doc.getBaseUrl() + "/sys/common/static/";
|
String baseUrl = "#{domainURL}/sys/common/static/";
|
||||||
String sourcePath = metadataJson.getString(LLMConsts.KNOWLEDGE_DOC_METADATA_SOURCES_PATH);
|
String sourcePath = metadataJson.getString(LLMConsts.KNOWLEDGE_DOC_METADATA_SOURCES_PATH);
|
||||||
if(oConvertUtils.isNotEmpty(sourcePath)) {
|
if(oConvertUtils.isNotEmpty(sourcePath)) {
|
||||||
String escapedPath = uploadpath;
|
String escapedPath = uploadpath;
|
||||||
if (File.separator.equals("\\")){
|
//update-begin---author:wangshuai---date:2025-06-03---for:【QQYUN-12636】【AI知识库】文档库上传 本地local 文档中的图片不展示---
|
||||||
|
/*if (File.separator.equals("\\")){
|
||||||
escapedPath = uploadpath.replace("//", "\\\\");
|
escapedPath = uploadpath.replace("//", "\\\\");
|
||||||
}
|
}*/
|
||||||
|
//update-end---author:wangshuai---date:2025-06-03---for:【QQYUN-12636】【AI知识库】文档库上传 本地local 文档中的图片不展示---
|
||||||
sourcePath = sourcePath.replaceFirst("^" + escapedPath, "").replace("\\", "/");
|
sourcePath = sourcePath.replaceFirst("^" + escapedPath, "").replace("\\", "/");
|
||||||
baseUrl = baseUrl + sourcePath + "/";
|
String docFilePath = metadataJson.getString(LLMConsts.KNOWLEDGE_DOC_METADATA_FILEPATH);
|
||||||
StringBuffer sb = replaceImageUrl(content, baseUrl);
|
docFilePath = FilenameUtils.getPath(docFilePath);
|
||||||
|
docFilePath = docFilePath.replace("\\", "/");
|
||||||
|
StringBuffer sb = replaceImageUrl(content, baseUrl + sourcePath + "/", baseUrl + docFilePath);
|
||||||
content = sb.toString();
|
content = sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,11 +497,9 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static StringBuffer replaceImageUrl(String content, String baseUrl) {
|
private static StringBuffer replaceImageUrl(String content, String abstractBaseUrl, String relativeBaseUrl) {
|
||||||
// 正则表达式匹配md文件中的图片语法 
|
// 正则表达式匹配md文件中的图片语法 
|
||||||
String mdImagePattern = "!\\[(.*?)]\\((.*?)(\\s*=\\d+)?\\)";
|
Matcher matcher = PATTERN_MD_IMAGE.matcher(content);
|
||||||
Pattern pattern = Pattern.compile(mdImagePattern);
|
|
||||||
Matcher matcher = pattern.matcher(content);
|
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
@ -481,7 +507,16 @@ public class EmbeddingHandler implements IEmbeddingHandler {
|
|||||||
// 检查是否是本地图片路径
|
// 检查是否是本地图片路径
|
||||||
if (!imageUrl.startsWith("http")) {
|
if (!imageUrl.startsWith("http")) {
|
||||||
// 替换成网络图片路径
|
// 替换成网络图片路径
|
||||||
String networkImageUrl = baseUrl + imageUrl;
|
String networkImageUrl = abstractBaseUrl + imageUrl;
|
||||||
|
if(imageUrl.startsWith("/")) {
|
||||||
|
// 绝对路径
|
||||||
|
networkImageUrl = abstractBaseUrl + imageUrl;
|
||||||
|
}else{
|
||||||
|
// 相对路径
|
||||||
|
networkImageUrl = relativeBaseUrl + imageUrl;
|
||||||
|
}
|
||||||
|
// 修改图片路径中//->/,但保留http://和https://
|
||||||
|
networkImageUrl = networkImageUrl.replaceAll("(?<!http:)(?<!https:)//", "/");
|
||||||
matcher.appendReplacement(sb, "");
|
matcher.appendReplacement(sb, "");
|
||||||
} else {
|
} else {
|
||||||
matcher.appendReplacement(sb, "");
|
matcher.appendReplacement(sb, "");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.jeecg.modules.airag.llm.mapper;
|
package org.jeecg.modules.airag.llm.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
||||||
|
|
||||||
@ -11,4 +12,14 @@ import org.jeecg.modules.airag.llm.entity.AiragKnowledge;
|
|||||||
*/
|
*/
|
||||||
public interface AiragKnowledgeMapper extends BaseMapper<AiragKnowledge> {
|
public interface AiragKnowledgeMapper extends BaseMapper<AiragKnowledge> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询知识库信息(忽略租户)
|
||||||
|
* for [QQYUN-12113]分享之后的聊天,应用、模型、知识库不根据租户查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/21 15:24
|
||||||
|
*/
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
AiragKnowledge getByIdIgnoreTenant(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.jeecg.modules.airag.llm.mapper;
|
package org.jeecg.modules.airag.llm.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
import org.jeecg.modules.airag.llm.entity.AiragModel;
|
||||||
|
|
||||||
@ -11,4 +12,14 @@ import org.jeecg.modules.airag.llm.entity.AiragModel;
|
|||||||
*/
|
*/
|
||||||
public interface AiragModelMapper extends BaseMapper<AiragModel> {
|
public interface AiragModelMapper extends BaseMapper<AiragModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询模型信息(忽略租户)
|
||||||
|
* for [QQYUN-12113]分享之后的聊天,应用、模型、知识库不根据租户查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/21 15:24
|
||||||
|
*/
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
AiragModel getByIdIgnoreTenant(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,4 +2,8 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.airag.llm.mapper.AiragKnowledgeMapper">
|
<mapper namespace="org.jeecg.modules.airag.llm.mapper.AiragKnowledgeMapper">
|
||||||
|
|
||||||
|
<select id="getByIdIgnoreTenant" resultType="org.jeecg.modules.airag.llm.entity.AiragKnowledge">
|
||||||
|
SELECT * FROM airag_knowledge WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -2,4 +2,8 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.airag.llm.mapper.AiragModelMapper">
|
<mapper namespace="org.jeecg.modules.airag.llm.mapper.AiragModelMapper">
|
||||||
|
|
||||||
|
<select id="getByIdIgnoreTenant" resultType="org.jeecg.modules.airag.llm.entity.AiragModel">
|
||||||
|
SELECT * FROM airag_model WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -67,6 +67,14 @@ public interface IAiragKnowledgeDocService extends IService<AiragKnowledgeDoc> {
|
|||||||
*/
|
*/
|
||||||
Result<?> removeDocByIds(List<String> docIds);
|
Result<?> removeDocByIds(List<String> docIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过知识库id删除所以文档
|
||||||
|
*
|
||||||
|
* @param knowId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Result<?> deleteAllByKnowId(String knowId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从zip包导入文档
|
* 从zip包导入文档
|
||||||
* @param knowId
|
* @param knowId
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.jeecg.modules.airag.llm.service.impl;
|
package org.jeecg.modules.airag.llm.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||||
|
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.config.TenantContext;
|
import org.jeecg.common.config.TenantContext;
|
||||||
@ -26,9 +29,12 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@ -36,8 +42,6 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
|
|
||||||
import static org.jeecg.modules.airag.llm.consts.LLMConsts.*;
|
import static org.jeecg.modules.airag.llm.consts.LLMConsts.*;
|
||||||
|
|
||||||
@ -79,6 +83,12 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
*/
|
*/
|
||||||
private static final ExecutorService buildDocExecutorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
|
private static final ExecutorService buildDocExecutorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
|
||||||
|
|
||||||
|
// 解压文件:单个文件最大150MB
|
||||||
|
private static final long MAX_FILE_SIZE = 150 * 1024 * 1024;
|
||||||
|
// 解压文件:总解压大小1024MB
|
||||||
|
private static final long MAX_TOTAL_SIZE = 1024 * 1024 * 1024;
|
||||||
|
// 解压文件:最多解压10000个Entry
|
||||||
|
private static final int MAX_ENTRY_COUNT = 10000;
|
||||||
|
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
@Override
|
@Override
|
||||||
@ -122,7 +132,6 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
AssertUtils.assertNotEmpty("文档不存在", docList);
|
AssertUtils.assertNotEmpty("文档不存在", docList);
|
||||||
|
|
||||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||||
String baseUrl = CommonUtils.getBaseUrl(request);
|
|
||||||
// 检查状态
|
// 检查状态
|
||||||
List<AiragKnowledgeDoc> knowledgeDocs = docList.stream()
|
List<AiragKnowledgeDoc> knowledgeDocs = docList.stream()
|
||||||
.filter(doc -> {
|
.filter(doc -> {
|
||||||
@ -143,7 +152,6 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
})
|
})
|
||||||
.peek(doc -> {
|
.peek(doc -> {
|
||||||
doc.setStatus(KNOWLEDGE_DOC_STATUS_BUILDING);
|
doc.setStatus(KNOWLEDGE_DOC_STATUS_BUILDING);
|
||||||
doc.setBaseUrl(baseUrl);
|
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (oConvertUtils.isObjectEmpty(knowledgeDocs)) {
|
if (oConvertUtils.isObjectEmpty(knowledgeDocs)) {
|
||||||
@ -174,13 +182,11 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
this.updateById(doc);
|
this.updateById(doc);
|
||||||
log.info("重建文档成功, 知识库id: {}, 文档id: {}", knowId, doc.getId());
|
log.info("重建文档成功, 知识库id: {}, 文档id: {}", knowId, doc.getId());
|
||||||
} else {
|
} else {
|
||||||
doc.setStatus(KNOWLEDGE_DOC_STATUS_DRAFT);
|
this.handleDocBuildFailed(doc, "向量化失败");
|
||||||
this.updateById(doc);
|
|
||||||
log.info("重建文档失败, 知识库id: {}, 文档id: {}", knowId, doc.getId());
|
log.info("重建文档失败, 知识库id: {}, 文档id: {}", knowId, doc.getId());
|
||||||
}
|
}
|
||||||
}catch (Throwable t){
|
}catch (Throwable t){
|
||||||
doc.setStatus(KNOWLEDGE_DOC_STATUS_DRAFT);
|
this.handleDocBuildFailed(doc, t.getMessage());
|
||||||
this.updateById(doc);
|
|
||||||
log.error("重建文档失败:" + t.getMessage() + ", 知识库id: " + knowId + ", 文档id: " + doc.getId(), t);
|
log.error("重建文档失败:" + t.getMessage() + ", 知识库id: " + knowId + ", 文档id: " + doc.getId(), t);
|
||||||
}
|
}
|
||||||
//update-end---author:chenrui ---date:20250410 for:[QQYUN-11943]【ai】ai知识库 上传完文档 一直显示构建中?------------
|
//update-end---author:chenrui ---date:20250410 for:[QQYUN-11943]【ai】ai知识库 上传完文档 一直显示构建中?------------
|
||||||
@ -190,6 +196,24 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
return Result.ok("操作成功");
|
return Result.ok("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理文档构建失败
|
||||||
|
*/
|
||||||
|
private void handleDocBuildFailed(AiragKnowledgeDoc doc, String failedReason) {
|
||||||
|
doc.setStatus(KNOWLEDGE_DOC_STATUS_FAILED);
|
||||||
|
|
||||||
|
String metadataStr = doc.getMetadata();
|
||||||
|
JSONObject metadata;
|
||||||
|
if (oConvertUtils.isEmpty(metadataStr)) {
|
||||||
|
metadata = new JSONObject();
|
||||||
|
} else {
|
||||||
|
metadata = JSONObject.parseObject(metadataStr);
|
||||||
|
}
|
||||||
|
metadata.put("failedReason", failedReason);
|
||||||
|
doc.setMetadata(metadata.toJSONString());
|
||||||
|
|
||||||
|
this.updateById(doc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<?> removeByKnowIds(List<String> knowIds) {
|
public Result<?> removeByKnowIds(List<String> knowIds) {
|
||||||
@ -198,8 +222,16 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
AiragKnowledge airagKnowledge = airagKnowledgeMapper.selectById(knowId);
|
AiragKnowledge airagKnowledge = airagKnowledgeMapper.selectById(knowId);
|
||||||
AssertUtils.assertNotEmpty("知识库不存在", airagKnowledge);
|
AssertUtils.assertNotEmpty("知识库不存在", airagKnowledge);
|
||||||
AssertUtils.assertNotEmpty("请先为知识库配置向量模型库", airagKnowledge.getEmbedId());
|
AssertUtils.assertNotEmpty("请先为知识库配置向量模型库", airagKnowledge.getEmbedId());
|
||||||
|
// 异步删除向量数据
|
||||||
|
final String embedId = airagKnowledge.getEmbedId();
|
||||||
|
final String finalKnowId = knowId;
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
embeddingHandler.deleteEmbedDocsByKnowId(finalKnowId, embedId);
|
||||||
|
} catch (Throwable ignore) {
|
||||||
|
}
|
||||||
|
});
|
||||||
// 删除数据
|
// 删除数据
|
||||||
embeddingHandler.deleteEmbedDocsByKnowId(knowId, airagKnowledge.getEmbedId());
|
|
||||||
airagKnowledgeDocMapper.deleteByMainId(knowId);
|
airagKnowledgeDocMapper.deleteByMainId(knowId);
|
||||||
}
|
}
|
||||||
return Result.OK();
|
return Result.OK();
|
||||||
@ -223,13 +255,39 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
AiragKnowledge airagKnowledge = airagKnowledgeMapper.selectById(knowId);
|
AiragKnowledge airagKnowledge = airagKnowledgeMapper.selectById(knowId);
|
||||||
AssertUtils.assertNotEmpty("知识库不存在", airagKnowledge);
|
AssertUtils.assertNotEmpty("知识库不存在", airagKnowledge);
|
||||||
AssertUtils.assertNotEmpty("请先为知识库配置向量模型库", airagKnowledge.getEmbedId());
|
AssertUtils.assertNotEmpty("请先为知识库配置向量模型库", airagKnowledge.getEmbedId());
|
||||||
|
// 异步删除向量数据
|
||||||
|
final String embedId = airagKnowledge.getEmbedId();
|
||||||
|
final List<String> docIdsToDelete = new ArrayList<>(groupedDocIds);
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
embeddingHandler.deleteEmbedDocsByDocIds(docIdsToDelete, embedId);
|
||||||
|
} catch (Throwable ignore) {
|
||||||
|
}
|
||||||
|
});
|
||||||
// 删除数据
|
// 删除数据
|
||||||
embeddingHandler.deleteEmbedDocsByDocIds(groupedDocIds, airagKnowledge.getEmbedId());
|
|
||||||
airagKnowledgeDocMapper.deleteBatchIds(groupedDocIds);
|
airagKnowledgeDocMapper.deleteBatchIds(groupedDocIds);
|
||||||
});
|
});
|
||||||
return Result.ok("success");
|
return Result.ok("success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> deleteAllByKnowId(String knowId) {
|
||||||
|
if (oConvertUtils.isEmpty(knowId)) {
|
||||||
|
return Result.error("知识库id不能为空");
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<AiragKnowledgeDoc> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(AiragKnowledgeDoc::getKnowledgeId, knowId);
|
||||||
|
//noinspection unchecked
|
||||||
|
wrapper.select(AiragKnowledgeDoc::getId);
|
||||||
|
List<AiragKnowledgeDoc> docList = airagKnowledgeDocMapper.selectList(wrapper);
|
||||||
|
if (docList.isEmpty()) {
|
||||||
|
return Result.ok("暂无文档");
|
||||||
|
}
|
||||||
|
List<String> docIds = docList.stream().map(AiragKnowledgeDoc::getId).collect(Collectors.toList());
|
||||||
|
this.removeDocByIds(docIds);
|
||||||
|
return Result.ok("清空完成");
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = {java.lang.Exception.class})
|
@Transactional(rollbackFor = {java.lang.Exception.class})
|
||||||
@Override
|
@Override
|
||||||
public Result<?> importDocumentFromZip(String knowId, MultipartFile zipFile) {
|
public Result<?> importDocumentFromZip(String knowId, MultipartFile zipFile) {
|
||||||
@ -283,6 +341,7 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
doc.setMetadata(metadata.toJSONString());
|
doc.setMetadata(metadata.toJSONString());
|
||||||
docList.add(doc);
|
docList.add(doc);
|
||||||
});
|
});
|
||||||
|
AssertUtils.assertNotEmpty("压缩包中没有符合要求的文档", docList);
|
||||||
// 保存数据
|
// 保存数据
|
||||||
this.saveBatch(docList);
|
this.saveBatch(docList);
|
||||||
// 重建文档
|
// 重建文档
|
||||||
@ -299,57 +358,113 @@ public class AiragKnowledgeDocServiceImpl extends ServiceImpl<AiragKnowledgeDocM
|
|||||||
/**
|
/**
|
||||||
* 解压缩文件
|
* 解压缩文件
|
||||||
*
|
*
|
||||||
* @param zipFilePath
|
* @param zipFilePath 压缩文件路径
|
||||||
* @param destDir
|
* @param destDir 目标文件夹
|
||||||
* @param afterExtract
|
* @param afterExtract 解压完成后回调
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @author chenrui
|
* @author chenrui
|
||||||
* @date 2025/3/20 14:37
|
* @date 2025/3/20 14:37
|
||||||
*/
|
*/
|
||||||
public static void unzipFile(String zipFilePath, String destDir, Consumer<File> afterExtract) throws
|
public static void unzipFile(String zipFilePath, String destDir, Consumer<File> afterExtract) throws IOException {
|
||||||
IOException {
|
unzipFile(Paths.get(zipFilePath), Paths.get(destDir), afterExtract);
|
||||||
// 创建目标目录
|
|
||||||
File dir = new File(destDir);
|
|
||||||
if (!dir.exists()) {
|
|
||||||
dir.mkdirs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try (ZipFile zipFile = new ZipFile(zipFilePath)) {
|
|
||||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
/**
|
||||||
byte[] buffer = new byte[1024];
|
* 解压缩文件
|
||||||
|
*
|
||||||
|
* @param zipFilePath 压缩文件路径
|
||||||
|
* @param targetDir 目标文件夹
|
||||||
|
* @param afterExtract 解压完成后回调
|
||||||
|
* @throws IOException
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/28 17:02
|
||||||
|
*/
|
||||||
|
private static void unzipFile(Path zipFilePath, Path targetDir, Consumer<File> afterExtract) throws IOException {
|
||||||
|
long totalUnzippedSize = 0;
|
||||||
|
int entryCount = 0;
|
||||||
|
|
||||||
|
if (!Files.exists(targetDir)) {
|
||||||
|
Files.createDirectories(targetDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ZipFile zipFile = new ZipFile(zipFilePath.toFile())) {
|
||||||
|
Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
|
||||||
|
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
ZipEntry ze = entries.nextElement();
|
ZipArchiveEntry entry = entries.nextElement();
|
||||||
File newFile = new File(destDir, ze.getName());
|
entryCount++;
|
||||||
|
if (entryCount > MAX_ENTRY_COUNT) {
|
||||||
// 预防 ZIP 路径穿越攻击
|
throw new IOException("解压文件数量超限,可能是zip bomb攻击");
|
||||||
String canonicalDestDirPath = dir.getCanonicalPath();
|
|
||||||
String canonicalFilePath = newFile.getCanonicalPath();
|
|
||||||
if (!canonicalFilePath.startsWith(canonicalDestDirPath + File.separator)) {
|
|
||||||
throw new IOException("ZIP 路径穿越攻击被阻止: " + ze.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ze.isDirectory()) {
|
Path newPath = safeResolve(targetDir, entry.getName());
|
||||||
newFile.mkdirs();
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
Files.createDirectories(newPath);
|
||||||
} else {
|
} else {
|
||||||
// 创建父目录
|
Files.createDirectories(newPath.getParent());
|
||||||
new File(newFile.getParent()).mkdirs();
|
try (InputStream is = zipFile.getInputStream(entry);
|
||||||
|
OutputStream os = Files.newOutputStream(newPath)) {
|
||||||
|
|
||||||
// 读取 ZIP 文件并写入新文件
|
long bytesCopied = copyLimited(is, os, MAX_FILE_SIZE);
|
||||||
try (InputStream zis = zipFile.getInputStream(ze);
|
totalUnzippedSize += bytesCopied;
|
||||||
FileOutputStream fos = new FileOutputStream(newFile)) {
|
|
||||||
int len;
|
if (totalUnzippedSize > MAX_TOTAL_SIZE) {
|
||||||
while ((len = zis.read(buffer)) > 0) {
|
throw new IOException("解压总大小超限,可能是zip bomb攻击");
|
||||||
fos.write(buffer, 0, len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解压完成后回调
|
||||||
if (afterExtract != null) {
|
if (afterExtract != null) {
|
||||||
afterExtract.accept(newFile);
|
afterExtract.accept(newPath.toFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全解析路径,防止Zip Slip攻击
|
||||||
|
*
|
||||||
|
* @param targetDir
|
||||||
|
* @param entryName
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/28 16:46
|
||||||
|
*/
|
||||||
|
private static Path safeResolve(Path targetDir, String entryName) throws IOException {
|
||||||
|
Path resolvedPath = targetDir.resolve(entryName).normalize();
|
||||||
|
if (!resolvedPath.startsWith(targetDir)) {
|
||||||
|
throw new IOException("ZIP 路径穿越攻击被阻止:" + entryName);
|
||||||
|
}
|
||||||
|
return resolvedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制输入流到输出流,并限制最大字节数
|
||||||
|
*
|
||||||
|
* @param in
|
||||||
|
* @param out
|
||||||
|
* @param maxBytes
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/4/28 17:03
|
||||||
|
*/
|
||||||
|
private static long copyLimited(InputStream in, OutputStream out, long maxBytes) throws IOException {
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
long totalCopied = 0;
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = in.read(buffer)) != -1) {
|
||||||
|
totalCopied += bytesRead;
|
||||||
|
if (totalCopied > maxBytes) {
|
||||||
|
throw new IOException("单个文件解压超限,可能是zip bomb攻击");
|
||||||
|
}
|
||||||
|
out.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
return totalCopied;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +0,0 @@
|
|||||||
package org.jeecg.modules.airag.llm.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 知识库查询返回结果
|
|
||||||
*
|
|
||||||
* @Author: chenrui
|
|
||||||
* @Date: 2025/2/18 17:53
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class KnowledgeSearchResult {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 命中的文档内容
|
|
||||||
*/
|
|
||||||
String data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 命中的文档列表
|
|
||||||
*/
|
|
||||||
List<Map<String, Object>> documents;
|
|
||||||
|
|
||||||
public KnowledgeSearchResult(String data, List<Map<String, Object>> documents) {
|
|
||||||
this.data = data;
|
|
||||||
this.documents = documents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package org.jeecg.modules.airag.ocr.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.util.RedisUtil;
|
||||||
|
import org.jeecg.modules.airag.ocr.entity.AiOcr;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/airag/ocr")
|
||||||
|
public class AiOcrController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
private static final String AI_OCR_REDIS_KEY = "airag:ocr";
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<?> list(){
|
||||||
|
Object aiOcr = redisUtil.get(AI_OCR_REDIS_KEY);
|
||||||
|
IPage<AiOcr> page = new Page<>(1,10);
|
||||||
|
if(null != aiOcr){
|
||||||
|
List<AiOcr> aiOcrList = JSONObject.parseArray(aiOcr.toString(), AiOcr.class);
|
||||||
|
page.setRecords(aiOcrList);
|
||||||
|
page.setTotal(aiOcrList.size());
|
||||||
|
page.setPages(aiOcrList.size());
|
||||||
|
}
|
||||||
|
return Result.OK(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<String> add(@RequestBody AiOcr aiOcr){
|
||||||
|
Object aiOcrList = redisUtil.get(AI_OCR_REDIS_KEY);
|
||||||
|
aiOcr.setId(UUID.randomUUID().toString().replace("-",""));
|
||||||
|
if(null == aiOcrList){
|
||||||
|
List<AiOcr> list = new ArrayList<>();
|
||||||
|
list.add(aiOcr);
|
||||||
|
redisUtil.set(AI_OCR_REDIS_KEY, JSONObject.toJSONString(list));
|
||||||
|
}else{
|
||||||
|
List<AiOcr> aiOcrs = JSONObject.parseArray(aiOcrList.toString(), AiOcr.class);
|
||||||
|
aiOcrs.add(aiOcr);
|
||||||
|
redisUtil.set(AI_OCR_REDIS_KEY,JSONObject.toJSONString(aiOcrs));
|
||||||
|
}
|
||||||
|
return Result.OK("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/edit")
|
||||||
|
public Result<String> updateById(@RequestBody AiOcr aiOcr){
|
||||||
|
Object aiOcrList = redisUtil.get(AI_OCR_REDIS_KEY);
|
||||||
|
if(null != aiOcrList){
|
||||||
|
List<AiOcr> aiOcrs = JSONObject.parseArray(aiOcrList.toString(), AiOcr.class);
|
||||||
|
aiOcrs.forEach(item->{
|
||||||
|
if(item.getId().equals(aiOcr.getId())){
|
||||||
|
BeanUtils.copyProperties(aiOcr,item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
redisUtil.set(AI_OCR_REDIS_KEY,JSONObject.toJSONString(aiOcrs));
|
||||||
|
}else{
|
||||||
|
return Result.OK("编辑失败,未找到该数据");
|
||||||
|
}
|
||||||
|
return Result.OK("编辑成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/deleteById")
|
||||||
|
public Result<String> deleteById(@RequestBody AiOcr aiOcr){
|
||||||
|
Object aiOcrObj = redisUtil.get(AI_OCR_REDIS_KEY);
|
||||||
|
if(null != aiOcrObj){
|
||||||
|
List<AiOcr> aiOcrs = JSONObject.parseArray(aiOcrObj.toString(), AiOcr.class);
|
||||||
|
List<AiOcr> aiOcrList = new ArrayList<>();
|
||||||
|
for(AiOcr ocr: aiOcrs){
|
||||||
|
if(!ocr.getId().equals(aiOcr.getId())){
|
||||||
|
aiOcrList.add(ocr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(aiOcrList)){
|
||||||
|
redisUtil.set(AI_OCR_REDIS_KEY,JSONObject.toJSONString(aiOcrList));
|
||||||
|
}else{
|
||||||
|
redisUtil.removeAll(AI_OCR_REDIS_KEY);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return Result.OK("删除失败,未找到该数据");
|
||||||
|
}
|
||||||
|
return Result.OK("删除成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package org.jeecg.modules.airag.ocr.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: OCR识别实体类
|
||||||
|
*
|
||||||
|
* @author: wangshuai
|
||||||
|
* @date: 2025/4/16 17:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AiOcr {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示词
|
||||||
|
*/
|
||||||
|
private String prompt;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,78 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false">
|
|
||||||
<!--定义日志文件的存储地址 -->
|
|
||||||
<property name="LOG_HOME" value="../logs" />
|
|
||||||
|
|
||||||
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
|
||||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
|
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
|
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 按照每天生成日志文件 -->
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<!--日志文件输出的文件名 -->
|
|
||||||
<FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
|
||||||
<!--日志文件保留天数 -->
|
|
||||||
<MaxHistory>30</MaxHistory>
|
|
||||||
<maxFileSize>10MB</maxFileSize>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
|
||||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 生成 error html格式日志开始 -->
|
|
||||||
<appender name="HTML" class="ch.qos.logback.core.FileAppender">
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<!--设置日志级别,过滤掉info日志,只输入error日志-->
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
||||||
<layout class="ch.qos.logback.classic.html.HTMLLayout">
|
|
||||||
<pattern>%p%d%msg%M%F{32}%L</pattern>
|
|
||||||
</layout>
|
|
||||||
</encoder>
|
|
||||||
<file>${LOG_HOME}/error-log.html</file>
|
|
||||||
</appender>
|
|
||||||
<!-- 生成 error html格式日志结束 -->
|
|
||||||
|
|
||||||
<!-- 每天生成一个html格式的日志开始 -->
|
|
||||||
<appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<!--日志文件输出的文件名 -->
|
|
||||||
<FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
|
|
||||||
<!--日志文件保留天数 -->
|
|
||||||
<MaxHistory>30</MaxHistory>
|
|
||||||
<MaxFileSize>10MB</MaxFileSize>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
||||||
<layout class="ch.qos.logback.classic.html.HTMLLayout">
|
|
||||||
<pattern>%p%d%msg%M%F{32}%L</pattern>
|
|
||||||
</layout>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
<!-- 每天生成一个html格式的日志结束 -->
|
|
||||||
|
|
||||||
<!--myibatis log configure -->
|
|
||||||
<logger name="com.apache.ibatis" level="TRACE" />
|
|
||||||
<logger name="java.sql.Connection" level="DEBUG" />
|
|
||||||
<logger name="java.sql.Statement" level="DEBUG" />
|
|
||||||
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
|
||||||
<logger name="logging.level.dev.langchain4j" level="DEBUG" />
|
|
||||||
<logger name="logging.level.dev.ai4j.openai4j" level="DEBUG" />
|
|
||||||
<!-- 日志输出级别 -->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="STDOUT" />
|
|
||||||
<!-- <appender-ref ref="FILE" />-->
|
|
||||||
<!-- <appender-ref ref="HTML" />-->
|
|
||||||
<!-- <appender-ref ref="FILE_HTML" />-->
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
@ -1,7 +1,10 @@
|
|||||||
//package org.jeecg.modules.airag.test;
|
//package org.jeecg.modules.airag.test;
|
||||||
//
|
//
|
||||||
|
//import dev.langchain4j.agent.tool.ToolParameters;
|
||||||
|
//import dev.langchain4j.agent.tool.ToolSpecification;
|
||||||
//import dev.langchain4j.data.message.*;
|
//import dev.langchain4j.data.message.*;
|
||||||
//import dev.langchain4j.model.chat.ChatLanguageModel;
|
//import dev.langchain4j.model.chat.ChatLanguageModel;
|
||||||
|
//import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
|
||||||
//import dev.langchain4j.model.openai.OpenAiChatModel;
|
//import dev.langchain4j.model.openai.OpenAiChatModel;
|
||||||
//import dev.langchain4j.model.output.Response;
|
//import dev.langchain4j.model.output.Response;
|
||||||
//import dev.langchain4j.service.AiServices;
|
//import dev.langchain4j.service.AiServices;
|
||||||
@ -12,15 +15,13 @@
|
|||||||
//import org.jeecg.ai.factory.AiModelOptions;
|
//import org.jeecg.ai.factory.AiModelOptions;
|
||||||
//import org.jeecg.ai.handler.AIParams;
|
//import org.jeecg.ai.handler.AIParams;
|
||||||
//import org.jeecg.ai.handler.LLMHandler;
|
//import org.jeecg.ai.handler.LLMHandler;
|
||||||
//import org.jeecg.modules.airag.llm.handler.AIChatParams;
|
//import org.junit.jupiter.api.Test;
|
||||||
//import org.junit.Test;
|
|
||||||
//
|
//
|
||||||
//import java.io.IOException;
|
//import java.io.IOException;
|
||||||
|
//import java.io.Serial;
|
||||||
//import java.nio.file.Files;
|
//import java.nio.file.Files;
|
||||||
//import java.nio.file.Paths;
|
//import java.nio.file.Paths;
|
||||||
//import java.util.ArrayList;
|
//import java.util.*;
|
||||||
//import java.util.Base64;
|
|
||||||
//import java.util.Collections;
|
|
||||||
//import java.util.concurrent.ConcurrentHashMap;
|
//import java.util.concurrent.ConcurrentHashMap;
|
||||||
//import java.util.concurrent.CountDownLatch;
|
//import java.util.concurrent.CountDownLatch;
|
||||||
//
|
//
|
||||||
@ -174,4 +175,51 @@
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
// @Test
|
||||||
|
// public void testFuncCalling() {
|
||||||
|
// String apiKey = "sk-";
|
||||||
|
// String baseUrl = "https://api.v3.cm/v1";
|
||||||
|
// String modelName = "gpt-4o-mini";
|
||||||
|
// double temperature = 0.7;
|
||||||
|
// ChatLanguageModel llmModel = OpenAiChatModel.builder()
|
||||||
|
// .apiKey(apiKey)
|
||||||
|
// .baseUrl(baseUrl)
|
||||||
|
// .modelName(modelName)
|
||||||
|
// .temperature(temperature)
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// List<ToolSpecification> toolSpecifications = new ArrayList<>();
|
||||||
|
// Map<String, Map<String, Object>> properties = new ConcurrentHashMap<>();
|
||||||
|
//
|
||||||
|
// properties.put("location", new HashMap<>() {
|
||||||
|
// @Serial
|
||||||
|
// private static final long serialVersionUID = -8440944665582258534L;
|
||||||
|
// {
|
||||||
|
// put("type", "string");
|
||||||
|
// put("description", "The city and state, e.g. San Francisco, CA");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// ToolSpecification toolSpecification = ToolSpecification.builder()
|
||||||
|
// .name("get_current_weather")
|
||||||
|
// .description("Get the current weather in a given location")
|
||||||
|
// .parameters(ToolParameters.builder()
|
||||||
|
// .properties(properties)
|
||||||
|
// .required(List.of("location"))
|
||||||
|
// .type("string")
|
||||||
|
// .build())
|
||||||
|
// .build();
|
||||||
|
// toolSpecifications.add(toolSpecification);
|
||||||
|
//
|
||||||
|
// List<ChatMessage> messages = new ArrayList<>();
|
||||||
|
// messages.add(UserMessage.from("How is the weather in Beijing today?"));
|
||||||
|
//
|
||||||
|
// Response<AiMessage> resp = llmModel.generate(messages, toolSpecifications);
|
||||||
|
// System.out.println(resp);
|
||||||
|
//
|
||||||
|
// /*Response { content = AiMessage { text = null
|
||||||
|
// toolExecutionRequests = [ToolExecutionRequest { id = "call_hjPaRh9WAHv6Ib7KpgHpp8Tl", name = "get_current_weather", arguments = "{"location":"Beijing, China"}" }] },
|
||||||
|
// tokenUsage = TokenUsage { inputTokenCount = 69, outputTokenCount = 19, totalTokenCount = 88 }, finishReason = TOOL_EXECUTION, metadata = {} }*/
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
//}
|
//}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,97 +0,0 @@
|
|||||||
常见问题
|
|
||||||
1.pnpm安装依赖报错
|
|
||||||
错误: node\_modules\\vite\\node\_modules\\esbuild\\esbuild.exe ENOENT
|
|
||||||
解决方案:https://blog.csdn.net/weixin_41760500/article/details/119885574
命令:node ./node_modules/esbuild/install.js
|
|
||||||
2.pnpm安装后,访问提示缺少依赖
|
|
||||||
解决方案: https://stackoverflow.com/questions/70597494/pnpm-does-not-resolve-dependencies
|
|
||||||
3.pnpm install出现错误
|
|
||||||
错误:ERR\_PNPM\_PEER\_DEP\_ISSUES Unmet peer dependencies
|
|
||||||
http://ms521.cn/index.php/Home/Index/article/aid/271
|
|
||||||
4.项目安装依赖无问题,访问页面报错
|
|
||||||
前端部分报错:
|
|
||||||
[plugin:vite:vue-jsx] Cannot find package 'C:\Users\123\Desktop\JeecgBoot-master\pincone_system\jeecgboot-vue3\node_modules\.pnpm\@vitejs+plugin-vue-jsx@3.1.0_vite@5.4.9_@types+node@20.16.13_less@4.2.0_terser@5.36.0__vue@3.5.12_typescript@4.9.5_\node_modules\@babel\plugin-transform-typescript\lib\index.js' imported from C:\Users\123\Desktop\JeecgBoot-master\pincone_system\jeecgboot-vue3\node_modules\.pnpm\@vitejs+plugin-vue-jsx@3.1.0_vite@5.4.9_@types+node@20.16.13_less@4.2.0_terser@5.36.0__vue@3.5.12_typescript@4.9.5_\node_modules\@vitejs\plugin-vue-jsx\dist\index.cjs Did you mean to import "@babel/plugin-transform-typescript/lib/index.js"? #7396
|
|
||||||
回答: 是因为项目的路径太长导致 ,相关问题Issues,查看相关博客
|
|
||||||
• https://blog.csdn.net/weixin_43235500/article/details/142144989
|
|
||||||
• https://blog.csdn.net/qq_25996219/article/details/140328092
|
|
||||||
5. 通过npm install启动报错
|
|
||||||
建议:请使用pnpm i 可以避免更多问题
|
|
||||||
错误情况:
|
|
||||||
解决:进入提示的路径 \node_modules\vite-plugin-mock\node_modules\esbuild\
执行命令: node install.js
再启动就好了
|
|
||||||
6. 前端刷新进不了登录页面
|
|
||||||
报错props.ts:15 Uncaught (in promise) SyntaxError: Unexpected token '='
错误截图:
|
|
||||||
原因:谷歌浏览器版本过低,升级浏览器
比如这边版本就过低了
|
|
||||||
|
|
||||||
7.表单如何全部禁用
|
|
||||||
加上这个属性就可以了
|
|
||||||
效果
|
|
||||||
8.table列表如何自定义排序
|
|
||||||
defSort: {
|
|
||||||
column: 'id',
|
|
||||||
order: 'desc',
|
|
||||||
},
|
|
||||||
参考示例:
|
|
||||||
|
|
||||||
9.idea编写js时爆红,提示statement expected
|
|
||||||
https://blog.csdn.net/mlsama/article/details/80633009
|
|
||||||
10.抽屉的setDrawerProps不好使(值会还原)
|
|
||||||
|
|
||||||
11. 如何删除不需要的demo,制作一个精简版本
|
|
||||||
精简项目,删除demo等非必须功能
|
|
||||||
12.vue3 暗黑模式下显示不完整
|
|
||||||
错误示例:
|
|
||||||
|
|
||||||
解决方案:
|
|
||||||
在样式中的字体颜色和背景颜色使用@变量名称来代替
|
|
||||||
color: @text-color;
|
|
||||||
background-color: @component-background;
|
|
||||||
|
|
||||||
[info] 通用样式变量名称可以在在目录bulid->vite->plugin->themes.ts中找到,darkModifyVars是重写antd中的样式
|
|
||||||
|
|
||||||
[info]更多样式变量名称请参考目录node_modules/es/style/themes/default.less
|
|
||||||
改造完成之后的效果
|
|
||||||
|
|
||||||
13.操作列“删除按钮”界面布局异常
|
|
||||||
相关issue
|
|
||||||
https://github.com/jeecgboot/jeecgboot-vue3/issues/458
|
|
||||||
问题截图:
|
|
||||||
|
|
||||||
解决方案:找到popConfirm填写属性placement: 'left'
|
|
||||||
placement: 'left',
|
|
||||||
|
|
||||||
效果截图
|
|
||||||
|
|
||||||
14.在centos7中下载依赖pnpm i时 mozjpeg依赖下载不下来
|
|
||||||
https://github.com/jeecgboot/jeecgboot-vue3/issues/433#issuecomment-1510470534
|
|
||||||
15.日期遮挡问题
|
|
||||||
问题截图:
下拉显示组件,页面滚动时,页面出现错位遮挡问题
|
|
||||||
|
|
||||||
解决方案:将组件挂载到父节点上
|
|
||||||
getPopupContainer: (node) => node.parentNode,
|
|
||||||
效果截图
|
|
||||||
|
|
||||||
16.nextTick作用
|
|
||||||
在 Vue 3 中,nextTick 方法用于在 DOM 更新之后执行回调函数。它的作用是在下次 DOM 更新循环结束后执行一些操作,以确保你在操作更新的 DOM 元素时能够获取到最新的结果。
nextTick 方法可以用于以下情况:
|
|
||||||
1 在更新数据后立即操作 DOM 元素。
|
|
||||||
2 在更新组件后执行某些逻辑或触发一些副作用。
|
|
||||||
3 在更新后获取更新后的 DOM 元素的尺寸或位置等信息。
|
|
||||||
使用nextTick 方法有两种方式:
1.使用回调函数:
|
|
||||||
nextTick(()=>
|
|
||||||
//在DOM更新后执行的操作
|
|
||||||
}):
|
|
||||||
2.使用Promise:
|
|
||||||
nextTick().then(()=>
|
|
||||||
//在DOM更新后执行的操作
|
|
||||||
})
|
|
||||||
无论使用哪种方式,传入的回调函数或Promisel回调都会在下一次DOM更新周期之后被调用。这样可以确保在数据变化后,Vue已经完成了相应的DOM更新。
|
|
||||||
需要注意的是,nextTick 方法是异步执行的,因此不能保证回调函数会立即执行。如果需要等待nextTick执行完成,可以使用await关键字或者. then()方法来等待Promise的完成。
|
|
||||||
17. 一个页面多个表格,列的展示会互相影响
|
|
||||||
[info] 相关issue
|
|
||||||
https://github.com/jeecgboot/jeecgboot-vue3/issues/1064
|
|
||||||
[info]问题截图
|
|
||||||
|
|
||||||
[info] 解决方案:在不同的tableProps下设置不同的checkKey即可解决
|
|
||||||
|
|
||||||
tableSetting: { cacheKey: 'depart_user_departInfo' },
|
|
||||||
18. 通过npm install启动报错
|
|
||||||
可以使用这个命令:
|
|
||||||
npm install --ignore-scripts
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -1,8 +1,8 @@
|
|||||||
//package org.jeecg.modules.demo.cloud.controller;
|
//package org.jeecg.modules.demo.cloud.controller;
|
||||||
//
|
//
|
||||||
//import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
//import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||||
//import io.swagger.annotations.Api;
|
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
//import io.swagger.annotations.ApiOperation;
|
//import io.swagger.v3.oas.annotations.Operation;
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
//import org.jeecg.common.api.vo.Result;
|
//import org.jeecg.common.api.vo.Result;
|
||||||
//import org.jeecg.common.system.api.ISysBaseAPI;
|
//import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
@ -18,7 +18,7 @@
|
|||||||
// *
|
// *
|
||||||
// */
|
// */
|
||||||
//@Slf4j
|
//@Slf4j
|
||||||
//@Api(tags = "【微服务】单元测试")
|
//@Tag(name = "【微服务】单元测试")
|
||||||
//@RestController
|
//@RestController
|
||||||
//@RequestMapping("/test")
|
//@RequestMapping("/test")
|
||||||
//public class JcloudDemoFeignController {
|
//public class JcloudDemoFeignController {
|
||||||
@ -34,7 +34,7 @@
|
|||||||
// */
|
// */
|
||||||
// @GetMapping("/callSystem")
|
// @GetMapping("/callSystem")
|
||||||
// //@SentinelResource(value = "remoteDict",fallback = "getDefaultHandler")
|
// //@SentinelResource(value = "remoteDict",fallback = "getDefaultHandler")
|
||||||
// @ApiOperation(value = "通过feign调用system服务", notes = "测试jeecg-demo服务,是否通过fegin调用system服务接口")
|
// @Operation(summary = "通过feign调用system服务")
|
||||||
// public Result getRemoteDict() {
|
// public Result getRemoteDict() {
|
||||||
// List<DictModel> list = sysBaseApi.queryAllDict();
|
// List<DictModel> list = sysBaseApi.queryAllDict();
|
||||||
// return Result.OK(list);
|
// return Result.OK(list);
|
||||||
@ -48,7 +48,7 @@
|
|||||||
//// * @return
|
//// * @return
|
||||||
//// */
|
//// */
|
||||||
//// @GetMapping("/callErp")
|
//// @GetMapping("/callErp")
|
||||||
//// @ApiOperation(value = "测试feign erp", notes = "测试feign erp")
|
//// @Operation(summary = "测试feign erp")
|
||||||
//// public Result callErp() {
|
//// public Result callErp() {
|
||||||
//// log.info("call erp 服务");
|
//// log.info("call erp 服务");
|
||||||
//// String res = erpHelloApi.callHello();
|
//// String res = erpHelloApi.callHello();
|
||||||
|
|||||||
@ -1,95 +0,0 @@
|
|||||||
package org.jeecg.modules.demo.gpt.controller;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.jeecg.chatgpt.service.AiChatService;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
//update-begin---author:chenrui ---date:20240110 for:[QQYUN-5509]AI生成表结构和软文------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: chatGpt接口
|
|
||||||
* @Author: chenrui
|
|
||||||
* @Date: 2024/1/9 16:30
|
|
||||||
*/
|
|
||||||
@Tag(name = "AI接口")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test/ai")
|
|
||||||
@Slf4j
|
|
||||||
public class AiController {
|
|
||||||
|
|
||||||
private static final String CACHE_PREFIX = "ai:resp:";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AiChatService aiChatService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过AI生成模块表设计
|
|
||||||
* @param descr 描述
|
|
||||||
* @return
|
|
||||||
* @author chenrui
|
|
||||||
* @date 2024/1/9 20:12
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "通过AI生成模块表设计")
|
|
||||||
@PostMapping(value = "/gen/schema/modules")
|
|
||||||
@Operation(summary = "通过AI生成模块表设计")
|
|
||||||
public Result<String> genSchemaModules(@RequestParam(name = "prompt", required = true) String prompt) {
|
|
||||||
String result = aiChatService.genSchemaModules(prompt);
|
|
||||||
return Result.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过AI生成软文
|
|
||||||
* @param descr 描述
|
|
||||||
* @return
|
|
||||||
* @author chenrui
|
|
||||||
* @date 2024/1/9 20:12
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "通过AI生成软文")
|
|
||||||
@PostMapping(value = "/gen/article")
|
|
||||||
@Operation(summary = "通过AI生成软文")
|
|
||||||
public Result<String> genArticle(@RequestParam(name = "prompt", required = true) String prompt) {
|
|
||||||
String result = aiChatService.genArticleWithMd(prompt);
|
|
||||||
return Result.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向AI提问
|
|
||||||
* @param message
|
|
||||||
* @return
|
|
||||||
* @author chenrui
|
|
||||||
* @date 2024/1/15 19:11
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "向AI提问")
|
|
||||||
@PostMapping(value = "/completions")
|
|
||||||
@Operation(summary = "向AI提问")
|
|
||||||
public Result<?> completions(@RequestParam(name = "message", required = true) String message) {
|
|
||||||
String result = aiChatService.completions(message);
|
|
||||||
return Result.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 让AI生成图片
|
|
||||||
* @param prompt
|
|
||||||
* @return
|
|
||||||
* @author chenrui
|
|
||||||
* @date 2024/1/15 19:11
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "让AI生成图片")
|
|
||||||
@PostMapping(value = "/gen/image")
|
|
||||||
@Operation(summary = "让AI生成图片")
|
|
||||||
public Result<?> genImage(@RequestParam(name = "prompt", required = true) String prompt) {
|
|
||||||
String result = aiChatService.imageGenerate(prompt);
|
|
||||||
return Result.ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//update-end---author:chenrui ---date:20240110 for://update-begin---author:chenrui ---date:20240110 for:[QQYUN-5509]AI生成表结构和软文------------------------
|
|
||||||
@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -64,7 +62,7 @@ public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoSe
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "获取所有Demo数据列表")
|
@Operation(summary = "获取Demo数据列表")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
|
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
|
||||||
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
@ -477,7 +475,6 @@ public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoSe
|
|||||||
* 测试Mono对象
|
* 测试Mono对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "Mono测试")
|
|
||||||
@GetMapping(value ="/test")
|
@GetMapping(value ="/test")
|
||||||
public Mono<String> test() {
|
public Mono<String> test() {
|
||||||
//解决shiro报错No SecurityManager accessible to the calling code, either bound to the org.apache.shiro
|
//解决shiro报错No SecurityManager accessible to the calling code, either bound to the org.apache.shiro
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package org.jeecg.modules.demo.test.controller;
|
package org.jeecg.modules.demo.test.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package org.jeecg.modules.demo.test.entity;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.Version;
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@ -11,6 +10,8 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|||||||
@ -24,6 +24,12 @@
|
|||||||
<artifactId>hibernate-re</artifactId>
|
<artifactId>hibernate-re</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- AI大模型管理 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-module-airag</artifactId>
|
||||||
|
<version>${jeecgboot.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- 企业微信/钉钉 api -->
|
<!-- 企业微信/钉钉 api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework</groupId>
|
<groupId>org.jeecgframework</groupId>
|
||||||
@ -40,10 +46,16 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- mongo、redis和文件数据集支持包,按需引入 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
<artifactId>jimureport-nosql-starter</artifactId>
|
<artifactId>jimureport-nosql-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 后台导出接口Echart图表支持包,按需引入
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
|
<artifactId>jimureport-echarts-starter</artifactId>
|
||||||
|
</dependency> -->
|
||||||
<!-- 积木BI -->
|
<!-- 积木BI -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
<groupId>org.jeecgframework.jimureport</groupId>
|
||||||
|
|||||||
@ -27,6 +27,10 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.SynchronousQueue;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 邮箱发送信息
|
* @Description: 邮箱发送信息
|
||||||
@ -54,32 +58,37 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
|||||||
* 真实姓名变量
|
* 真实姓名变量
|
||||||
*/
|
*/
|
||||||
private static final String realNameExp = "{REALNAME}";
|
private static final String realNameExp = "{REALNAME}";
|
||||||
|
/**
|
||||||
|
* 线程池用于异步发送消息
|
||||||
|
*/
|
||||||
|
public static ExecutorService cachedThreadPool = new ThreadPoolExecutor(0, 1024, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
||||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||||
MimeMessage message = mailSender.createMimeMessage();
|
MimeMessage message = mailSender.createMimeMessage();
|
||||||
MimeMessageHelper helper = null;
|
|
||||||
//update-begin-author:taoyan date:20200811 for:配置类数据获取
|
//update-begin-author:taoyan date:20200811 for:配置类数据获取
|
||||||
if(oConvertUtils.isEmpty(emailFrom)){
|
if(oConvertUtils.isEmpty(emailFrom)){
|
||||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||||
setEmailFrom(staticConfig.getEmailFrom());
|
setEmailFrom(staticConfig.getEmailFrom());
|
||||||
}
|
}
|
||||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||||
|
cachedThreadPool.execute(()->{
|
||||||
try {
|
try {
|
||||||
helper = new MimeMessageHelper(message, true);
|
log.info("============> 开始邮件发送,接收人:"+esReceiver);
|
||||||
|
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
||||||
// 设置发送方邮箱地址
|
// 设置发送方邮箱地址
|
||||||
helper.setFrom(emailFrom);
|
helper.setFrom(emailFrom);
|
||||||
helper.setTo(esReceiver);
|
helper.setTo(esReceiver);
|
||||||
helper.setSubject(esTitle);
|
helper.setSubject(esTitle);
|
||||||
helper.setText(esContent, true);
|
helper.setText(esContent, true);
|
||||||
mailSender.send(message);
|
mailSender.send(message);
|
||||||
|
log.info("============> 邮件发送成功,接收人:"+esReceiver);
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
e.printStackTrace();
|
log.error("============> 邮件发送失败,接收人:"+esReceiver, e.getMessage());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -180,13 +189,13 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
|||||||
private void sendEmail(String email, String content, String title){
|
private void sendEmail(String email, String content, String title){
|
||||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||||
MimeMessage message = mailSender.createMimeMessage();
|
MimeMessage message = mailSender.createMimeMessage();
|
||||||
MimeMessageHelper helper = null;
|
|
||||||
if (oConvertUtils.isEmpty(emailFrom)) {
|
if (oConvertUtils.isEmpty(emailFrom)) {
|
||||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||||
setEmailFrom(staticConfig.getEmailFrom());
|
setEmailFrom(staticConfig.getEmailFrom());
|
||||||
}
|
}
|
||||||
|
cachedThreadPool.execute(()->{
|
||||||
try {
|
try {
|
||||||
helper = new MimeMessageHelper(message, true);
|
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
||||||
// 设置发送方邮箱地址
|
// 设置发送方邮箱地址
|
||||||
helper.setFrom(emailFrom);
|
helper.setFrom(emailFrom);
|
||||||
helper.setTo(email);
|
helper.setTo(email);
|
||||||
@ -195,9 +204,11 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
|||||||
helper.setSubject(title);
|
helper.setSubject(title);
|
||||||
helper.setText(content, true);
|
helper.setText(content, true);
|
||||||
mailSender.send(message);
|
mailSender.send(message);
|
||||||
|
log.info("============> 邮件发送成功,接收人:"+email);
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
e.printStackTrace();
|
log.warn("============> 邮件发送失败,接收人:"+email, e.getMessage());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//update-end-author:taoyan date:2023-6-20 for: QQYUN-5557【简流】通知节点 发送邮箱 表单上有一个邮箱字段,流程中,邮件发送节点,邮件接收人 不可选择邮箱
|
//update-end-author:taoyan date:2023-6-20 for: QQYUN-5557【简流】通知节点 发送邮箱 表单上有一个邮箱字段,流程中,邮件发送节点,邮件接收人 不可选择邮箱
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,21 @@ public class CustomInMemoryHttpTraceRepository extends InMemoryHttpExchangeRepos
|
|||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for [issues/8309]系统监控>请求追踪,列表每刷新一下,总数据就减一#8309
|
||||||
|
* @param trace
|
||||||
|
* @author chenrui
|
||||||
|
* @date 2025/6/4 19:38
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(HttpExchange trace) {
|
||||||
|
// 只有当请求不是OPTIONS方法,并且URI不包含httptrace时才记录数据
|
||||||
|
if (!"OPTIONS".equals(trace.getRequest().getMethod()) &&
|
||||||
|
!trace.getRequest().getUri().toString().contains("httptrace")) {
|
||||||
|
super.add(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<HttpExchange> findAll(String query) {
|
public List<HttpExchange> findAll(String query) {
|
||||||
List<HttpExchange> allTrace = super.findAll();
|
List<HttpExchange> allTrace = super.findAll();
|
||||||
if (null != allTrace && !allTrace.isEmpty()) {
|
if (null != allTrace && !allTrace.isEmpty()) {
|
||||||
|
|||||||
@ -162,7 +162,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
String method = openApi.getRequestMethod();
|
String method = openApi.getRequestMethod();
|
||||||
String appkey = request.getHeader("appkey");
|
String appkey = request.getHeader("appkey");
|
||||||
OpenApiAuth openApiAuth = openApiAuthService.getByAppkey(appkey);
|
OpenApiAuth openApiAuth = openApiAuthService.getByAppkey(appkey);
|
||||||
SysUser systemUser = sysUserService.getById(openApiAuth.getSystemUserId());
|
SysUser systemUser = sysUserService.getUserByName(openApiAuth.getCreateBy());
|
||||||
String token = this.getToken(systemUser.getUsername(), systemUser.getPassword());
|
String token = this.getToken(systemUser.getUsername(), systemUser.getPassword());
|
||||||
httpHeaders.put("X-Access-Token", Lists.newArrayList(token));
|
httpHeaders.put("X-Access-Token", Lists.newArrayList(token));
|
||||||
httpHeaders.put("Content-Type",Lists.newArrayList("application/json"));
|
httpHeaders.put("Content-Type",Lists.newArrayList("application/json"));
|
||||||
@ -382,7 +382,7 @@ public class OpenApiController extends JeecgController<OpenApi, OpenApiService>
|
|||||||
SwaggerInfo info = new SwaggerInfo();
|
SwaggerInfo info = new SwaggerInfo();
|
||||||
|
|
||||||
info.setDescription("OpenAPI 接口列表");
|
info.setDescription("OpenAPI 接口列表");
|
||||||
info.setVersion("3.8.0");
|
info.setVersion("3.8.1");
|
||||||
info.setTitle("OpenAPI 接口列表");
|
info.setTitle("OpenAPI 接口列表");
|
||||||
info.setTermsOfService("https://jeecg.com");
|
info.setTermsOfService("https://jeecg.com");
|
||||||
|
|
||||||
|
|||||||
@ -1,35 +1,22 @@
|
|||||||
package org.jeecg.modules.openapi.controller;
|
package org.jeecg.modules.openapi.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
||||||
import org.jeecg.modules.openapi.service.OpenApiPermissionService;
|
import org.jeecg.modules.openapi.service.OpenApiPermissionService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/openapi/permission")
|
@RequestMapping("/openapi/permission")
|
||||||
public class OpenApiPermissionController extends JeecgController<OpenApiPermission, OpenApiPermissionService> {
|
public class OpenApiPermissionController extends JeecgController<OpenApiPermission, OpenApiPermissionService> {
|
||||||
|
|
||||||
@PostMapping("add")
|
@PostMapping("add")
|
||||||
public Result add(@RequestBody OpenApiPermission openApiPermission) {
|
public Result add(@RequestBody OpenApiPermission openApiPermission) {
|
||||||
List<String> list = Arrays.asList(openApiPermission.getApiId().split(","));
|
service.add(openApiPermission);
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
|
||||||
list.forEach(l->{
|
|
||||||
OpenApiPermission saveApiPermission = new OpenApiPermission();
|
|
||||||
saveApiPermission.setApiId(l);
|
|
||||||
saveApiPermission.setApiAuthId(openApiPermission.getApiAuthId());
|
|
||||||
service.save(saveApiPermission);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Result.ok("保存成功");
|
return Result.ok("保存成功");
|
||||||
}
|
}
|
||||||
@GetMapping("/list")
|
@GetMapping("/getOpenApi")
|
||||||
public Result list( String apiAuthId) {
|
public Result<?> getOpenApi( String apiAuthId) {
|
||||||
return Result.ok(service.list(Wrappers.<OpenApiPermission>lambdaQuery().eq(OpenApiPermission::getApiAuthId,apiAuthId)));
|
return service.getOpenApi(apiAuthId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.jeecg.modules.openapi.entity;
|
package org.jeecg.modules.openapi.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -95,4 +96,9 @@ public class OpenApi implements Serializable {
|
|||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 历史已选接口
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String ifCheckBox = "0";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package org.jeecg.modules.openapi.service;
|
package org.jeecg.modules.openapi.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.openapi.entity.OpenApi;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,4 +12,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface OpenApiPermissionService extends IService<OpenApiPermission> {
|
public interface OpenApiPermissionService extends IService<OpenApiPermission> {
|
||||||
List<OpenApiPermission> findByAuthId(String authId);
|
List<OpenApiPermission> findByAuthId(String authId);
|
||||||
|
|
||||||
|
Result<?> getOpenApi(String apiAuthId);
|
||||||
|
|
||||||
|
void add(OpenApiPermission openApiPermission);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,67 @@
|
|||||||
package org.jeecg.modules.openapi.service.impl;
|
package org.jeecg.modules.openapi.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.openapi.entity.OpenApi;
|
||||||
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
import org.jeecg.modules.openapi.entity.OpenApiPermission;
|
||||||
import org.jeecg.modules.openapi.mapper.OpenApiPermissionMapper;
|
import org.jeecg.modules.openapi.mapper.OpenApiPermissionMapper;
|
||||||
import org.jeecg.modules.openapi.service.OpenApiPermissionService;
|
import org.jeecg.modules.openapi.service.OpenApiPermissionService;
|
||||||
|
import org.jeecg.modules.openapi.service.OpenApiService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @date 2024/12/19 17:44
|
* @date 2024/12/19 17:44
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class OpenApiPermissionServiceImpl extends ServiceImpl<OpenApiPermissionMapper, OpenApiPermission> implements OpenApiPermissionService {
|
public class OpenApiPermissionServiceImpl extends ServiceImpl<OpenApiPermissionMapper, OpenApiPermission> implements OpenApiPermissionService {
|
||||||
|
@Resource
|
||||||
|
private OpenApiService openApiService;
|
||||||
@Override
|
@Override
|
||||||
public List<OpenApiPermission> findByAuthId(String authId) {
|
public List<OpenApiPermission> findByAuthId(String authId) {
|
||||||
return baseMapper.selectList(Wrappers.lambdaQuery(OpenApiPermission.class).eq(OpenApiPermission::getApiAuthId, authId));
|
return baseMapper.selectList(Wrappers.lambdaQuery(OpenApiPermission.class).eq(OpenApiPermission::getApiAuthId, authId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> getOpenApi(String apiAuthId) {
|
||||||
|
List<OpenApi> openApis = openApiService.list();
|
||||||
|
if (CollectionUtil.isEmpty(openApis)) {
|
||||||
|
return Result.error("接口不存在");
|
||||||
|
}
|
||||||
|
List<OpenApiPermission> openApiPermissions = baseMapper.selectList(Wrappers.<OpenApiPermission>lambdaQuery().eq(OpenApiPermission::getApiAuthId, apiAuthId));
|
||||||
|
if (CollectionUtil.isNotEmpty(openApiPermissions)) {
|
||||||
|
Map<String, OpenApi> openApiMap = openApis.stream().collect(Collectors.toMap(OpenApi::getId, o -> o));
|
||||||
|
for (OpenApiPermission openApiPermission : openApiPermissions) {
|
||||||
|
OpenApi openApi = openApiMap.get(openApiPermission.getApiId());
|
||||||
|
if (openApi!=null) {
|
||||||
|
openApi.setIfCheckBox("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.ok(openApis);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(OpenApiPermission openApiPermission) {
|
||||||
|
this.remove(Wrappers.<OpenApiPermission>lambdaQuery().eq(OpenApiPermission::getApiAuthId, openApiPermission.getApiAuthId()));
|
||||||
|
List<String> list = Arrays.asList(openApiPermission.getApiId().split(","));
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(l->{
|
||||||
|
if (StrUtil.isNotEmpty(l)){
|
||||||
|
OpenApiPermission saveApiPermission = new OpenApiPermission();
|
||||||
|
saveApiPermission.setApiId(l);
|
||||||
|
saveApiPermission.setApiAuthId(openApiPermission.getApiAuthId());
|
||||||
|
this.save(saveApiPermission);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.modules.quartz.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|||||||
@ -229,7 +229,7 @@ public class CommonController {
|
|||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
if(!file.exists()){
|
if(!file.exists()){
|
||||||
response.setStatus(404);
|
response.setStatus(404);
|
||||||
log.error("文件["+imgPath+"]不存在..");
|
log.warn("文件["+imgPath+"]不存在..");
|
||||||
return;
|
return;
|
||||||
//throw new RuntimeException();
|
//throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package org.jeecg.modules.system.controller;
|
package org.jeecg.modules.system.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.aliyuncs.exceptions.ClientException;
|
import com.aliyuncs.exceptions.ClientException;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
|
|||||||
@ -534,6 +534,7 @@ public class SysAnnouncementController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/vue3List", method = RequestMethod.GET)
|
@RequestMapping(value = "/vue3List", method = RequestMethod.GET)
|
||||||
public Result<List<SysAnnouncement>> vue3List(@RequestParam(name="fromUser", required = false) String fromUser,
|
public Result<List<SysAnnouncement>> vue3List(@RequestParam(name="fromUser", required = false) String fromUser,
|
||||||
|
@RequestParam(name="busType", required = false) String busType,
|
||||||
@RequestParam(name="starFlag", required = false) String starFlag,
|
@RequestParam(name="starFlag", required = false) String starFlag,
|
||||||
@RequestParam(name="rangeDateKey", required = false) String rangeDateKey,
|
@RequestParam(name="rangeDateKey", required = false) String rangeDateKey,
|
||||||
@RequestParam(name="beginDate", required = false) String beginDate,
|
@RequestParam(name="beginDate", required = false) String beginDate,
|
||||||
@ -562,7 +563,7 @@ public class SysAnnouncementController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2、根据条件查询用户的通知消息
|
// 2、根据条件查询用户的通知消息
|
||||||
List<SysAnnouncement> ls = this.sysAnnouncementService.querySysMessageList(pageSize, pageNo, fromUser, starFlag, beginTime, endTime);
|
List<SysAnnouncement> ls = this.sysAnnouncementService.querySysMessageList(pageSize, pageNo, fromUser, starFlag,busType, beginTime, endTime);
|
||||||
|
|
||||||
// 3、设置当前页的消息为已读
|
// 3、设置当前页的消息为已读
|
||||||
if (!CollectionUtils.isEmpty(ls)) {
|
if (!CollectionUtils.isEmpty(ls)) {
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.modules.system.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.dto.DataLogDTO;
|
import org.jeecg.common.api.dto.DataLogDTO;
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
@ -35,6 +33,8 @@ import org.jeecg.modules.system.service.ISysPermissionService;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 部门权限表
|
* @Description: 部门权限表
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
@ -30,6 +28,8 @@ import org.jeecg.common.system.base.controller.JeecgController;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 部门角色
|
* @Description: 部门角色
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import java.util.Date;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.modules.system.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package org.jeecg.modules.system.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
|
|||||||
@ -986,4 +986,16 @@ public class SysTenantController {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目前只给敲敲云人员与部门下的用户删除使用
|
||||||
|
*
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/deleteUser")
|
||||||
|
public Result<String> deleteUser(@RequestBody SysUser sysUser,HttpServletRequest request){
|
||||||
|
Integer tenantId = oConvertUtils.getInteger(TokenUtils.getTenantIdByRequest(request), null);
|
||||||
|
sysTenantService.deleteUser(sysUser, tenantId);
|
||||||
|
return Result.ok("删除用户成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,6 @@ public class SysUserOnlineController {
|
|||||||
public ISysUserService userService;
|
public ISysUserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysBaseApiImpl sysBaseApi;
|
private SysBaseApiImpl sysBaseApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BaseCommonService baseCommonService;
|
private BaseCommonService baseCommonService;
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user