feat:feature-REQ/2129 增加参数校验

This commit is contained in:
lilong 2024-03-28 11:08:50 +08:00
parent 8631568215
commit e79aaedac6
4 changed files with 14 additions and 22 deletions

View File

@ -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<ReceivePerson> 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端
* 工人端企业端服务器
* CMCMPSYSTEM
*
* @See cn.axzo.im.center.common.enums.AppTypeEnum
*/
private AppTypeEnum appType;
/**
* im账号可以personId和imAccount二选一
*/
@NotBlank(message = "imAccount不能为空")
private String imAccount;
}
}

View File

@ -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<ReceivePerson> 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;
}
}

View File

@ -157,6 +157,10 @@ public class RobotInfoService {
List<String> robotIds = resolveRobotIds(robotInfoQuery);
if (StringUtils.isNotBlank(robotInfoQuery.getMsgTemplateCode()) && CollectionUtils.isEmpty(robotIds)) {
return PageResp.zero(robotInfoQuery.getPage(), robotInfoQuery.getPageSize());
}
IPage<RobotInfo> robotInfoPage = robotInfoDao.queryRobotInfoOfPage(robotInfoQuery, robotIds);
List<RobotInfoResp> robotInfoRespList = BeanMapper.copyList(robotInfoPage.getRecords(), RobotInfoResp.class);
PageResp<RobotInfoResp> pageOfRobotInfoResp = PageResp.list(robotInfoPage.getCurrent(), robotInfoPage.getSize(),

View File

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