Commit 3696b666f42fccceee74d53c07bfb874f63dc461
1 parent
bb0b7056
修改:im 模块简单实现
Showing
33 changed files
with
329 additions
and
292 deletions
pom.xml
| @@ -15,8 +15,6 @@ | @@ -15,8 +15,6 @@ | ||
| 15 | <!-- 各种 module 拓展 --> | 15 | <!-- 各种 module 拓展 --> |
| 16 | <module>yudao-module-system</module> | 16 | <module>yudao-module-system</module> |
| 17 | <module>yudao-module-infra</module> | 17 | <module>yudao-module-infra</module> |
| 18 | - <module>yudao-module-im</module> | ||
| 19 | - <module>yudao-module-im/yudao-module-im-api</module> | ||
| 20 | <!-- <module>yudao-module-member</module>--> | 18 | <!-- <module>yudao-module-member</module>--> |
| 21 | <!-- <module>yudao-module-bpm</module>--> | 19 | <!-- <module>yudao-module-bpm</module>--> |
| 22 | <!-- <module>yudao-module-report</module>--> | 20 | <!-- <module>yudao-module-report</module>--> |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/ConversationController.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/ImConversationController.java
| @@ -6,11 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -6,11 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationPageReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationRespVO; | ||
| 11 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationSaveReqVO; | ||
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ConversationDO; | ||
| 13 | -import cn.iocoder.yudao.module.im.service.conversation.ConversationService; | 9 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationPageReqVO; |
| 10 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ImConversationDO; | ||
| 13 | +import cn.iocoder.yudao.module.im.service.conversation.ImConversationService; | ||
| 14 | import io.swagger.v3.oas.annotations.Operation; | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 15 | import io.swagger.v3.oas.annotations.Parameter; | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| 16 | import io.swagger.v3.oas.annotations.tags.Tag; | 16 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -31,23 +31,23 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | @@ -31,23 +31,23 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | ||
| 31 | @RestController | 31 | @RestController |
| 32 | @RequestMapping("/im/conversation") | 32 | @RequestMapping("/im/conversation") |
| 33 | @Validated | 33 | @Validated |
| 34 | -public class ConversationController { | 34 | +public class ImConversationController { |
| 35 | 35 | ||
| 36 | @Resource | 36 | @Resource |
| 37 | - private ConversationService conversationService; | 37 | + private ImConversationService imConversationService; |
| 38 | 38 | ||
| 39 | @PostMapping("/create") | 39 | @PostMapping("/create") |
| 40 | @Operation(summary = "创建会话") | 40 | @Operation(summary = "创建会话") |
| 41 | @PreAuthorize("@ss.hasPermission('im:conversation:create')") | 41 | @PreAuthorize("@ss.hasPermission('im:conversation:create')") |
| 42 | - public CommonResult<Long> createConversation(@Valid @RequestBody ConversationSaveReqVO createReqVO) { | ||
| 43 | - return success(conversationService.createConversation(createReqVO)); | 42 | + public CommonResult<Long> createConversation(@Valid @RequestBody ImConversationSaveReqVO createReqVO) { |
| 43 | + return success(imConversationService.createConversation(createReqVO)); | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | @PutMapping("/update") | 46 | @PutMapping("/update") |
| 47 | @Operation(summary = "更新会话") | 47 | @Operation(summary = "更新会话") |
| 48 | @PreAuthorize("@ss.hasPermission('im:conversation:update')") | 48 | @PreAuthorize("@ss.hasPermission('im:conversation:update')") |
| 49 | - public CommonResult<Boolean> updateConversation(@Valid @RequestBody ConversationSaveReqVO updateReqVO) { | ||
| 50 | - conversationService.updateConversation(updateReqVO); | 49 | + public CommonResult<Boolean> updateConversation(@Valid @RequestBody ImConversationSaveReqVO updateReqVO) { |
| 50 | + imConversationService.updateConversation(updateReqVO); | ||
| 51 | return success(true); | 51 | return success(true); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -56,7 +56,7 @@ public class ConversationController { | @@ -56,7 +56,7 @@ public class ConversationController { | ||
| 56 | @Parameter(name = "id", description = "编号", required = true) | 56 | @Parameter(name = "id", description = "编号", required = true) |
| 57 | @PreAuthorize("@ss.hasPermission('im:conversation:delete')") | 57 | @PreAuthorize("@ss.hasPermission('im:conversation:delete')") |
| 58 | public CommonResult<Boolean> deleteConversation(@RequestParam("id") Long id) { | 58 | public CommonResult<Boolean> deleteConversation(@RequestParam("id") Long id) { |
| 59 | - conversationService.deleteConversation(id); | 59 | + imConversationService.deleteConversation(id); |
| 60 | return success(true); | 60 | return success(true); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| @@ -64,30 +64,30 @@ public class ConversationController { | @@ -64,30 +64,30 @@ public class ConversationController { | ||
| 64 | @Operation(summary = "获得会话") | 64 | @Operation(summary = "获得会话") |
| 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 66 | @PreAuthorize("@ss.hasPermission('im:conversation:query')") | 66 | @PreAuthorize("@ss.hasPermission('im:conversation:query')") |
| 67 | - public CommonResult<ConversationRespVO> getConversation(@RequestParam("id") Long id) { | ||
| 68 | - ConversationDO conversation = conversationService.getConversation(id); | ||
| 69 | - return success(BeanUtils.toBean(conversation, ConversationRespVO.class)); | 67 | + public CommonResult<ImConversationRespVO> getConversation(@RequestParam("id") Long id) { |
| 68 | + ImConversationDO conversation = imConversationService.getConversation(id); | ||
| 69 | + return success(BeanUtils.toBean(conversation, ImConversationRespVO.class)); | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @GetMapping("/page") | 72 | @GetMapping("/page") |
| 73 | @Operation(summary = "获得会话分页") | 73 | @Operation(summary = "获得会话分页") |
| 74 | @PreAuthorize("@ss.hasPermission('im:conversation:query')") | 74 | @PreAuthorize("@ss.hasPermission('im:conversation:query')") |
| 75 | - public CommonResult<PageResult<ConversationRespVO>> getConversationPage(@Valid ConversationPageReqVO pageReqVO) { | ||
| 76 | - PageResult<ConversationDO> pageResult = conversationService.getConversationPage(pageReqVO); | ||
| 77 | - return success(BeanUtils.toBean(pageResult, ConversationRespVO.class)); | 75 | + public CommonResult<PageResult<ImConversationRespVO>> getConversationPage(@Valid ImConversationPageReqVO pageReqVO) { |
| 76 | + PageResult<ImConversationDO> pageResult = imConversationService.getConversationPage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, ImConversationRespVO.class)); | ||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | @GetMapping("/export-excel") | 80 | @GetMapping("/export-excel") |
| 81 | @Operation(summary = "导出会话 Excel") | 81 | @Operation(summary = "导出会话 Excel") |
| 82 | @PreAuthorize("@ss.hasPermission('im:conversation:export')") | 82 | @PreAuthorize("@ss.hasPermission('im:conversation:export')") |
| 83 | @OperateLog(type = EXPORT) | 83 | @OperateLog(type = EXPORT) |
| 84 | - public void exportConversationExcel(@Valid ConversationPageReqVO pageReqVO, | 84 | + public void exportConversationExcel(@Valid ImConversationPageReqVO pageReqVO, |
| 85 | HttpServletResponse response) throws IOException { | 85 | HttpServletResponse response) throws IOException { |
| 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 87 | - List<ConversationDO> list = conversationService.getConversationPage(pageReqVO).getList(); | 87 | + List<ImConversationDO> list = imConversationService.getConversationPage(pageReqVO).getList(); |
| 88 | // 导出 Excel | 88 | // 导出 Excel |
| 89 | - ExcelUtils.write(response, "会话.xls", "数据", ConversationRespVO.class, | ||
| 90 | - BeanUtils.toBean(list, ConversationRespVO.class)); | 89 | + ExcelUtils.write(response, "会话.xls", "数据", ImConversationRespVO.class, |
| 90 | + BeanUtils.toBean(list, ImConversationRespVO.class)); | ||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | } | 93 | } |
| 94 | \ No newline at end of file | 94 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ConversationPageReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ImConversationPageReqVO.java
| @@ -15,13 +15,13 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -15,13 +15,13 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 15 | @Data | 15 | @Data |
| 16 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
| 17 | @ToString(callSuper = true) | 17 | @ToString(callSuper = true) |
| 18 | -public class ConversationPageReqVO extends PageParam { | 18 | +public class ImConversationPageReqVO extends PageParam { |
| 19 | 19 | ||
| 20 | @Schema(description = "所属用户", example = "11545") | 20 | @Schema(description = "所属用户", example = "11545") |
| 21 | private Long userId; | 21 | private Long userId; |
| 22 | 22 | ||
| 23 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", example = "1") | 23 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", example = "1") |
| 24 | - private Boolean conversationType; | 24 | + private Integer conversationType; |
| 25 | 25 | ||
| 26 | @Schema(description = "单聊时,用户编号;群聊时,群编号", example = "21454") | 26 | @Schema(description = "单聊时,用户编号;群聊时,群编号", example = "21454") |
| 27 | private String targetId; | 27 | private String targetId; |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ConversationRespVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ImConversationRespVO.java
| @@ -10,7 +10,7 @@ import java.time.LocalDateTime; | @@ -10,7 +10,7 @@ import java.time.LocalDateTime; | ||
| 10 | @Schema(description = "管理后台 - 会话 Response VO") | 10 | @Schema(description = "管理后台 - 会话 Response VO") |
| 11 | @Data | 11 | @Data |
| 12 | @ExcelIgnoreUnannotated | 12 | @ExcelIgnoreUnannotated |
| 13 | -public class ConversationRespVO { | 13 | +public class ImConversationRespVO { |
| 14 | 14 | ||
| 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13905") | 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13905") |
| 16 | @ExcelProperty("编号") | 16 | @ExcelProperty("编号") |
| @@ -22,7 +22,7 @@ public class ConversationRespVO { | @@ -22,7 +22,7 @@ public class ConversationRespVO { | ||
| 22 | 22 | ||
| 23 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 23 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 24 | @ExcelProperty("类型:1 单聊;2 群聊;4 通知会话(预留)") | 24 | @ExcelProperty("类型:1 单聊;2 群聊;4 通知会话(预留)") |
| 25 | - private Boolean conversationType; | 25 | + private Integer conversationType; |
| 26 | 26 | ||
| 27 | @Schema(description = "单聊时,用户编号;群聊时,群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21454") | 27 | @Schema(description = "单聊时,用户编号;群聊时,群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21454") |
| 28 | @ExcelProperty("单聊时,用户编号;群聊时,群编号") | 28 | @ExcelProperty("单聊时,用户编号;群聊时,群编号") |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ConversationSaveReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/conversation/vo/ImConversationSaveReqVO.java
| @@ -9,7 +9,7 @@ import java.time.LocalDateTime; | @@ -9,7 +9,7 @@ import java.time.LocalDateTime; | ||
| 9 | 9 | ||
| 10 | @Schema(description = "管理后台 - 会话新增/修改 Request VO") | 10 | @Schema(description = "管理后台 - 会话新增/修改 Request VO") |
| 11 | @Data | 11 | @Data |
| 12 | -public class ConversationSaveReqVO { | 12 | +public class ImConversationSaveReqVO { |
| 13 | 13 | ||
| 14 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13905") | 14 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13905") |
| 15 | private Long id; | 15 | private Long id; |
| @@ -20,7 +20,7 @@ public class ConversationSaveReqVO { | @@ -20,7 +20,7 @@ public class ConversationSaveReqVO { | ||
| 20 | 20 | ||
| 21 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 21 | @Schema(description = "类型:1 单聊;2 群聊;4 通知会话(预留)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 22 | @NotNull(message = "类型:1 单聊;2 群聊;4 通知会话(预留)不能为空") | 22 | @NotNull(message = "类型:1 单聊;2 群聊;4 通知会话(预留)不能为空") |
| 23 | - private Boolean conversationType; | 23 | + private Integer conversationType; |
| 24 | 24 | ||
| 25 | @Schema(description = "单聊时,用户编号;群聊时,群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21454") | 25 | @Schema(description = "单聊时,用户编号;群聊时,群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21454") |
| 26 | @NotEmpty(message = "单聊时,用户编号;群聊时,群编号不能为空") | 26 | @NotEmpty(message = "单聊时,用户编号;群聊时,群编号不能为空") |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/InboxController.java
| @@ -9,7 +9,7 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | @@ -9,7 +9,7 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 9 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; | 9 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; |
| 10 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxRespVO; | 10 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxRespVO; |
| 11 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 11 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; |
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.inbox.InboxDO; | 12 | +import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 13 | import cn.iocoder.yudao.module.im.service.inbox.InboxService; | 13 | import cn.iocoder.yudao.module.im.service.inbox.InboxService; |
| 14 | import io.swagger.v3.oas.annotations.Operation; | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 15 | import io.swagger.v3.oas.annotations.Parameter; | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| @@ -65,7 +65,7 @@ public class InboxController { | @@ -65,7 +65,7 @@ public class InboxController { | ||
| 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 66 | @PreAuthorize("@ss.hasPermission('im:inbox:query')") | 66 | @PreAuthorize("@ss.hasPermission('im:inbox:query')") |
| 67 | public CommonResult<InboxRespVO> getInbox(@RequestParam("id") Long id) { | 67 | public CommonResult<InboxRespVO> getInbox(@RequestParam("id") Long id) { |
| 68 | - InboxDO inbox = inboxService.getInbox(id); | 68 | + ImInboxDO inbox = inboxService.getInbox(id); |
| 69 | return success(BeanUtils.toBean(inbox, InboxRespVO.class)); | 69 | return success(BeanUtils.toBean(inbox, InboxRespVO.class)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -73,7 +73,7 @@ public class InboxController { | @@ -73,7 +73,7 @@ public class InboxController { | ||
| 73 | @Operation(summary = "获得收件箱分页") | 73 | @Operation(summary = "获得收件箱分页") |
| 74 | @PreAuthorize("@ss.hasPermission('im:inbox:query')") | 74 | @PreAuthorize("@ss.hasPermission('im:inbox:query')") |
| 75 | public CommonResult<PageResult<InboxRespVO>> getInboxPage(@Valid InboxPageReqVO pageReqVO) { | 75 | public CommonResult<PageResult<InboxRespVO>> getInboxPage(@Valid InboxPageReqVO pageReqVO) { |
| 76 | - PageResult<InboxDO> pageResult = inboxService.getInboxPage(pageReqVO); | 76 | + PageResult<ImInboxDO> pageResult = inboxService.getInboxPage(pageReqVO); |
| 77 | return success(BeanUtils.toBean(pageResult, InboxRespVO.class)); | 77 | return success(BeanUtils.toBean(pageResult, InboxRespVO.class)); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| @@ -84,7 +84,7 @@ public class InboxController { | @@ -84,7 +84,7 @@ public class InboxController { | ||
| 84 | public void exportInboxExcel(@Valid InboxPageReqVO pageReqVO, | 84 | public void exportInboxExcel(@Valid InboxPageReqVO pageReqVO, |
| 85 | HttpServletResponse response) throws IOException { | 85 | HttpServletResponse response) throws IOException { |
| 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 87 | - List<InboxDO> list = inboxService.getInboxPage(pageReqVO).getList(); | 87 | + List<ImInboxDO> list = inboxService.getInboxPage(pageReqVO).getList(); |
| 88 | // 导出 Excel | 88 | // 导出 Excel |
| 89 | ExcelUtils.write(response, "收件箱.xls", "数据", InboxRespVO.class, | 89 | ExcelUtils.write(response, "收件箱.xls", "数据", InboxRespVO.class, |
| 90 | BeanUtils.toBean(list, InboxRespVO.class)); | 90 | BeanUtils.toBean(list, InboxRespVO.class)); |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/MessageController.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/ImMessageController.java
| @@ -6,11 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -6,11 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessagePageReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessageRespVO; | ||
| 11 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessageSaveReqVO; | ||
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.message.MessageDO; | ||
| 13 | -import cn.iocoder.yudao.module.im.service.message.MessageService; | 9 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; |
| 10 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | ||
| 13 | +import cn.iocoder.yudao.module.im.service.message.ImMessageService; | ||
| 14 | import io.swagger.v3.oas.annotations.Operation; | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 15 | import io.swagger.v3.oas.annotations.Parameter; | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| 16 | import io.swagger.v3.oas.annotations.tags.Tag; | 16 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -31,23 +31,23 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | @@ -31,23 +31,23 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E | ||
| 31 | @RestController | 31 | @RestController |
| 32 | @RequestMapping("/im/message") | 32 | @RequestMapping("/im/message") |
| 33 | @Validated | 33 | @Validated |
| 34 | -public class MessageController { | 34 | +public class ImMessageController { |
| 35 | 35 | ||
| 36 | @Resource | 36 | @Resource |
| 37 | - private MessageService messageService; | 37 | + private ImMessageService imMessageService; |
| 38 | 38 | ||
| 39 | @PostMapping("/create") | 39 | @PostMapping("/create") |
| 40 | @Operation(summary = "创建消息") | 40 | @Operation(summary = "创建消息") |
| 41 | @PreAuthorize("@ss.hasPermission('im:message:create')") | 41 | @PreAuthorize("@ss.hasPermission('im:message:create')") |
| 42 | - public CommonResult<Long> createMessage(@Valid @RequestBody MessageSaveReqVO createReqVO) { | ||
| 43 | - return success(messageService.createMessage(createReqVO)); | 42 | + public CommonResult<Long> createMessage(@Valid @RequestBody ImMessageSaveReqVO createReqVO) { |
| 43 | + return success(imMessageService.createMessage(createReqVO)); | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | @PutMapping("/update") | 46 | @PutMapping("/update") |
| 47 | @Operation(summary = "更新消息") | 47 | @Operation(summary = "更新消息") |
| 48 | @PreAuthorize("@ss.hasPermission('im:message:update')") | 48 | @PreAuthorize("@ss.hasPermission('im:message:update')") |
| 49 | - public CommonResult<Boolean> updateMessage(@Valid @RequestBody MessageSaveReqVO updateReqVO) { | ||
| 50 | - messageService.updateMessage(updateReqVO); | 49 | + public CommonResult<Boolean> updateMessage(@Valid @RequestBody ImMessageSaveReqVO updateReqVO) { |
| 50 | + imMessageService.updateMessage(updateReqVO); | ||
| 51 | return success(true); | 51 | return success(true); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -56,7 +56,7 @@ public class MessageController { | @@ -56,7 +56,7 @@ public class MessageController { | ||
| 56 | @Parameter(name = "id", description = "编号", required = true) | 56 | @Parameter(name = "id", description = "编号", required = true) |
| 57 | @PreAuthorize("@ss.hasPermission('im:message:delete')") | 57 | @PreAuthorize("@ss.hasPermission('im:message:delete')") |
| 58 | public CommonResult<Boolean> deleteMessage(@RequestParam("id") Long id) { | 58 | public CommonResult<Boolean> deleteMessage(@RequestParam("id") Long id) { |
| 59 | - messageService.deleteMessage(id); | 59 | + imMessageService.deleteMessage(id); |
| 60 | return success(true); | 60 | return success(true); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| @@ -64,36 +64,36 @@ public class MessageController { | @@ -64,36 +64,36 @@ public class MessageController { | ||
| 64 | @Operation(summary = "获得消息") | 64 | @Operation(summary = "获得消息") |
| 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 66 | @PreAuthorize("@ss.hasPermission('im:message:query')") | 66 | @PreAuthorize("@ss.hasPermission('im:message:query')") |
| 67 | - public CommonResult<MessageRespVO> getMessage(@RequestParam("id") Long id) { | ||
| 68 | - MessageDO message = messageService.getMessage(id); | ||
| 69 | - return success(BeanUtils.toBean(message, MessageRespVO.class)); | 67 | + public CommonResult<ImMessageRespVO> getMessage(@RequestParam("id") Long id) { |
| 68 | + ImMessageDO message = imMessageService.getMessage(id); | ||
| 69 | + return success(BeanUtils.toBean(message, ImMessageRespVO.class)); | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @GetMapping("/page") | 72 | @GetMapping("/page") |
| 73 | @Operation(summary = "获得消息分页") | 73 | @Operation(summary = "获得消息分页") |
| 74 | @PreAuthorize("@ss.hasPermission('im:message:query')") | 74 | @PreAuthorize("@ss.hasPermission('im:message:query')") |
| 75 | - public CommonResult<PageResult<MessageRespVO>> getMessagePage(@Valid MessagePageReqVO pageReqVO) { | ||
| 76 | - PageResult<MessageDO> pageResult = messageService.getMessagePage(pageReqVO); | ||
| 77 | - return success(BeanUtils.toBean(pageResult, MessageRespVO.class)); | 75 | + public CommonResult<PageResult<ImMessageRespVO>> getMessagePage(@Valid ImMessagePageReqVO pageReqVO) { |
| 76 | + PageResult<ImMessageDO> pageResult = imMessageService.getMessagePage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, ImMessageRespVO.class)); | ||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | @GetMapping("/export-excel") | 80 | @GetMapping("/export-excel") |
| 81 | @Operation(summary = "导出消息 Excel") | 81 | @Operation(summary = "导出消息 Excel") |
| 82 | @PreAuthorize("@ss.hasPermission('im:message:export')") | 82 | @PreAuthorize("@ss.hasPermission('im:message:export')") |
| 83 | @OperateLog(type = EXPORT) | 83 | @OperateLog(type = EXPORT) |
| 84 | - public void exportMessageExcel(@Valid MessagePageReqVO pageReqVO, | 84 | + public void exportMessageExcel(@Valid ImMessagePageReqVO pageReqVO, |
| 85 | HttpServletResponse response) throws IOException { | 85 | HttpServletResponse response) throws IOException { |
| 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | 86 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 87 | - List<MessageDO> list = messageService.getMessagePage(pageReqVO).getList(); | 87 | + List<ImMessageDO> list = imMessageService.getMessagePage(pageReqVO).getList(); |
| 88 | // 导出 Excel | 88 | // 导出 Excel |
| 89 | - ExcelUtils.write(response, "消息.xls", "数据", MessageRespVO.class, | ||
| 90 | - BeanUtils.toBean(list, MessageRespVO.class)); | 89 | + ExcelUtils.write(response, "消息.xls", "数据", ImMessageRespVO.class, |
| 90 | + BeanUtils.toBean(list, ImMessageRespVO.class)); | ||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | @PostMapping("/send") | 93 | @PostMapping("/send") |
| 94 | @Operation(summary = "发送私聊消息") | 94 | @Operation(summary = "发送私聊消息") |
| 95 | - public CommonResult<Long> sendMessage(@Valid @RequestBody MessageSaveReqVO messageSaveReqVO) { | ||
| 96 | - return success(messageService.sendPrivateMessage(messageSaveReqVO)); | 95 | + public CommonResult<Long> sendMessage(@Valid @RequestBody ImMessageSaveReqVO imMessageSaveReqVO) { |
| 96 | + return success(imMessageService.sendPrivateMessage(imMessageSaveReqVO)); | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | } | 99 | } |
| 100 | \ No newline at end of file | 100 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/MessagePageReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/ImMessagePageReqVO.java
| @@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 15 | @Data | 15 | @Data |
| 16 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
| 17 | @ToString(callSuper = true) | 17 | @ToString(callSuper = true) |
| 18 | -public class MessagePageReqVO extends PageParam { | 18 | +public class ImMessagePageReqVO extends PageParam { |
| 19 | 19 | ||
| 20 | @Schema(description = "客户端消息编号 uuid,用于排重", example = "3331") | 20 | @Schema(description = "客户端消息编号 uuid,用于排重", example = "3331") |
| 21 | private String clientMessageId; | 21 | private String clientMessageId; |
| @@ -33,13 +33,13 @@ public class MessagePageReqVO extends PageParam { | @@ -33,13 +33,13 @@ public class MessagePageReqVO extends PageParam { | ||
| 33 | private String senderAvatar; | 33 | private String senderAvatar; |
| 34 | 34 | ||
| 35 | @Schema(description = "会话类型", example = "2") | 35 | @Schema(description = "会话类型", example = "2") |
| 36 | - private Boolean conversationType; | 36 | + private Integer conversationType; |
| 37 | 37 | ||
| 38 | @Schema(description = "会话标志") | 38 | @Schema(description = "会话标志") |
| 39 | private String conversationNo; | 39 | private String conversationNo; |
| 40 | 40 | ||
| 41 | @Schema(description = "消息类型", example = "1") | 41 | @Schema(description = "消息类型", example = "1") |
| 42 | - private Boolean contentType; | 42 | + private Integer contentType; |
| 43 | 43 | ||
| 44 | @Schema(description = "消息内容") | 44 | @Schema(description = "消息内容") |
| 45 | private String content; | 45 | private String content; |
| @@ -49,7 +49,7 @@ public class MessagePageReqVO extends PageParam { | @@ -49,7 +49,7 @@ public class MessagePageReqVO extends PageParam { | ||
| 49 | private LocalDateTime[] sendTime; | 49 | private LocalDateTime[] sendTime; |
| 50 | 50 | ||
| 51 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);") | 51 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);") |
| 52 | - private Boolean sendFrom; | 52 | + private Integer sendFrom; |
| 53 | 53 | ||
| 54 | @Schema(description = "创建时间") | 54 | @Schema(description = "创建时间") |
| 55 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 55 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/MessageRespVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/ImMessageRespVO.java
| @@ -10,7 +10,7 @@ import java.time.LocalDateTime; | @@ -10,7 +10,7 @@ import java.time.LocalDateTime; | ||
| 10 | @Schema(description = "管理后台 - 消息 Response VO") | 10 | @Schema(description = "管理后台 - 消息 Response VO") |
| 11 | @Data | 11 | @Data |
| 12 | @ExcelIgnoreUnannotated | 12 | @ExcelIgnoreUnannotated |
| 13 | -public class MessageRespVO { | 13 | +public class ImMessageRespVO { |
| 14 | 14 | ||
| 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30713") | 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30713") |
| 16 | @ExcelProperty("编号") | 16 | @ExcelProperty("编号") |
| @@ -38,7 +38,7 @@ public class MessageRespVO { | @@ -38,7 +38,7 @@ public class MessageRespVO { | ||
| 38 | 38 | ||
| 39 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 39 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 40 | @ExcelProperty("会话类型") | 40 | @ExcelProperty("会话类型") |
| 41 | - private Boolean conversationType; | 41 | + private Integer conversationType; |
| 42 | 42 | ||
| 43 | @Schema(description = "会话标志", requiredMode = Schema.RequiredMode.REQUIRED) | 43 | @Schema(description = "会话标志", requiredMode = Schema.RequiredMode.REQUIRED) |
| 44 | @ExcelProperty("会话标志") | 44 | @ExcelProperty("会话标志") |
| @@ -46,7 +46,7 @@ public class MessageRespVO { | @@ -46,7 +46,7 @@ public class MessageRespVO { | ||
| 46 | 46 | ||
| 47 | @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 47 | @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 48 | @ExcelProperty("消息类型") | 48 | @ExcelProperty("消息类型") |
| 49 | - private Boolean contentType; | 49 | + private Integer contentType; |
| 50 | 50 | ||
| 51 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) | 51 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) |
| 52 | @ExcelProperty("消息内容") | 52 | @ExcelProperty("消息内容") |
| @@ -58,7 +58,7 @@ public class MessageRespVO { | @@ -58,7 +58,7 @@ public class MessageRespVO { | ||
| 58 | 58 | ||
| 59 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);", requiredMode = Schema.RequiredMode.REQUIRED) | 59 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);", requiredMode = Schema.RequiredMode.REQUIRED) |
| 60 | @ExcelProperty("消息来源 100-用户发送;200-系统发送(一般是通知);") | 60 | @ExcelProperty("消息来源 100-用户发送;200-系统发送(一般是通知);") |
| 61 | - private Boolean sendFrom; | 61 | + private Integer sendFrom; |
| 62 | 62 | ||
| 63 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 63 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 64 | @ExcelProperty("创建时间") | 64 | @ExcelProperty("创建时间") |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/MessageSaveReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/vo/ImMessageSaveReqVO.java
| @@ -9,7 +9,7 @@ import java.time.LocalDateTime; | @@ -9,7 +9,7 @@ import java.time.LocalDateTime; | ||
| 9 | 9 | ||
| 10 | @Schema(description = "管理后台 - 消息新增/修改 Request VO") | 10 | @Schema(description = "管理后台 - 消息新增/修改 Request VO") |
| 11 | @Data | 11 | @Data |
| 12 | -public class MessageSaveReqVO { | 12 | +public class ImMessageSaveReqVO { |
| 13 | 13 | ||
| 14 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30713") | 14 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30713") |
| 15 | private Long id; | 15 | private Long id; |
| @@ -36,7 +36,7 @@ public class MessageSaveReqVO { | @@ -36,7 +36,7 @@ public class MessageSaveReqVO { | ||
| 36 | 36 | ||
| 37 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 37 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 38 | @NotNull(message = "会话类型不能为空") | 38 | @NotNull(message = "会话类型不能为空") |
| 39 | - private Boolean conversationType; | 39 | + private Integer conversationType; |
| 40 | 40 | ||
| 41 | @Schema(description = "会话标志", requiredMode = Schema.RequiredMode.REQUIRED) | 41 | @Schema(description = "会话标志", requiredMode = Schema.RequiredMode.REQUIRED) |
| 42 | @NotEmpty(message = "会话标志不能为空") | 42 | @NotEmpty(message = "会话标志不能为空") |
| @@ -44,18 +44,17 @@ public class MessageSaveReqVO { | @@ -44,18 +44,17 @@ public class MessageSaveReqVO { | ||
| 44 | 44 | ||
| 45 | @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 45 | @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 46 | @NotNull(message = "消息类型不能为空") | 46 | @NotNull(message = "消息类型不能为空") |
| 47 | - private Boolean contentType; | 47 | + private Integer contentType; |
| 48 | 48 | ||
| 49 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) | 49 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) |
| 50 | @NotEmpty(message = "消息内容不能为空") | 50 | @NotEmpty(message = "消息内容不能为空") |
| 51 | private String content; | 51 | private String content; |
| 52 | 52 | ||
| 53 | @Schema(description = "发送时间", requiredMode = Schema.RequiredMode.REQUIRED) | 53 | @Schema(description = "发送时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 54 | - @NotNull(message = "发送时间不能为空") | ||
| 55 | private LocalDateTime sendTime; | 54 | private LocalDateTime sendTime; |
| 56 | 55 | ||
| 57 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);", requiredMode = Schema.RequiredMode.REQUIRED) | 56 | @Schema(description = "消息来源 100-用户发送;200-系统发送(一般是通知);", requiredMode = Schema.RequiredMode.REQUIRED) |
| 58 | @NotNull(message = "消息来源 100-用户发送;200-系统发送(一般是通知);不能为空") | 57 | @NotNull(message = "消息来源 100-用户发送;200-系统发送(一般是通知);不能为空") |
| 59 | - private Boolean sendFrom; | 58 | + private Integer sendFrom; |
| 60 | 59 | ||
| 61 | } | 60 | } |
| 62 | \ No newline at end of file | 61 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/conversation/ConversationDO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/conversation/ImConversationDO.java
| @@ -21,7 +21,7 @@ import java.time.LocalDateTime; | @@ -21,7 +21,7 @@ import java.time.LocalDateTime; | ||
| 21 | @Builder | 21 | @Builder |
| 22 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 23 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 24 | -public class ConversationDO extends BaseDO { | 24 | +public class ImConversationDO extends BaseDO { |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 编号 | 27 | * 编号 |
| @@ -35,7 +35,7 @@ public class ConversationDO extends BaseDO { | @@ -35,7 +35,7 @@ public class ConversationDO extends BaseDO { | ||
| 35 | /** | 35 | /** |
| 36 | * 类型:1 单聊;2 群聊;4 通知会话(预留) | 36 | * 类型:1 单聊;2 群聊;4 通知会话(预留) |
| 37 | */ | 37 | */ |
| 38 | - private Boolean conversationType; | 38 | + private Integer conversationType; |
| 39 | /** | 39 | /** |
| 40 | * 单聊时,用户编号;群聊时,群编号 | 40 | * 单聊时,用户编号;群聊时,群编号 |
| 41 | */ | 41 | */ |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/inbox/InboxDO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/inbox/ImInboxDO.java
| @@ -19,7 +19,7 @@ import lombok.*; | @@ -19,7 +19,7 @@ import lombok.*; | ||
| 19 | @Builder | 19 | @Builder |
| 20 | @NoArgsConstructor | 20 | @NoArgsConstructor |
| 21 | @AllArgsConstructor | 21 | @AllArgsConstructor |
| 22 | -public class InboxDO extends BaseDO { | 22 | +public class ImInboxDO extends BaseDO { |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 编号 | 25 | * 编号 |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/message/MessageDO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/dataobject/message/ImMessageDO.java
| @@ -21,7 +21,7 @@ import java.time.LocalDateTime; | @@ -21,7 +21,7 @@ import java.time.LocalDateTime; | ||
| 21 | @Builder | 21 | @Builder |
| 22 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 23 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 24 | -public class MessageDO extends BaseDO { | 24 | +public class ImMessageDO extends BaseDO { |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 编号 | 27 | * 编号 |
| @@ -51,7 +51,7 @@ public class MessageDO extends BaseDO { | @@ -51,7 +51,7 @@ public class MessageDO extends BaseDO { | ||
| 51 | /** | 51 | /** |
| 52 | * 会话类型 | 52 | * 会话类型 |
| 53 | */ | 53 | */ |
| 54 | - private Boolean conversationType; | 54 | + private Integer conversationType; |
| 55 | /** | 55 | /** |
| 56 | * 会话标志 | 56 | * 会话标志 |
| 57 | */ | 57 | */ |
| @@ -59,7 +59,7 @@ public class MessageDO extends BaseDO { | @@ -59,7 +59,7 @@ public class MessageDO extends BaseDO { | ||
| 59 | /** | 59 | /** |
| 60 | * 消息类型 | 60 | * 消息类型 |
| 61 | */ | 61 | */ |
| 62 | - private Boolean contentType; | 62 | + private Integer contentType; |
| 63 | /** | 63 | /** |
| 64 | * 消息内容 | 64 | * 消息内容 |
| 65 | */ | 65 | */ |
| @@ -71,6 +71,6 @@ public class MessageDO extends BaseDO { | @@ -71,6 +71,6 @@ public class MessageDO extends BaseDO { | ||
| 71 | /** | 71 | /** |
| 72 | * 消息来源 100-用户发送;200-系统发送(一般是通知); | 72 | * 消息来源 100-用户发送;200-系统发送(一般是通知); |
| 73 | */ | 73 | */ |
| 74 | - private Boolean sendFrom; | 74 | + private Integer sendFrom; |
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | \ No newline at end of file | 77 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/mysql/conversation/ConversationMapper.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.im.dal.mysql.conversation; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.im.dal.mysql.conversation; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ConversationDO; | 6 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationPageReqVO; |
| 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ImConversationDO; | ||
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -13,18 +13,18 @@ import org.apache.ibatis.annotations.Mapper; | @@ -13,18 +13,18 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 13 | * @author 芋道源码 | 13 | * @author 芋道源码 |
| 14 | */ | 14 | */ |
| 15 | @Mapper | 15 | @Mapper |
| 16 | -public interface ConversationMapper extends BaseMapperX<ConversationDO> { | 16 | +public interface ConversationMapper extends BaseMapperX<ImConversationDO> { |
| 17 | 17 | ||
| 18 | - default PageResult<ConversationDO> selectPage(ConversationPageReqVO reqVO) { | ||
| 19 | - return selectPage(reqVO, new LambdaQueryWrapperX<ConversationDO>() | ||
| 20 | - .eqIfPresent(ConversationDO::getUserId, reqVO.getUserId()) | ||
| 21 | - .eqIfPresent(ConversationDO::getConversationType, reqVO.getConversationType()) | ||
| 22 | - .eqIfPresent(ConversationDO::getTargetId, reqVO.getTargetId()) | ||
| 23 | - .eqIfPresent(ConversationDO::getNo, reqVO.getNo()) | ||
| 24 | - .eqIfPresent(ConversationDO::getPinned, reqVO.getPinned()) | ||
| 25 | - .betweenIfPresent(ConversationDO::getLastReadTime, reqVO.getLastReadTime()) | ||
| 26 | - .betweenIfPresent(ConversationDO::getCreateTime, reqVO.getCreateTime()) | ||
| 27 | - .orderByDesc(ConversationDO::getId)); | 18 | + default PageResult<ImConversationDO> selectPage(ImConversationPageReqVO reqVO) { |
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<ImConversationDO>() | ||
| 20 | + .eqIfPresent(ImConversationDO::getUserId, reqVO.getUserId()) | ||
| 21 | + .eqIfPresent(ImConversationDO::getConversationType, reqVO.getConversationType()) | ||
| 22 | + .eqIfPresent(ImConversationDO::getTargetId, reqVO.getTargetId()) | ||
| 23 | + .eqIfPresent(ImConversationDO::getNo, reqVO.getNo()) | ||
| 24 | + .eqIfPresent(ImConversationDO::getPinned, reqVO.getPinned()) | ||
| 25 | + .betweenIfPresent(ImConversationDO::getLastReadTime, reqVO.getLastReadTime()) | ||
| 26 | + .betweenIfPresent(ImConversationDO::getCreateTime, reqVO.getCreateTime()) | ||
| 27 | + .orderByDesc(ImConversationDO::getId)); | ||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | } | 30 | } |
| 31 | \ No newline at end of file | 31 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/mysql/inbox/InboxMapper.java
| @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; | 6 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; |
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.inbox.InboxDO; | 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -13,15 +13,15 @@ import org.apache.ibatis.annotations.Mapper; | @@ -13,15 +13,15 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 13 | * @author 芋道源码 | 13 | * @author 芋道源码 |
| 14 | */ | 14 | */ |
| 15 | @Mapper | 15 | @Mapper |
| 16 | -public interface InboxMapper extends BaseMapperX<InboxDO> { | 16 | +public interface InboxMapper extends BaseMapperX<ImInboxDO> { |
| 17 | 17 | ||
| 18 | - default PageResult<InboxDO> selectPage(InboxPageReqVO reqVO) { | ||
| 19 | - return selectPage(reqVO, new LambdaQueryWrapperX<InboxDO>() | ||
| 20 | - .eqIfPresent(InboxDO::getUserId, reqVO.getUserId()) | ||
| 21 | - .eqIfPresent(InboxDO::getMessageId, reqVO.getMessageId()) | ||
| 22 | - .eqIfPresent(InboxDO::getSequence, reqVO.getSequence()) | ||
| 23 | - .betweenIfPresent(InboxDO::getCreateTime, reqVO.getCreateTime()) | ||
| 24 | - .orderByDesc(InboxDO::getId)); | 18 | + default PageResult<ImInboxDO> selectPage(InboxPageReqVO reqVO) { |
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<ImInboxDO>() | ||
| 20 | + .eqIfPresent(ImInboxDO::getUserId, reqVO.getUserId()) | ||
| 21 | + .eqIfPresent(ImInboxDO::getMessageId, reqVO.getMessageId()) | ||
| 22 | + .eqIfPresent(ImInboxDO::getSequence, reqVO.getSequence()) | ||
| 23 | + .betweenIfPresent(ImInboxDO::getCreateTime, reqVO.getCreateTime()) | ||
| 24 | + .orderByDesc(ImInboxDO::getId)); | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | } | 27 | } |
| 28 | \ No newline at end of file | 28 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/mysql/message/ImMessageMapper.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.im.dal.mysql.message; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 消息 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface ImMessageMapper extends BaseMapperX<ImMessageDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<ImMessageDO> selectPage(ImMessagePageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<ImMessageDO>() | ||
| 20 | + .eqIfPresent(ImMessageDO::getClientMessageId, reqVO.getClientMessageId()) | ||
| 21 | + .eqIfPresent(ImMessageDO::getSenderId, reqVO.getSenderId()) | ||
| 22 | + .eqIfPresent(ImMessageDO::getReceiverId, reqVO.getReceiverId()) | ||
| 23 | + .likeIfPresent(ImMessageDO::getSenderNickname, reqVO.getSenderNickname()) | ||
| 24 | + .eqIfPresent(ImMessageDO::getSenderAvatar, reqVO.getSenderAvatar()) | ||
| 25 | + .eqIfPresent(ImMessageDO::getConversationType, reqVO.getConversationType()) | ||
| 26 | + .eqIfPresent(ImMessageDO::getConversationNo, reqVO.getConversationNo()) | ||
| 27 | + .eqIfPresent(ImMessageDO::getContentType, reqVO.getContentType()) | ||
| 28 | + .eqIfPresent(ImMessageDO::getContent, reqVO.getContent()) | ||
| 29 | + .betweenIfPresent(ImMessageDO::getSendTime, reqVO.getSendTime()) | ||
| 30 | + .eqIfPresent(ImMessageDO::getSendFrom, reqVO.getSendFrom()) | ||
| 31 | + .betweenIfPresent(ImMessageDO::getCreateTime, reqVO.getCreateTime()) | ||
| 32 | + .orderByDesc(ImMessageDO::getId)); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | +} | ||
| 0 | \ No newline at end of file | 36 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/mysql/message/MessageMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.im.dal.mysql.message; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessagePageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.message.MessageDO; | ||
| 8 | -import org.apache.ibatis.annotations.Mapper; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 消息 Mapper | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@Mapper | ||
| 16 | -public interface MessageMapper extends BaseMapperX<MessageDO> { | ||
| 17 | - | ||
| 18 | - default PageResult<MessageDO> selectPage(MessagePageReqVO reqVO) { | ||
| 19 | - return selectPage(reqVO, new LambdaQueryWrapperX<MessageDO>() | ||
| 20 | - .eqIfPresent(MessageDO::getClientMessageId, reqVO.getClientMessageId()) | ||
| 21 | - .eqIfPresent(MessageDO::getSenderId, reqVO.getSenderId()) | ||
| 22 | - .eqIfPresent(MessageDO::getReceiverId, reqVO.getReceiverId()) | ||
| 23 | - .likeIfPresent(MessageDO::getSenderNickname, reqVO.getSenderNickname()) | ||
| 24 | - .eqIfPresent(MessageDO::getSenderAvatar, reqVO.getSenderAvatar()) | ||
| 25 | - .eqIfPresent(MessageDO::getConversationType, reqVO.getConversationType()) | ||
| 26 | - .eqIfPresent(MessageDO::getConversationNo, reqVO.getConversationNo()) | ||
| 27 | - .eqIfPresent(MessageDO::getContentType, reqVO.getContentType()) | ||
| 28 | - .eqIfPresent(MessageDO::getContent, reqVO.getContent()) | ||
| 29 | - .betweenIfPresent(MessageDO::getSendTime, reqVO.getSendTime()) | ||
| 30 | - .eqIfPresent(MessageDO::getSendFrom, reqVO.getSendFrom()) | ||
| 31 | - .betweenIfPresent(MessageDO::getCreateTime, reqVO.getCreateTime()) | ||
| 32 | - .orderByDesc(MessageDO::getId)); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | -} | ||
| 36 | \ No newline at end of file | 0 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/conversation/ConversationService.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/conversation/ImConversationService.java
| 1 | package cn.iocoder.yudao.module.im.service.conversation; | 1 | package cn.iocoder.yudao.module.im.service.conversation; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationSaveReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ConversationDO; | 4 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationPageReqVO; |
| 5 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ImConversationDO; | ||
| 7 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| @@ -11,7 +11,7 @@ import jakarta.validation.Valid; | @@ -11,7 +11,7 @@ import jakarta.validation.Valid; | ||
| 11 | * | 11 | * |
| 12 | * @author 芋道源码 | 12 | * @author 芋道源码 |
| 13 | */ | 13 | */ |
| 14 | -public interface ConversationService { | 14 | +public interface ImConversationService { |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * 创建会话 | 17 | * 创建会话 |
| @@ -19,14 +19,14 @@ public interface ConversationService { | @@ -19,14 +19,14 @@ public interface ConversationService { | ||
| 19 | * @param createReqVO 创建信息 | 19 | * @param createReqVO 创建信息 |
| 20 | * @return 编号 | 20 | * @return 编号 |
| 21 | */ | 21 | */ |
| 22 | - Long createConversation(@Valid ConversationSaveReqVO createReqVO); | 22 | + Long createConversation(@Valid ImConversationSaveReqVO createReqVO); |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 更新会话 | 25 | * 更新会话 |
| 26 | * | 26 | * |
| 27 | * @param updateReqVO 更新信息 | 27 | * @param updateReqVO 更新信息 |
| 28 | */ | 28 | */ |
| 29 | - void updateConversation(@Valid ConversationSaveReqVO updateReqVO); | 29 | + void updateConversation(@Valid ImConversationSaveReqVO updateReqVO); |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 删除会话 | 32 | * 删除会话 |
| @@ -41,7 +41,7 @@ public interface ConversationService { | @@ -41,7 +41,7 @@ public interface ConversationService { | ||
| 41 | * @param id 编号 | 41 | * @param id 编号 |
| 42 | * @return 会话 | 42 | * @return 会话 |
| 43 | */ | 43 | */ |
| 44 | - ConversationDO getConversation(Long id); | 44 | + ImConversationDO getConversation(Long id); |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * 获得会话分页 | 47 | * 获得会话分页 |
| @@ -49,6 +49,6 @@ public interface ConversationService { | @@ -49,6 +49,6 @@ public interface ConversationService { | ||
| 49 | * @param pageReqVO 分页查询 | 49 | * @param pageReqVO 分页查询 |
| 50 | * @return 会话分页 | 50 | * @return 会话分页 |
| 51 | */ | 51 | */ |
| 52 | - PageResult<ConversationDO> getConversationPage(ConversationPageReqVO pageReqVO); | 52 | + PageResult<ImConversationDO> getConversationPage(ImConversationPageReqVO pageReqVO); |
| 53 | 53 | ||
| 54 | } | 54 | } |
| 55 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/conversation/ConversationServiceImpl.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/conversation/ImConversationServiceImpl.java
| @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.im.service.conversation; | @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.im.service.conversation; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ConversationSaveReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ConversationDO; | 5 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationPageReqVO; |
| 6 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ImConversationDO; | ||
| 8 | import cn.iocoder.yudao.module.im.dal.mysql.conversation.ConversationMapper; | 8 | import cn.iocoder.yudao.module.im.dal.mysql.conversation.ConversationMapper; |
| 9 | import jakarta.annotation.Resource; | 9 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| @@ -20,26 +20,26 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.CONVERSATION_N | @@ -20,26 +20,26 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.CONVERSATION_N | ||
| 20 | */ | 20 | */ |
| 21 | @Service | 21 | @Service |
| 22 | @Validated | 22 | @Validated |
| 23 | -public class ConversationServiceImpl implements ConversationService { | 23 | +public class ImConversationServiceImpl implements ImConversationService { |
| 24 | 24 | ||
| 25 | @Resource | 25 | @Resource |
| 26 | private ConversationMapper conversationMapper; | 26 | private ConversationMapper conversationMapper; |
| 27 | 27 | ||
| 28 | @Override | 28 | @Override |
| 29 | - public Long createConversation(ConversationSaveReqVO createReqVO) { | 29 | + public Long createConversation(ImConversationSaveReqVO createReqVO) { |
| 30 | // 插入 | 30 | // 插入 |
| 31 | - ConversationDO conversation = BeanUtils.toBean(createReqVO, ConversationDO.class); | 31 | + ImConversationDO conversation = BeanUtils.toBean(createReqVO, ImConversationDO.class); |
| 32 | conversationMapper.insert(conversation); | 32 | conversationMapper.insert(conversation); |
| 33 | // 返回 | 33 | // 返回 |
| 34 | return conversation.getId(); | 34 | return conversation.getId(); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | - public void updateConversation(ConversationSaveReqVO updateReqVO) { | 38 | + public void updateConversation(ImConversationSaveReqVO updateReqVO) { |
| 39 | // 校验存在 | 39 | // 校验存在 |
| 40 | validateConversationExists(updateReqVO.getId()); | 40 | validateConversationExists(updateReqVO.getId()); |
| 41 | // 更新 | 41 | // 更新 |
| 42 | - ConversationDO updateObj = BeanUtils.toBean(updateReqVO, ConversationDO.class); | 42 | + ImConversationDO updateObj = BeanUtils.toBean(updateReqVO, ImConversationDO.class); |
| 43 | conversationMapper.updateById(updateObj); | 43 | conversationMapper.updateById(updateObj); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -58,12 +58,12 @@ public class ConversationServiceImpl implements ConversationService { | @@ -58,12 +58,12 @@ public class ConversationServiceImpl implements ConversationService { | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| 61 | - public ConversationDO getConversation(Long id) { | 61 | + public ImConversationDO getConversation(Long id) { |
| 62 | return conversationMapper.selectById(id); | 62 | return conversationMapper.selectById(id); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @Override | 65 | @Override |
| 66 | - public PageResult<ConversationDO> getConversationPage(ConversationPageReqVO pageReqVO) { | 66 | + public PageResult<ImConversationDO> getConversationPage(ImConversationPageReqVO pageReqVO) { |
| 67 | return conversationMapper.selectPage(pageReqVO); | 67 | return conversationMapper.selectPage(pageReqVO); |
| 68 | } | 68 | } |
| 69 | 69 |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/inbox/InboxService.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.im.service.inbox; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.im.service.inbox; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; | 4 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; |
| 5 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 5 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; |
| 6 | -import cn.iocoder.yudao.module.im.dal.dataobject.inbox.InboxDO; | 6 | +import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 7 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| @@ -41,7 +41,7 @@ public interface InboxService { | @@ -41,7 +41,7 @@ public interface InboxService { | ||
| 41 | * @param id 编号 | 41 | * @param id 编号 |
| 42 | * @return 收件箱 | 42 | * @return 收件箱 |
| 43 | */ | 43 | */ |
| 44 | - InboxDO getInbox(Long id); | 44 | + ImInboxDO getInbox(Long id); |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * 获得收件箱分页 | 47 | * 获得收件箱分页 |
| @@ -49,6 +49,6 @@ public interface InboxService { | @@ -49,6 +49,6 @@ public interface InboxService { | ||
| 49 | * @param pageReqVO 分页查询 | 49 | * @param pageReqVO 分页查询 |
| 50 | * @return 收件箱分页 | 50 | * @return 收件箱分页 |
| 51 | */ | 51 | */ |
| 52 | - PageResult<InboxDO> getInboxPage(InboxPageReqVO pageReqVO); | 52 | + PageResult<ImInboxDO> getInboxPage(InboxPageReqVO pageReqVO); |
| 53 | 53 | ||
| 54 | } | 54 | } |
| 55 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/inbox/InboxServiceImpl.java
| @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; | 5 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxPageReqVO; |
| 6 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 6 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; |
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.inbox.InboxDO; | 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 8 | import cn.iocoder.yudao.module.im.dal.mysql.inbox.InboxMapper; | 8 | import cn.iocoder.yudao.module.im.dal.mysql.inbox.InboxMapper; |
| 9 | import jakarta.annotation.Resource; | 9 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| @@ -28,7 +28,7 @@ public class InboxServiceImpl implements InboxService { | @@ -28,7 +28,7 @@ public class InboxServiceImpl implements InboxService { | ||
| 28 | @Override | 28 | @Override |
| 29 | public Long createInbox(InboxSaveReqVO createReqVO) { | 29 | public Long createInbox(InboxSaveReqVO createReqVO) { |
| 30 | // 插入 | 30 | // 插入 |
| 31 | - InboxDO inbox = BeanUtils.toBean(createReqVO, InboxDO.class); | 31 | + ImInboxDO inbox = BeanUtils.toBean(createReqVO, ImInboxDO.class); |
| 32 | inboxMapper.insert(inbox); | 32 | inboxMapper.insert(inbox); |
| 33 | // 返回 | 33 | // 返回 |
| 34 | return inbox.getId(); | 34 | return inbox.getId(); |
| @@ -39,7 +39,7 @@ public class InboxServiceImpl implements InboxService { | @@ -39,7 +39,7 @@ public class InboxServiceImpl implements InboxService { | ||
| 39 | // 校验存在 | 39 | // 校验存在 |
| 40 | validateInboxExists(updateReqVO.getId()); | 40 | validateInboxExists(updateReqVO.getId()); |
| 41 | // 更新 | 41 | // 更新 |
| 42 | - InboxDO updateObj = BeanUtils.toBean(updateReqVO, InboxDO.class); | 42 | + ImInboxDO updateObj = BeanUtils.toBean(updateReqVO, ImInboxDO.class); |
| 43 | inboxMapper.updateById(updateObj); | 43 | inboxMapper.updateById(updateObj); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -58,12 +58,12 @@ public class InboxServiceImpl implements InboxService { | @@ -58,12 +58,12 @@ public class InboxServiceImpl implements InboxService { | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| 61 | - public InboxDO getInbox(Long id) { | 61 | + public ImInboxDO getInbox(Long id) { |
| 62 | return inboxMapper.selectById(id); | 62 | return inboxMapper.selectById(id); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @Override | 65 | @Override |
| 66 | - public PageResult<InboxDO> getInboxPage(InboxPageReqVO pageReqVO) { | 66 | + public PageResult<ImInboxDO> getInboxPage(InboxPageReqVO pageReqVO) { |
| 67 | return inboxMapper.selectPage(pageReqVO); | 67 | return inboxMapper.selectPage(pageReqVO); |
| 68 | } | 68 | } |
| 69 | 69 |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/message/MessageService.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/message/ImMessageService.java
| 1 | package cn.iocoder.yudao.module.im.service.message; | 1 | package cn.iocoder.yudao.module.im.service.message; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessagePageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessageSaveReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.im.dal.dataobject.message.MessageDO; | 4 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; |
| 5 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | ||
| 7 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| @@ -11,7 +11,7 @@ import jakarta.validation.Valid; | @@ -11,7 +11,7 @@ import jakarta.validation.Valid; | ||
| 11 | * | 11 | * |
| 12 | * @author 芋道源码 | 12 | * @author 芋道源码 |
| 13 | */ | 13 | */ |
| 14 | -public interface MessageService { | 14 | +public interface ImMessageService { |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * 创建消息 | 17 | * 创建消息 |
| @@ -19,14 +19,14 @@ public interface MessageService { | @@ -19,14 +19,14 @@ public interface MessageService { | ||
| 19 | * @param createReqVO 创建信息 | 19 | * @param createReqVO 创建信息 |
| 20 | * @return 编号 | 20 | * @return 编号 |
| 21 | */ | 21 | */ |
| 22 | - Long createMessage(@Valid MessageSaveReqVO createReqVO); | 22 | + Long createMessage(@Valid ImMessageSaveReqVO createReqVO); |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 更新消息 | 25 | * 更新消息 |
| 26 | * | 26 | * |
| 27 | * @param updateReqVO 更新信息 | 27 | * @param updateReqVO 更新信息 |
| 28 | */ | 28 | */ |
| 29 | - void updateMessage(@Valid MessageSaveReqVO updateReqVO); | 29 | + void updateMessage(@Valid ImMessageSaveReqVO updateReqVO); |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 删除消息 | 32 | * 删除消息 |
| @@ -41,7 +41,7 @@ public interface MessageService { | @@ -41,7 +41,7 @@ public interface MessageService { | ||
| 41 | * @param id 编号 | 41 | * @param id 编号 |
| 42 | * @return 消息 | 42 | * @return 消息 |
| 43 | */ | 43 | */ |
| 44 | - MessageDO getMessage(Long id); | 44 | + ImMessageDO getMessage(Long id); |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * 获得消息分页 | 47 | * 获得消息分页 |
| @@ -49,12 +49,12 @@ public interface MessageService { | @@ -49,12 +49,12 @@ public interface MessageService { | ||
| 49 | * @param pageReqVO 分页查询 | 49 | * @param pageReqVO 分页查询 |
| 50 | * @return 消息分页 | 50 | * @return 消息分页 |
| 51 | */ | 51 | */ |
| 52 | - PageResult<MessageDO> getMessagePage(MessagePageReqVO pageReqVO); | 52 | + PageResult<ImMessageDO> getMessagePage(ImMessagePageReqVO pageReqVO); |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | * 发送私聊消息 | 55 | * 发送私聊消息 |
| 56 | - * @param messageSaveReqVO 消息信息 | 56 | + * @param imMessageSaveReqVO 消息信息 |
| 57 | * @return 消息编号 | 57 | * @return 消息编号 |
| 58 | */ | 58 | */ |
| 59 | - Long sendPrivateMessage(MessageSaveReqVO messageSaveReqVO); | 59 | + Long sendPrivateMessage(ImMessageSaveReqVO imMessageSaveReqVO); |
| 60 | } | 60 | } |
| 61 | \ No newline at end of file | 61 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/message/MessageServiceImpl.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/message/ImMessageServiceImpl.java
| @@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.im.service.message; | @@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.im.service.message; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessagePageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.im.controller.admin.message.vo.MessageSaveReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.im.dal.dataobject.message.MessageDO; | ||
| 8 | -import cn.iocoder.yudao.module.im.dal.mysql.message.MessageMapper; | 5 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; |
| 6 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | ||
| 8 | +import cn.iocoder.yudao.module.im.dal.mysql.message.ImMessageMapper; | ||
| 9 | import jakarta.annotation.Resource; | 9 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 11 | import org.springframework.validation.annotation.Validated; |
| @@ -20,27 +20,27 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.MESSAGE_NOT_EX | @@ -20,27 +20,27 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.MESSAGE_NOT_EX | ||
| 20 | */ | 20 | */ |
| 21 | @Service | 21 | @Service |
| 22 | @Validated | 22 | @Validated |
| 23 | -public class MessageServiceImpl implements MessageService { | 23 | +public class ImMessageServiceImpl implements ImMessageService { |
| 24 | 24 | ||
| 25 | @Resource | 25 | @Resource |
| 26 | - private MessageMapper messageMapper; | 26 | + private ImMessageMapper imMessageMapper; |
| 27 | 27 | ||
| 28 | @Override | 28 | @Override |
| 29 | - public Long createMessage(MessageSaveReqVO createReqVO) { | 29 | + public Long createMessage(ImMessageSaveReqVO createReqVO) { |
| 30 | // 插入 | 30 | // 插入 |
| 31 | - MessageDO message = BeanUtils.toBean(createReqVO, MessageDO.class); | ||
| 32 | - messageMapper.insert(message); | 31 | + ImMessageDO message = BeanUtils.toBean(createReqVO, ImMessageDO.class); |
| 32 | + imMessageMapper.insert(message); | ||
| 33 | // 返回 | 33 | // 返回 |
| 34 | return message.getId(); | 34 | return message.getId(); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | - public void updateMessage(MessageSaveReqVO updateReqVO) { | 38 | + public void updateMessage(ImMessageSaveReqVO updateReqVO) { |
| 39 | // 校验存在 | 39 | // 校验存在 |
| 40 | validateMessageExists(updateReqVO.getId()); | 40 | validateMessageExists(updateReqVO.getId()); |
| 41 | // 更新 | 41 | // 更新 |
| 42 | - MessageDO updateObj = BeanUtils.toBean(updateReqVO, MessageDO.class); | ||
| 43 | - messageMapper.updateById(updateObj); | 42 | + ImMessageDO updateObj = BeanUtils.toBean(updateReqVO, ImMessageDO.class); |
| 43 | + imMessageMapper.updateById(updateObj); | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | @Override | 46 | @Override |
| @@ -48,27 +48,27 @@ public class MessageServiceImpl implements MessageService { | @@ -48,27 +48,27 @@ public class MessageServiceImpl implements MessageService { | ||
| 48 | // 校验存在 | 48 | // 校验存在 |
| 49 | validateMessageExists(id); | 49 | validateMessageExists(id); |
| 50 | // 删除 | 50 | // 删除 |
| 51 | - messageMapper.deleteById(id); | 51 | + imMessageMapper.deleteById(id); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | private void validateMessageExists(Long id) { | 54 | private void validateMessageExists(Long id) { |
| 55 | - if (messageMapper.selectById(id) == null) { | 55 | + if (imMessageMapper.selectById(id) == null) { |
| 56 | throw exception(MESSAGE_NOT_EXISTS); | 56 | throw exception(MESSAGE_NOT_EXISTS); |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| 61 | - public MessageDO getMessage(Long id) { | ||
| 62 | - return messageMapper.selectById(id); | 61 | + public ImMessageDO getMessage(Long id) { |
| 62 | + return imMessageMapper.selectById(id); | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @Override | 65 | @Override |
| 66 | - public PageResult<MessageDO> getMessagePage(MessagePageReqVO pageReqVO) { | ||
| 67 | - return messageMapper.selectPage(pageReqVO); | 66 | + public PageResult<ImMessageDO> getMessagePage(ImMessagePageReqVO pageReqVO) { |
| 67 | + return imMessageMapper.selectPage(pageReqVO); | ||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | @Override | 70 | @Override |
| 71 | - public Long sendPrivateMessage(MessageSaveReqVO messageSaveReqVO) { | 71 | + public Long sendPrivateMessage(ImMessageSaveReqVO imMessageSaveReqVO) { |
| 72 | return 0L; | 72 | return 0L; |
| 73 | } | 73 | } |
| 74 | 74 |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/websocket/ImWebSocketMessageListener.java
| @@ -4,9 +4,15 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | @@ -4,9 +4,15 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 4 | import cn.iocoder.yudao.framework.websocket.core.listener.WebSocketMessageListener; | 4 | import cn.iocoder.yudao.framework.websocket.core.listener.WebSocketMessageListener; |
| 5 | import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; | 5 | import cn.iocoder.yudao.framework.websocket.core.sender.WebSocketMessageSender; |
| 6 | import cn.iocoder.yudao.framework.websocket.core.util.WebSocketFrameworkUtils; | 6 | import cn.iocoder.yudao.framework.websocket.core.util.WebSocketFrameworkUtils; |
| 7 | +import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.ImConversationSaveReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | ||
| 7 | import cn.iocoder.yudao.module.im.enums.conversation.ImConversationTypeEnum; | 9 | import cn.iocoder.yudao.module.im.enums.conversation.ImConversationTypeEnum; |
| 10 | +import cn.iocoder.yudao.module.im.service.conversation.ImConversationService; | ||
| 11 | +import cn.iocoder.yudao.module.im.service.message.ImMessageService; | ||
| 8 | import cn.iocoder.yudao.module.im.websocket.message.ImReceiveMessage; | 12 | import cn.iocoder.yudao.module.im.websocket.message.ImReceiveMessage; |
| 9 | import cn.iocoder.yudao.module.im.websocket.message.ImSendMessage; | 13 | import cn.iocoder.yudao.module.im.websocket.message.ImSendMessage; |
| 14 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 15 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 10 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 11 | import org.springframework.stereotype.Component; | 17 | import org.springframework.stereotype.Component; |
| 12 | import org.springframework.web.socket.WebSocketSession; | 18 | import org.springframework.web.socket.WebSocketSession; |
| @@ -21,19 +27,65 @@ public class ImWebSocketMessageListener implements WebSocketMessageListener<ImSe | @@ -21,19 +27,65 @@ public class ImWebSocketMessageListener implements WebSocketMessageListener<ImSe | ||
| 21 | 27 | ||
| 22 | @Resource | 28 | @Resource |
| 23 | private WebSocketMessageSender webSocketMessageSender; | 29 | private WebSocketMessageSender webSocketMessageSender; |
| 30 | + @Resource | ||
| 31 | + private ImMessageService imMessageService; | ||
| 32 | + @Resource | ||
| 33 | + private AdminUserApi adminUserApi; | ||
| 34 | + @Resource | ||
| 35 | + private ImConversationService imConversationService; | ||
| 24 | 36 | ||
| 25 | @Override | 37 | @Override |
| 26 | public void onMessage(WebSocketSession session, ImSendMessage message) { | 38 | public void onMessage(WebSocketSession session, ImSendMessage message) { |
| 27 | Long fromUserId = WebSocketFrameworkUtils.getLoginUserId(session); | 39 | Long fromUserId = WebSocketFrameworkUtils.getLoginUserId(session); |
| 40 | + //1、插入消息表 | ||
| 41 | + ImMessageSaveReqVO imMessageSaveReqVO = new ImMessageSaveReqVO(); | ||
| 42 | + imMessageSaveReqVO.setClientMessageId(message.getClientMessageId()); | ||
| 43 | + imMessageSaveReqVO.setSenderId(fromUserId); | ||
| 44 | + imMessageSaveReqVO.setReceiverId(message.getReceiverId()); | ||
| 45 | + //查询发送人昵称和发送人头像 | ||
| 46 | + AdminUserRespDTO user = adminUserApi.getUser(fromUserId); | ||
| 47 | + imMessageSaveReqVO.setSenderNickname(user.getNickname()); | ||
| 48 | + imMessageSaveReqVO.setSenderAvatar(user.getAvatar()); | ||
| 49 | + imMessageSaveReqVO.setConversationType(message.getConversationType()); | ||
| 50 | + imMessageSaveReqVO.setContentType(message.getContentType()); | ||
| 51 | + imMessageSaveReqVO.setConversationNo("1"); | ||
| 52 | + imMessageSaveReqVO.setContent(message.getContent()); | ||
| 53 | + //消息来源 100-用户发送;200-系统发送(一般是通知);不能为空 | ||
| 54 | + imMessageSaveReqVO.setSendFrom(100); | ||
| 55 | + imMessageService.createMessage(imMessageSaveReqVO); | ||
| 56 | + | ||
| 57 | + | ||
| 28 | // 私聊 | 58 | // 私聊 |
| 29 | if (message.getConversationType().equals(ImConversationTypeEnum.PRIVATE.getType())) { | 59 | if (message.getConversationType().equals(ImConversationTypeEnum.PRIVATE.getType())) { |
| 60 | + //2、插入收件箱表(私聊:两条,群聊:每个群有一条) | ||
| 61 | + ImConversationSaveReqVO imConversationSaveReqVO = new ImConversationSaveReqVO(); | ||
| 62 | + imConversationSaveReqVO.setUserId(fromUserId); | ||
| 63 | + imConversationSaveReqVO.setConversationType(message.getConversationType()); | ||
| 64 | + //单聊时,用户编号;群聊时,群编号 | ||
| 65 | + imConversationSaveReqVO.setTargetId(message.getReceiverId()+""); | ||
| 66 | + //会话标志 单聊:s_{userId}_{targetId},需要排序 userId 和 targetId 群聊:g_groupId | ||
| 67 | + imConversationSaveReqVO.setNo("s_" + fromUserId + "_" + message.getReceiverId()); | ||
| 68 | + imConversationSaveReqVO.setPinned(false); | ||
| 69 | + imConversationService.createConversation(imConversationSaveReqVO); | ||
| 70 | + | ||
| 71 | + ImConversationSaveReqVO imConversationSaveReqVO1 = new ImConversationSaveReqVO(); | ||
| 72 | + imConversationSaveReqVO1.setUserId(message.getReceiverId()); | ||
| 73 | + imConversationSaveReqVO1.setConversationType(message.getConversationType()); | ||
| 74 | + //单聊时,用户编号;群聊时,群编号 | ||
| 75 | + imConversationSaveReqVO1.setTargetId(fromUserId+""); | ||
| 76 | + //会话标志 单聊:s_{userId}_{targetId},需要排序 userId 和 targetId 群聊:g_groupId | ||
| 77 | + imConversationSaveReqVO1.setNo("s_" + message.getReceiverId() + "_" + fromUserId); | ||
| 78 | + imConversationSaveReqVO1.setPinned(false); | ||
| 79 | + imConversationService.createConversation(imConversationSaveReqVO1); | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + //3、推送消息 | ||
| 30 | ImReceiveMessage toMessage = new ImReceiveMessage(); | 83 | ImReceiveMessage toMessage = new ImReceiveMessage(); |
| 31 | - toMessage.setToId(fromUserId); | 84 | + toMessage.setFromId(fromUserId); |
| 32 | toMessage.setConversationType(ImConversationTypeEnum.PRIVATE.getType()); | 85 | toMessage.setConversationType(ImConversationTypeEnum.PRIVATE.getType()); |
| 33 | - //消息类型 | ||
| 34 | - toMessage.setType(message.getType()); | ||
| 35 | - toMessage.setBody(message.getBody()); | ||
| 36 | - webSocketMessageSender.sendObject(UserTypeEnum.ADMIN.getValue(), message.getToId(), // 给指定用户 | 86 | + toMessage.setContentType(message.getContentType()); |
| 87 | + toMessage.setContent(message.getContent()); | ||
| 88 | + webSocketMessageSender.sendObject(UserTypeEnum.ADMIN.getValue(), message.getReceiverId(), // 给指定用户 | ||
| 37 | "im-message-receive", toMessage); | 89 | "im-message-receive", toMessage); |
| 38 | } | 90 | } |
| 39 | } | 91 | } |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/websocket/message/ImReceiveMessage.java
| @@ -4,20 +4,20 @@ import cn.iocoder.yudao.module.im.dal.dataobject.message.body.ImMessageBody; | @@ -4,20 +4,20 @@ import cn.iocoder.yudao.module.im.dal.dataobject.message.body.ImMessageBody; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| 7 | -@Schema(description = "管理后台 - 消息发送 send") | 7 | +@Schema(description = "管理后台 - 消息发送 receive") |
| 8 | @Data | 8 | @Data |
| 9 | public class ImReceiveMessage { | 9 | public class ImReceiveMessage { |
| 10 | 10 | ||
| 11 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 11 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 12 | private Integer conversationType; // 对应 ImConversationTypeEnum 枚举 | 12 | private Integer conversationType; // 对应 ImConversationTypeEnum 枚举 |
| 13 | 13 | ||
| 14 | - @Schema(description = "聊天对象,用户编号或群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 15 | - private Long toId; // 根据 conversationType 区分 | 14 | + @Schema(description = "发送人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 15 | + private Long fromId; // 根据 conversationType 区分 | ||
| 16 | 16 | ||
| 17 | - @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | - private Integer type; // 参见 ImMessageTypeEnum 枚举 | 17 | + @Schema(description = "内容类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 18 | + private Integer contentType; // 参见 ImMessageTypeEnum 枚举 | ||
| 19 | 19 | ||
| 20 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) | 20 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) |
| 21 | - private ImMessageBody body; | 21 | + private String content; |
| 22 | 22 | ||
| 23 | } | 23 | } |
| 24 | \ No newline at end of file | 24 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/websocket/message/ImSendMessage.java
| @@ -2,22 +2,26 @@ package cn.iocoder.yudao.module.im.websocket.message; | @@ -2,22 +2,26 @@ package cn.iocoder.yudao.module.im.websocket.message; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.im.dal.dataobject.message.body.ImMessageBody; | 3 | import cn.iocoder.yudao.module.im.dal.dataobject.message.body.ImMessageBody; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| 6 | 7 | ||
| 7 | @Schema(description = "管理后台 - 消息发送 send") | 8 | @Schema(description = "管理后台 - 消息发送 send") |
| 8 | @Data | 9 | @Data |
| 9 | public class ImSendMessage { | 10 | public class ImSendMessage { |
| 10 | 11 | ||
| 12 | + @Schema(description = "客户端消息编号 uuid,用于排重", requiredMode = Schema.RequiredMode.REQUIRED, example = "3331") | ||
| 13 | + private String clientMessageId; | ||
| 14 | + | ||
| 11 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 15 | @Schema(description = "会话类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 12 | private Integer conversationType; // 对应 ImConversationTypeEnum 枚举 | 16 | private Integer conversationType; // 对应 ImConversationTypeEnum 枚举 |
| 13 | 17 | ||
| 14 | - @Schema(description = "聊天对象,用户编号或群编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 15 | - private Long toId; // 根据 conversationType 区分 | 18 | + @Schema(description = "接收人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 19 | + private Long receiverId; // 根据 conversationType 区分 | ||
| 16 | 20 | ||
| 17 | - @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | - private Integer type; // 参见 ImMessageTypeEnum 枚举 | 21 | + @Schema(description = "内容类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 22 | + private Integer contentType; // 参见 ImMessageTypeEnum 枚举 | ||
| 19 | 23 | ||
| 20 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) | 24 | @Schema(description = "消息内容", requiredMode = Schema.RequiredMode.REQUIRED) |
| 21 | - private ImMessageBody body; | 25 | + private String content; |
| 22 | 26 | ||
| 23 | } | 27 | } |
| 24 | \ No newline at end of file | 28 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/resources/mapper/message/MessageMapper.xml renamed to yudao-module-im/yudao-module-im-biz/src/main/resources/mapper/message/ImMessageMapper.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.im.dal.mysql.message.MessageMapper"> | 3 | +<mapper namespace="cn.iocoder.yudao.module.im.dal.mysql.message.ImMessageMapper"> |
| 4 | 4 | ||
| 5 | <!-- | 5 | <!-- |
| 6 | 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | 6 | 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/conversation/ConversationServiceImplTest.java renamed to yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/conversation/ImConversationServiceImplTest.java
| @@ -2,42 +2,35 @@ package cn.iocoder.yudao.module.im.service.conversation; | @@ -2,42 +2,35 @@ package cn.iocoder.yudao.module.im.service.conversation; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import jakarta.annotation.Resource; | 6 | import jakarta.annotation.Resource; |
| 8 | 7 | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 9 | ||
| 11 | import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.*; | 10 | import cn.iocoder.yudao.module.im.controller.admin.conversation.vo.*; |
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ConversationDO; | 11 | +import cn.iocoder.yudao.module.im.dal.dataobject.conversation.ImConversationDO; |
| 13 | import cn.iocoder.yudao.module.im.dal.mysql.conversation.ConversationMapper; | 12 | import cn.iocoder.yudao.module.im.dal.mysql.conversation.ConversationMapper; |
| 14 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 15 | 14 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 18 | -import java.util.*; | ||
| 19 | -import java.time.LocalDateTime; | ||
| 20 | 16 | ||
| 21 | -import static cn.hutool.core.util.RandomUtil.*; | ||
| 22 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; | 17 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; |
| 23 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; | 18 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; |
| 24 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 25 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; | 20 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; |
| 26 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | 21 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; |
| 27 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; | ||
| 28 | import static org.junit.jupiter.api.Assertions.*; | 22 | import static org.junit.jupiter.api.Assertions.*; |
| 29 | -import static org.mockito.Mockito.*; | ||
| 30 | 23 | ||
| 31 | /** | 24 | /** |
| 32 | - * {@link ConversationServiceImpl} 的单元测试类 | 25 | + * {@link ImConversationServiceImpl} 的单元测试类 |
| 33 | * | 26 | * |
| 34 | * @author 芋道源码 | 27 | * @author 芋道源码 |
| 35 | */ | 28 | */ |
| 36 | -@Import(ConversationServiceImpl.class) | ||
| 37 | -public class ConversationServiceImplTest extends BaseDbUnitTest { | 29 | +@Import(ImConversationServiceImpl.class) |
| 30 | +public class ImConversationServiceImplTest extends BaseDbUnitTest { | ||
| 38 | 31 | ||
| 39 | @Resource | 32 | @Resource |
| 40 | - private ConversationServiceImpl conversationService; | 33 | + private ImConversationServiceImpl conversationService; |
| 41 | 34 | ||
| 42 | @Resource | 35 | @Resource |
| 43 | private ConversationMapper conversationMapper; | 36 | private ConversationMapper conversationMapper; |
| @@ -45,38 +38,38 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | @@ -45,38 +38,38 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | ||
| 45 | @Test | 38 | @Test |
| 46 | public void testCreateConversation_success() { | 39 | public void testCreateConversation_success() { |
| 47 | // 准备参数 | 40 | // 准备参数 |
| 48 | - ConversationSaveReqVO createReqVO = randomPojo(ConversationSaveReqVO.class).setId(null); | 41 | + ImConversationSaveReqVO createReqVO = randomPojo(ImConversationSaveReqVO.class).setId(null); |
| 49 | 42 | ||
| 50 | // 调用 | 43 | // 调用 |
| 51 | Long conversationId = conversationService.createConversation(createReqVO); | 44 | Long conversationId = conversationService.createConversation(createReqVO); |
| 52 | // 断言 | 45 | // 断言 |
| 53 | assertNotNull(conversationId); | 46 | assertNotNull(conversationId); |
| 54 | // 校验记录的属性是否正确 | 47 | // 校验记录的属性是否正确 |
| 55 | - ConversationDO conversation = conversationMapper.selectById(conversationId); | 48 | + ImConversationDO conversation = conversationMapper.selectById(conversationId); |
| 56 | assertPojoEquals(createReqVO, conversation, "id"); | 49 | assertPojoEquals(createReqVO, conversation, "id"); |
| 57 | } | 50 | } |
| 58 | 51 | ||
| 59 | @Test | 52 | @Test |
| 60 | public void testUpdateConversation_success() { | 53 | public void testUpdateConversation_success() { |
| 61 | // mock 数据 | 54 | // mock 数据 |
| 62 | - ConversationDO dbConversation = randomPojo(ConversationDO.class); | 55 | + ImConversationDO dbConversation = randomPojo(ImConversationDO.class); |
| 63 | conversationMapper.insert(dbConversation);// @Sql: 先插入出一条存在的数据 | 56 | conversationMapper.insert(dbConversation);// @Sql: 先插入出一条存在的数据 |
| 64 | // 准备参数 | 57 | // 准备参数 |
| 65 | - ConversationSaveReqVO updateReqVO = randomPojo(ConversationSaveReqVO.class, o -> { | 58 | + ImConversationSaveReqVO updateReqVO = randomPojo(ImConversationSaveReqVO.class, o -> { |
| 66 | o.setId(dbConversation.getId()); // 设置更新的 ID | 59 | o.setId(dbConversation.getId()); // 设置更新的 ID |
| 67 | }); | 60 | }); |
| 68 | 61 | ||
| 69 | // 调用 | 62 | // 调用 |
| 70 | conversationService.updateConversation(updateReqVO); | 63 | conversationService.updateConversation(updateReqVO); |
| 71 | // 校验是否更新正确 | 64 | // 校验是否更新正确 |
| 72 | - ConversationDO conversation = conversationMapper.selectById(updateReqVO.getId()); // 获取最新的 | 65 | + ImConversationDO conversation = conversationMapper.selectById(updateReqVO.getId()); // 获取最新的 |
| 73 | assertPojoEquals(updateReqVO, conversation); | 66 | assertPojoEquals(updateReqVO, conversation); |
| 74 | } | 67 | } |
| 75 | 68 | ||
| 76 | @Test | 69 | @Test |
| 77 | public void testUpdateConversation_notExists() { | 70 | public void testUpdateConversation_notExists() { |
| 78 | // 准备参数 | 71 | // 准备参数 |
| 79 | - ConversationSaveReqVO updateReqVO = randomPojo(ConversationSaveReqVO.class); | 72 | + ImConversationSaveReqVO updateReqVO = randomPojo(ImConversationSaveReqVO.class); |
| 80 | 73 | ||
| 81 | // 调用, 并断言异常 | 74 | // 调用, 并断言异常 |
| 82 | assertServiceException(() -> conversationService.updateConversation(updateReqVO), CONVERSATION_NOT_EXISTS); | 75 | assertServiceException(() -> conversationService.updateConversation(updateReqVO), CONVERSATION_NOT_EXISTS); |
| @@ -85,7 +78,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | @@ -85,7 +78,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | ||
| 85 | @Test | 78 | @Test |
| 86 | public void testDeleteConversation_success() { | 79 | public void testDeleteConversation_success() { |
| 87 | // mock 数据 | 80 | // mock 数据 |
| 88 | - ConversationDO dbConversation = randomPojo(ConversationDO.class); | 81 | + ImConversationDO dbConversation = randomPojo(ImConversationDO.class); |
| 89 | conversationMapper.insert(dbConversation);// @Sql: 先插入出一条存在的数据 | 82 | conversationMapper.insert(dbConversation);// @Sql: 先插入出一条存在的数据 |
| 90 | // 准备参数 | 83 | // 准备参数 |
| 91 | Long id = dbConversation.getId(); | 84 | Long id = dbConversation.getId(); |
| @@ -109,7 +102,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | @@ -109,7 +102,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | ||
| 109 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | 102 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 110 | public void testGetConversationPage() { | 103 | public void testGetConversationPage() { |
| 111 | // mock 数据 | 104 | // mock 数据 |
| 112 | - ConversationDO dbConversation = randomPojo(ConversationDO.class, o -> { // 等会查询到 | 105 | + ImConversationDO dbConversation = randomPojo(ImConversationDO.class, o -> { // 等会查询到 |
| 113 | o.setUserId(null); | 106 | o.setUserId(null); |
| 114 | o.setConversationType(null); | 107 | o.setConversationType(null); |
| 115 | o.setTargetId(null); | 108 | o.setTargetId(null); |
| @@ -134,7 +127,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | @@ -134,7 +127,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | ||
| 134 | // 测试 createTime 不匹配 | 127 | // 测试 createTime 不匹配 |
| 135 | conversationMapper.insert(cloneIgnoreId(dbConversation, o -> o.setCreateTime(null))); | 128 | conversationMapper.insert(cloneIgnoreId(dbConversation, o -> o.setCreateTime(null))); |
| 136 | // 准备参数 | 129 | // 准备参数 |
| 137 | - ConversationPageReqVO reqVO = new ConversationPageReqVO(); | 130 | + ImConversationPageReqVO reqVO = new ImConversationPageReqVO(); |
| 138 | reqVO.setUserId(null); | 131 | reqVO.setUserId(null); |
| 139 | reqVO.setConversationType(null); | 132 | reqVO.setConversationType(null); |
| 140 | reqVO.setTargetId(null); | 133 | reqVO.setTargetId(null); |
| @@ -144,7 +137,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | @@ -144,7 +137,7 @@ public class ConversationServiceImplTest extends BaseDbUnitTest { | ||
| 144 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | 137 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
| 145 | 138 | ||
| 146 | // 调用 | 139 | // 调用 |
| 147 | - PageResult<ConversationDO> pageResult = conversationService.getConversationPage(reqVO); | 140 | + PageResult<ImConversationDO> pageResult = conversationService.getConversationPage(reqVO); |
| 148 | // 断言 | 141 | // 断言 |
| 149 | assertEquals(1, pageResult.getTotal()); | 142 | assertEquals(1, pageResult.getTotal()); |
| 150 | assertEquals(1, pageResult.getList().size()); | 143 | assertEquals(1, pageResult.getList().size()); |
yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/inbox/InboxServiceImplTest.java
| @@ -2,31 +2,24 @@ package cn.iocoder.yudao.module.im.service.inbox; | @@ -2,31 +2,24 @@ package cn.iocoder.yudao.module.im.service.inbox; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import jakarta.annotation.Resource; | 6 | import jakarta.annotation.Resource; |
| 8 | 7 | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 9 | ||
| 11 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.*; | 10 | import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.*; |
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.inbox.InboxDO; | 11 | +import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 13 | import cn.iocoder.yudao.module.im.dal.mysql.inbox.InboxMapper; | 12 | import cn.iocoder.yudao.module.im.dal.mysql.inbox.InboxMapper; |
| 14 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 15 | 14 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 18 | -import java.util.*; | ||
| 19 | -import java.time.LocalDateTime; | ||
| 20 | 16 | ||
| 21 | -import static cn.hutool.core.util.RandomUtil.*; | ||
| 22 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; | 17 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; |
| 23 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; | 18 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; |
| 24 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 25 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; | 20 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; |
| 26 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | 21 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; |
| 27 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; | ||
| 28 | import static org.junit.jupiter.api.Assertions.*; | 22 | import static org.junit.jupiter.api.Assertions.*; |
| 29 | -import static org.mockito.Mockito.*; | ||
| 30 | 23 | ||
| 31 | /** | 24 | /** |
| 32 | * {@link InboxServiceImpl} 的单元测试类 | 25 | * {@link InboxServiceImpl} 的单元测试类 |
| @@ -52,14 +45,14 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -52,14 +45,14 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 52 | // 断言 | 45 | // 断言 |
| 53 | assertNotNull(inboxId); | 46 | assertNotNull(inboxId); |
| 54 | // 校验记录的属性是否正确 | 47 | // 校验记录的属性是否正确 |
| 55 | - InboxDO inbox = inboxMapper.selectById(inboxId); | 48 | + ImInboxDO inbox = inboxMapper.selectById(inboxId); |
| 56 | assertPojoEquals(createReqVO, inbox, "id"); | 49 | assertPojoEquals(createReqVO, inbox, "id"); |
| 57 | } | 50 | } |
| 58 | 51 | ||
| 59 | @Test | 52 | @Test |
| 60 | public void testUpdateInbox_success() { | 53 | public void testUpdateInbox_success() { |
| 61 | // mock 数据 | 54 | // mock 数据 |
| 62 | - InboxDO dbInbox = randomPojo(InboxDO.class); | 55 | + ImInboxDO dbInbox = randomPojo(ImInboxDO.class); |
| 63 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 | 56 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 |
| 64 | // 准备参数 | 57 | // 准备参数 |
| 65 | InboxSaveReqVO updateReqVO = randomPojo(InboxSaveReqVO.class, o -> { | 58 | InboxSaveReqVO updateReqVO = randomPojo(InboxSaveReqVO.class, o -> { |
| @@ -69,7 +62,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -69,7 +62,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 69 | // 调用 | 62 | // 调用 |
| 70 | inboxService.updateInbox(updateReqVO); | 63 | inboxService.updateInbox(updateReqVO); |
| 71 | // 校验是否更新正确 | 64 | // 校验是否更新正确 |
| 72 | - InboxDO inbox = inboxMapper.selectById(updateReqVO.getId()); // 获取最新的 | 65 | + ImInboxDO inbox = inboxMapper.selectById(updateReqVO.getId()); // 获取最新的 |
| 73 | assertPojoEquals(updateReqVO, inbox); | 66 | assertPojoEquals(updateReqVO, inbox); |
| 74 | } | 67 | } |
| 75 | 68 | ||
| @@ -85,7 +78,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -85,7 +78,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 85 | @Test | 78 | @Test |
| 86 | public void testDeleteInbox_success() { | 79 | public void testDeleteInbox_success() { |
| 87 | // mock 数据 | 80 | // mock 数据 |
| 88 | - InboxDO dbInbox = randomPojo(InboxDO.class); | 81 | + ImInboxDO dbInbox = randomPojo(ImInboxDO.class); |
| 89 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 | 82 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 |
| 90 | // 准备参数 | 83 | // 准备参数 |
| 91 | Long id = dbInbox.getId(); | 84 | Long id = dbInbox.getId(); |
| @@ -109,7 +102,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -109,7 +102,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 109 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | 102 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 110 | public void testGetInboxPage() { | 103 | public void testGetInboxPage() { |
| 111 | // mock 数据 | 104 | // mock 数据 |
| 112 | - InboxDO dbInbox = randomPojo(InboxDO.class, o -> { // 等会查询到 | 105 | + ImInboxDO dbInbox = randomPojo(ImInboxDO.class, o -> { // 等会查询到 |
| 113 | o.setUserId(null); | 106 | o.setUserId(null); |
| 114 | o.setMessageId(null); | 107 | o.setMessageId(null); |
| 115 | o.setSequence(null); | 108 | o.setSequence(null); |
| @@ -132,7 +125,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -132,7 +125,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 132 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | 125 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
| 133 | 126 | ||
| 134 | // 调用 | 127 | // 调用 |
| 135 | - PageResult<InboxDO> pageResult = inboxService.getInboxPage(reqVO); | 128 | + PageResult<ImInboxDO> pageResult = inboxService.getInboxPage(reqVO); |
| 136 | // 断言 | 129 | // 断言 |
| 137 | assertEquals(1, pageResult.getTotal()); | 130 | assertEquals(1, pageResult.getTotal()); |
| 138 | assertEquals(1, pageResult.getList().size()); | 131 | assertEquals(1, pageResult.getList().size()); |
yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/message/MessageServiceImplTest.java renamed to yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/message/ImMessageServiceImplTest.java
| @@ -2,81 +2,74 @@ package cn.iocoder.yudao.module.im.service.message; | @@ -2,81 +2,74 @@ package cn.iocoder.yudao.module.im.service.message; | ||
| 2 | 2 | ||
| 3 | import org.junit.jupiter.api.Disabled; | 3 | import org.junit.jupiter.api.Disabled; |
| 4 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
| 5 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 6 | 5 | ||
| 7 | import jakarta.annotation.Resource; | 6 | import jakarta.annotation.Resource; |
| 8 | 7 | ||
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 8 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 9 | ||
| 11 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.*; | 10 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.*; |
| 12 | -import cn.iocoder.yudao.module.im.dal.dataobject.message.MessageDO; | ||
| 13 | -import cn.iocoder.yudao.module.im.dal.mysql.message.MessageMapper; | 11 | +import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; |
| 12 | +import cn.iocoder.yudao.module.im.dal.mysql.message.ImMessageMapper; | ||
| 14 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 15 | 14 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | import org.springframework.context.annotation.Import; | 15 | import org.springframework.context.annotation.Import; |
| 18 | -import java.util.*; | ||
| 19 | -import java.time.LocalDateTime; | ||
| 20 | 16 | ||
| 21 | -import static cn.hutool.core.util.RandomUtil.*; | ||
| 22 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; | 17 | import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.*; |
| 23 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; | 18 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; |
| 24 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | 19 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 25 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; | 20 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; |
| 26 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | 21 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; |
| 27 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; | ||
| 28 | import static org.junit.jupiter.api.Assertions.*; | 22 | import static org.junit.jupiter.api.Assertions.*; |
| 29 | -import static org.mockito.Mockito.*; | ||
| 30 | 23 | ||
| 31 | /** | 24 | /** |
| 32 | - * {@link MessageServiceImpl} 的单元测试类 | 25 | + * {@link ImMessageServiceImpl} 的单元测试类 |
| 33 | * | 26 | * |
| 34 | * @author 芋道源码 | 27 | * @author 芋道源码 |
| 35 | */ | 28 | */ |
| 36 | -@Import(MessageServiceImpl.class) | ||
| 37 | -public class MessageServiceImplTest extends BaseDbUnitTest { | 29 | +@Import(ImMessageServiceImpl.class) |
| 30 | +public class ImMessageServiceImplTest extends BaseDbUnitTest { | ||
| 38 | 31 | ||
| 39 | @Resource | 32 | @Resource |
| 40 | - private MessageServiceImpl messageService; | 33 | + private ImMessageServiceImpl messageService; |
| 41 | 34 | ||
| 42 | @Resource | 35 | @Resource |
| 43 | - private MessageMapper messageMapper; | 36 | + private ImMessageMapper imMessageMapper; |
| 44 | 37 | ||
| 45 | @Test | 38 | @Test |
| 46 | public void testCreateMessage_success() { | 39 | public void testCreateMessage_success() { |
| 47 | // 准备参数 | 40 | // 准备参数 |
| 48 | - MessageSaveReqVO createReqVO = randomPojo(MessageSaveReqVO.class).setId(null); | 41 | + ImMessageSaveReqVO createReqVO = randomPojo(ImMessageSaveReqVO.class).setId(null); |
| 49 | 42 | ||
| 50 | // 调用 | 43 | // 调用 |
| 51 | Long messageId = messageService.createMessage(createReqVO); | 44 | Long messageId = messageService.createMessage(createReqVO); |
| 52 | // 断言 | 45 | // 断言 |
| 53 | assertNotNull(messageId); | 46 | assertNotNull(messageId); |
| 54 | // 校验记录的属性是否正确 | 47 | // 校验记录的属性是否正确 |
| 55 | - MessageDO message = messageMapper.selectById(messageId); | 48 | + ImMessageDO message = imMessageMapper.selectById(messageId); |
| 56 | assertPojoEquals(createReqVO, message, "id"); | 49 | assertPojoEquals(createReqVO, message, "id"); |
| 57 | } | 50 | } |
| 58 | 51 | ||
| 59 | @Test | 52 | @Test |
| 60 | public void testUpdateMessage_success() { | 53 | public void testUpdateMessage_success() { |
| 61 | // mock 数据 | 54 | // mock 数据 |
| 62 | - MessageDO dbMessage = randomPojo(MessageDO.class); | ||
| 63 | - messageMapper.insert(dbMessage);// @Sql: 先插入出一条存在的数据 | 55 | + ImMessageDO dbMessage = randomPojo(ImMessageDO.class); |
| 56 | + imMessageMapper.insert(dbMessage);// @Sql: 先插入出一条存在的数据 | ||
| 64 | // 准备参数 | 57 | // 准备参数 |
| 65 | - MessageSaveReqVO updateReqVO = randomPojo(MessageSaveReqVO.class, o -> { | 58 | + ImMessageSaveReqVO updateReqVO = randomPojo(ImMessageSaveReqVO.class, o -> { |
| 66 | o.setId(dbMessage.getId()); // 设置更新的 ID | 59 | o.setId(dbMessage.getId()); // 设置更新的 ID |
| 67 | }); | 60 | }); |
| 68 | 61 | ||
| 69 | // 调用 | 62 | // 调用 |
| 70 | messageService.updateMessage(updateReqVO); | 63 | messageService.updateMessage(updateReqVO); |
| 71 | // 校验是否更新正确 | 64 | // 校验是否更新正确 |
| 72 | - MessageDO message = messageMapper.selectById(updateReqVO.getId()); // 获取最新的 | 65 | + ImMessageDO message = imMessageMapper.selectById(updateReqVO.getId()); // 获取最新的 |
| 73 | assertPojoEquals(updateReqVO, message); | 66 | assertPojoEquals(updateReqVO, message); |
| 74 | } | 67 | } |
| 75 | 68 | ||
| 76 | @Test | 69 | @Test |
| 77 | public void testUpdateMessage_notExists() { | 70 | public void testUpdateMessage_notExists() { |
| 78 | // 准备参数 | 71 | // 准备参数 |
| 79 | - MessageSaveReqVO updateReqVO = randomPojo(MessageSaveReqVO.class); | 72 | + ImMessageSaveReqVO updateReqVO = randomPojo(ImMessageSaveReqVO.class); |
| 80 | 73 | ||
| 81 | // 调用, 并断言异常 | 74 | // 调用, 并断言异常 |
| 82 | assertServiceException(() -> messageService.updateMessage(updateReqVO), MESSAGE_NOT_EXISTS); | 75 | assertServiceException(() -> messageService.updateMessage(updateReqVO), MESSAGE_NOT_EXISTS); |
| @@ -85,15 +78,15 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | @@ -85,15 +78,15 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | ||
| 85 | @Test | 78 | @Test |
| 86 | public void testDeleteMessage_success() { | 79 | public void testDeleteMessage_success() { |
| 87 | // mock 数据 | 80 | // mock 数据 |
| 88 | - MessageDO dbMessage = randomPojo(MessageDO.class); | ||
| 89 | - messageMapper.insert(dbMessage);// @Sql: 先插入出一条存在的数据 | 81 | + ImMessageDO dbMessage = randomPojo(ImMessageDO.class); |
| 82 | + imMessageMapper.insert(dbMessage);// @Sql: 先插入出一条存在的数据 | ||
| 90 | // 准备参数 | 83 | // 准备参数 |
| 91 | Long id = dbMessage.getId(); | 84 | Long id = dbMessage.getId(); |
| 92 | 85 | ||
| 93 | // 调用 | 86 | // 调用 |
| 94 | messageService.deleteMessage(id); | 87 | messageService.deleteMessage(id); |
| 95 | // 校验数据不存在了 | 88 | // 校验数据不存在了 |
| 96 | - assertNull(messageMapper.selectById(id)); | 89 | + assertNull(imMessageMapper.selectById(id)); |
| 97 | } | 90 | } |
| 98 | 91 | ||
| 99 | @Test | 92 | @Test |
| @@ -109,7 +102,7 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | @@ -109,7 +102,7 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | ||
| 109 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | 102 | @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 |
| 110 | public void testGetMessagePage() { | 103 | public void testGetMessagePage() { |
| 111 | // mock 数据 | 104 | // mock 数据 |
| 112 | - MessageDO dbMessage = randomPojo(MessageDO.class, o -> { // 等会查询到 | 105 | + ImMessageDO dbMessage = randomPojo(ImMessageDO.class, o -> { // 等会查询到 |
| 113 | o.setClientMessageId(null); | 106 | o.setClientMessageId(null); |
| 114 | o.setSenderId(null); | 107 | o.setSenderId(null); |
| 115 | o.setReceiverId(null); | 108 | o.setReceiverId(null); |
| @@ -123,33 +116,33 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | @@ -123,33 +116,33 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | ||
| 123 | o.setSendFrom(null); | 116 | o.setSendFrom(null); |
| 124 | o.setCreateTime(null); | 117 | o.setCreateTime(null); |
| 125 | }); | 118 | }); |
| 126 | - messageMapper.insert(dbMessage); | 119 | + imMessageMapper.insert(dbMessage); |
| 127 | // 测试 clientMessageId 不匹配 | 120 | // 测试 clientMessageId 不匹配 |
| 128 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setClientMessageId(null))); | 121 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setClientMessageId(null))); |
| 129 | // 测试 senderId 不匹配 | 122 | // 测试 senderId 不匹配 |
| 130 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderId(null))); | 123 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderId(null))); |
| 131 | // 测试 receiverId 不匹配 | 124 | // 测试 receiverId 不匹配 |
| 132 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setReceiverId(null))); | 125 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setReceiverId(null))); |
| 133 | // 测试 senderNickname 不匹配 | 126 | // 测试 senderNickname 不匹配 |
| 134 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderNickname(null))); | 127 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderNickname(null))); |
| 135 | // 测试 senderAvatar 不匹配 | 128 | // 测试 senderAvatar 不匹配 |
| 136 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderAvatar(null))); | 129 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSenderAvatar(null))); |
| 137 | // 测试 conversationType 不匹配 | 130 | // 测试 conversationType 不匹配 |
| 138 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setConversationType(null))); | 131 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setConversationType(null))); |
| 139 | // 测试 conversationNo 不匹配 | 132 | // 测试 conversationNo 不匹配 |
| 140 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setConversationNo(null))); | 133 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setConversationNo(null))); |
| 141 | // 测试 contentType 不匹配 | 134 | // 测试 contentType 不匹配 |
| 142 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setContentType(null))); | 135 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setContentType(null))); |
| 143 | // 测试 content 不匹配 | 136 | // 测试 content 不匹配 |
| 144 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setContent(null))); | 137 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setContent(null))); |
| 145 | // 测试 sendTime 不匹配 | 138 | // 测试 sendTime 不匹配 |
| 146 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSendTime(null))); | 139 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSendTime(null))); |
| 147 | // 测试 sendFrom 不匹配 | 140 | // 测试 sendFrom 不匹配 |
| 148 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSendFrom(null))); | 141 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setSendFrom(null))); |
| 149 | // 测试 createTime 不匹配 | 142 | // 测试 createTime 不匹配 |
| 150 | - messageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setCreateTime(null))); | 143 | + imMessageMapper.insert(cloneIgnoreId(dbMessage, o -> o.setCreateTime(null))); |
| 151 | // 准备参数 | 144 | // 准备参数 |
| 152 | - MessagePageReqVO reqVO = new MessagePageReqVO(); | 145 | + ImMessagePageReqVO reqVO = new ImMessagePageReqVO(); |
| 153 | reqVO.setClientMessageId(null); | 146 | reqVO.setClientMessageId(null); |
| 154 | reqVO.setSenderId(null); | 147 | reqVO.setSenderId(null); |
| 155 | reqVO.setReceiverId(null); | 148 | reqVO.setReceiverId(null); |
| @@ -164,7 +157,7 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | @@ -164,7 +157,7 @@ public class MessageServiceImplTest extends BaseDbUnitTest { | ||
| 164 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | 157 | reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); |
| 165 | 158 | ||
| 166 | // 调用 | 159 | // 调用 |
| 167 | - PageResult<MessageDO> pageResult = messageService.getMessagePage(reqVO); | 160 | + PageResult<ImMessageDO> pageResult = messageService.getMessagePage(reqVO); |
| 168 | // 断言 | 161 | // 断言 |
| 169 | assertEquals(1, pageResult.getTotal()); | 162 | assertEquals(1, pageResult.getTotal()); |
| 170 | assertEquals(1, pageResult.getList().size()); | 163 | assertEquals(1, pageResult.getList().size()); |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/AdminUserRespDTO.java
yudao-server/src/main/resources/application-local.yaml
| @@ -47,14 +47,14 @@ spring: | @@ -47,14 +47,14 @@ spring: | ||
| 47 | datasource: | 47 | datasource: |
| 48 | master: | 48 | master: |
| 49 | name: ruoyi-vue-pro | 49 | name: ruoyi-vue-pro |
| 50 | - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 | 50 | + url: jdbc:mysql://chaojiniu.top:23306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 |
| 51 | # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 | 51 | # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 |
| 52 | # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 | 52 | # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 |
| 53 | # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 | 53 | # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 |
| 54 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 | 54 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 |
| 55 | # url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 | 55 | # url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 |
| 56 | - username: root | ||
| 57 | - password: 123456 | 56 | + username: ruoyi-vue-pro |
| 57 | + password: ruoyi-@h2ju02hebp | ||
| 58 | # username: sa | 58 | # username: sa |
| 59 | # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | 59 | # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W |
| 60 | # username: SYSDBA # DM 连接的示例 | 60 | # username: SYSDBA # DM 连接的示例 |
| @@ -62,23 +62,23 @@ spring: | @@ -62,23 +62,23 @@ spring: | ||
| 62 | slave: # 模拟从库,可根据自己需要修改 | 62 | slave: # 模拟从库,可根据自己需要修改 |
| 63 | name: ruoyi-vue-pro | 63 | name: ruoyi-vue-pro |
| 64 | lazy: true # 开启懒加载,保证启动速度 | 64 | lazy: true # 开启懒加载,保证启动速度 |
| 65 | - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 | 65 | + url: jdbc:mysql://chaojiniu.top:23306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 |
| 66 | # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 | 66 | # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 |
| 67 | # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 | 67 | # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 |
| 68 | # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 | 68 | # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 |
| 69 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 | 69 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 |
| 70 | - username: root | ||
| 71 | - password: 123456 | 70 | + username: ruoyi-vue-pro |
| 71 | + password: ruoyi-@h2ju02hebp | ||
| 72 | # username: sa | 72 | # username: sa |
| 73 | # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | 73 | # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W |
| 74 | 74 | ||
| 75 | # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | 75 | # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 |
| 76 | data: | 76 | data: |
| 77 | redis: | 77 | redis: |
| 78 | - host: 127.0.0.1 # 地址 | 78 | + host: chaojiniu.top # 地址 |
| 79 | port: 6379 # 端口 | 79 | port: 6379 # 端口 |
| 80 | database: 0 # 数据库索引 | 80 | database: 0 # 数据库索引 |
| 81 | -# password: dev # 密码,建议生产环境开启 | 81 | + password: fsknKD7UvQYZsyf2hXXn # 密码,建议生产环境开启 |
| 82 | 82 | ||
| 83 | --- #################### 定时任务相关配置 #################### | 83 | --- #################### 定时任务相关配置 #################### |
| 84 | 84 |
yudao-server/src/main/resources/application.yaml
| @@ -185,7 +185,7 @@ yudao: | @@ -185,7 +185,7 @@ yudao: | ||
| 185 | - cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants | 185 | - cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants |
| 186 | - cn.iocoder.yudao.module.im.enums.ErrorCodeConstants | 186 | - cn.iocoder.yudao.module.im.enums.ErrorCodeConstants |
| 187 | tenant: # 多租户相关配置项 | 187 | tenant: # 多租户相关配置项 |
| 188 | - enable: true | 188 | + enable: false |
| 189 | ignore-urls: | 189 | ignore-urls: |
| 190 | - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 | 190 | - /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号 |
| 191 | - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 | 191 | - /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号 |