Browse Source

系统消息

master
xsx 1 year ago
parent
commit
ff79c6546c
  1. 122
      README.md
  2. 21
      db/im-admin.sql
  3. 8
      im-admin-ui/package.json
  4. 11
      im-admin-ui/src/api/im/systemMessage/types.ts
  5. 306
      im-admin-ui/src/components/Editor/index.vue
  6. 2
      im-admin-ui/src/components/ImagePreview/index.vue
  7. 145
      im-admin-ui/src/components/ImageUpload/index.vue
  8. 139
      im-admin-ui/src/views/im/message/system/index.vue
  9. 2
      im-admin-ui/src/views/system/notice/index.vue
  10. 6
      im-admin-ui/vite.config.ts
  11. 2
      im-admin/ruoyi-common/ruoyi-common-mybatis/src/main/resources/common-mybatis.yml
  12. 57
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImBaseEntity.java
  13. 3
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImGroup.java
  14. 4
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImGroupMessage.java
  15. 3
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImPrivateMessage.java
  16. 8
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSensitiveWord.java
  17. 3
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSmPushTask.java
  18. 37
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSystemMessage.java
  19. 6
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImUser.java
  20. 12
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/bo/ImSystemMessageBo.java
  21. 4
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImGroupMessageVo.java
  22. 4
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImGroupVo.java
  23. 4
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImPrivateMessageVo.java
  24. 4
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSensitiveWordVo.java
  25. 7
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSmPushTaskVo.java
  26. 39
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSystemMessageVo.java
  27. 6
      im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImUserVo.java
  28. 3
      im-admin/ruoyi-im/src/main/java/org/dromara/im/service/IImSystemMessageService.java
  29. 42
      im-admin/ruoyi-im/src/main/java/org/dromara/im/service/impl/ImSystemMessageServiceImpl.java
  30. 36
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysFileController.java
  31. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysClient.java
  32. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysDept.java
  33. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysRole.java
  34. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenant.java
  35. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantPackage.java
  36. 2
      im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysUser.java

122
README.md

@ -1,93 +1,67 @@
# 盒子IM商业版后台
# 盒子IM后台管理
#### 介绍
本项目为盒子IM后台管理,主要为盒子IM提供用户管理、群组管理、消息管理、敏感词管理等后台功能。
盒子IM前台代码地址:https://gitee.com/bluexsx/box-im
详细文档: https://www.yuque.com/u1475064/mufu2a
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
#### 基于maku框架
为了减少重复工作,达到快速开发目的,本项目选择了一款优秀的开源脚手架-maku进行二次开发。
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
maku的仓库:
https://gitee.com/makunet/maku-boot
https://gitee.com/makunet/maku-admin
## Add your files
maku的文档:
https://maku.net/docs/maku-boot/index
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
#### 框架改造说明
为了更好地与盒子IM的业务相结合,同时保持代码的简洁性,对ruoyi-vue-plus框架进行了以下改造:
1. 移除了定时任务、监控、工作流模块
2. 添加minio模块替代原先的oss模块
3. 加入了ruoyi-im模块,此模块即为盒子IM的核心后台模块
4. 为了兼容历史数据,逻辑删除值由'2'修改为'1'
```
cd existing_repo
git remote add origin http://113.45.141.159:8099/commerce/box-im-admin-ry.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](http://113.45.141.159:8099/commerce/box-im-admin-ry/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
#### 本地快速启动
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
1.安装运行环境
- 安装node:v18.19.0
- 安装jdk:17
- 安装maven:3.9.6
- 安装mysql:8.0,密码分别为root/root,创建名为im_admin的数据库,并执行db/im-admin.sql
- 安装redis:6.2
- 安装minio:RELEASE.2024-xx,使用默认账号、密码、端口
## Suggestions for a good README
注: 盒子IM的后台服务同时还依赖im-platform的数据库,请在启动前先初始化该数据库
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
2.启动后端服务
进入 im-admin目录,打开控制台
```
mvn clean package
java -jar ./maku-server/target/im-admin.jar
```
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
3.启动前端
进入 maku-admin目录,打开控制台
```
npm install
npm run dev
```
访问 http://localhost:3000
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
#### 界面截图:
![输入图片说明](%E6%88%AA%E5%9B%BE/1.png)
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
![输入图片说明](%E6%88%AA%E5%9B%BE/2.png)
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
![输入图片说明](%E6%88%AA%E5%9B%BE/3.png)
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
![输入图片说明](%E6%88%AA%E5%9B%BE/4.png)
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
![输入图片说明](%E6%88%AA%E5%9B%BE/5.png)
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
#### 点下star吧
如果项目对您有帮助,请点亮右上方的star,支持一下作者吧!

21
db/im-admin.sql

@ -344,15 +344,22 @@ insert into sys_menu values('5002', '群聊封禁', '5', '2', '#', '', '', 1, 0
insert into sys_menu values('5003', '群聊导出', '5', '3', '#', '', '', 1, 0, 'F', '0', '0', 'im:group:export', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('5004', '群聊成员', '5', '4', '#', '', '', 1, 0, 'F', '0', '0', 'im:group:member', '#', 103, 1, sysdate(), null, null, '');
-- IM-私聊管理
-- IM-私聊消息
insert into sys_menu values('6', '消息管理', '0', '3', 'message', null, '', 1, 0, 'M', '0', '0', '', 'message', 103, 1, sysdate(), null, null, 'IM消息管理');
insert into sys_menu values('60', '私聊消息', '6', '1', 'private','im/message/private/index', '', 1, 0, 'C', '0', '0', 'im:privateMessage:list', 'education', 103, 1, sysdate(), null, null, 'IM私聊消息');
insert into sys_menu values('6001', '私聊消息查询', '60', '1', '#', '', '', 1, 0, 'F', '0', '0', 'im:privateMessage:query', '#', 103, 1, sysdate(), null, null, '');
-- IM-群聊管理
-- IM-群聊消息
insert into sys_menu values('61', '群聊消息', '6', '2', 'group', 'im/message/group/index', '', 1, 0, 'C', '0', '0', 'im:groupMessage:list', 'category', 103, 1, sysdate(), null, null, 'IM群聊消息');
insert into sys_menu values('6101', '群聊消息查询', '61', '1', '#', '', '', 1, 0, 'F', '0', '0', 'im:groupMessage:query', '#', 103, 1, sysdate(), null, null, '');
-- IM-系统消息
insert into sys_menu values('62', '系统消息', '6', '4', 'system', 'im/message/system/index', '', 1, 0, 'C', '0', '0', 'im:systemMessage:list', 'category', 103, 1, sysdate(), null, null, 'IM系统消息');
insert into sys_menu values('6201', '系统消息查询', '6', '1', '#', '', '', 1, 0, 'F', '0', '0', 'im:systemMessage:query', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('6202', '系统消息添加', '6', '2', '#', '', '', 1, 0, 'F', '0', '0', 'im:systemMessage:add', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('6203', '系统消息删除', '6', '3', '#', '', '', 1, 0, 'F', '0', '0', 'im:systemMessage:remove', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('6204', '系统消息修改', '6', '4', '#', '', '', 1, 0, 'F', '0', '0', 'im:systemMessage:edit', '#', 103, 1, sysdate(), null, null, '');
-- IM-敏感词管理
insert into sys_menu values('7', '敏感词管理', '0', '2', 'im/sensitiveWord', 'im/sensitiveWord/index', '', 1, 0, 'C', '0', '0', 'im:sensitiveWord:list', 'documentation', 103, 1, sysdate(), null, null, 'IM敏感词管理');
insert into sys_menu values('7001', '敏感词查询', '7', '1', '#', '', '', 1, 0, 'F', '0', '0', 'im:sensitiveWord:query', '#', 103, 1, sysdate(), null, null, '');
@ -361,6 +368,8 @@ insert into sys_menu values('7003', '敏感词删除', '7', '3', '#', '', '', 1
insert into sys_menu values('7004', '敏感词修改', '7', '4', '#', '', '', 1, 0, 'F', '0', '0', 'im:sensitiveWord:edit', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('7005', '敏感词导出', '7', '5', '#', '', '', 1, 0, 'F', '0', '0', 'im:sensitiveWord:export', '#', 103, 1, sysdate(), null, null, '');
-- ----------------------------
-- 6、用户和角色关联表 用户N-1角色
-- ----------------------------
@ -470,6 +479,8 @@ insert into sys_dict_type values(13, '000000', '布尔值', 'im_bool', 103,
insert into sys_dict_type values(14, '000000', '用户状态', 'im_user_status', 103, 1, sysdate(), null, null, 'IM用户状态');
insert into sys_dict_type values(15, '000000', '消息状态', 'im_message_status', 103, 1, sysdate(), null, null, 'IM消息状态');
insert into sys_dict_type values(16, '000000', '消息类型', 'im_message_type', 103, 1, sysdate(), null, null, 'IM消息类型');
insert into sys_dict_type values(17, '000000', '系统消息内容类型', 'im_sm_content_type', 103, 1, sysdate(), null, null, 'IM系统消息内容类型');
insert into sys_dict_type values(18, '000000', '系统消息推送状态', 'im_sm_push_status', 103, 1, sysdate(), null, null, 'IM系统消息推送状态');
-- ----------------------------
@ -545,6 +556,12 @@ insert into sys_dict_data values(51, '000000', 5, '视频', '4', 'im_messa
insert into sys_dict_data values(52, '000000', 6, '文字提示', '21', 'im_message_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(53, '000000', 7, '语音通话', '40', 'im_message_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(54, '000000', 8, '视频通话', '41', 'im_message_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(55, '000000', 1, '富文本', '0', 'im_sm_content_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(56, '000000', 2, '外部链接', '1', 'im_sm_content_type', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(57, '000000', 1, '待发送', '1', 'im_sm_push_status', '', 'warn', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(58, '000000', 2, '发送中', '2', 'im_sm_push_status', '', 'primary', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(59, '000000', 3, '已发送', '3', 'im_sm_push_status', '', 'success', 'N', 103, 1, sysdate(), null, null, '');
insert into sys_dict_data values(60, '000000', 4, '已取消', '4', 'im_sm_push_status', '', 'danger', 'N', 103, 1, sysdate(), null, null, '');
-- ----------------------------

8
im-admin-ui/package.json

@ -16,8 +16,9 @@
"dependencies": {
"@element-plus/icons-vue": "2.3.1",
"@highlightjs/vue-plugin": "2.1.0",
"@vueup/vue-quill": "1.2.0",
"@vueuse/core": "10.9.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "4.1.1",
"await-to-js": "3.0.0",
"axios": "1.6.8",
@ -31,6 +32,7 @@
"fuse.js": "7.0.0",
"highlight.js": "11.9.0",
"image-conversion": "^2.1.1",
"js-base64": "^3.7.7",
"js-cookie": "3.0.5",
"jsencrypt": "3.3.2",
"nprogress": "0.2.0",
@ -62,10 +64,10 @@
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-define-config": "2.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.23.0",
"fast-glob": "3.3.2",
"postcss": "8.4.36",

11
im-admin-ui/src/api/im/systemMessage/types.ts

@ -34,20 +34,15 @@ export interface SystemMessageVO {
*/
externLink: string;
/**
* 0 1
*/
deleted: number;
/**
*
*/
creator: number;
/**
*
*
*/
updater: number;
creatorName: string
}

306
im-admin-ui/src/components/Editor/index.vue

@ -1,244 +1,88 @@
<template>
<div>
<el-upload
v-if="type === 'url'"
:action="upload.url"
:before-upload="handleBeforeUpload"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
class="editor-img-uploader"
name="file"
:show-file-list="false"
:headers="upload.headers"
>
<i ref="uploadRef"></i>
</el-upload>
</div>
<div class="editor">
<quill-editor
ref="quillEditorRef"
v-model:content="content"
content-type="html"
:options="options"
:style="styles"
@text-change="(e: any) => $emit('update:modelValue', content)"
/>
</div>
<div style="border: 1px solid #ccc; z-index: 100">
<!-- 工具栏 -->
<Toolbar :editor="editorRef" :mode="mode" style="border-bottom: 1px solid #ccc" />
<!-- 编辑器 -->
<Editor :model-value="modelValue" :style="style" :disabled="disabled" :default-config="editorConfig"
:mode="mode" @on-created="handleCreated" @on-change="handleChange" />
</div>
</template>
<script setup lang="ts">
import '@vueup/vue-quill/dist/vue-quill.snow.css';
import { QuillEditor, Quill } from '@vueup/vue-quill';
import { propTypes } from '@/utils/propTypes';
<script lang="ts" setup name="MaEditor">
import '@wangeditor/editor/dist/css/style.css'
import { onBeforeUnmount, shallowRef } from 'vue'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { IDomEditor, IEditorConfig } from '@wangieditor/editor'
import { globalHeaders } from '@/utils/request';
defineEmits(['update:modelValue']);
import axios from 'axios';
const props = defineProps({
/* 编辑器的内容 */
modelValue: propTypes.string,
/* 高度 */
height: propTypes.number.def(400),
/* 最小高度 */
minHeight: propTypes.number.def(400),
/* 只读 */
readOnly: propTypes.bool.def(false),
/* 上传文件大小限制(MB) */
fileSize: propTypes.number.def(5),
/* 类型(base64格式、url格式) */
type: propTypes.string.def('url')
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const upload = reactive<UploadOption>({
headers: globalHeaders(),
url: import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload'
});
const quillEditorRef = ref();
const uploadRef = ref<HTMLDivElement>();
modelValue: {
type: String,
default: ''
},
mode: {
type: String,
default: 'default' // [default | simple]
},
placeholder: {
type: String,
default: ''
},
style: {
type: String,
default: 'height: 400px;'
},
disabled: {
type: Boolean,
default: false
}
})
const options = ref<any>({
theme: 'snow',
bounds: document.body,
debug: 'warn',
modules: {
//
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'], // 线 线
['blockquote', 'code-block'], //
[{ list: 'ordered' }, { list: 'bullet' }], //
[{ indent: '-1' }, { indent: '+1' }], //
[{ size: ['small', false, 'large', 'huge'] }], //
[{ header: [1, 2, 3, 4, 5, 6, false] }], //
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
['clean'], //
['link', 'image', 'video'] //
],
handlers: {
image: (value: boolean) => {
if (value) {
// element
uploadRef.value.click();
} else {
Quill.format('image', true);
}
}
}
}
},
placeholder: '请输入内容',
readOnly: props.readOnly
});
// shallowRef
const editorRef = shallowRef()
const styles = computed(() => {
let style: any = {};
if (props.minHeight) {
style.minHeight = `${props.minHeight}px`;
}
if (props.height) {
style.height = `${props.height}px`;
}
return style;
});
type InsertFnType = (url: string, alt: string, href: string) => void
const content = ref('');
watch(
() => props.modelValue,
(v: string) => {
if (v !== content.value) {
content.value = v || '<p></p>';
}
},
{ immediate: true }
);
//
const handleUploadSuccess = (res: any) => {
//
if (res.code === 200) {
//
let quill = toRaw(quillEditorRef.value).getQuill();
//
let length = quill.selection.savedRange.index;
// res
quill.insertEmbed(length, 'image', res.data.url);
//
quill.setSelection(length + 1);
proxy?.$modal.closeLoading();
} else {
proxy?.$modal.msgError('图片插入失败');
proxy?.$modal.closeLoading();
}
};
//
const handleBeforeUpload = (file: any) => {
const type = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg'];
const isJPG = type.includes(file.type);
//
if (!isJPG) {
proxy?.$modal.msgError(`图片格式错误!`);
return false;
}
//
if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) {
proxy?.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
return false;
}
}
proxy?.$modal.loading('正在上传文件,请稍候...');
return true;
};
//
const editorConfig: Partial<IEditorConfig> = {
placeholder: props.placeholder,
readOnly: props.disabled,
MENU_CONF: {
uploadImage: {
async customUpload(file: File, insertFn: InsertFnType) {
// file
console.log(file)
const fd = new FormData()
fd.append('file', file)
let url = import.meta.env.VITE_APP_BASE_API + '/image/upload';
let headers = globalHeaders();
headers['Content-Type'] = 'multipart/form-data';
let res = await axios.post(url, fd, { headers })
console.log(res);
insertFn(res.data.data.originUrl, file.name, '')
}
}
}
}
//
const handleUploadError = (err: any) => {
proxy?.$modal.msgError('上传文件失败');
};
</script>
//
onBeforeUnmount(() => {
const editor = editorRef.value
if (editor == null) {
return
}
console.log("onBeforeUnmount")
editor.destroy()
})
<style>
.editor-img-uploader {
display: none;
}
.editor,
.ql-toolbar {
white-space: pre-wrap !important;
line-height: normal !important;
}
.quill-img {
display: none;
}
.ql-snow .ql-tooltip[data-mode='link']::before {
content: '请输入链接地址:';
}
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
border-right: 0;
content: '保存';
padding-right: 0;
}
.ql-snow .ql-tooltip[data-mode='video']::before {
content: '请输入视频地址:';
}
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
content: '14px';
const handleCreated = (editor: IDomEditor) => {
editorRef.value = editor
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='small']::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='small']::before {
content: '10px';
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='large']::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='large']::before {
content: '18px';
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='huge']::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='huge']::before {
content: '32px';
}
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
content: '文本';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='1']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before {
content: '标题1';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='2']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before {
content: '标题2';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='3']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='3']::before {
content: '标题3';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='4']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='4']::before {
content: '标题4';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='5']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='5']::before {
content: '标题5';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='6']::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='6']::before {
content: '标题6';
}
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
content: '标准字体';
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='serif']::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before {
content: '衬线字体';
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='monospace']::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before {
content: '等宽字体';
// change
const emit = defineEmits(['update:modelValue'])
const handleChange = (editor: IDomEditor) => {
emit('update:modelValue', editor.getHtml())
}
</style>
</script>

2
im-admin-ui/src/components/ImagePreview/index.vue

@ -1,5 +1,5 @@
<template>
<el-image :src="`${realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="realSrcList" preview-teleported>
<el-image :src="`${realSrc}`" fit="fill" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="realSrcList" preview-teleported>
<template #error>
<div class="image-slot">
<el-icon><picture-filled /></el-icon>

145
im-admin-ui/src/components/ImageUpload/index.vue

@ -0,0 +1,145 @@
<template>
<div class="component-upload-image">
<el-upload class="upload" ref="imageUpload" :action="uploadImgUrl" list-type="picture-card"
:style="style"
:on-success="handleUploadSuccess" :before-upload="handleBeforeUpload"
:on-error="handleUploadError" :show-file-list="false"
:headers="headers" :on-preview="handlePictureCardPreview">
<img v-if="modelValue" :src="modelValue" class="avatar">
<el-icon v-else class="avatar-uploader-icon">
<plus />
</el-icon>
</el-upload>
<!-- 上传提示 -->
<div v-if="showTip" class="el-upload__tip">
请上传
<template v-if="fileSize">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</template>
<template v-if="fileType">
格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b>
</template>
的文件
</div>
<el-dialog v-model="dialogVisible" title="预览" width="800px" append-to-body>
<img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto" />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
const props = defineProps({
modelValue: {
type: [String, Object, Array],
default: ''
},
width: {
type: Number,
default: 100
},
height: {
type: Number,
default: 100
},
//
limit: propTypes.number.def(5),
// (MB)
fileSize: propTypes.number.def(5),
// , ['png', 'jpg', 'jpeg']
fileType: propTypes.array.def(['png', 'jpg', 'jpeg']),
//
isShowTip: {
type: Boolean,
default: false
}
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:modelValue']);
const dialogImageUrl = ref('');
const dialogVisible = ref(false);
const baseUrl = import.meta.env.VITE_APP_BASE_API;
const uploadImgUrl = ref(baseUrl + '/system/image/upload'); //
const headers = ref(globalHeaders());
const showTip = computed(() => props.isShowTip && (props.fileType || props.fileSize));
/** 上传前loading加载 */
const handleBeforeUpload = (file: any) => {
let isImg = false;
if (props.fileType.length) {
let fileExtension = '';
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1);
}
isImg = props.fileType.some((type: any) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
} else {
isImg = file.type.indexOf('image') > -1;
}
if (!isImg) {
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
return false;
}
if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) {
proxy?.$modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`);
return false;
}
}
};
//
const handleUploadSuccess = (res: any) => {
if (res.code === 200) {
emit('update:modelValue', res.data.originUrl);
} else {
emit('update:modelValue', '');
}
};
//
const handleUploadError = () => {
proxy?.$modal.msgError('上传图片失败');
proxy?.$modal.closeLoading();
};
//
const handlePictureCardPreview = (file: any) => {
dialogImageUrl.value = file.url;
dialogVisible.value = true;
};
const style = computed(() => {
return `width:${props.width}px;height: ${props.height}px;`
})
</script>
<style lang="scss">
//.el-upload--picture-card
:deep(.hide .el-upload--picture-card) {
display: none;
}
.upload {
width: 300px ;
height: 200px;
}
.el-upload--picture-card {
width: 100% !important;
height: 100% !important;
}
.avatar {
width: 100%;
height: 100%;
}
</style>

139
im-admin-ui/src/views/im/message/system/index.vue

@ -1,33 +1,14 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="标题" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="封面" prop="coverUrl">
<el-input v-model="queryParams.coverUrl" placeholder="请输入封面" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="简介" prop="intro">
<el-input v-model="queryParams.intro" placeholder="请输入简介" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="富文本内容,base64编码" prop="richText">
<el-input v-model="queryParams.richText" placeholder="请输入富文本内容,base64编码" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="外部链接" prop="externLink">
<el-input v-model="queryParams.externLink" placeholder="请输入外部链接" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="删除标识 0:正常 1:已删除" prop="deleted">
<el-input v-model="queryParams.deleted" placeholder="请输入删除标识 0:正常 1:已删除" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="创建者" prop="creator">
<el-input v-model="queryParams.creator" placeholder="请输入创建者" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="更新者" prop="updater">
<el-input v-model="queryParams.updater" placeholder="请输入更新者" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -41,16 +22,20 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['im:systemMessage:add']">新增</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd"
v-hasPermi="['im:systemMessage:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['im:systemMessage:edit']">修改</el-button>
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
v-hasPermi="['im:systemMessage:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['im:systemMessage:remove']">删除</el-button>
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
v-hasPermi="['im:systemMessage:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['im:systemMessage:export']">导出</el-button>
<el-button type="warning" plain icon="Download" @click="handleExport"
v-hasPermi="['im:systemMessage:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -58,56 +43,57 @@
<el-table v-loading="loading" :data="systemMessageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" v-if="true" />
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="封面" align="center" prop="coverUrl" />
<el-table-column label="简介" align="center" prop="intro" />
<el-table-column label="内容类型 0:富文本 1:外部链接" align="center" prop="contentType" />
<el-table-column label="富文本内容,base64编码" align="center" prop="richText" />
<el-table-column label="外部链接" align="center" prop="externLink" />
<el-table-column label="删除标识 0:正常 1:已删除" align="center" prop="deleted" />
<el-table-column label="创建者" align="center" prop="creator" />
<el-table-column label="更新者" align="center" prop="updater" />
<el-table-column label="封面" align="center" prop="coverUrl">
<template #default="scope">
<image-preview :src="scope.row.coverUrl" :width="100" :height="60" />
</template>
</el-table-column>
<el-table-column label="内容类型" align="center" prop="contentType">
<template #default="scope">
<dict-tag :options="im_sm_content_type" :value="scope.row.contentType"></dict-tag>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="creatorName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['im:systemMessage:edit']"></el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['im:systemMessage:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['im:systemMessage:remove']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['im:systemMessage:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改系统消息对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-dialog :title="dialog.title" v-model="dialog.visible" width="80%" append-to-body>
<el-form ref="systemMessageFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="封面" prop="coverUrl">
<el-input v-model="form.coverUrl" placeholder="请输入封面" />
<image-upload v-model="form.coverUrl" width="200" height="150"></image-upload>
</el-form-item>
<el-form-item label="简介" prop="intro">
<el-input v-model="form.intro" placeholder="请输入简介" />
</el-form-item>
<el-form-item label="富文本内容,base64编码" prop="richText">
<el-input v-model="form.richText" type="textarea" placeholder="请输入内容" />
<el-form-item label="类型" prop="contentType">
<el-radio-group v-model="form.contentType">
<el-radio v-for="dict in im_sm_content_type" :key="dict.value" :value="parseInt(dict.value)">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="外部链接" prop="externLink">
<el-input v-model="form.externLink" placeholder="请输入外部链接" />
</el-form-item>
<el-form-item label="删除标识 0:正常 1:已删除" prop="deleted">
<el-input v-model="form.deleted" placeholder="请输入删除标识 0:正常 1:已删除" />
<el-form-item v-if="form.contentType==0" label="富文本内容" prop="richText">
<editor v-model="richText" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="创建者" prop="creator">
<el-input v-model="form.creator" placeholder="请输入创建者" />
</el-form-item>
<el-form-item label="更新者" prop="updater">
<el-input v-model="form.updater" placeholder="请输入更新者" />
<el-form-item v-else label="外部链接" prop="externLink">
<el-input v-model="form.externLink" placeholder="请输入外部链接" />
</el-form-item>
</el-form>
<template #footer>
@ -123,6 +109,7 @@
<script setup name="SystemMessage" lang="ts">
import { listSystemMessage, getSystemMessage, delSystemMessage, addSystemMessage, updateSystemMessage } from '@/api/im/systemMessage';
import { SystemMessageVO, SystemMessageQuery, SystemMessageForm } from '@/api/im/systemMessage/types';
import { Base64 } from 'js-base64';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -155,27 +142,16 @@ const initFormData: SystemMessageForm = {
creator: undefined,
updater: undefined,
}
const data = reactive<PageData<SystemMessageForm, SystemMessageQuery>>({
form: {...initFormData},
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
coverUrl: undefined,
intro: undefined,
contentType: undefined,
richText: undefined,
externLink: undefined,
deleted: undefined,
creator: undefined,
updater: undefined,
params: {
}
contentType: undefined
},
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
title: [
{ required: true, message: "标题不能为空", trigger: "blur" }
],
@ -186,27 +162,14 @@ const data = reactive<PageData<SystemMessageForm, SystemMessageQuery>>({
{ required: true, message: "简介不能为空", trigger: "blur" }
],
contentType: [
{ required: true, message: "内容类型 0:富文本 1:外部链接不能为空", trigger: "change" }
],
richText: [
{ required: true, message: "富文本内容,base64编码不能为空", trigger: "blur" }
],
externLink: [
{ required: true, message: "外部链接不能为空", trigger: "blur" }
],
deleted: [
{ required: true, message: "删除标识 0:正常 1:已删除不能为空", trigger: "blur" }
],
creator: [
{ required: true, message: "创建者不能为空", trigger: "blur" }
],
updater: [
{ required: true, message: "更新者不能为空", trigger: "blur" }
],
{ required: true, message: "内容类型不能为空", trigger: "change" }
]
}
});
const { queryParams, form, rules } = toRefs(data);
const richText = ref()
const { im_sm_content_type } = toRefs<any>(proxy?.useDict('im_sm_content_type'));
/** 查询系统消息列表 */
const getList = async () => {
@ -225,8 +188,9 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
form.value = {...initFormData};
form.value = { ...initFormData };
systemMessageFormRef.value?.resetFields();
richText.value = ''
}
/** 搜索按钮操作 */
@ -251,6 +215,7 @@ const handleSelectionChange = (selection: SystemMessageVO[]) => {
/** 新增按钮操作 */
const handleAdd = () => {
reset();
form.value.contentType = 0;
dialog.visible = true;
dialog.title = "添加系统消息";
}
@ -261,6 +226,7 @@ const handleUpdate = async (row?: SystemMessageVO) => {
const _id = row?.id || ids.value[0]
const res = await getSystemMessage(_id);
Object.assign(form.value, res.data);
richText.value = Base64.decode(res.data.richText);
dialog.visible = true;
dialog.title = "修改系统消息";
}
@ -270,10 +236,11 @@ const submitForm = () => {
systemMessageFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
form.value.richText = Base64.encode(richText.value)
if (form.value.id) {
await updateSystemMessage(form.value).finally(() => buttonLoading.value = false);
await updateSystemMessage(form.value).finally(() => buttonLoading.value = false);
} else {
await addSystemMessage(form.value).finally(() => buttonLoading.value = false);
await addSystemMessage(form.value).finally(() => buttonLoading.value = false);
}
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;

2
im-admin-ui/src/views/system/notice/index.vue

@ -184,7 +184,7 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
noticeFormRef.value?.resetFields();
//noticeFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {

6
im-admin-ui/vite.config.ts

@ -63,15 +63,9 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
'@vueuse/core',
'echarts',
'vue-i18n',
'@vueup/vue-quill',
'bpmn-js/lib/Viewer',
'bpmn-js/lib/Modeler.js',
'bpmn-js-properties-panel',
'min-dash',
'diagram-js/lib/navigation/movecanvas',
'diagram-js/lib/navigation/zoomscroll',
'bpmn-js/lib/features/palette/PaletteProvider',
'bpmn-js/lib/features/context-pad/ContextPadProvider',
'diagram-js/lib/draw/BaseRenderer',
'tiny-svg',
'image-conversion',

2
im-admin/ruoyi-common/ruoyi-common-mybatis/src/main/resources/common-mybatis.yml

@ -25,7 +25,7 @@ mybatis-plus:
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
idType: ASSIGN_ID
# 逻辑已删除值(框架表均使用此值 禁止随意修改)
logicDeleteValue: 2
logicDeleteValue: 1
# 逻辑未删除值
logicNotDeleteValue: 0
insertStrategy: NOT_NULL

57
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImBaseEntity.java

@ -0,0 +1,57 @@
package org.dromara.im.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author Blue
* @date 2024-12-29
* @version 1.0
*/
@Data
public class ImBaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
private Integer deleted;
}

3
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImGroup.java

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fhs.core.trans.vo.TransPojo;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -18,8 +17,6 @@ import java.util.Date;
@TableName("im_group")
public class ImGroup implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id

4
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImGroupMessage.java

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -17,9 +16,6 @@ import java.util.Date;
@TableName("im_group_message")
public class ImGroupMessage {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/

3
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImPrivateMessage.java

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -17,8 +16,6 @@ import java.util.Date;
@TableName("im_private_message")
public class ImPrivateMessage {
@Serial
private static final long serialVersionUID = 1L;
/**
* id

8
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSensitiveWord.java

@ -1,10 +1,11 @@
package org.dromara.im.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -17,9 +18,6 @@ import java.util.Date;
@TableName("im_sensitive_word")
public class ImSensitiveWord {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@ -39,12 +37,14 @@ public class ImSensitiveWord {
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}

3
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSmPushTask.java

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -18,8 +17,6 @@ import java.util.Date;
@TableName("im_sm_push_task")
public class ImSmPushTask {
@Serial
private static final long serialVersionUID = 1L;
/**
* id

37
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImSystemMessage.java

@ -1,13 +1,8 @@
package org.dromara.im.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
/**
* 系统消息对象 im_system_message
@ -18,16 +13,7 @@ import java.io.Serial;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("im_system_message")
public class ImSystemMessage extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id")
private Long id;
public class ImSystemMessage extends ImBaseEntity {
/**
* 标题
@ -59,26 +45,5 @@ public class ImSystemMessage extends BaseEntity {
*/
private String externLink;
/**
* 版本号
*/
@Version
private Long version;
/**
* 删除标识 0正常 1已删除
*/
private Long deleted;
/**
* 创建者
*/
private Long creator;
/**
* 更新者
*/
private Long updater;
}

6
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/ImUser.java

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fhs.core.trans.vo.TransPojo;
import lombok.Data;
import java.io.Serial;
import java.util.Date;
/**
@ -18,13 +17,10 @@ import java.util.Date;
@TableName("im_user")
public class ImUser implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id")
@TableId
private Long id;
/**

12
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/bo/ImSystemMessageBo.java

@ -48,37 +48,27 @@ public class ImSystemMessageBo extends BaseEntity {
/**
* 内容类型 0:富文本 1:外部链接
*/
@NotNull(message = "内容类型 0:富文本 1:外部链接不能为空", groups = { AddGroup.class, EditGroup.class })
@NotNull(message = "内容类型", groups = { AddGroup.class, EditGroup.class })
private Long contentType;
/**
* 富文本内容base64编码
*/
@NotBlank(message = "富文本内容,base64编码不能为空", groups = { AddGroup.class, EditGroup.class })
private String richText;
/**
* 外部链接
*/
@NotBlank(message = "外部链接不能为空", groups = { AddGroup.class, EditGroup.class })
private String externLink;
/**
* 删除标识 0正常 1已删除
*/
@NotNull(message = "删除标识 0:正常 1:已删除不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deleted;
/**
* 创建者
*/
@NotNull(message = "创建者不能为空", groups = { AddGroup.class, EditGroup.class })
private Long creator;
/**
* 更新者
*/
@NotNull(message = "更新者不能为空", groups = { AddGroup.class, EditGroup.class })
private Long updater;

4
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImGroupMessageVo.java

@ -12,7 +12,6 @@ import org.dromara.im.domain.ImGroup;
import org.dromara.im.domain.ImGroupMessage;
import org.dromara.im.domain.ImUser;
import java.io.Serial;
import java.util.Date;
@ -28,9 +27,6 @@ import java.util.Date;
@AutoMapper(target = ImGroupMessage.class)
public class ImGroupMessageVo implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/

4
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImGroupVo.java

@ -14,7 +14,6 @@ import org.dromara.im.constant.ImConstant;
import org.dromara.im.domain.ImGroup;
import org.dromara.im.domain.ImUser;
import java.io.Serial;
import java.util.Date;
/**
@ -28,9 +27,6 @@ import java.util.Date;
@AutoMapper(target = ImGroup.class)
public class ImGroupVo implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/

4
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImPrivateMessageVo.java

@ -11,7 +11,6 @@ import org.dromara.im.constant.ImConstant;
import org.dromara.im.domain.ImPrivateMessage;
import org.dromara.im.domain.ImUser;
import java.io.Serial;
import java.util.Date;
@ -27,9 +26,6 @@ import java.util.Date;
@AutoMapper(target = ImPrivateMessage.class)
public class ImPrivateMessageVo implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/

4
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSensitiveWordVo.java

@ -11,7 +11,6 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.im.domain.ImSensitiveWord;
import org.dromara.system.domain.SysUser;
import java.io.Serial;
import java.util.Date;
/**
@ -25,9 +24,6 @@ import java.util.Date;
@AutoMapper(target = ImSensitiveWord.class)
public class ImSensitiveWordVo implements TransPojo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/

7
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSmPushTaskVo.java

@ -6,8 +6,6 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.im.domain.ImSmPushTask;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
@ -21,10 +19,7 @@ import java.util.Date;
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ImSmPushTask.class)
public class ImSmPushTaskVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
public class ImSmPushTaskVo {
/**
* id

39
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImSystemMessageVo.java

@ -1,13 +1,14 @@
package org.dromara.im.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.im.domain.ImSystemMessage;
import java.io.Serial;
import java.io.Serializable;
import org.dromara.system.domain.SysUser;
@ -20,70 +21,50 @@ import java.io.Serializable;
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ImSystemMessage.class)
public class ImSystemMessageVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
public class ImSystemMessageVo implements TransPojo {
/**
* id
*/
@ExcelProperty(value = "id")
private Long id;
/**
* 标题
*/
@ExcelProperty(value = "标题")
private String title;
/**
* 封面
*/
@ExcelProperty(value = "封面")
private String coverUrl;
/**
* 简介
*/
@ExcelProperty(value = "简介")
private String intro;
/**
* 内容类型 0:富文本 1:外部链接
* 内容类型
*/
@ExcelProperty(value = "内容类型 0:富文本 1:外部链接")
private Long contentType;
/**
* 富文本内容base64编码
*/
@ExcelProperty(value = "富文本内容,base64编码")
private String richText;
/**
* 外部链接
*/
@ExcelProperty(value = "外部链接")
private String externLink;
/**
* 删除标识 0正常 1已删除
*/
@ExcelProperty(value = "删除标识 0:正常 1:已删除")
private Long deleted;
/**
* 创建者
*/
@ExcelProperty(value = "创建者")
@Trans(type = TransType.SIMPLE, target = SysUser.class, fields = "userName", ref = "creatorName")
private Long creator;
/**
* 更新者
*/
@ExcelProperty(value = "更新者")
private Long updater;
@Schema(description = "创建者名称")
private String creatorName;
}

6
im-admin/ruoyi-im/src/main/java/org/dromara/im/domain/vo/ImUserVo.java

@ -8,8 +8,6 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.im.domain.ImUser;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
@ -23,10 +21,8 @@ import java.util.Date;
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ImUser.class)
public class ImUserVo implements Serializable {
public class ImUserVo {
@Serial
private static final long serialVersionUID = 1L;
/**
* id

3
im-admin/ruoyi-im/src/main/java/org/dromara/im/service/IImSystemMessageService.java

@ -65,4 +65,7 @@ public interface IImSystemMessageService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
List<ImSystemMessageVo> findByTitle(String title);
}

42
im-admin/ruoyi-im/src/main/java/org/dromara/im/service/impl/ImSystemMessageServiceImpl.java

@ -1,5 +1,6 @@
package org.dromara.im.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -19,7 +20,6 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 系统消息Service业务层处理
@ -72,17 +72,10 @@ public class ImSystemMessageServiceImpl implements IImSystemMessageService {
}
private LambdaQueryWrapper<ImSystemMessage> buildQueryWrapper(ImSystemMessageBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ImSystemMessage> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StringUtils.isNotBlank(bo.getTitle()), ImSystemMessage::getTitle, bo.getTitle());
wrapper.eq(StringUtils.isNotBlank(bo.getCoverUrl()), ImSystemMessage::getCoverUrl, bo.getCoverUrl());
wrapper.eq(StringUtils.isNotBlank(bo.getIntro()), ImSystemMessage::getIntro, bo.getIntro());
wrapper.eq(bo.getContentType() != null, ImSystemMessage::getContentType, bo.getContentType());
wrapper.eq(StringUtils.isNotBlank(bo.getRichText()), ImSystemMessage::getRichText, bo.getRichText());
wrapper.eq(StringUtils.isNotBlank(bo.getExternLink()), ImSystemMessage::getExternLink, bo.getExternLink());
wrapper.eq(bo.getDeleted() != null, ImSystemMessage::getDeleted, bo.getDeleted());
wrapper.eq(bo.getCreator() != null, ImSystemMessage::getCreator, bo.getCreator());
wrapper.eq(bo.getUpdater() != null, ImSystemMessage::getUpdater, bo.getUpdater());
wrapper.orderByDesc(ImSystemMessage::getId);
return wrapper;
}
@ -95,12 +88,7 @@ public class ImSystemMessageServiceImpl implements IImSystemMessageService {
@Override
public Boolean insertByBo(ImSystemMessageBo bo) {
ImSystemMessage add = MapstructUtils.convert(bo, ImSystemMessage.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
return baseMapper.insert(add) > 0;
}
/**
@ -112,16 +100,9 @@ public class ImSystemMessageServiceImpl implements IImSystemMessageService {
@Override
public Boolean updateByBo(ImSystemMessageBo bo) {
ImSystemMessage update = MapstructUtils.convert(bo, ImSystemMessage.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(ImSystemMessage entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除系统消息信息
@ -132,9 +113,20 @@ public class ImSystemMessageServiceImpl implements IImSystemMessageService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public List<ImSystemMessageVo> findByTitle(String title) {
// 取出标题匹配的前10条
LambdaQueryWrapper<ImSystemMessage> wrapper = Wrappers.lambdaQuery();
if(StrUtil.isNotEmpty(title)){
wrapper.like(ImSystemMessage::getTitle, title);
}
wrapper.select(ImSystemMessage::getId, ImSystemMessage::getTitle);
wrapper.orderByDesc(ImSystemMessage::getId);
wrapper.last("limit 10");
return baseMapper.selectVoList(wrapper);
}
}

36
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysFileController.java

@ -0,0 +1,36 @@
package org.dromara.system.controller.system;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.minio.service.FileService;
import org.dromara.common.minio.vo.UploadImageVO;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@Slf4j
@RestController
@RequestMapping("/system")
@Tag(name = "文件上传")
@RequiredArgsConstructor
public class SysFileController {
private final FileService fileService;
@Operation(summary = "上传图片", description = "上传图片,上传后返回原图和缩略图的url")
@PostMapping("/image/upload")
public R<UploadImageVO> uploadImage(@RequestParam("file") MultipartFile file,@RequestParam(defaultValue = "false")Boolean withThumb) {
return R.ok(fileService.uploadImage(file,withThumb));
}
@Operation(summary = "上传文件", description = "上传文件,上传后返回文件url")
@PostMapping("/file/upload")
public R<String> uploadFile(@RequestParam("file") MultipartFile file) {
return R.ok(fileService.uploadFile(file));
}
}

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysClient.java

@ -68,7 +68,7 @@ public class SysClient extends BaseEntity {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysDept.java

@ -70,7 +70,7 @@ public class SysDept extends TenantEntity {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysRole.java

@ -62,7 +62,7 @@ public class SysRole extends TenantEntity {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenant.java

@ -95,7 +95,7 @@ public class SysTenant extends BaseEntity {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysTenantPackage.java

@ -46,7 +46,7 @@ public class SysTenantPackage extends BaseEntity {
*/
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

2
im-admin/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysUser.java

@ -84,7 +84,7 @@ public class SysUser extends TenantEntity implements TransPojo {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
@TableLogic
private String delFlag;

Loading…
Cancel
Save