diff --git a/yudao-admin-vue3/src/views/mall/promotion/kefu/components/KeFuMessageList.vue b/yudao-admin-vue3/src/views/mall/promotion/kefu/components/KeFuMessageList.vue index accb631..4f4f45b 100644 --- a/yudao-admin-vue3/src/views/mall/promotion/kefu/components/KeFuMessageList.vue +++ b/yudao-admin-vue3/src/views/mall/promotion/kefu/components/KeFuMessageList.vue @@ -447,6 +447,8 @@ } await sendMessage(msg) messages.success('转接成功') + + conversation.value = null } finally { // todo 刷新会话列表 } diff --git a/yudao-admin-vue3/src/views/mall/promotion/kefu/index.vue b/yudao-admin-vue3/src/views/mall/promotion/kefu/index.vue index 1540b9a..d577545 100644 --- a/yudao-admin-vue3/src/views/mall/promotion/kefu/index.vue +++ b/yudao-admin-vue3/src/views/mall/promotion/kefu/index.vue @@ -153,30 +153,93 @@ // ======================= WebSocket start ======================= - const server = ref( - (import.meta.env.VITE_BASE_URL + '/infra/ws').replace('http', 'ws') + - '?token=' + - getRefreshToken() // 使用 getRefreshToken() 方法,而不使用 getAccessToken() 方法的原因:WebSocket 无法方便的刷新访问令牌 - ) // WebSocket 服务地址 + const server = ref( + (import.meta.env.VITE_BASE_URL + '/infra/ws').replace('http', 'ws') + + '?token=' + + getRefreshToken() // 使用 getRefreshToken() 方法,而不使用 getAccessToken() 方法的原因:WebSocket 无法方便的刷新访问令牌 + ) // WebSocket 服务地址 - const chick = ref('2') - const userInfo = async () =>{ - chick.value = '1' - user.value = await UserApi.getUserInfo(userId.value) - } - const zuoji = () =>{ - chick.value = '2' - // keFuChatBoxRef.value?.getNewMessageList(conversations.value) - memberBrowsingHistoryRef.value?.initHistory(conversations.value) - } + let a = 0; - - /** 发起 WebSocket 连接 */ - const {data, close, open} = useWebSocket(server.value, { - autoReconnect: false, - heartbeat: true - }) + const {status, data, send, open, close} = useWebSocket(server.value, { + onConnected: function (ws) { + console.log('websocket 连接成功!', ws); + }, + onDisconnected: function (ws, event) { + console.log('WebSocket 连接断开', event); + }, + onError: function (ws, event) { + console.error('WebSocket 连接错误:', event); + if (event instanceof ErrorEvent) { + console.error('详细错误信息:', event.message); + } else { + console.error('非标准错误:', event); + } + }, + onMessage: function (ws, event) { + console.log('收到的 WebSocket 消息:', event.data); + a = a + 1 ; + if(a == 2){ + getConversationList() + keFuChatBoxRef.value?.refreshMessageList() + a = 0; + } + + // 如果收到的数据存在 + // if (event.data) { + // let parsedData; + + // // 尝试解析消息 + // try { + // parsedData = JSON.parse(event.data); + // } catch (error) { + // console.error('JSON 解析错误:', error, '原始数据:', event.data); + // return; // 如果解析失败,跳过后续处理 + // } + + // // 根据消息的 type 类型来处理不同的消息 + // const { type } = parsedData; + // if (!type) { + // console.warn('收到未定义类型的消息:', parsedData); + // return; + // } + + // // 示例:处理特定类型的消息 + // switch (type) { + // case 'pong': + // // 处理心跳消息 + // console.log('收到心跳 ping 消息'); + // // 如果需要回复 pong,可以在这里发送消息 + // send(JSON.stringify({ type: 'pong' })); + // break; + + // case 'chat': + // // 处理聊天消息 + // console.log('收到聊天消息:', parsedData.content); + // // 处理聊天消息的逻辑 + // break; + + // case 'notification': + // // 处理通知消息 + // console.log('收到通知消息:', parsedData.message); + // // 执行通知操作 + // break; + + // default: + // console.warn('收到未知类型的消息:', type); + // break; + // } + // } else { + // console.warn('接收到空数据:', event); + // } + }, + autoReconnect: false, // 开启自动重连 + heartbeat: true + }); + + + /** 监听 WebSocket 数据 */ watchEffect(() => { @@ -188,7 +251,7 @@ if (data.value === 'pong') { return } - + // 2.1 解析 type 消息类型 const jsonMessage = JSON.parse(data.value) const type = jsonMessage.type @@ -215,6 +278,8 @@ console.error(error) } }) + + // ======================= WebSocket end ======================= /** 加载会话列表 */ const keFuConversationRef = ref>() @@ -237,18 +302,32 @@ window.close(); // window.location.href = '/kefu/support-staff'; } + + + const chick = ref('2') + const userInfo = async () =>{ + chick.value = '1' + user.value = await UserApi.getUserInfo(userId.value) + } + const zuoji = () =>{ + chick.value = '2' + // keFuChatBoxRef.value?.getNewMessageList(conversations.value) + memberBrowsingHistoryRef.value?.initHistory(conversations.value) + } /** 初始化 */ onMounted(() => { getConversationList() // 打开 websocket 连接 open() + console.log('WebSocket 已初始化'); }) /** 销毁 */ onBeforeUnmount(() => { // 关闭 websocket 连接 close() + console.log('WebSocket 已关闭'); }) diff --git a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java index aa618fb..039c306 100644 --- a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java @@ -29,6 +29,6 @@ public class WebSocketProperties { * 可选值:local、redis、rocketmq、kafka、rabbitmq */ @NotNull(message = "WebSocket 的消息发送者不能为空") - private String senderType = "local"; + private String senderType = "redis"; } diff --git a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/YudaoWebSocketAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/YudaoWebSocketAutoConfiguration.java index 0f08b7c..3aded88 100644 --- a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/YudaoWebSocketAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/YudaoWebSocketAutoConfiguration.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mq.redis.core.RedisMQTemplate; import cn.iocoder.yudao.framework.websocket.core.handler.JsonWebSocketMessageHandler; import cn.iocoder.yudao.framework.websocket.core.listener.WebSocketMessageListener; import cn.iocoder.yudao.framework.websocket.core.security.LoginUserHandshakeInterceptor; +import cn.iocoder.yudao.framework.websocket.core.security.WebSocketAuthorizeRequestsCustomizer; import cn.iocoder.yudao.framework.websocket.core.sender.kafka.KafkaWebSocketMessageConsumer; import cn.iocoder.yudao.framework.websocket.core.sender.kafka.KafkaWebSocketMessageSender; import cn.iocoder.yudao.framework.websocket.core.sender.local.LocalWebSocketMessageSender; @@ -76,10 +77,15 @@ public class YudaoWebSocketAutoConfiguration { return new WebSocketSessionManagerImpl(); } + @Bean + public WebSocketAuthorizeRequestsCustomizer webSocketAuthorizeRequestsCustomizer(WebSocketProperties webSocketProperties) { + return new WebSocketAuthorizeRequestsCustomizer(webSocketProperties); + } + // ==================== Sender 相关 ==================== @Configuration - @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "local", matchIfMissing = true) + @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "local") public class LocalWebSocketMessageSenderConfiguration { @Bean @@ -90,7 +96,7 @@ public class YudaoWebSocketAutoConfiguration { } @Configuration - @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "redis", matchIfMissing = true) + @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "redis") public class RedisWebSocketMessageSenderConfiguration { @Bean @@ -108,7 +114,7 @@ public class YudaoWebSocketAutoConfiguration { } @Configuration - @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "rocketmq", matchIfMissing = true) + @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "rocketmq") public class RocketMQWebSocketMessageSenderConfiguration { @Bean @@ -127,7 +133,7 @@ public class YudaoWebSocketAutoConfiguration { } @Configuration - @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "rabbitmq", matchIfMissing = true) + @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "rabbitmq") public class RabbitMQWebSocketMessageSenderConfiguration { @Bean @@ -156,7 +162,7 @@ public class YudaoWebSocketAutoConfiguration { } @Configuration - @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "kafka", matchIfMissing = true) + @ConditionalOnProperty(prefix = "yudao.websocket", name = "sender-type", havingValue = "kafka") public class KafkaWebSocketMessageSenderConfiguration { @Bean diff --git a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java index 5614f05..478a470 100644 --- a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java +++ b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java @@ -21,4 +21,4 @@ public class WebSocketAuthorizeRequestsCustomizer extends AuthorizeRequestsCusto registry.antMatchers(webSocketProperties.getPath()).permitAll(); } -} +} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApi.java index 38582c2..6694776 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApi.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApi.java @@ -43,7 +43,7 @@ public interface WebSocketSenderApi { send(userType, userId, messageType, JsonUtils.toJsonString(messageContent)); } - default void sendObject(Integer userType, String messageType, Object messageContent) { + default void sendObject(Integer userType, String messageType, Object messageContent) { //用户发送消息 send(userType, messageType, JsonUtils.toJsonString(messageContent)); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/pom.xml b/yudao-module-mall/yudao-module-promotion-biz/pom.xml index b27e387..073374d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/pom.xml +++ b/yudao-module-mall/yudao-module-promotion-biz/pom.xml @@ -79,6 +79,12 @@ org.springframework.boot spring-boot-starter-data-mongodb + + cn.iocoder.boot + yudao-module-system-biz + 2.1.0-jdk8-snapshot + compile + diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyTemplatePropertyRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyTemplatePropertyRespVO.java index aa237e0..fd3f882 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyTemplatePropertyRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyTemplatePropertyRespVO.java @@ -28,4 +28,8 @@ public class AppDiyTemplatePropertyRespVO { @JsonRawValue private String user; + private String goodsType; + + private String themeType; + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index 1b7e1d5..b44680f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -61,4 +61,11 @@ public class DiyTemplateDO extends BaseDO { */ private String property; + + @TableField(exist = false) + private String goodsType; + + @TableField(exist = false) + private String themeType; + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index f6d5e72..81ffa96 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -11,12 +11,15 @@ import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert; import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyTemplateMapper; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; @@ -36,6 +39,9 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { @Resource private DiyPageService diyPageService; + @Resource + private DictDataApi dictDataApi; + @Transactional(rollbackFor = Exception.class) @Override public Long createDiyTemplate(DiyTemplateCreateReqVO createReqVO) { @@ -165,7 +171,17 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { @Override public DiyTemplateDO getUsedDiyTemplate() { - return diyTemplateMapper.selectByUsed(true); + DiyTemplateDO diyTemplateDO = diyTemplateMapper.selectByUsed(true); + + List dictDataList = dictDataApi.getDictDataList("diy-template-theme"); + DictDataRespDTO dictDataRespDTO = dictDataList.get(0); + diyTemplateDO.setThemeType(dictDataRespDTO.getValue()); + + List dictDataList1 = dictDataApi.getDictDataList("diy-template-goods"); + DictDataRespDTO dictDataRespDTO1 = dictDataList1.get(0); + diyTemplateDO.setGoodsType(dictDataRespDTO1.getValue()); + + return diyTemplateDO; } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java index ce21647..ffa7663 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java @@ -31,6 +31,8 @@ public interface KeFuMessageService { * @return 编号 */ Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO); + + String sendKefuMessageTest(String s); /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java index b191488..52f930c 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; @@ -16,7 +17,10 @@ import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuM import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; import cn.iocoder.yudao.module.promotion.dal.mysql.kefu.KeFuMessageMapper; +import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; +import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -51,9 +55,12 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { @Resource private WebSocketSenderApi webSocketSenderApi; + @Resource + private NotifyMessageMapper notifyMessageMapper; + @Override @Transactional(rollbackFor = Exception.class) - public Long sendKefuMessage(KeFuMessageSendReqVO sendReqVO) { + public Long sendKefuMessage(KeFuMessageSendReqVO sendReqVO) { //客服发消息 // 1.1 校验会话是否存在 KeFuConversationDO conversation = conversationService.validateKefuConversationExists(sendReqVO.getConversationId()); // 1.2 校验接收人是否存在 @@ -74,20 +81,39 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { } @Override - public Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO) { + public Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO) { //用户发消息 // 1.1 设置会话编号 KeFuMessageDO kefuMessage = BeanUtils.toBean(sendReqVO, KeFuMessageDO.class); KeFuConversationDO conversation = conversationService.getOrCreateConversation(sendReqVO.getSenderId()); kefuMessage.setConversationId(conversation.getId()); // 1.2 保存消息 + kefuMessage.setReceiverId(conversation.getKefuId()).setReceiverType(UserTypeEnum.ADMIN.getValue()); // 设置接收人 keFuMessageMapper.insert(kefuMessage); // 2. 更新会话消息冗余 conversationService.updateConversationLastMessage(kefuMessage); + + getSelf().sendAsyncMessageToMembers(conversation.getKefuId(), KEFU_MESSAGE_TYPE, kefuMessage); + // 3. 通知所有管理员更新对话 - getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_TYPE, kefuMessage); + getSelf().sendAsyncMessageToAdmins(KEFU_MESSAGE_TYPE, kefuMessage); return kefuMessage.getId(); } + //添加站内信 +// MemberUserRespDTO user = memberUserApi.getUser(sendReqVO.getSenderId()); +// NotifyMessageDO notifyMessageDO = new NotifyMessageDO() +// .setUserId(sendReqVO.getSenderId()) +// .setUserType(sendReqVO.getSenderType()) +// .setTemplateId((long)1) +// .setTemplateCode() +// .setTemplateNickname(user.getNickname()) +// .setTemplateContent("客户发来消息") +// .setTemplateType(2) +// .setTemplateParams() +// .setReadStatus(2); +// notifyMessageMapper.insert(notifyMessageDO); + + @Override public String sendKefuMessageTest(String s){ webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), 1L, "1", s);; @@ -137,11 +163,21 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { webSocketSenderApi.sendObject(UserTypeEnum.MEMBER.getValue(), userId, messageType, content); } + @Async + public void sendAsyncMessageToMembers(Long userId, String messageType, Object content) { + webSocketSenderApi.sendObject(UserTypeEnum.MEMBER.getValue(), userId, messageType, content); + } + @Async public void sendAsyncMessageToAdmin(String messageType, Object content) { webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), messageType, content); } + @Async + public void sendAsyncMessageToAdmins(String messageType, Object content) { + webSocketSenderApi.sendObject(UserTypeEnum.MEMBER.getValue(), messageType, content); + } + @Override public PageResult getKeFuMessagePage(KeFuMessagePageReqVO pageReqVO) { return keFuMessageMapper.selectPage(pageReqVO); diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java index facedfa..6574af5 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java @@ -27,4 +27,7 @@ public interface NotifyMessageSendApi { */ Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO); + + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java index 2f45624..aecfc75 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java @@ -40,10 +40,12 @@ public class DictDataController { @Resource private DictDataService dictDataService; + @Resource public DictDataApi dictDataApi; + @PostMapping("/create") @Operation(summary = "新增字典数据") @PreAuthorize("@ss.hasPermission('system:dict:create')") @@ -159,6 +161,54 @@ public class DictDataController { } + /** + * 修改装修商品分类字典数据 + */ + @GetMapping(value = "/diy-template-goods") + public CommonResult setGoods(String id) { + List dictDataList = dictDataApi.getDictDataList("diy-template-goods"); + DictDataRespDTO dictDataRespDTO = dictDataList.get(0); + DictDataSaveReqVO dictDataSaveReqVO = BeanUtils.toBean(dictDataRespDTO, DictDataSaveReqVO.class); + dictDataSaveReqVO.setValue(id); + dictDataService.updateDictData(dictDataSaveReqVO); + return success(id); + } + + /** + * 修改装修商品分类字典数据 + */ + @GetMapping(value = "/getGoods") + public CommonResult getGoods() { + List dictDataList = dictDataApi.getDictDataList("diy-template-goods"); + DictDataRespDTO dictDataRespDTO = dictDataList.get(0); + return success(dictDataRespDTO.getValue()); + } + + + /** + * 修改装修装修风格字典数据 + */ + @GetMapping(value = "/diy-template-theme") + public CommonResult setTheme(String id) { + List dictDataList = dictDataApi.getDictDataList("diy-template-theme"); + DictDataRespDTO dictDataRespDTO = dictDataList.get(0); + DictDataSaveReqVO dictDataSaveReqVO = BeanUtils.toBean(dictDataRespDTO, DictDataSaveReqVO.class); + dictDataSaveReqVO.setValue(id); + dictDataService.updateDictData(dictDataSaveReqVO); + return success(id); + } + + + /** + * 修改装修装修风格字典数据 + */ + @GetMapping(value = "/getTheme") + public CommonResult getTheme() { + List dictDataList = dictDataApi.getDictDataList("diy-template-theme"); + DictDataRespDTO dictDataRespDTO = dictDataList.get(0); + return success(dictDataRespDTO.getValue()); + } + } diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 3e46da8..4e2dffa 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -210,7 +210,7 @@ yudao: websocket: enable: true # websocket的开关 path: /infra/ws # 路径 - sender-type: local # 消息发送的类型,可选值为 local、redis、rocketmq、kafka、rabbitmq + sender-type: redis # 消息发送的类型,可选值为 local、redis、rocketmq、kafka、rabbitmq sender-rocketmq: topic: ${spring.application.name}-websocket # 消息发送的 RocketMQ Topic consumer-group: ${spring.application.name}-websocket-consumer # 消息发送的 RocketMQ Consumer Group