Commit 2d052ea75291815081a9f4e77d4e795a02a655dc
1 parent
3696b666
修改:私聊消息存库
Showing
16 changed files
with
147 additions
and
100 deletions
yudao-module-im/yudao-module-im-biz/pom.xml
| @@ -60,6 +60,11 @@ | @@ -60,6 +60,11 @@ | ||
| 60 | <groupId>cn.iocoder.boot</groupId> | 60 | <groupId>cn.iocoder.boot</groupId> |
| 61 | <artifactId>yudao-spring-boot-starter-websocket</artifactId> | 61 | <artifactId>yudao-spring-boot-starter-websocket</artifactId> |
| 62 | </dependency> | 62 | </dependency> |
| 63 | + | ||
| 64 | + <dependency> | ||
| 65 | + <groupId>org.redisson</groupId> | ||
| 66 | + <artifactId>redisson-spring-boot-starter</artifactId> | ||
| 67 | + </dependency> | ||
| 63 | </dependencies> | 68 | </dependencies> |
| 64 | 69 | ||
| 65 | </project> | 70 | </project> |
| 66 | \ No newline at end of file | 71 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/InboxController.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/ImInboxController.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.inbox.vo.InboxPageReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxRespVO; | ||
| 11 | -import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 9 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxPageReqVO; |
| 10 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxSaveReqVO; | ||
| 12 | import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; | 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.ImInboxService; |
| 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/inbox") | 32 | @RequestMapping("/im/inbox") |
| 33 | @Validated | 33 | @Validated |
| 34 | -public class InboxController { | 34 | +public class ImInboxController { |
| 35 | 35 | ||
| 36 | @Resource | 36 | @Resource |
| 37 | - private InboxService inboxService; | 37 | + private ImInboxService imInboxService; |
| 38 | 38 | ||
| 39 | @PostMapping("/create") | 39 | @PostMapping("/create") |
| 40 | @Operation(summary = "创建收件箱") | 40 | @Operation(summary = "创建收件箱") |
| 41 | @PreAuthorize("@ss.hasPermission('im:inbox:create')") | 41 | @PreAuthorize("@ss.hasPermission('im:inbox:create')") |
| 42 | - public CommonResult<Long> createInbox(@Valid @RequestBody InboxSaveReqVO createReqVO) { | ||
| 43 | - return success(inboxService.createInbox(createReqVO)); | 42 | + public CommonResult<Long> createInbox(@Valid @RequestBody ImInboxSaveReqVO createReqVO) { |
| 43 | + return success(imInboxService.createInbox(createReqVO)); | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | @PutMapping("/update") | 46 | @PutMapping("/update") |
| 47 | @Operation(summary = "更新收件箱") | 47 | @Operation(summary = "更新收件箱") |
| 48 | @PreAuthorize("@ss.hasPermission('im:inbox:update')") | 48 | @PreAuthorize("@ss.hasPermission('im:inbox:update')") |
| 49 | - public CommonResult<Boolean> updateInbox(@Valid @RequestBody InboxSaveReqVO updateReqVO) { | ||
| 50 | - inboxService.updateInbox(updateReqVO); | 49 | + public CommonResult<Boolean> updateInbox(@Valid @RequestBody ImInboxSaveReqVO updateReqVO) { |
| 50 | + imInboxService.updateInbox(updateReqVO); | ||
| 51 | return success(true); | 51 | return success(true); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -56,7 +56,7 @@ public class InboxController { | @@ -56,7 +56,7 @@ public class InboxController { | ||
| 56 | @Parameter(name = "id", description = "编号", required = true) | 56 | @Parameter(name = "id", description = "编号", required = true) |
| 57 | @PreAuthorize("@ss.hasPermission('im:inbox:delete')") | 57 | @PreAuthorize("@ss.hasPermission('im:inbox:delete')") |
| 58 | public CommonResult<Boolean> deleteInbox(@RequestParam("id") Long id) { | 58 | public CommonResult<Boolean> deleteInbox(@RequestParam("id") Long id) { |
| 59 | - inboxService.deleteInbox(id); | 59 | + imInboxService.deleteInbox(id); |
| 60 | return success(true); | 60 | return success(true); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| @@ -64,30 +64,30 @@ public class InboxController { | @@ -64,30 +64,30 @@ public class InboxController { | ||
| 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:inbox:query')") | 66 | @PreAuthorize("@ss.hasPermission('im:inbox:query')") |
| 67 | - public CommonResult<InboxRespVO> getInbox(@RequestParam("id") Long id) { | ||
| 68 | - ImInboxDO inbox = inboxService.getInbox(id); | ||
| 69 | - return success(BeanUtils.toBean(inbox, InboxRespVO.class)); | 67 | + public CommonResult<ImInboxRespVO> getInbox(@RequestParam("id") Long id) { |
| 68 | + ImInboxDO inbox = imInboxService.getInbox(id); | ||
| 69 | + return success(BeanUtils.toBean(inbox, ImInboxRespVO.class)); | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @GetMapping("/page") | 72 | @GetMapping("/page") |
| 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) { | ||
| 76 | - PageResult<ImInboxDO> pageResult = inboxService.getInboxPage(pageReqVO); | ||
| 77 | - return success(BeanUtils.toBean(pageResult, InboxRespVO.class)); | 75 | + public CommonResult<PageResult<ImInboxRespVO>> getInboxPage(@Valid ImInboxPageReqVO pageReqVO) { |
| 76 | + PageResult<ImInboxDO> pageResult = imInboxService.getInboxPage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, ImInboxRespVO.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:inbox:export')") | 82 | @PreAuthorize("@ss.hasPermission('im:inbox:export')") |
| 83 | @OperateLog(type = EXPORT) | 83 | @OperateLog(type = EXPORT) |
| 84 | - public void exportInboxExcel(@Valid InboxPageReqVO pageReqVO, | 84 | + public void exportInboxExcel(@Valid ImInboxPageReqVO 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<ImInboxDO> list = inboxService.getInboxPage(pageReqVO).getList(); | 87 | + List<ImInboxDO> list = imInboxService.getInboxPage(pageReqVO).getList(); |
| 88 | // 导出 Excel | 88 | // 导出 Excel |
| 89 | - ExcelUtils.write(response, "收件箱.xls", "数据", InboxRespVO.class, | ||
| 90 | - BeanUtils.toBean(list, InboxRespVO.class)); | 89 | + ExcelUtils.write(response, "收件箱.xls", "数据", ImInboxRespVO.class, |
| 90 | + BeanUtils.toBean(list, ImInboxRespVO.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/inbox/vo/InboxPageReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/vo/ImInboxPageReqVO.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 InboxPageReqVO extends PageParam { | 18 | +public class ImInboxPageReqVO extends PageParam { |
| 19 | 19 | ||
| 20 | @Schema(description = "用户编号", example = "3979") | 20 | @Schema(description = "用户编号", example = "3979") |
| 21 | private Long userId; | 21 | private Long userId; |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/vo/InboxRespVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/vo/ImInboxRespVO.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 InboxRespVO { | 13 | +public class ImInboxRespVO { |
| 14 | 14 | ||
| 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18389") | 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18389") |
| 16 | @ExcelProperty("编号") | 16 | @ExcelProperty("编号") |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/vo/InboxSaveReqVO.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/inbox/vo/ImInboxSaveReqVO.java
| @@ -2,11 +2,15 @@ package cn.iocoder.yudao.module.im.controller.admin.inbox.vo; | @@ -2,11 +2,15 @@ package cn.iocoder.yudao.module.im.controller.admin.inbox.vo; | ||
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import jakarta.validation.constraints.NotNull; | 4 | import jakarta.validation.constraints.NotNull; |
| 5 | +import lombok.AllArgsConstructor; | ||
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | +import lombok.NoArgsConstructor; | ||
| 6 | 8 | ||
| 7 | @Schema(description = "管理后台 - 收件箱新增/修改 Request VO") | 9 | @Schema(description = "管理后台 - 收件箱新增/修改 Request VO") |
| 8 | @Data | 10 | @Data |
| 9 | -public class InboxSaveReqVO { | 11 | +@AllArgsConstructor |
| 12 | +@NoArgsConstructor | ||
| 13 | +public class ImInboxSaveReqVO { | ||
| 10 | 14 | ||
| 11 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18389") | 15 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18389") |
| 12 | private Long id; | 16 | private Long id; |
| @@ -23,4 +27,10 @@ public class InboxSaveReqVO { | @@ -23,4 +27,10 @@ public class InboxSaveReqVO { | ||
| 23 | @NotNull(message = "序号,按照 user 递增不能为空") | 27 | @NotNull(message = "序号,按照 user 递增不能为空") |
| 24 | private Long sequence; | 28 | private Long sequence; |
| 25 | 29 | ||
| 30 | + public ImInboxSaveReqVO(Long userId, Long messageId, Long sequence) { | ||
| 31 | + this.userId = userId; | ||
| 32 | + this.messageId = messageId; | ||
| 33 | + this.sequence = sequence; | ||
| 34 | + } | ||
| 35 | + | ||
| 26 | } | 36 | } |
| 27 | \ No newline at end of file | 37 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/controller/admin/message/ImMessageController.java
| @@ -90,10 +90,4 @@ public class ImMessageController { | @@ -90,10 +90,4 @@ public class ImMessageController { | ||
| 90 | BeanUtils.toBean(list, ImMessageRespVO.class)); | 90 | BeanUtils.toBean(list, ImMessageRespVO.class)); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | - @PostMapping("/send") | ||
| 94 | - @Operation(summary = "发送私聊消息") | ||
| 95 | - public CommonResult<Long> sendMessage(@Valid @RequestBody ImMessageSaveReqVO imMessageSaveReqVO) { | ||
| 96 | - return success(imMessageService.sendPrivateMessage(imMessageSaveReqVO)); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | } | 93 | } |
| 100 | \ 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/dal/mysql/inbox/InboxMapper.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.im.dal.mysql.inbox; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.im.dal.mysql.inbox; | ||
| 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.inbox.vo.InboxPageReqVO; | 6 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxPageReqVO; |
| 7 | import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; | 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 | ||
| @@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper; | @@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 15 | @Mapper | 15 | @Mapper |
| 16 | public interface InboxMapper extends BaseMapperX<ImInboxDO> { | 16 | public interface InboxMapper extends BaseMapperX<ImInboxDO> { |
| 17 | 17 | ||
| 18 | - default PageResult<ImInboxDO> selectPage(InboxPageReqVO reqVO) { | 18 | + default PageResult<ImInboxDO> selectPage(ImInboxPageReqVO reqVO) { |
| 19 | return selectPage(reqVO, new LambdaQueryWrapperX<ImInboxDO>() | 19 | return selectPage(reqVO, new LambdaQueryWrapperX<ImInboxDO>() |
| 20 | .eqIfPresent(ImInboxDO::getUserId, reqVO.getUserId()) | 20 | .eqIfPresent(ImInboxDO::getUserId, reqVO.getUserId()) |
| 21 | .eqIfPresent(ImInboxDO::getMessageId, reqVO.getMessageId()) | 21 | .eqIfPresent(ImInboxDO::getMessageId, reqVO.getMessageId()) |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/redis/RedisKeyConstants.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.im.dal.redis; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * im Redis Key 枚举类 | ||
| 6 | + * | ||
| 7 | + * @author 芋道源码 | ||
| 8 | + */ | ||
| 9 | +public interface RedisKeyConstants { | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 收件箱序号生成器 | ||
| 13 | + * KEY 格式: im:inbox:sequence:{userId} | ||
| 14 | + * VALUE 数据类型: String | ||
| 15 | + */ | ||
| 16 | + String INBOX_SEQUENCE = "im_inbox_sequence:%s"; | ||
| 17 | +} |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/dal/redis/inbox/SequenceGeneratorRedisDao.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.im.dal.redis.inbox; | ||
| 2 | + | ||
| 3 | +import jakarta.annotation.Resource; | ||
| 4 | +import org.springframework.data.redis.core.RedisTemplate; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +import static cn.iocoder.yudao.module.im.dal.redis.RedisKeyConstants.INBOX_SEQUENCE; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 序号生成器 Redis DAO | ||
| 11 | + * | ||
| 12 | + * @author anhaohao | ||
| 13 | + */ | ||
| 14 | +@Repository | ||
| 15 | +public class SequenceGeneratorRedisDao { | ||
| 16 | + | ||
| 17 | + @Resource | ||
| 18 | + private RedisTemplate<String, Long> redisTemplate; | ||
| 19 | + | ||
| 20 | + private static String formatKey(Long userId) { | ||
| 21 | + return String.format(INBOX_SEQUENCE, userId); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public Long generateSequence(Long userId) { | ||
| 25 | + return redisTemplate.opsForValue().increment(formatKey(userId), 1); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | +} |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/conversation/ImConversationService.java
| @@ -51,4 +51,5 @@ public interface ImConversationService { | @@ -51,4 +51,5 @@ public interface ImConversationService { | ||
| 51 | */ | 51 | */ |
| 52 | PageResult<ImConversationDO> getConversationPage(ImConversationPageReqVO pageReqVO); | 52 | PageResult<ImConversationDO> getConversationPage(ImConversationPageReqVO pageReqVO); |
| 53 | 53 | ||
| 54 | + | ||
| 54 | } | 55 | } |
| 55 | \ No newline at end of file | 56 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/inbox/InboxService.java renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/inbox/ImInboxService.java
| 1 | package cn.iocoder.yudao.module.im.service.inbox; | 1 | package cn.iocoder.yudao.module.im.service.inbox; |
| 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.inbox.vo.InboxPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 4 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxPageReqVO; |
| 5 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; | 6 | import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; |
| 7 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ||
| @@ -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 InboxService { | 14 | +public interface ImInboxService { |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * 创建收件箱 | 17 | * 创建收件箱 |
| @@ -19,14 +19,14 @@ public interface InboxService { | @@ -19,14 +19,14 @@ public interface InboxService { | ||
| 19 | * @param createReqVO 创建信息 | 19 | * @param createReqVO 创建信息 |
| 20 | * @return 编号 | 20 | * @return 编号 |
| 21 | */ | 21 | */ |
| 22 | - Long createInbox(@Valid InboxSaveReqVO createReqVO); | 22 | + Long createInbox(@Valid ImInboxSaveReqVO createReqVO); |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 更新收件箱 | 25 | * 更新收件箱 |
| 26 | * | 26 | * |
| 27 | * @param updateReqVO 更新信息 | 27 | * @param updateReqVO 更新信息 |
| 28 | */ | 28 | */ |
| 29 | - void updateInbox(@Valid InboxSaveReqVO updateReqVO); | 29 | + void updateInbox(@Valid ImInboxSaveReqVO updateReqVO); |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 删除收件箱 | 32 | * 删除收件箱 |
| @@ -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<ImInboxDO> getInboxPage(InboxPageReqVO pageReqVO); | 52 | + PageResult<ImInboxDO> getInboxPage(ImInboxPageReqVO 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 renamed to yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/inbox/ImInboxServiceImpl.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.im.service.inbox; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.im.service.inbox; | ||
| 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.inbox.vo.InboxPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.InboxSaveReqVO; | 5 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxPageReqVO; |
| 6 | +import cn.iocoder.yudao.module.im.controller.admin.inbox.vo.ImInboxSaveReqVO; | ||
| 7 | import cn.iocoder.yudao.module.im.dal.dataobject.inbox.ImInboxDO; | 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; |
| @@ -20,13 +20,13 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.INBOX_NOT_EXIS | @@ -20,13 +20,13 @@ import static cn.iocoder.yudao.module.im.enums.ErrorCodeConstants.INBOX_NOT_EXIS | ||
| 20 | */ | 20 | */ |
| 21 | @Service | 21 | @Service |
| 22 | @Validated | 22 | @Validated |
| 23 | -public class InboxServiceImpl implements InboxService { | 23 | +public class ImInboxServiceImpl implements ImInboxService { |
| 24 | 24 | ||
| 25 | @Resource | 25 | @Resource |
| 26 | private InboxMapper inboxMapper; | 26 | private InboxMapper inboxMapper; |
| 27 | 27 | ||
| 28 | @Override | 28 | @Override |
| 29 | - public Long createInbox(InboxSaveReqVO createReqVO) { | 29 | + public Long createInbox(ImInboxSaveReqVO createReqVO) { |
| 30 | // 插入 | 30 | // 插入 |
| 31 | ImInboxDO inbox = BeanUtils.toBean(createReqVO, ImInboxDO.class); | 31 | ImInboxDO inbox = BeanUtils.toBean(createReqVO, ImInboxDO.class); |
| 32 | inboxMapper.insert(inbox); | 32 | inboxMapper.insert(inbox); |
| @@ -35,7 +35,7 @@ public class InboxServiceImpl implements InboxService { | @@ -35,7 +35,7 @@ public class InboxServiceImpl implements InboxService { | ||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | - public void updateInbox(InboxSaveReqVO updateReqVO) { | 38 | + public void updateInbox(ImInboxSaveReqVO updateReqVO) { |
| 39 | // 校验存在 | 39 | // 校验存在 |
| 40 | validateInboxExists(updateReqVO.getId()); | 40 | validateInboxExists(updateReqVO.getId()); |
| 41 | // 更新 | 41 | // 更新 |
| @@ -63,7 +63,7 @@ public class InboxServiceImpl implements InboxService { | @@ -63,7 +63,7 @@ public class InboxServiceImpl implements InboxService { | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @Override | 65 | @Override |
| 66 | - public PageResult<ImInboxDO> getInboxPage(InboxPageReqVO pageReqVO) { | 66 | + public PageResult<ImInboxDO> getInboxPage(ImInboxPageReqVO 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/ImMessageService.java
| @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; | 4 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO; |
| 5 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | 5 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; |
| 6 | import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | 6 | import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; |
| 7 | +import cn.iocoder.yudao.module.im.websocket.message.ImSendMessage; | ||
| 7 | import jakarta.validation.Valid; | 8 | import jakarta.validation.Valid; |
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| @@ -51,10 +52,13 @@ public interface ImMessageService { | @@ -51,10 +52,13 @@ public interface ImMessageService { | ||
| 51 | */ | 52 | */ |
| 52 | PageResult<ImMessageDO> getMessagePage(ImMessagePageReqVO pageReqVO); | 53 | PageResult<ImMessageDO> getMessagePage(ImMessagePageReqVO pageReqVO); |
| 53 | 54 | ||
| 55 | + | ||
| 54 | /** | 56 | /** |
| 55 | - * 发送私聊消息 | ||
| 56 | - * @param imMessageSaveReqVO 消息信息 | ||
| 57 | - * @return 消息编号 | 57 | + * 保存私聊消息 |
| 58 | + * | ||
| 59 | + * @param imSendMessage 消息信息 | ||
| 60 | + * @param fromUserId 发送人编号 | ||
| 61 | + * @return id | ||
| 58 | */ | 62 | */ |
| 59 | - Long sendPrivateMessage(ImMessageSaveReqVO imMessageSaveReqVO); | 63 | + Long savePrivateMessage(ImSendMessage imSendMessage, Long fromUserId); |
| 60 | } | 64 | } |
| 61 | \ No newline at end of file | 65 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/service/message/ImMessageServiceImpl.java
| @@ -6,6 +6,9 @@ import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO | @@ -6,6 +6,9 @@ import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessagePageReqVO | ||
| 6 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; | 6 | import cn.iocoder.yudao.module.im.controller.admin.message.vo.ImMessageSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; | 7 | import cn.iocoder.yudao.module.im.dal.dataobject.message.ImMessageDO; |
| 8 | import cn.iocoder.yudao.module.im.dal.mysql.message.ImMessageMapper; | 8 | import cn.iocoder.yudao.module.im.dal.mysql.message.ImMessageMapper; |
| 9 | +import cn.iocoder.yudao.module.im.websocket.message.ImSendMessage; | ||
| 10 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 11 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 9 | import jakarta.annotation.Resource; | 12 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| @@ -24,6 +27,8 @@ public class ImMessageServiceImpl implements ImMessageService { | @@ -24,6 +27,8 @@ public class ImMessageServiceImpl implements ImMessageService { | ||
| 24 | 27 | ||
| 25 | @Resource | 28 | @Resource |
| 26 | private ImMessageMapper imMessageMapper; | 29 | private ImMessageMapper imMessageMapper; |
| 30 | + @Resource | ||
| 31 | + private AdminUserApi adminUserApi; | ||
| 27 | 32 | ||
| 28 | @Override | 33 | @Override |
| 29 | public Long createMessage(ImMessageSaveReqVO createReqVO) { | 34 | public Long createMessage(ImMessageSaveReqVO createReqVO) { |
| @@ -67,9 +72,24 @@ public class ImMessageServiceImpl implements ImMessageService { | @@ -67,9 +72,24 @@ public class ImMessageServiceImpl implements ImMessageService { | ||
| 67 | return imMessageMapper.selectPage(pageReqVO); | 72 | return imMessageMapper.selectPage(pageReqVO); |
| 68 | } | 73 | } |
| 69 | 74 | ||
| 75 | + | ||
| 70 | @Override | 76 | @Override |
| 71 | - public Long sendPrivateMessage(ImMessageSaveReqVO imMessageSaveReqVO) { | ||
| 72 | - return 0L; | 77 | + public Long savePrivateMessage(ImSendMessage message, Long fromUserId) { |
| 78 | + ImMessageSaveReqVO imMessageSaveReqVO = new ImMessageSaveReqVO(); | ||
| 79 | + imMessageSaveReqVO.setClientMessageId(message.getClientMessageId()); | ||
| 80 | + imMessageSaveReqVO.setSenderId(fromUserId); | ||
| 81 | + imMessageSaveReqVO.setReceiverId(message.getReceiverId()); | ||
| 82 | + //查询发送人昵称和发送人头像 | ||
| 83 | + AdminUserRespDTO user = adminUserApi.getUser(fromUserId); | ||
| 84 | + imMessageSaveReqVO.setSenderNickname(user.getNickname()); | ||
| 85 | + imMessageSaveReqVO.setSenderAvatar(user.getAvatar()); | ||
| 86 | + imMessageSaveReqVO.setConversationType(message.getConversationType()); | ||
| 87 | + imMessageSaveReqVO.setContentType(message.getContentType()); | ||
| 88 | + imMessageSaveReqVO.setConversationNo("1"); | ||
| 89 | + imMessageSaveReqVO.setContent(message.getContent()); | ||
| 90 | + //消息来源 100-用户发送;200-系统发送(一般是通知);不能为空 | ||
| 91 | + imMessageSaveReqVO.setSendFrom(100); | ||
| 92 | + return createMessage(imMessageSaveReqVO); | ||
| 73 | } | 93 | } |
| 74 | 94 | ||
| 75 | } | 95 | } |
| 76 | \ No newline at end of file | 96 | \ No newline at end of file |
yudao-module-im/yudao-module-im-biz/src/main/java/cn/iocoder/yudao/module/im/websocket/ImWebSocketMessageListener.java
| @@ -4,15 +4,14 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | @@ -4,15 +4,14 @@ 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.controller.admin.inbox.vo.ImInboxSaveReqVO; |
| 8 | +import cn.iocoder.yudao.module.im.dal.redis.inbox.SequenceGeneratorRedisDao; | ||
| 9 | 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; | 10 | import cn.iocoder.yudao.module.im.service.conversation.ImConversationService; |
| 11 | +import cn.iocoder.yudao.module.im.service.inbox.ImInboxService; | ||
| 11 | import cn.iocoder.yudao.module.im.service.message.ImMessageService; | 12 | import cn.iocoder.yudao.module.im.service.message.ImMessageService; |
| 12 | import cn.iocoder.yudao.module.im.websocket.message.ImReceiveMessage; | 13 | import cn.iocoder.yudao.module.im.websocket.message.ImReceiveMessage; |
| 13 | import cn.iocoder.yudao.module.im.websocket.message.ImSendMessage; | 14 | 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; | ||
| 16 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| 17 | import org.springframework.stereotype.Component; | 16 | import org.springframework.stereotype.Component; |
| 18 | import org.springframework.web.socket.WebSocketSession; | 17 | import org.springframework.web.socket.WebSocketSession; |
| @@ -30,54 +29,23 @@ public class ImWebSocketMessageListener implements WebSocketMessageListener<ImSe | @@ -30,54 +29,23 @@ public class ImWebSocketMessageListener implements WebSocketMessageListener<ImSe | ||
| 30 | @Resource | 29 | @Resource |
| 31 | private ImMessageService imMessageService; | 30 | private ImMessageService imMessageService; |
| 32 | @Resource | 31 | @Resource |
| 33 | - private AdminUserApi adminUserApi; | ||
| 34 | - @Resource | ||
| 35 | private ImConversationService imConversationService; | 32 | private ImConversationService imConversationService; |
| 33 | + @Resource | ||
| 34 | + private ImInboxService imInboxService; | ||
| 35 | + @Resource | ||
| 36 | + private SequenceGeneratorRedisDao sequenceGeneratorRedisDao; | ||
| 36 | 37 | ||
| 37 | @Override | 38 | @Override |
| 38 | public void onMessage(WebSocketSession session, ImSendMessage message) { | 39 | public void onMessage(WebSocketSession session, ImSendMessage message) { |
| 39 | Long fromUserId = WebSocketFrameworkUtils.getLoginUserId(session); | 40 | Long fromUserId = WebSocketFrameworkUtils.getLoginUserId(session); |
| 40 | //1、插入消息表 | 41 | //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 | - | 42 | + Long messageId = imMessageService.savePrivateMessage(message, fromUserId); |
| 57 | 43 | ||
| 58 | // 私聊 | 44 | // 私聊 |
| 59 | if (message.getConversationType().equals(ImConversationTypeEnum.PRIVATE.getType())) { | 45 | if (message.getConversationType().equals(ImConversationTypeEnum.PRIVATE.getType())) { |
| 60 | //2、插入收件箱表(私聊:两条,群聊:每个群有一条) | 46 | //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 | - | 47 | + imInboxService.createInbox(new ImInboxSaveReqVO(message.getReceiverId(), messageId, sequenceGeneratorRedisDao.generateSequence(message.getReceiverId()))); |
| 48 | + imInboxService.createInbox(new ImInboxSaveReqVO(fromUserId, messageId, sequenceGeneratorRedisDao.generateSequence(fromUserId))); | ||
| 81 | 49 | ||
| 82 | //3、推送消息 | 50 | //3、推送消息 |
| 83 | ImReceiveMessage toMessage = new ImReceiveMessage(); | 51 | ImReceiveMessage toMessage = new ImReceiveMessage(); |
yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/inbox/InboxServiceImplTest.java renamed to yudao-module-im/yudao-module-im-biz/src/test/java/cn/iocoder/yudao/module/im/service/inbox/ImInboxServiceImplTest.java
| @@ -22,15 +22,15 @@ import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | @@ -22,15 +22,15 @@ import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; | ||
| 22 | import static org.junit.jupiter.api.Assertions.*; | 22 | import static org.junit.jupiter.api.Assertions.*; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | - * {@link InboxServiceImpl} 的单元测试类 | 25 | + * {@link ImInboxServiceImpl} 的单元测试类 |
| 26 | * | 26 | * |
| 27 | * @author 芋道源码 | 27 | * @author 芋道源码 |
| 28 | */ | 28 | */ |
| 29 | -@Import(InboxServiceImpl.class) | ||
| 30 | -public class InboxServiceImplTest extends BaseDbUnitTest { | 29 | +@Import(ImInboxServiceImpl.class) |
| 30 | +public class ImInboxServiceImplTest extends BaseDbUnitTest { | ||
| 31 | 31 | ||
| 32 | @Resource | 32 | @Resource |
| 33 | - private InboxServiceImpl inboxService; | 33 | + private ImInboxServiceImpl inboxService; |
| 34 | 34 | ||
| 35 | @Resource | 35 | @Resource |
| 36 | private InboxMapper inboxMapper; | 36 | private InboxMapper inboxMapper; |
| @@ -38,7 +38,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -38,7 +38,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 38 | @Test | 38 | @Test |
| 39 | public void testCreateInbox_success() { | 39 | public void testCreateInbox_success() { |
| 40 | // 准备参数 | 40 | // 准备参数 |
| 41 | - InboxSaveReqVO createReqVO = randomPojo(InboxSaveReqVO.class).setId(null); | 41 | + ImInboxSaveReqVO createReqVO = randomPojo(ImInboxSaveReqVO.class).setId(null); |
| 42 | 42 | ||
| 43 | // 调用 | 43 | // 调用 |
| 44 | Long inboxId = inboxService.createInbox(createReqVO); | 44 | Long inboxId = inboxService.createInbox(createReqVO); |
| @@ -55,7 +55,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -55,7 +55,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 55 | ImInboxDO dbInbox = randomPojo(ImInboxDO.class); | 55 | ImInboxDO dbInbox = randomPojo(ImInboxDO.class); |
| 56 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 | 56 | inboxMapper.insert(dbInbox);// @Sql: 先插入出一条存在的数据 |
| 57 | // 准备参数 | 57 | // 准备参数 |
| 58 | - InboxSaveReqVO updateReqVO = randomPojo(InboxSaveReqVO.class, o -> { | 58 | + ImInboxSaveReqVO updateReqVO = randomPojo(ImInboxSaveReqVO.class, o -> { |
| 59 | o.setId(dbInbox.getId()); // 设置更新的 ID | 59 | o.setId(dbInbox.getId()); // 设置更新的 ID |
| 60 | }); | 60 | }); |
| 61 | 61 | ||
| @@ -69,7 +69,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -69,7 +69,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 69 | @Test | 69 | @Test |
| 70 | public void testUpdateInbox_notExists() { | 70 | public void testUpdateInbox_notExists() { |
| 71 | // 准备参数 | 71 | // 准备参数 |
| 72 | - InboxSaveReqVO updateReqVO = randomPojo(InboxSaveReqVO.class); | 72 | + ImInboxSaveReqVO updateReqVO = randomPojo(ImInboxSaveReqVO.class); |
| 73 | 73 | ||
| 74 | // 调用, 并断言异常 | 74 | // 调用, 并断言异常 |
| 75 | assertServiceException(() -> inboxService.updateInbox(updateReqVO), INBOX_NOT_EXISTS); | 75 | assertServiceException(() -> inboxService.updateInbox(updateReqVO), INBOX_NOT_EXISTS); |
| @@ -118,7 +118,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | @@ -118,7 +118,7 @@ public class InboxServiceImplTest extends BaseDbUnitTest { | ||
| 118 | // 测试 createTime 不匹配 | 118 | // 测试 createTime 不匹配 |
| 119 | inboxMapper.insert(cloneIgnoreId(dbInbox, o -> o.setCreateTime(null))); | 119 | inboxMapper.insert(cloneIgnoreId(dbInbox, o -> o.setCreateTime(null))); |
| 120 | // 准备参数 | 120 | // 准备参数 |
| 121 | - InboxPageReqVO reqVO = new InboxPageReqVO(); | 121 | + ImInboxPageReqVO reqVO = new ImInboxPageReqVO(); |
| 122 | reqVO.setUserId(null); | 122 | reqVO.setUserId(null); |
| 123 | reqVO.setMessageId(null); | 123 | reqVO.setMessageId(null); |
| 124 | reqVO.setSequence(null); | 124 | reqVO.setSequence(null); |