24 changed files with 1 additions and 2241 deletions
@ -1,87 +0,0 @@ |
|||||
import request from '@/utils/request'; |
|
||||
import { AxiosPromise } from 'axios'; |
|
||||
import { SmPushTaskVO, SmPushTaskForm, SmPushTaskQuery } from '@/api/im/smPushTask/types'; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息推送任务列表 |
|
||||
* @param query |
|
||||
* @returns {*} |
|
||||
*/ |
|
||||
|
|
||||
export const listSmPushTask = (query?: SmPushTaskQuery): AxiosPromise<SmPushTaskVO[]> => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask/list', |
|
||||
method: 'get', |
|
||||
params: query |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息推送任务详细 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const getSmPushTask = (id: number): AxiosPromise<SmPushTaskVO> => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask/' + id, |
|
||||
method: 'get' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息推送任务 |
|
||||
* @param data |
|
||||
*/ |
|
||||
export const addSmPushTask = (data: SmPushTaskForm) => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask', |
|
||||
method: 'post', |
|
||||
data: data |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息推送任务 |
|
||||
* @param data |
|
||||
*/ |
|
||||
export const updateSmPushTask = (data: SmPushTaskForm) => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask', |
|
||||
method: 'put', |
|
||||
data: data |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 删除系统消息推送任务 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const delSmPushTask = (id: number | Array< number>) => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask/' + id, |
|
||||
method: 'delete' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 取消任务 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const cancelSmPushTask = (id: number) => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask/cancel?id=' + id, |
|
||||
method: 'put' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 开启任务 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const openSmPushTask = (id: number) => { |
|
||||
return request({ |
|
||||
url: '/im/smPushTask/open?id=' + id, |
|
||||
method: 'put' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
@ -1,161 +0,0 @@ |
|||||
export interface SmPushTaskVO { |
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
id: number; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
messageId: number; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
seqNo: number; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
sendTime: string; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
status: number; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
sendToAll: boolean; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id,逗号分隔,send_to_all为false时有效 |
|
||||
*/ |
|
||||
recvIds: string; |
|
||||
|
|
||||
/** |
|
||||
* 删除标识 0:正常 1:已删除 |
|
||||
*/ |
|
||||
deleted: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator: number; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
updater: number; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
export interface SmPushTaskForm extends BaseEntity { |
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
id?: number; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
messageId?: number; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
seqNo?: number; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
sendTime?: string; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
status?: number; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
sendToAll?: boolean; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id,逗号分隔,send_to_all为false时有效 |
|
||||
*/ |
|
||||
recvIds?: string; |
|
||||
|
|
||||
/** |
|
||||
* 删除标识 0:正常 1:已删除 |
|
||||
*/ |
|
||||
deleted?: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator?: number; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
updater?: number; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
export interface SmPushTaskQuery extends PageQuery { |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
messageId?: number; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
seqNo?: number; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
sendTime?: string; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
status?: number; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
sendToAll?: boolean; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id,逗号分隔,send_to_all为false时有效 |
|
||||
*/ |
|
||||
recvIds?: string; |
|
||||
|
|
||||
/** |
|
||||
* 删除标识 0:正常 1:已删除 |
|
||||
*/ |
|
||||
deleted?: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator?: number; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
updater?: number; |
|
||||
|
|
||||
/** |
|
||||
* 日期范围参数 |
|
||||
*/ |
|
||||
params?: any; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -1,75 +0,0 @@ |
|||||
import request from '@/utils/request'; |
|
||||
import { AxiosPromise } from 'axios'; |
|
||||
import { SystemMessageVO, SystemMessageForm, SystemMessageQuery } from '@/api/im/systemMessage/types'; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息列表 |
|
||||
* @param query |
|
||||
* @returns {*} |
|
||||
*/ |
|
||||
|
|
||||
export const listSystemMessage = (query?: SystemMessageQuery): AxiosPromise<SystemMessageVO[]> => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage/list', |
|
||||
method: 'get', |
|
||||
params: query |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息详细 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const getSystemMessage = (id: string | number): AxiosPromise<SystemMessageVO> => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage/' + id, |
|
||||
method: 'get' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息 |
|
||||
* @param data |
|
||||
*/ |
|
||||
export const addSystemMessage = (data: SystemMessageForm) => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage', |
|
||||
method: 'post', |
|
||||
data: data |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息 |
|
||||
* @param data |
|
||||
*/ |
|
||||
export const updateSystemMessage = (data: SystemMessageForm) => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage', |
|
||||
method: 'put', |
|
||||
data: data |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 删除系统消息 |
|
||||
* @param id |
|
||||
*/ |
|
||||
export const delSystemMessage = (id: string | number | Array<string | number>) => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage/' + id, |
|
||||
method: 'delete' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
/** |
|
||||
* 根据标题模糊查询系统消息 |
|
||||
* @param title |
|
||||
*/ |
|
||||
export const findSystemMessageByTitle = (title?: String): AxiosPromise<SystemMessageVO[]> => { |
|
||||
return request({ |
|
||||
url: '/im/systemMessage/findByTitle?title=' + title, |
|
||||
method: 'get' |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
@ -1,156 +0,0 @@ |
|||||
export interface SystemMessageVO { |
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
id: string | number; |
|
||||
|
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
title: string; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
coverUrl: string; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
intro: string; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 0:富文本 1:外部链接 |
|
||||
*/ |
|
||||
contentType: number; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
richText: string; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
externLink: string; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creatorName: string |
|
||||
|
|
||||
} |
|
||||
|
|
||||
export interface SystemMessageForm extends BaseEntity { |
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
id?: string | number; |
|
||||
|
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
title?: string; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
coverUrl?: string; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
intro?: string; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 0:富文本 1:外部链接 |
|
||||
*/ |
|
||||
contentType?: number; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
richText?: string; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
externLink?: string; |
|
||||
|
|
||||
/** |
|
||||
* 删除标识 0:正常 1:已删除 |
|
||||
*/ |
|
||||
deleted?: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator?: number; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
updater?: number; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
export interface SystemMessageQuery extends PageQuery { |
|
||||
|
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
title?: string; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
coverUrl?: string; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
intro?: string; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 0:富文本 1:外部链接 |
|
||||
*/ |
|
||||
contentType?: number; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
richText?: string; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
externLink?: string; |
|
||||
|
|
||||
/** |
|
||||
* 删除标识 0:正常 1:已删除 |
|
||||
*/ |
|
||||
deleted?: number; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
creator?: number; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
updater?: number; |
|
||||
|
|
||||
/** |
|
||||
* 日期范围参数 |
|
||||
*/ |
|
||||
params?: any; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -1,51 +0,0 @@ |
|||||
<template> |
|
||||
<el-select v-model="messageIds" :multiple="multiple" filterable remote clearable |
|
||||
:placeholder="placeholder" :remote-method="handleRemote" :loading="loading"> |
|
||||
<el-option v-for="message in options" :key="message.id" :label="message.title" :value="message.id" /> |
|
||||
</el-select> |
|
||||
</template> |
|
||||
|
|
||||
<script setup lang="ts" name="ImSmSelect"> |
|
||||
|
|
||||
import { computed } from 'vue' |
|
||||
import { ref } from 'vue' |
|
||||
import { findSystemMessageByTitle } from '@/api/im/systemMessage' |
|
||||
|
|
||||
const props = defineProps({ |
|
||||
multiple: { |
|
||||
type: Boolean, |
|
||||
required: false, |
|
||||
default: () => false |
|
||||
}, |
|
||||
placeholder: { |
|
||||
type: String, |
|
||||
required: false, |
|
||||
default: () => '' |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
const loading = ref(false) |
|
||||
const options = ref() |
|
||||
const model = defineModel<number | Array<Number> | string | Array<String>>() |
|
||||
const messageIds = computed({ |
|
||||
get() { |
|
||||
if(model.value != undefined){ |
|
||||
return model.value |
|
||||
}else if(props.multiple){ |
|
||||
return [] |
|
||||
} |
|
||||
}, |
|
||||
set(value) { |
|
||||
model.value = value |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
const handleRemote = (title: string)=>{ |
|
||||
loading.value = true |
|
||||
findSystemMessageByTitle(title).then((res) => { |
|
||||
loading.value = false; |
|
||||
options.value = res.data; |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
</script> |
|
||||
@ -1,275 +0,0 @@ |
|||||
<template> |
|
||||
<div class="p-2"> |
|
||||
<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> |
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
</el-card> |
|
||||
</div> |
|
||||
</transition> |
|
||||
|
|
||||
<el-card shadow="never"> |
|
||||
<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-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-col> |
|
||||
<el-col :span="1.5"> |
|
||||
<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> |
|
||||
</template> |
|
||||
|
|
||||
<el-table v-loading="loading" :data="systemMessageList" @selection-change="handleSelectionChange"> |
|
||||
<el-table-column type="selection" width="55" align="center" /> |
|
||||
<el-table-column label="标题" align="center" prop="title" /> |
|
||||
<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-button link type="primary" @click="handleSend(scope.row)" |
|
||||
v-hasPermi="['im:smPushTask:add']">推送</el-button> |
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" |
|
||||
v-hasPermi="['im:systemMessage:edit']">修改</el-button> |
|
||||
<el-button link type="danger" @click="handleDelete(scope.row)" |
|
||||
v-hasPermi="['im:systemMessage:remove']">删除</el-button> |
|
||||
</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" /> |
|
||||
</el-card> |
|
||||
<!-- 添加或修改系统消息对话框 --> |
|
||||
<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"> |
|
||||
<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="类型" 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 v-if="form.contentType == 0" label="富文本内容" prop="richText"> |
|
||||
<editor v-model="richText" placeholder="请输入内容" /> |
|
||||
</el-form-item> |
|
||||
<el-form-item v-else label="外部链接" prop="externLink"> |
|
||||
<el-input v-model="form.externLink" placeholder="请输入外部链接" /> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
<template #footer> |
|
||||
<div class="dialog-footer"> |
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> |
|
||||
<el-button @click="cancel">取 消</el-button> |
|
||||
</div> |
|
||||
</template> |
|
||||
</el-dialog> |
|
||||
<sm-task-info ref="taskInfoRef"></sm-task-info> |
|
||||
</div> |
|
||||
|
|
||||
</template> |
|
||||
|
|
||||
<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'; |
|
||||
import SmTaskInfo from '../task/SmTaskInfo.vue'; |
|
||||
|
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
||||
|
|
||||
const systemMessageList = ref<SystemMessageVO[]>([]); |
|
||||
const buttonLoading = ref(false); |
|
||||
const loading = ref(true); |
|
||||
const showSearch = ref(true); |
|
||||
const ids = ref<Array<string | number>>([]); |
|
||||
const single = ref(true); |
|
||||
const multiple = ref(true); |
|
||||
const total = ref(0); |
|
||||
|
|
||||
const queryFormRef = ref<ElFormInstance>(); |
|
||||
const systemMessageFormRef = ref<ElFormInstance>(); |
|
||||
const taskInfoRef = ref(); |
|
||||
|
|
||||
const dialog = reactive<DialogOption>({ |
|
||||
visible: false, |
|
||||
title: '' |
|
||||
}); |
|
||||
|
|
||||
const initFormData: SystemMessageForm = { |
|
||||
id: undefined, |
|
||||
title: undefined, |
|
||||
coverUrl: undefined, |
|
||||
intro: undefined, |
|
||||
contentType: undefined, |
|
||||
richText: undefined, |
|
||||
externLink: undefined, |
|
||||
deleted: undefined, |
|
||||
creator: undefined, |
|
||||
updater: undefined, |
|
||||
} |
|
||||
|
|
||||
const data = reactive<PageData<SystemMessageForm, SystemMessageQuery>>({ |
|
||||
form: { ...initFormData }, |
|
||||
queryParams: { |
|
||||
pageNum: 1, |
|
||||
pageSize: 10, |
|
||||
title: undefined, |
|
||||
contentType: undefined |
|
||||
}, |
|
||||
rules: { |
|
||||
title: [ |
|
||||
{ required: true, message: "标题不能为空", trigger: "blur" } |
|
||||
], |
|
||||
coverUrl: [ |
|
||||
{ required: true, message: "封面不能为空", trigger: "blur" } |
|
||||
], |
|
||||
intro: [ |
|
||||
{ required: true, message: "简介不能为空", trigger: "blur" } |
|
||||
], |
|
||||
contentType: [ |
|
||||
{ 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 () => { |
|
||||
loading.value = true; |
|
||||
const res = await listSystemMessage(queryParams.value); |
|
||||
systemMessageList.value = res.rows; |
|
||||
total.value = res.total; |
|
||||
loading.value = false; |
|
||||
} |
|
||||
|
|
||||
/** 取消按钮 */ |
|
||||
const cancel = () => { |
|
||||
reset(); |
|
||||
dialog.visible = false; |
|
||||
} |
|
||||
|
|
||||
/** 表单重置 */ |
|
||||
const reset = () => { |
|
||||
form.value = { ...initFormData }; |
|
||||
systemMessageFormRef.value?.resetFields(); |
|
||||
richText.value = '' |
|
||||
} |
|
||||
|
|
||||
/** 搜索按钮操作 */ |
|
||||
const handleQuery = () => { |
|
||||
queryParams.value.pageNum = 1; |
|
||||
getList(); |
|
||||
} |
|
||||
|
|
||||
/** 重置按钮操作 */ |
|
||||
const resetQuery = () => { |
|
||||
queryFormRef.value?.resetFields(); |
|
||||
handleQuery(); |
|
||||
} |
|
||||
|
|
||||
/** 多选框选中数据 */ |
|
||||
const handleSelectionChange = (selection: SystemMessageVO[]) => { |
|
||||
ids.value = selection.map(item => item.id); |
|
||||
single.value = selection.length != 1; |
|
||||
multiple.value = !selection.length; |
|
||||
} |
|
||||
|
|
||||
/** 新增按钮操作 */ |
|
||||
const handleAdd = () => { |
|
||||
reset(); |
|
||||
form.value.contentType = 0; |
|
||||
dialog.visible = true; |
|
||||
dialog.title = "添加系统消息"; |
|
||||
} |
|
||||
|
|
||||
/** 修改按钮操作 */ |
|
||||
const handleUpdate = async (row?: SystemMessageVO) => { |
|
||||
reset(); |
|
||||
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 = "修改系统消息"; |
|
||||
} |
|
||||
|
|
||||
/** 提交按钮 */ |
|
||||
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); |
|
||||
} else { |
|
||||
await addSystemMessage(form.value).finally(() => buttonLoading.value = false); |
|
||||
} |
|
||||
proxy?.$modal.msgSuccess("操作成功"); |
|
||||
dialog.visible = false; |
|
||||
await getList(); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
/** 删除按钮操作 */ |
|
||||
const handleDelete = async (row?: SystemMessageVO) => { |
|
||||
const _ids = row?.id || ids.value; |
|
||||
await proxy?.$modal.confirm('是否确认删除系统消息编号为"' + _ids + '"的数据项?').finally(() => loading.value = false); |
|
||||
await delSystemMessage(_ids); |
|
||||
proxy?.$modal.msgSuccess("删除成功"); |
|
||||
await getList(); |
|
||||
} |
|
||||
|
|
||||
/** 导出按钮操作 */ |
|
||||
const handleExport = () => { |
|
||||
proxy?.download('im/systemMessage/export', { |
|
||||
...queryParams.value |
|
||||
}, `systemMessage_${new Date().getTime()}.xlsx`) |
|
||||
} |
|
||||
|
|
||||
|
|
||||
const handleSend = (row?: SystemMessageVO) =>{ |
|
||||
taskInfoRef.value.initByMessage(row.id); |
|
||||
} |
|
||||
|
|
||||
onMounted(() => { |
|
||||
getList(); |
|
||||
}); |
|
||||
</script> |
|
||||
@ -1,128 +0,0 @@ |
|||||
<template> |
|
||||
<!-- 添加或修改系统消息推送任务对话框 --> |
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> |
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="80px"> |
|
||||
<el-form-item label="系统消息" prop="messageId"> |
|
||||
<im-sm-select v-model="form.messageId"></im-sm-select> |
|
||||
</el-form-item> |
|
||||
<el-form-item label="推送时间" prop="sendTime"> |
|
||||
<el-date-picker clearable v-model="form.sendTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" |
|
||||
placeholder="请选择推送时间"> |
|
||||
</el-date-picker> |
|
||||
</el-form-item> |
|
||||
<el-form-item label="接收用户" prop="sendToAll"> |
|
||||
<el-radio-group v-model="form.sendToAll"> |
|
||||
<el-radio :value="true">全体用户</el-radio> |
|
||||
<el-radio :value="false">指定用户</el-radio> |
|
||||
</el-radio-group> |
|
||||
</el-form-item> |
|
||||
<el-form-item v-if="!form.sendToAll"> |
|
||||
<im-user-select v-model="recvIds" :multiple="true" placeholder="请选择最多20个用户"></im-user-select> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
<template #footer> |
|
||||
<div class="dialog-footer"> |
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> |
|
||||
<el-button @click="cancel">取 消</el-button> |
|
||||
</div> |
|
||||
</template> |
|
||||
</el-dialog> |
|
||||
</template> |
|
||||
|
|
||||
<script setup name="SmTaskInfo" lang="ts"> |
|
||||
import { getSmPushTask, addSmPushTask, updateSmPushTask } from '@/api/im/smPushTask'; |
|
||||
import { SmPushTaskForm, SmPushTaskVO } from '@/api/im/smPushTask/types'; |
|
||||
import { parseTime } from '@/utils/ruoyi'; |
|
||||
|
|
||||
const emit = defineEmits(['refreshDataList']) |
|
||||
|
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
||||
const recvIds = ref<Array<number>>([]); |
|
||||
const dataFormRef = ref<ElFormInstance>(); |
|
||||
const dataRules = ref() |
|
||||
const buttonLoading = ref(false); |
|
||||
const dialog = reactive<DialogOption>({ |
|
||||
visible: false, |
|
||||
title: '' |
|
||||
}); |
|
||||
|
|
||||
const form: SmPushTaskForm = reactive({ |
|
||||
id: undefined, |
|
||||
messageId: null, |
|
||||
sendTime: null, |
|
||||
sendToAll: true, |
|
||||
recvIds: '' |
|
||||
}) |
|
||||
|
|
||||
/** 提交按钮 */ |
|
||||
const submitForm = () => { |
|
||||
buttonLoading.value = true; |
|
||||
dataFormRef.value?.validate(async (valid: boolean) => { |
|
||||
if (valid) { |
|
||||
form.recvIds = recvIds.value.join(","); |
|
||||
if (form.id) { |
|
||||
updateSmPushTask(form).finally(() => buttonLoading.value = false); |
|
||||
} else { |
|
||||
await addSmPushTask(form).finally(() => buttonLoading.value = false); |
|
||||
} |
|
||||
proxy?.$modal.msgSuccess("操作成功"); |
|
||||
dialog.visible = false; |
|
||||
emit('refreshDataList') |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
const init = async (id?: number) => { |
|
||||
dialog.visible = true; |
|
||||
form.id = id; |
|
||||
recvIds.value = []; |
|
||||
// 重置表单数据 |
|
||||
dataFormRef.value?.resetFields() |
|
||||
if (id) { |
|
||||
const res = await getSmPushTask(id); |
|
||||
Object.assign(form, res.data); |
|
||||
if (res.data.recvIds) { |
|
||||
recvIds.value = res.data.recvIds.split(",").map(Number); |
|
||||
} |
|
||||
dialog.title = "修改推送任务"; |
|
||||
} else { |
|
||||
dialog.title = "添加推送任务"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
const initByTask = (task?: SmPushTaskVO) => { |
|
||||
dialog.visible = true; |
|
||||
dataFormRef.value?.resetFields() |
|
||||
form.id = undefined; |
|
||||
form.messageId = task.messageId; |
|
||||
form.sendToAll = task.sendToAll; |
|
||||
form.recvIds = task.recvIds; |
|
||||
form.sendTime = parseTime(new Date(),'{y}-{m}-{d} {h}:{i}:{s}'); |
|
||||
recvIds.value = []; |
|
||||
if (task.recvIds) { |
|
||||
recvIds.value = task.recvIds.split(",").map(Number); |
|
||||
} |
|
||||
dialog.title = "添加推送任务"; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
const initByMessage = (messageId: number) => { |
|
||||
dialog.visible = true; |
|
||||
dialog.title = "添加推送任务"; |
|
||||
dataFormRef.value?.resetFields() |
|
||||
form.id = undefined; |
|
||||
form.messageId = messageId; |
|
||||
form.sendToAll = true; |
|
||||
form.recvIds = ''; |
|
||||
form.sendTime = parseTime(new Date(),'{y}-{m}-{d} {h}:{i}:{s}'); |
|
||||
console.log(form.sendTime) |
|
||||
} |
|
||||
|
|
||||
const cancel = () => { |
|
||||
|
|
||||
dialog.visible = false; |
|
||||
} |
|
||||
defineExpose({ |
|
||||
init, initByTask, initByMessage |
|
||||
}) |
|
||||
</script> |
|
||||
@ -1,176 +0,0 @@ |
|||||
<template> |
|
||||
<div class="p-2"> |
|
||||
<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="messageId"> |
|
||||
<im-sm-select v-model="queryParams.messageId" placeholder="请输入系统消息" clearable ></im-sm-select> |
|
||||
</el-form-item> |
|
||||
<el-form-item> |
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
</el-card> |
|
||||
</div> |
|
||||
</transition> |
|
||||
|
|
||||
<el-card shadow="never"> |
|
||||
<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:smPushTask:add']">新增</el-button> |
|
||||
</el-col> |
|
||||
<el-col :span="1.5"> |
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" |
|
||||
v-hasPermi="['im:smPushTask:remove']">删除</el-button> |
|
||||
</el-col> |
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
|
||||
</el-row> |
|
||||
</template> |
|
||||
|
|
||||
<el-table v-loading="loading" :data="smPushTaskList" @selection-change="handleSelectionChange"> |
|
||||
<el-table-column type="selection" width="55" align="center" /> |
|
||||
<el-table-column label="推送消息" align="center" prop="messageTitle" /> |
|
||||
<el-table-column label="推送时间" align="center" prop="sendTime" width="180"> |
|
||||
<template #default="scope"> |
|
||||
<span>{{ parseTime(scope.row.sendTime, '{y}-{m}-{d}') }}</span> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column label="推送状态" align="center" prop="status"> |
|
||||
<template #default="scope"> |
|
||||
<dict-tag :options="im_sm_push_status" :value="scope.row.status" /> |
|
||||
</template> |
|
||||
</el-table-column>> |
|
||||
<el-table-column label="接收用户" align="center" prop="recvIds"> |
|
||||
<template #default="scope"> |
|
||||
<span>{{ scope.row.sendToAll ? '全体用户' : `共${scope.row.recvIds.split(',').length}个用户` }}</span> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column label="创建者" align="center" prop="creatorName" /> |
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" /> |
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|
||||
<template #default="scope"> |
|
||||
<el-button v-if="scope.row.status == 1" v-hasPermi="['im:smPushTask:edit']" type="primary" link |
|
||||
@click="handleUpdate(scope.row)">修改</el-button> |
|
||||
<el-button v-hasPermi="['im:smPushTask:remove']" type="danger" link |
|
||||
@click="handleDelete(scope.row)">删除</el-button> |
|
||||
<el-button v-if="scope.row.status == 1" v-hasPermi="['im:smPushTask:edit']" type="danger" link |
|
||||
@click="handleCancel(scope.row.id)">取消</el-button> |
|
||||
<el-button v-if="scope.row.status == 4" v-hasPermi="['im:smPushTask:edit']" type="primary" link |
|
||||
@click="handleOpen(scope.row.id)">开启</el-button> |
|
||||
<el-button v-if="scope.row.status == 3" v-hasPermi="['im:smPushTask:add']" type="primary" link |
|
||||
@click="handleResend(scope.row.id)">再次推送</el-button> |
|
||||
</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" /> |
|
||||
</el-card> |
|
||||
<sm-task-info ref="taskInfoRef" @refreshDataList="getList"></sm-task-info> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script setup name="SmPushTask" lang="ts"> |
|
||||
import { listSmPushTask, getSmPushTask, delSmPushTask, cancelSmPushTask, openSmPushTask } from '@/api/im/smPushTask'; |
|
||||
import { SmPushTaskVO, SmPushTaskQuery } from '@/api/im/smPushTask/types'; |
|
||||
import SmTaskInfo from './SmTaskInfo.vue' |
|
||||
|
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
||||
|
|
||||
const smPushTaskList = ref<SmPushTaskVO[]>([]); |
|
||||
|
|
||||
const loading = ref(true); |
|
||||
const showSearch = ref(true); |
|
||||
const ids = ref<Array<number>>([]); |
|
||||
const single = ref(true); |
|
||||
const multiple = ref(true); |
|
||||
const total = ref(0); |
|
||||
|
|
||||
const queryFormRef = ref<ElFormInstance>(); |
|
||||
const taskInfoRef = ref(); |
|
||||
|
|
||||
const queryParams = reactive<SmPushTaskQuery>({ |
|
||||
pageNum: 1, |
|
||||
pageSize: 10, |
|
||||
messageId: undefined, |
|
||||
}) |
|
||||
const { im_sm_push_status } = toRefs<any>(proxy?.useDict('im_sm_push_status')); |
|
||||
|
|
||||
|
|
||||
/** 查询系统消息推送任务列表 */ |
|
||||
const getList = async () => { |
|
||||
loading.value = true; |
|
||||
const res = await listSmPushTask(queryParams); |
|
||||
smPushTaskList.value = res.rows; |
|
||||
total.value = res.total; |
|
||||
loading.value = false; |
|
||||
} |
|
||||
|
|
||||
/** 搜索按钮操作 */ |
|
||||
const handleQuery = () => { |
|
||||
queryParams.pageNum = 1; |
|
||||
getList(); |
|
||||
} |
|
||||
|
|
||||
/** 重置按钮操作 */ |
|
||||
const resetQuery = () => { |
|
||||
queryFormRef.value?.resetFields(); |
|
||||
handleQuery(); |
|
||||
} |
|
||||
|
|
||||
/** 多选框选中数据 */ |
|
||||
const handleSelectionChange = (selection: SmPushTaskVO[]) => { |
|
||||
ids.value = selection.map(item => item.id); |
|
||||
single.value = selection.length != 1; |
|
||||
multiple.value = !selection.length; |
|
||||
} |
|
||||
|
|
||||
/** 新增按钮操作 */ |
|
||||
const handleAdd = () => { |
|
||||
console.log(taskInfoRef.value) |
|
||||
taskInfoRef.value.init() |
|
||||
} |
|
||||
|
|
||||
/** 修改按钮操作 */ |
|
||||
const handleUpdate = async (row: SmPushTaskVO) => { |
|
||||
taskInfoRef.value.init(row.id); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** 删除按钮操作 */ |
|
||||
const handleDelete = async (row?: SmPushTaskVO) => { |
|
||||
const _ids = row?.id || ids.value; |
|
||||
await proxy?.$modal.confirm('是否确认删除?').finally(() => loading.value = false); |
|
||||
await delSmPushTask(_ids); |
|
||||
proxy?.$modal.msgSuccess("删除成功"); |
|
||||
await getList(); |
|
||||
} |
|
||||
|
|
||||
const handleCancel = (id: number) => { |
|
||||
cancelSmPushTask(id).then(() => { |
|
||||
getList() |
|
||||
ElMessage.success('任务取消成功') |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
const handleOpen = (id: number) => { |
|
||||
openSmPushTask(id).then(() => { |
|
||||
getList(); |
|
||||
ElMessage.success('任务开启成功') |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
const handleResend = async(id: number) => { |
|
||||
const res = await getSmPushTask(id); |
|
||||
taskInfoRef.value.initByTask(res.data); |
|
||||
} |
|
||||
|
|
||||
onMounted(() => { |
|
||||
getList(); |
|
||||
}); |
|
||||
</script> |
|
||||
@ -1,107 +0,0 @@ |
|||||
package org.dromara.im.controller; |
|
||||
|
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
||||
import jakarta.validation.constraints.NotEmpty; |
|
||||
import jakarta.validation.constraints.NotNull; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.dromara.common.core.domain.R; |
|
||||
import org.dromara.common.core.validate.AddGroup; |
|
||||
import org.dromara.common.core.validate.EditGroup; |
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|
||||
import org.dromara.common.log.annotation.Log; |
|
||||
import org.dromara.common.log.enums.BusinessType; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.common.web.core.BaseController; |
|
||||
import org.dromara.im.domain.bo.ImSmPushTaskBo; |
|
||||
import org.dromara.im.domain.vo.ImSmPushTaskVo; |
|
||||
import org.dromara.im.service.IImSmPushTaskService; |
|
||||
import org.springframework.validation.annotation.Validated; |
|
||||
import org.springframework.web.bind.annotation.*; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Validated |
|
||||
@RequiredArgsConstructor |
|
||||
@RestController |
|
||||
@RequestMapping("/im/smPushTask") |
|
||||
public class ImSmPushTaskController extends BaseController { |
|
||||
|
|
||||
private final IImSmPushTaskService imSmPushTaskService; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息推送任务列表 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:smPushTask:list") |
|
||||
@GetMapping("/list") |
|
||||
public TableDataInfo<ImSmPushTaskVo> list(ImSmPushTaskBo bo, PageQuery pageQuery) { |
|
||||
return imSmPushTaskService.queryPageList(bo, pageQuery); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 获取系统消息推送任务详细信息 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:smPushTask:query") |
|
||||
@GetMapping("/{id}") |
|
||||
public R<ImSmPushTaskVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) { |
|
||||
return R.ok(imSmPushTaskService.queryById(id)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息推送任务 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:smPushTask:add") |
|
||||
@Log(title = "系统消息推送任务", businessType = BusinessType.INSERT) |
|
||||
@RepeatSubmit() |
|
||||
@PostMapping() |
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ImSmPushTaskBo bo) { |
|
||||
return toAjax(imSmPushTaskService.insertByBo(bo)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息推送任务 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:smPushTask:edit") |
|
||||
@Log(title = "系统消息推送任务", businessType = BusinessType.UPDATE) |
|
||||
@RepeatSubmit() |
|
||||
@PutMapping() |
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ImSmPushTaskBo bo) { |
|
||||
return toAjax(imSmPushTaskService.updateByBo(bo)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 删除系统消息推送任务 |
|
||||
* |
|
||||
* @param ids 主键串 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:smPushTask:remove") |
|
||||
@Log(title = "系统消息推送任务", businessType = BusinessType.DELETE) |
|
||||
@DeleteMapping("/{ids}") |
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) { |
|
||||
return toAjax(imSmPushTaskService.deleteByIds(List.of(ids), true)); |
|
||||
} |
|
||||
|
|
||||
@PutMapping("cancel") |
|
||||
@Log(title = "取消推送任务", businessType = BusinessType.UPDATE) |
|
||||
@SaCheckPermission("im:smPushTask:edit") |
|
||||
public R<Void> cancel(@RequestParam("id") Long id) { |
|
||||
imSmPushTaskService.cancel(id); |
|
||||
return R.ok(); |
|
||||
} |
|
||||
|
|
||||
@PutMapping("open") |
|
||||
@Log(title = "开启推送任务", businessType = BusinessType.UPDATE) |
|
||||
@SaCheckPermission("im:smPushTask:edit") |
|
||||
public R<Void> open(@RequestParam("id") Long id) { |
|
||||
imSmPushTaskService.open(id); |
|
||||
return R.ok(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,100 +0,0 @@ |
|||||
package org.dromara.im.controller; |
|
||||
|
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
||||
import jakarta.validation.constraints.NotEmpty; |
|
||||
import jakarta.validation.constraints.NotNull; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.dromara.common.core.domain.R; |
|
||||
import org.dromara.common.core.validate.AddGroup; |
|
||||
import org.dromara.common.core.validate.EditGroup; |
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|
||||
import org.dromara.common.log.annotation.Log; |
|
||||
import org.dromara.common.log.enums.BusinessType; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.common.web.core.BaseController; |
|
||||
import org.dromara.im.domain.bo.ImSystemMessageBo; |
|
||||
import org.dromara.im.domain.vo.ImSystemMessageVo; |
|
||||
import org.dromara.im.service.IImSystemMessageService; |
|
||||
import org.springframework.validation.annotation.Validated; |
|
||||
import org.springframework.web.bind.annotation.*; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Validated |
|
||||
@RequiredArgsConstructor |
|
||||
@RestController |
|
||||
@RequestMapping("/im/systemMessage") |
|
||||
public class ImSystemMessageController extends BaseController { |
|
||||
|
|
||||
private final IImSystemMessageService systemMessageService; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息列表 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:systemMessage:list") |
|
||||
@GetMapping("/list") |
|
||||
public TableDataInfo<ImSystemMessageVo> list(ImSystemMessageBo bo, PageQuery pageQuery) { |
|
||||
return systemMessageService.queryPageList(bo, pageQuery); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 获取系统消息详细信息 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:systemMessage:query") |
|
||||
@GetMapping("/{id}") |
|
||||
public R<ImSystemMessageVo> getInfo(@NotNull(message = "主键不能为空") |
|
||||
@PathVariable Long id) { |
|
||||
return R.ok(systemMessageService.queryById(id)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:systemMessage:add") |
|
||||
@Log(title = "系统消息", businessType = BusinessType.INSERT) |
|
||||
@RepeatSubmit() |
|
||||
@PostMapping() |
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ImSystemMessageBo bo) { |
|
||||
return toAjax(systemMessageService.insertByBo(bo)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:systemMessage:edit") |
|
||||
@Log(title = "系统消息", businessType = BusinessType.UPDATE) |
|
||||
@RepeatSubmit() |
|
||||
@PutMapping() |
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ImSystemMessageBo bo) { |
|
||||
return toAjax(systemMessageService.updateByBo(bo)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 删除系统消息 |
|
||||
* |
|
||||
* @param ids 主键串 |
|
||||
*/ |
|
||||
@SaCheckPermission("im:systemMessage:remove") |
|
||||
@Log(title = "系统消息", businessType = BusinessType.DELETE) |
|
||||
@DeleteMapping("/{ids}") |
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|
||||
@PathVariable Long[] ids) { |
|
||||
return toAjax(systemMessageService.deleteWithValidByIds(List.of(ids), true)); |
|
||||
} |
|
||||
|
|
||||
@GetMapping("findByTitle") |
|
||||
@SaCheckPermission("im:systemMessage:list") |
|
||||
public R<List<ImSystemMessageVo>> findByTitle(@RequestParam String title) { |
|
||||
return R.ok(systemMessageService.findByTitle(title)); |
|
||||
} |
|
||||
} |
|
||||
@ -1,73 +0,0 @@ |
|||||
package org.dromara.im.domain; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic; |
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务对象 im_sm_push_task |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@TableName("im_sm_push_task") |
|
||||
public class ImSmPushTask { |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
@TableId(value = "id") |
|
||||
private Long id; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
private Long messageId; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
private Long seqNo; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
private Date sendTime; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
private Integer status; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
private Boolean sendToAll; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id,逗号分隔,send_to_all为false时有效 |
|
||||
*/ |
|
||||
private String recvIds; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
private Long creator; |
|
||||
|
|
||||
/** |
|
||||
* 创建时间 |
|
||||
*/ |
|
||||
private Date createTime; |
|
||||
|
|
||||
/** |
|
||||
* 删除标记 |
|
||||
*/ |
|
||||
@TableLogic |
|
||||
private Boolean deleted; |
|
||||
|
|
||||
} |
|
||||
@ -1,71 +0,0 @@ |
|||||
package org.dromara.im.domain; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic; |
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||
import com.fhs.core.trans.vo.TransPojo; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息对象 im_system_message |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@TableName("im_system_message") |
|
||||
public class ImSystemMessage implements TransPojo { |
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
@TableId |
|
||||
private Long id; |
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
private String title; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
private String coverUrl; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
private String intro; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 0:富文本 1:外部链接 |
|
||||
*/ |
|
||||
private Long contentType; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
private String richText; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
private String externLink; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
private Long creator; |
|
||||
|
|
||||
/** |
|
||||
* 创建时间 |
|
||||
*/ |
|
||||
private Date createTime; |
|
||||
|
|
||||
/** |
|
||||
* 删除标记 |
|
||||
*/ |
|
||||
@TableLogic |
|
||||
private Boolean deleted; |
|
||||
} |
|
||||
@ -1,63 +0,0 @@ |
|||||
package org.dromara.im.domain.bo; |
|
||||
|
|
||||
import io.github.linpeilie.annotations.AutoMapper; |
|
||||
import jakarta.validation.constraints.NotNull; |
|
||||
import lombok.Data; |
|
||||
import lombok.EqualsAndHashCode; |
|
||||
import org.dromara.common.core.validate.AddGroup; |
|
||||
import org.dromara.common.core.validate.EditGroup; |
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|
||||
import org.dromara.im.domain.ImSmPushTask; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务业务对象 im_sm_push_task |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@EqualsAndHashCode(callSuper = true) |
|
||||
@AutoMapper(target = ImSmPushTask.class, reverseConvertGenerate = false) |
|
||||
public class ImSmPushTaskBo extends BaseEntity { |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class }) |
|
||||
private Long id; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
@NotNull(message = "系统消息id不能为空", groups = { AddGroup.class, EditGroup.class }) |
|
||||
private Long messageId; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
private Long seqNo; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
private Date sendTime; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
private Integer status; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
private Boolean sendToAll; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id,逗号分隔 |
|
||||
*/ |
|
||||
private String recvIds; |
|
||||
|
|
||||
} |
|
||||
@ -1,75 +0,0 @@ |
|||||
package org.dromara.im.domain.bo; |
|
||||
|
|
||||
import io.github.linpeilie.annotations.AutoMapper; |
|
||||
import jakarta.validation.constraints.NotBlank; |
|
||||
import jakarta.validation.constraints.NotNull; |
|
||||
import lombok.Data; |
|
||||
import lombok.EqualsAndHashCode; |
|
||||
import org.dromara.common.core.validate.AddGroup; |
|
||||
import org.dromara.common.core.validate.EditGroup; |
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|
||||
import org.dromara.im.domain.ImSystemMessage; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息业务对象 im_system_message |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@EqualsAndHashCode(callSuper = true) |
|
||||
@AutoMapper(target = ImSystemMessage.class, reverseConvertGenerate = false) |
|
||||
public class ImSystemMessageBo extends BaseEntity { |
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class }) |
|
||||
private Long id; |
|
||||
|
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
@NotBlank(message = "标题不能为空", groups = { AddGroup.class, EditGroup.class }) |
|
||||
private String title; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
@NotBlank(message = "封面不能为空", groups = { AddGroup.class, EditGroup.class }) |
|
||||
private String coverUrl; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
@NotBlank(message = "简介不能为空", groups = { AddGroup.class, EditGroup.class }) |
|
||||
private String intro; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 0:富文本 1:外部链接 |
|
||||
*/ |
|
||||
@NotNull(message = "内容类型", groups = { AddGroup.class, EditGroup.class }) |
|
||||
private Long contentType; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
private String richText; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
private String externLink; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
private Long creator; |
|
||||
|
|
||||
/** |
|
||||
* 更新者 |
|
||||
*/ |
|
||||
private Long updater; |
|
||||
|
|
||||
|
|
||||
} |
|
||||
@ -1,85 +0,0 @@ |
|||||
package org.dromara.im.domain.vo; |
|
||||
|
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|
||||
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 lombok.Data; |
|
||||
import org.dromara.im.constant.ImConstant; |
|
||||
import org.dromara.im.domain.ImSmPushTask; |
|
||||
import org.dromara.im.domain.ImSystemMessage; |
|
||||
import org.dromara.system.domain.SysUser; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务视图对象 im_sm_push_task |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@ExcelIgnoreUnannotated |
|
||||
@AutoMapper(target = ImSmPushTask.class) |
|
||||
public class ImSmPushTaskVo implements TransPojo { |
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
private Long id; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息id |
|
||||
*/ |
|
||||
@Trans(type = TransType.SIMPLE, dataSource = ImConstant.DS_IM_PLATFORM, target = ImSystemMessage.class, |
|
||||
fields = "title", ref = "messageTitle") |
|
||||
private Long messageId; |
|
||||
|
|
||||
/** |
|
||||
* 消息标题 |
|
||||
*/ |
|
||||
private String messageTitle; |
|
||||
|
|
||||
/** |
|
||||
* 发送序列号 |
|
||||
*/ |
|
||||
private Long seqNo; |
|
||||
|
|
||||
/** |
|
||||
* 推送时间 |
|
||||
*/ |
|
||||
private Date sendTime; |
|
||||
|
|
||||
/** |
|
||||
* 状态 1:待发送 2:发送中 3:已发送 4:已取消 |
|
||||
*/ |
|
||||
private Integer status; |
|
||||
|
|
||||
/** |
|
||||
* 是否发送给全体用户 |
|
||||
*/ |
|
||||
private Boolean sendToAll; |
|
||||
|
|
||||
/** |
|
||||
* 接收用户id |
|
||||
*/ |
|
||||
private String recvIds; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
@Trans(type = TransType.SIMPLE, target = SysUser.class, fields = "userName", ref = "creatorName") |
|
||||
private Long creator; |
|
||||
|
|
||||
/** |
|
||||
* 创建者名称 |
|
||||
*/ |
|
||||
private String creatorName; |
|
||||
|
|
||||
/** |
|
||||
* 创建时间 |
|
||||
*/ |
|
||||
private Date createTime; |
|
||||
|
|
||||
} |
|
||||
@ -1,70 +0,0 @@ |
|||||
package org.dromara.im.domain.vo; |
|
||||
|
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|
||||
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 org.dromara.system.domain.SysUser; |
|
||||
|
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 系统消息视图对象 im_system_message |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@Data |
|
||||
@ExcelIgnoreUnannotated |
|
||||
@AutoMapper(target = ImSystemMessage.class) |
|
||||
public class ImSystemMessageVo implements TransPojo { |
|
||||
|
|
||||
/** |
|
||||
* id |
|
||||
*/ |
|
||||
private Long id; |
|
||||
|
|
||||
/** |
|
||||
* 标题 |
|
||||
*/ |
|
||||
private String title; |
|
||||
|
|
||||
/** |
|
||||
* 封面 |
|
||||
*/ |
|
||||
private String coverUrl; |
|
||||
|
|
||||
/** |
|
||||
* 简介 |
|
||||
*/ |
|
||||
private String intro; |
|
||||
|
|
||||
/** |
|
||||
* 内容类型 |
|
||||
*/ |
|
||||
private Long contentType; |
|
||||
|
|
||||
/** |
|
||||
* 富文本内容,base64编码 |
|
||||
*/ |
|
||||
private String richText; |
|
||||
|
|
||||
/** |
|
||||
* 外部链接 |
|
||||
*/ |
|
||||
private String externLink; |
|
||||
|
|
||||
/** |
|
||||
* 创建者 |
|
||||
*/ |
|
||||
@Trans(type = TransType.SIMPLE, target = SysUser.class, fields = "userName", ref = "creatorName") |
|
||||
private Long creator; |
|
||||
|
|
||||
@Schema(description = "创建者名称") |
|
||||
private String creatorName; |
|
||||
|
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
package org.dromara.im.mapper; |
|
||||
|
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|
||||
import org.dromara.im.domain.ImSmPushTask; |
|
||||
import org.dromara.im.domain.vo.ImSmPushTaskVo; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务Mapper接口 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
public interface ImSmPushTaskMapper extends BaseMapperPlus<ImSmPushTask, ImSmPushTaskVo> { |
|
||||
|
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
package org.dromara.im.mapper; |
|
||||
|
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|
||||
import org.dromara.im.domain.ImSystemMessage; |
|
||||
import org.dromara.im.domain.vo.ImSystemMessageVo; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息Mapper接口 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
public interface ImSystemMessageMapper extends BaseMapperPlus<ImSystemMessage, ImSystemMessageVo> { |
|
||||
|
|
||||
} |
|
||||
@ -1,67 +0,0 @@ |
|||||
package org.dromara.im.service; |
|
||||
|
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.im.domain.bo.ImSmPushTaskBo; |
|
||||
import org.dromara.im.domain.vo.ImSmPushTaskVo; |
|
||||
|
|
||||
import java.util.Collection; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务Service接口 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
public interface IImSmPushTaskService { |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息推送任务 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
* @return 系统消息推送任务 |
|
||||
*/ |
|
||||
ImSmPushTaskVo queryById(Long id); |
|
||||
|
|
||||
/** |
|
||||
* 分页查询系统消息推送任务列表 |
|
||||
* |
|
||||
* @param bo 查询条件 |
|
||||
* @param pageQuery 分页参数 |
|
||||
* @return 系统消息推送任务分页列表 |
|
||||
*/ |
|
||||
TableDataInfo<ImSmPushTaskVo> queryPageList(ImSmPushTaskBo bo, PageQuery pageQuery); |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息推送任务 |
|
||||
* |
|
||||
* @param bo 系统消息推送任务 |
|
||||
* @return 是否新增成功 |
|
||||
*/ |
|
||||
Boolean insertByBo(ImSmPushTaskBo bo); |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息推送任务 |
|
||||
* |
|
||||
* @param bo 系统消息推送任务 |
|
||||
* @return 是否修改成功 |
|
||||
*/ |
|
||||
Boolean updateByBo(ImSmPushTaskBo bo); |
|
||||
|
|
||||
/** |
|
||||
* 校验并批量删除系统消息推送任务信息 |
|
||||
* |
|
||||
* @param ids 待删除的主键集合 |
|
||||
* @param isValid 是否进行有效性校验 |
|
||||
* @return 是否删除成功 |
|
||||
*/ |
|
||||
Boolean deleteByIds(Collection<Long> ids, Boolean isValid); |
|
||||
|
|
||||
|
|
||||
void cancel(Long id); |
|
||||
|
|
||||
void open(Long id); |
|
||||
|
|
||||
boolean isExistTask(Collection<Long> messageIds); |
|
||||
} |
|
||||
@ -1,65 +0,0 @@ |
|||||
package org.dromara.im.service; |
|
||||
|
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.im.domain.bo.ImSystemMessageBo; |
|
||||
import org.dromara.im.domain.vo.ImSystemMessageVo; |
|
||||
|
|
||||
import java.util.Collection; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息Service接口 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
public interface IImSystemMessageService { |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
* @return 系统消息 |
|
||||
*/ |
|
||||
ImSystemMessageVo queryById(Long id); |
|
||||
|
|
||||
/** |
|
||||
* 分页查询系统消息列表 |
|
||||
* |
|
||||
* @param bo 查询条件 |
|
||||
* @param pageQuery 分页参数 |
|
||||
* @return 系统消息分页列表 |
|
||||
*/ |
|
||||
TableDataInfo<ImSystemMessageVo> queryPageList(ImSystemMessageBo bo, PageQuery pageQuery); |
|
||||
|
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息 |
|
||||
* |
|
||||
* @param bo 系统消息 |
|
||||
* @return 是否新增成功 |
|
||||
*/ |
|
||||
Boolean insertByBo(ImSystemMessageBo bo); |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息 |
|
||||
* |
|
||||
* @param bo 系统消息 |
|
||||
* @return 是否修改成功 |
|
||||
*/ |
|
||||
Boolean updateByBo(ImSystemMessageBo bo); |
|
||||
|
|
||||
/** |
|
||||
* 校验并批量删除系统消息信息 |
|
||||
* |
|
||||
* @param ids 待删除的主键集合 |
|
||||
* @param isValid 是否进行有效性校验 |
|
||||
* @return 是否删除成功 |
|
||||
*/ |
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|
||||
|
|
||||
|
|
||||
List<ImSystemMessageVo> findByTitle(String title); |
|
||||
} |
|
||||
@ -1,169 +0,0 @@ |
|||||
package org.dromara.im.service.impl; |
|
||||
|
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.apache.logging.log4j.util.Strings; |
|
||||
import org.dromara.common.core.exception.ServiceException; |
|
||||
import org.dromara.common.core.utils.MapstructUtils; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.common.satoken.utils.LoginHelper; |
|
||||
import org.dromara.im.constant.ImConstant; |
|
||||
import org.dromara.im.domain.ImSmPushTask; |
|
||||
import org.dromara.im.domain.bo.ImSmPushTaskBo; |
|
||||
import org.dromara.im.domain.vo.ImSmPushTaskVo; |
|
||||
import org.dromara.im.enums.ImSmPushStatus; |
|
||||
import org.dromara.im.mapper.ImSmPushTaskMapper; |
|
||||
import org.dromara.im.service.IImSmPushTaskService; |
|
||||
import org.dromara.im.util.CommaTextUtils; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.Collection; |
|
||||
import java.util.Date; |
|
||||
import java.util.Objects; |
|
||||
import java.util.Set; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息推送任务Service业务层处理 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@DS(ImConstant.DS_IM_PLATFORM) |
|
||||
@RequiredArgsConstructor |
|
||||
@Service |
|
||||
public class ImSmPushTaskServiceImpl implements IImSmPushTaskService { |
|
||||
|
|
||||
private final ImSmPushTaskMapper baseMapper; |
|
||||
|
|
||||
/** |
|
||||
* 查询系统消息推送任务 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
* @return 系统消息推送任务 |
|
||||
*/ |
|
||||
@Override |
|
||||
public ImSmPushTaskVo queryById(Long id){ |
|
||||
return baseMapper.selectVoById(id); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 分页查询系统消息推送任务列表 |
|
||||
* |
|
||||
* @param bo 查询条件 |
|
||||
* @param pageQuery 分页参数 |
|
||||
* @return 系统消息推送任务分页列表 |
|
||||
*/ |
|
||||
@Override |
|
||||
public TableDataInfo<ImSmPushTaskVo> queryPageList(ImSmPushTaskBo bo, PageQuery pageQuery) { |
|
||||
LambdaQueryWrapper<ImSmPushTask> wrapper = buildQueryWrapper(bo); |
|
||||
Page<ImSmPushTaskVo> result = baseMapper.selectVoPage(pageQuery.build(), wrapper); |
|
||||
return TableDataInfo.build(result); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
private LambdaQueryWrapper<ImSmPushTask> buildQueryWrapper(ImSmPushTaskBo bo) { |
|
||||
LambdaQueryWrapper<ImSmPushTask> wrapper = Wrappers.lambdaQuery(); |
|
||||
wrapper.eq(bo.getMessageId() != null, ImSmPushTask::getMessageId, bo.getMessageId()); |
|
||||
wrapper.orderByDesc(ImSmPushTask::getId); |
|
||||
return wrapper; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息推送任务 |
|
||||
* |
|
||||
* @param bo 系统消息推送任务 |
|
||||
* @return 是否新增成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean insertByBo(ImSmPushTaskBo bo) { |
|
||||
ImSmPushTask task = valid(MapstructUtils.convert(bo, ImSmPushTask.class)); |
|
||||
task.setDeleted(false); |
|
||||
task.setCreator(LoginHelper.getUserId()); |
|
||||
task.setCreateTime(new Date()); |
|
||||
return baseMapper.insert(task) > 0; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息推送任务 |
|
||||
* |
|
||||
* @param bo 系统消息推送任务 |
|
||||
* @return 是否修改成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean updateByBo(ImSmPushTaskBo bo) { |
|
||||
ImSmPushTask task = this.baseMapper.selectById(bo.getId()); |
|
||||
if (!ImSmPushStatus.WAIT_SEND.getValue().equals(task.getStatus())) { |
|
||||
throw new ServiceException("只允许修改未发送的任务"); |
|
||||
} |
|
||||
task = valid(MapstructUtils.convert(bo, ImSmPushTask.class)); |
|
||||
return baseMapper.updateById(task) > 0; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 校验并批量删除系统消息推送任务信息 |
|
||||
* |
|
||||
* @param ids 待删除的主键集合 |
|
||||
* @param isValid 是否进行有效性校验 |
|
||||
* @return 是否删除成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean deleteByIds(Collection<Long> ids, Boolean isValid) { |
|
||||
return baseMapper.deleteByIds(ids) > 0; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void cancel(Long id) { |
|
||||
LambdaUpdateWrapper<ImSmPushTask> wrapper = Wrappers.lambdaUpdate(); |
|
||||
wrapper.eq(ImSmPushTask::getId, id); |
|
||||
wrapper.set(ImSmPushTask::getStatus, ImSmPushStatus.CANCEL.getValue()); |
|
||||
this.baseMapper.update(wrapper); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void open(Long id) { |
|
||||
LambdaUpdateWrapper<ImSmPushTask> wrapper = Wrappers.lambdaUpdate(); |
|
||||
wrapper.eq(ImSmPushTask::getId, id); |
|
||||
wrapper.set(ImSmPushTask::getStatus, ImSmPushStatus.WAIT_SEND.getValue()); |
|
||||
this.baseMapper.update(wrapper); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public boolean isExistTask(Collection<Long> messageIds) { |
|
||||
LambdaQueryWrapper<ImSmPushTask> wrapper = Wrappers.lambdaQuery(); |
|
||||
wrapper.in(ImSmPushTask::getMessageId, messageIds); |
|
||||
return this.baseMapper.exists(wrapper); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
private ImSmPushTask valid(ImSmPushTask task){ |
|
||||
// 校验接收用户
|
|
||||
if(task.getSendToAll()){ |
|
||||
task.setRecvIds(Strings.EMPTY); |
|
||||
}else { |
|
||||
// 去重
|
|
||||
Set<String> recvIds = CommaTextUtils.asSet(task.getRecvIds()); |
|
||||
if(recvIds.isEmpty()){ |
|
||||
throw new ServiceException("请选择接收用户"); |
|
||||
} |
|
||||
if(recvIds.size() > 20){ |
|
||||
throw new ServiceException("接收用户最多选择20人"); |
|
||||
} |
|
||||
task.setRecvIds(CommaTextUtils.asText(recvIds)); |
|
||||
} |
|
||||
// 校验时间:小于当前时间,修正为当前时间,表示立即发送
|
|
||||
if (Objects.isNull(task.getSendTime()) || task.getSendTime().compareTo(new Date()) < 0) { |
|
||||
task.setSendTime(new Date()); |
|
||||
} |
|
||||
return task; |
|
||||
} |
|
||||
} |
|
||||
@ -1,132 +0,0 @@ |
|||||
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; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.dromara.common.core.exception.ServiceException; |
|
||||
import org.dromara.common.core.utils.MapstructUtils; |
|
||||
import org.dromara.common.core.utils.StringUtils; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.common.satoken.utils.LoginHelper; |
|
||||
import org.dromara.im.constant.ImConstant; |
|
||||
import org.dromara.im.domain.ImSystemMessage; |
|
||||
import org.dromara.im.domain.bo.ImSystemMessageBo; |
|
||||
import org.dromara.im.domain.vo.ImSystemMessageVo; |
|
||||
import org.dromara.im.mapper.ImSystemMessageMapper; |
|
||||
import org.dromara.im.service.IImSmPushTaskService; |
|
||||
import org.dromara.im.service.IImSystemMessageService; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.Collection; |
|
||||
import java.util.Date; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 系统消息Service业务层处理 |
|
||||
* |
|
||||
* @author Blue |
|
||||
* @date 2024-12-22 |
|
||||
*/ |
|
||||
@DS(ImConstant.DS_IM_PLATFORM) |
|
||||
@RequiredArgsConstructor |
|
||||
@Service |
|
||||
public class ImSystemMessageServiceImpl implements IImSystemMessageService { |
|
||||
|
|
||||
private final ImSystemMessageMapper baseMapper; |
|
||||
|
|
||||
private final IImSmPushTaskService smPushTaskService; |
|
||||
/** |
|
||||
* 查询系统消息 |
|
||||
* |
|
||||
* @param id 主键 |
|
||||
* @return 系统消息 |
|
||||
*/ |
|
||||
@Override |
|
||||
public ImSystemMessageVo queryById(Long id){ |
|
||||
return baseMapper.selectVoById(id); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 分页查询系统消息列表 |
|
||||
* |
|
||||
* @param bo 查询条件 |
|
||||
* @param pageQuery 分页参数 |
|
||||
* @return 系统消息分页列表 |
|
||||
*/ |
|
||||
@Override |
|
||||
public TableDataInfo<ImSystemMessageVo> queryPageList(ImSystemMessageBo bo, PageQuery pageQuery) { |
|
||||
LambdaQueryWrapper<ImSystemMessage> wrapper = buildQueryWrapper(bo); |
|
||||
Page<ImSystemMessageVo> result = baseMapper.selectVoPage(pageQuery.build(), wrapper); |
|
||||
return TableDataInfo.build(result); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
private LambdaQueryWrapper<ImSystemMessage> buildQueryWrapper(ImSystemMessageBo bo) { |
|
||||
LambdaQueryWrapper<ImSystemMessage> wrapper = Wrappers.lambdaQuery(); |
|
||||
wrapper.eq(StringUtils.isNotBlank(bo.getTitle()), ImSystemMessage::getTitle, bo.getTitle()); |
|
||||
wrapper.eq(bo.getContentType() != null, ImSystemMessage::getContentType, bo.getContentType()); |
|
||||
wrapper.orderByDesc(ImSystemMessage::getId); |
|
||||
return wrapper; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 新增系统消息 |
|
||||
* |
|
||||
* @param bo 系统消息 |
|
||||
* @return 是否新增成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean insertByBo(ImSystemMessageBo bo) { |
|
||||
ImSystemMessage message = MapstructUtils.convert(bo, ImSystemMessage.class); |
|
||||
message.setDeleted(false); |
|
||||
message.setCreator(LoginHelper.getUserId()); |
|
||||
message.setCreateTime(new Date()); |
|
||||
return baseMapper.insert(message) > 0; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 修改系统消息 |
|
||||
* |
|
||||
* @param bo 系统消息 |
|
||||
* @return 是否修改成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean updateByBo(ImSystemMessageBo bo) { |
|
||||
ImSystemMessage message = MapstructUtils.convert(bo, ImSystemMessage.class); |
|
||||
return baseMapper.updateById(message) > 0; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 校验并批量删除系统消息信息 |
|
||||
* |
|
||||
* @param ids 待删除的主键集合 |
|
||||
* @param isValid 是否进行有效性校验 |
|
||||
* @return 是否删除成功 |
|
||||
*/ |
|
||||
@Override |
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|
||||
if(smPushTaskService.isExistTask(ids)){ |
|
||||
throw new ServiceException("部分消息存在关联任务,删除失败"); |
|
||||
} |
|
||||
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); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue