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';