From e79aaedac6475e6916edf76f1e670fba78180d87 Mon Sep 17 00:00:00 2001 From: lilong Date: Thu, 28 Mar 2024 11:08:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:feature-REQ/2129=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../center/api/vo/req/SendMessageParam.java | 24 +++---------------- .../api/vo/req/SendTemplateMessageParam.java | 6 +++++ .../cn/axzo/im/service/RobotInfoService.java | 4 ++++ sql/init.sql | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendMessageParam.java b/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendMessageParam.java index 5a103c2..1b5e347 100644 --- a/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendMessageParam.java +++ b/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendMessageParam.java @@ -8,6 +8,7 @@ import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; +import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.util.List; @@ -35,6 +36,7 @@ public class SendMessageParam { * 消息接收用户信息 */ @NotEmpty(message = "消息接收用户信息不能为空") + @Valid private List receivePersons; /** @@ -99,30 +101,10 @@ public class SendMessageParam { @AllArgsConstructor @NoArgsConstructor public static class ReceivePerson { - - /** - * 接收消息的personId - */ - private String personId; - - /** - * appType = AppTypeEnum.CMP时,因为网易云信无法对同一个账号做企业隔离,只能一个企业一个账号, - * 所以需要根据organizationalUnitId获取账号 - */ - private Long ouId; - - /** - * 发送消息到App端 - * 工人端、企业端、服务器 - * CM、CMP、SYSTEM - * - * @See cn.axzo.im.center.common.enums.AppTypeEnum - */ - private AppTypeEnum appType; - /** * im账号,可以personId和imAccount二选一 */ + @NotBlank(message = "imAccount不能为空") private String imAccount; } } diff --git a/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendTemplateMessageParam.java b/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendTemplateMessageParam.java index a2ecd7f..8bd1406 100644 --- a/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendTemplateMessageParam.java +++ b/im-center-api/src/main/java/cn/axzo/im/center/api/vo/req/SendTemplateMessageParam.java @@ -6,9 +6,12 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.NonNull; +import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; import java.util.List; @Data @@ -21,6 +24,7 @@ public class SendTemplateMessageParam { * 消息接收用户信息 */ @NotEmpty(message = "消息接收用户信息不能为空") + @Valid private List receivePersons; /** @@ -66,6 +70,7 @@ public class SendTemplateMessageParam { /** * 接收消息的personId */ + @NotBlank(message = "personId不能为空") private String personId; /** @@ -81,6 +86,7 @@ public class SendTemplateMessageParam { * * @See cn.axzo.im.center.common.enums.AppTypeEnum */ + @NotNull(message = "appType不能为空") private AppTypeEnum appType; } } diff --git a/im-center-server/src/main/java/cn/axzo/im/service/RobotInfoService.java b/im-center-server/src/main/java/cn/axzo/im/service/RobotInfoService.java index 4d566a1..87e02d3 100644 --- a/im-center-server/src/main/java/cn/axzo/im/service/RobotInfoService.java +++ b/im-center-server/src/main/java/cn/axzo/im/service/RobotInfoService.java @@ -157,6 +157,10 @@ public class RobotInfoService { List robotIds = resolveRobotIds(robotInfoQuery); + if (StringUtils.isNotBlank(robotInfoQuery.getMsgTemplateCode()) && CollectionUtils.isEmpty(robotIds)) { + return PageResp.zero(robotInfoQuery.getPage(), robotInfoQuery.getPageSize()); + } + IPage robotInfoPage = robotInfoDao.queryRobotInfoOfPage(robotInfoQuery, robotIds); List robotInfoRespList = BeanMapper.copyList(robotInfoPage.getRecords(), RobotInfoResp.class); PageResp pageOfRobotInfoResp = PageResp.list(robotInfoPage.getCurrent(), robotInfoPage.getSize(), diff --git a/sql/init.sql b/sql/init.sql index 4fba30c..7e875bd 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -130,6 +130,6 @@ ALTER TABLE im_message_history ADD COLUMN `result` varchar(1024) NULL COMMENT ' ALTER TABLE im_message_history ADD COLUMN `im_message_task_id` bigint NULL COMMENT '消息推送任务的id'; ALTER TABLE im_message_history ADD COLUMN status varchar(32) not null default 'PENDING' comment '消息状态:PENDING、SUCCEED、FAILED'; ALTER TABLE im_message_history ADD COLUMN receive_person_id varchar(100) not null default '' comment 'IM消息接收personId'; -ALTER TABLE im_message_history ADD COLUMN receive_ou_id bigint not null default 0 comment 'organizational_unit表的id'; +ALTER TABLE im_message_history ADD COLUMN receive_ou_id bigint comment 'organizational_unit表的id';