Commit 6bfaa848f29334f703599c7638aa37decac33c29
1 parent
865a58a6
✨ feat(im): 继续优化频道的各种代码(v2)
Showing
7 changed files
with
13 additions
and
10 deletions
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/controller/admin/manager/channel/vo/material/ImChannelMaterialPageReqVO.java
| ... | ... | @@ -19,7 +19,7 @@ public class ImChannelMaterialPageReqVO extends PageParam { |
| 19 | 19 | private Long channelId; |
| 20 | 20 | |
| 21 | 21 | @Schema(description = "内容类型", example = "1") |
| 22 | - private Integer type; // 参见 ImChannelMaterialContentTypeEnum 枚举类 | |
| 22 | + private Integer type; // 参见 ImChannelMaterialTypeEnum 枚举类 | |
| 23 | 23 | |
| 24 | 24 | @Schema(description = "标题", example = "活动") |
| 25 | 25 | private String title; | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/controller/admin/manager/channel/vo/material/ImChannelMaterialRespVO.java
| ... | ... | @@ -19,7 +19,7 @@ public class ImChannelMaterialRespVO { |
| 19 | 19 | private String channelName; |
| 20 | 20 | |
| 21 | 21 | @Schema(description = "内容类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 22 | - private Integer type; // 参见 ImChannelMaterialContentTypeEnum 枚举类 | |
| 22 | + private Integer type; // 参见 ImChannelMaterialTypeEnum 枚举类 | |
| 23 | 23 | |
| 24 | 24 | @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED) |
| 25 | 25 | private String title; | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/controller/admin/manager/channel/vo/material/ImChannelMaterialSaveReqVO.java
| ... | ... | @@ -19,7 +19,7 @@ public class ImChannelMaterialSaveReqVO { |
| 19 | 19 | |
| 20 | 20 | @Schema(description = "内容类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 21 | 21 | @NotNull(message = "内容类型不能为空") |
| 22 | - private Integer type; // 参见 ImChannelMaterialContentTypeEnum 枚举类 | |
| 22 | + private Integer type; // 参见 ImChannelMaterialTypeEnum 枚举类 | |
| 23 | 23 | |
| 24 | 24 | @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "双十一活动来啦") |
| 25 | 25 | @NotBlank(message = "标题不能为空") | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/channel/ImChannelMaterialDO.java
| 1 | 1 | package cn.iocoder.yudao.module.im.dal.dataobject.channel; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.im.enums.channel.ImChannelMaterialContentTypeEnum; | |
| 4 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImChannelMessageDO; | |
| 5 | +import cn.iocoder.yudao.module.im.enums.channel.ImChannelMaterialTypeEnum; | |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -41,7 +42,7 @@ public class ImChannelMaterialDO extends BaseDO { |
| 41 | 42 | /** |
| 42 | 43 | * 素材内容类型 |
| 43 | 44 | * <p> |
| 44 | - * 枚举 {@link ImChannelMaterialContentTypeEnum} | |
| 45 | + * 枚举 {@link ImChannelMaterialTypeEnum} | |
| 45 | 46 | */ |
| 46 | 47 | private Integer type; |
| 47 | 48 | /** |
| ... | ... | @@ -57,11 +58,11 @@ public class ImChannelMaterialDO extends BaseDO { |
| 57 | 58 | */ |
| 58 | 59 | private String summary; |
| 59 | 60 | /** |
| 60 | - * 富文本 HTML;在 {@link ImChannelMaterialContentTypeEnum#CONTENT} 使用 | |
| 61 | + * 富文本 HTML;在 {@link ImChannelMaterialTypeEnum#CONTENT} 使用 | |
| 61 | 62 | */ |
| 62 | 63 | private String content; |
| 63 | 64 | /** |
| 64 | - * 跳转链接;在 {@link ImChannelMaterialContentTypeEnum#LINK} 使用 | |
| 65 | + * 跳转链接;在 {@link ImChannelMaterialTypeEnum#LINK} 使用 | |
| 65 | 66 | */ |
| 66 | 67 | private String url; |
| 67 | 68 | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/enums/channel/ImChannelMaterialContentTypeEnum.java renamed to yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/enums/channel/ImChannelMaterialTypeEnum.java
| ... | ... | @@ -13,7 +13,7 @@ import java.util.Arrays; |
| 13 | 13 | */ |
| 14 | 14 | @Getter |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public enum ImChannelMaterialContentTypeEnum implements ArrayValuable<Integer> { | |
| 16 | +public enum ImChannelMaterialTypeEnum implements ArrayValuable<Integer> { | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * 站内富文本;点击素材在客户端内置详情页拉 content 渲染 |
| ... | ... | @@ -24,7 +24,7 @@ public enum ImChannelMaterialContentTypeEnum implements ArrayValuable<Integer> { |
| 24 | 24 | */ |
| 25 | 25 | LINK(2, "外链"); |
| 26 | 26 | |
| 27 | - public static final Integer[] ARRAYS = Arrays.stream(values()).map(ImChannelMaterialContentTypeEnum::getType).toArray(Integer[]::new); | |
| 27 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(ImChannelMaterialTypeEnum::getType).toArray(Integer[]::new); | |
| 28 | 28 | |
| 29 | 29 | private final Integer type; |
| 30 | 30 | private final String name; | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/channel/ImChannelServiceImpl.java
| ... | ... | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.im.controller.admin.manager.channel.vo.channel.Im |
| 9 | 9 | import cn.iocoder.yudao.module.im.dal.dataobject.channel.ImChannelDO; |
| 10 | 10 | import cn.iocoder.yudao.module.im.dal.mysql.channel.ImChannelMapper; |
| 11 | 11 | import jakarta.annotation.Resource; |
| 12 | +import org.springframework.context.annotation.Lazy; | |
| 12 | 13 | import org.springframework.stereotype.Service; |
| 13 | 14 | import org.springframework.validation.annotation.Validated; |
| 14 | 15 | |
| ... | ... | @@ -31,6 +32,7 @@ public class ImChannelServiceImpl implements ImChannelService { |
| 31 | 32 | @Resource |
| 32 | 33 | private ImChannelMapper channelMapper; |
| 33 | 34 | @Resource |
| 35 | + @Lazy // 延迟加载,解决循环依赖 | |
| 34 | 36 | private ImChannelMaterialService channelMaterialService; |
| 35 | 37 | |
| 36 | 38 | // ==================== 用户端 ==================== | ... | ... |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/websocket/dto/message/MaterialMessage.java
| ... | ... | @@ -17,7 +17,7 @@ public class MaterialMessage { |
| 17 | 17 | /** |
| 18 | 18 | * 素材内容类型 |
| 19 | 19 | * <p> |
| 20 | - * 枚举 {@link cn.iocoder.yudao.module.im.enums.channel.ImChannelMaterialContentTypeEnum} | |
| 20 | + * 枚举 {@link cn.iocoder.yudao.module.im.enums.channel.ImChannelMaterialTypeEnum} | |
| 21 | 21 | * 客户端按本字段判定点击行为:CONTENT 走站内详情页拉富文本;LINK 跳 url |
| 22 | 22 | */ |
| 23 | 23 | private Integer type; | ... | ... |