mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
perf(X-Pack): 钉钉配置增加聊天群
This commit is contained in:
committed by
fit2cloud-chenyw
parent
ed28401d29
commit
06e97b8fbf
@@ -137,5 +137,17 @@
|
||||
</resources>
|
||||
</cache>
|
||||
|
||||
<cache alias="de_v2_dingtalk_ticket_cache">
|
||||
<key-type>java.lang.String</key-type>
|
||||
<value-type>java.lang.String</value-type>
|
||||
<expiry>
|
||||
<ttl unit="minutes">120</ttl>
|
||||
</expiry>
|
||||
<resources>
|
||||
<heap unit="entries">1000</heap>
|
||||
<offheap unit="MB">10</offheap>
|
||||
</resources>
|
||||
</cache>
|
||||
|
||||
</config>
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"axios": "^1.3.3",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dayjs": "^1.11.9",
|
||||
"dingtalk-jsapi": "^3.1.0",
|
||||
"echarts": "^5.5.1",
|
||||
"element-plus-secondary": "^1.0.0",
|
||||
"element-resize-detector": "^1.2.4",
|
||||
|
||||
@@ -4224,6 +4224,10 @@ export default {
|
||||
add_task: 'Add task',
|
||||
lark_groups: 'Lark group',
|
||||
dingtalk_groups: ' Dingtalk group',
|
||||
dingtalk_groups_tips: 'Create an application robot first and add it to the group',
|
||||
robot_code_place: 'Defaults to the same as APP Key',
|
||||
click_add_chat: 'Please click the button below to add a group chat',
|
||||
add_chat_tips: 'Only supports admin-associated accounts using the client',
|
||||
larksuite_groups: 'Larksuite group',
|
||||
send_setting: 'Send settings',
|
||||
retrying_settings: 'Send failed retry settings',
|
||||
@@ -4603,6 +4607,7 @@ export default {
|
||||
notification_user: 'Notifier',
|
||||
notification_email: 'Email notification',
|
||||
please_enter_email: 'Please enter email, press Enter to confirm',
|
||||
please_choose_dingtalk_group: 'Please select dingtalk group',
|
||||
please_choose_lark_group: 'Please select lark group',
|
||||
notification_content: 'Notification content',
|
||||
default_msg: 'Default message',
|
||||
|
||||
@@ -4105,6 +4105,10 @@ export default {
|
||||
add_task: '新增任務',
|
||||
lark_groups: '飛書群',
|
||||
dingtalk_groups: '釘釘群',
|
||||
dingtalk_groups_tips: '先建立應用機器人並添加到群裡',
|
||||
robot_code_place: '默認與 APP Key一致',
|
||||
click_add_chat: '請點擊下方按鈕添加群聊',
|
||||
add_chat_tips: '僅支持 admin 關聯帳號在客戶端使用',
|
||||
larksuite_groups: '國際飛書群',
|
||||
send_setting: '發送設定',
|
||||
retrying_settings: '發送失敗重試設定',
|
||||
@@ -4471,6 +4475,7 @@ export default {
|
||||
notification_user: '通知人',
|
||||
notification_email: '郵件通知',
|
||||
please_enter_email: '請輸入郵箱,回車確認',
|
||||
please_choose_dingtalk_group: '請選擇釘釘群',
|
||||
please_choose_lark_group: '請選擇飛書群',
|
||||
notification_content: '通知內容',
|
||||
default_msg: '默認消息',
|
||||
|
||||
@@ -4112,6 +4112,10 @@ export default {
|
||||
add_task: '添加任务',
|
||||
lark_groups: '飞书群',
|
||||
dingtalk_groups: '钉钉群',
|
||||
dingtalk_groups_tips: '先创建应用机器人并添加到群里',
|
||||
robot_code_place: '默认与 APP Key一致',
|
||||
click_add_chat: '请点击下方按钮添加群聊',
|
||||
add_chat_tips: '仅支持 admin 关联账号在客户端使用',
|
||||
larksuite_groups: '国际飞书群',
|
||||
send_setting: '发送设置',
|
||||
retrying_settings: '发送失败重试设置',
|
||||
@@ -4483,6 +4487,7 @@ export default {
|
||||
notification_user: '通知人',
|
||||
notification_email: '邮件通知',
|
||||
please_enter_email: '请输入邮箱,回车确认',
|
||||
please_choose_dingtalk_group: '请选择钉钉群',
|
||||
please_choose_lark_group: '请选择飞书群',
|
||||
notification_content: '通知内容',
|
||||
default_msg: '默认消息',
|
||||
|
||||
@@ -13,6 +13,8 @@ import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { useLoading } from '@/hooks/web/useLoading'
|
||||
import { ElMessageBox } from 'element-plus-secondary'
|
||||
const appearanceStore = useAppearanceStoreWithOut()
|
||||
const { wsCache } = useCache()
|
||||
const permissionStore = usePermissionStoreWithOut()
|
||||
const interactiveStore = interactiveStoreWithOut()
|
||||
@@ -109,6 +111,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
}, {})
|
||||
}
|
||||
if (!pathValid(to.path) && to.path !== '/404' && !to.path.startsWith('/de-link')) {
|
||||
if (to.path.startsWith('/sys-setting')) {
|
||||
await noAdminPermission()
|
||||
}
|
||||
const firstPath = getFirstAuthMenu()
|
||||
next({ path: firstPath || '/404' })
|
||||
return
|
||||
@@ -137,6 +142,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
await interactiveStore.initInteractive(true)
|
||||
|
||||
if (!pathValid(to.path) && to.path !== '/404' && !to.path.startsWith('/de-link')) {
|
||||
if (to.path.startsWith('/sys-setting')) {
|
||||
await noAdminPermission()
|
||||
}
|
||||
const firstPath = getFirstAuthMenu()
|
||||
next({ path: firstPath || '/404' })
|
||||
return
|
||||
@@ -169,7 +177,34 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const noAdminPermission = async () => {
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
ElMessageBox.confirm('当前页面仅对 admin 开放, 即将跳转首页', {
|
||||
confirmButtonType: 'primary',
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '',
|
||||
autofocus: false,
|
||||
showCancelButton: false,
|
||||
showClose: false
|
||||
})
|
||||
.then(() => {
|
||||
resolve()
|
||||
})
|
||||
.catch(() => {
|
||||
reject()
|
||||
})
|
||||
})
|
||||
return Promise.race([
|
||||
promise,
|
||||
new Promise<void>(resolve => {
|
||||
setTimeout(() => {
|
||||
ElMessageBox.close()
|
||||
resolve()
|
||||
}, 3000)
|
||||
})
|
||||
])
|
||||
}
|
||||
router.afterEach(() => {
|
||||
done()
|
||||
loadDone()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const loadScript = (url: string, jsId?: string) => {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise<void>(function (resolve, reject) {
|
||||
const scriptId = jsId || 'de-fit2cloud-script-id'
|
||||
let dom = document.getElementById(scriptId)
|
||||
if (dom) {
|
||||
|
||||
2
de-xpack
2
de-xpack
Submodule de-xpack updated: d50936e2df...808a2c09f8
@@ -1,11 +1,10 @@
|
||||
package io.dataease.api.dingtalk.api;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.api.dingtalk.dto.DingtalkEnableEditor;
|
||||
import io.dataease.api.dingtalk.dto.DingtalkSettingCreator;
|
||||
import io.dataease.api.dingtalk.dto.DingtalkTokenRequest;
|
||||
import io.dataease.api.dingtalk.dto.*;
|
||||
import io.dataease.api.dingtalk.vo.DingtalkInfoVO;
|
||||
import io.dataease.api.lark.vo.LarkGroupVO;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -47,4 +46,12 @@ public interface DingtalkApi {
|
||||
@Operation(summary = "获取群组", hidden = true)
|
||||
@GetMapping("/getGroup")
|
||||
LarkGroupVO getGroup();
|
||||
|
||||
@Hidden
|
||||
@PostMapping("/getSignatureInfo")
|
||||
DingtalkSignatureInfo getSignatureInfo(@RequestBody SignatureRequest request);
|
||||
|
||||
@Hidden
|
||||
@PostMapping("/checkChat")
|
||||
void checkChat(@RequestBody DingtalkChatCheckRequest request);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.dataease.api.dingtalk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class DingtalkChatCheckRequest implements Serializable {
|
||||
private String chatId;
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
package io.dataease.api.dingtalk.dto;
|
||||
|
||||
import io.dataease.api.dingtalk.vo.DingtalkChatItem;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "钉钉设置构造器")
|
||||
@Data
|
||||
public class DingtalkSettingCreator implements Serializable {
|
||||
@Schema(description = "corpId", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String corpId;
|
||||
@Schema(description = "agentId", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String agentId;
|
||||
@Schema(description = "appKey", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@@ -20,4 +24,8 @@ public class DingtalkSettingCreator implements Serializable {
|
||||
private Boolean enable;
|
||||
@Schema(description = "是否有效")
|
||||
private Boolean valid;
|
||||
@Schema(description = "机器人Code")
|
||||
private String robotCode;
|
||||
@Schema(description = "群列表")
|
||||
private List<DingtalkChatItem> chatList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.dataease.api.dingtalk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DingtalkSignatureInfo implements Serializable {
|
||||
|
||||
private String corpId;
|
||||
|
||||
private String agentId;
|
||||
|
||||
private String timeStamp;
|
||||
|
||||
private String nonceStr;
|
||||
|
||||
private String signature;
|
||||
|
||||
private Integer type = 0;
|
||||
|
||||
private List<String> jsApiList = List.of("chooseChat");
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package io.dataease.api.dingtalk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SignatureRequest implements Serializable {
|
||||
|
||||
private String currentUrl;
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import java.util.List;
|
||||
@Schema(description = "钉钉信息")
|
||||
@Data
|
||||
public class DingtalkInfoVO implements Serializable {
|
||||
@Schema(description = "corpId")
|
||||
private String corpId;
|
||||
@Schema(description = "agentId")
|
||||
private String agentId;
|
||||
@Schema(description = "appKey")
|
||||
@@ -23,10 +25,10 @@ public class DingtalkInfoVO implements Serializable {
|
||||
@Schema(description = "是否可用")
|
||||
private Boolean valid = false;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "机器人Code")
|
||||
private String robotCode;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "群列表")
|
||||
private List<DingtalkChatItem> chatList;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user