feat:feature-REQ/2129 增加参数校验
This commit is contained in:
parent
8631568215
commit
e79aaedac6
@ -8,6 +8,7 @@ import lombok.Data;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -35,6 +36,7 @@ public class SendMessageParam {
|
|||||||
* 消息接收用户信息
|
* 消息接收用户信息
|
||||||
*/
|
*/
|
||||||
@NotEmpty(message = "消息接收用户信息不能为空")
|
@NotEmpty(message = "消息接收用户信息不能为空")
|
||||||
|
@Valid
|
||||||
private List<ReceivePerson> receivePersons;
|
private List<ReceivePerson> receivePersons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,30 +101,10 @@ public class SendMessageParam {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public static class ReceivePerson {
|
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二选一
|
* im账号,可以personId和imAccount二选一
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "imAccount不能为空")
|
||||||
private String imAccount;
|
private String imAccount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,9 +6,12 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -21,6 +24,7 @@ public class SendTemplateMessageParam {
|
|||||||
* 消息接收用户信息
|
* 消息接收用户信息
|
||||||
*/
|
*/
|
||||||
@NotEmpty(message = "消息接收用户信息不能为空")
|
@NotEmpty(message = "消息接收用户信息不能为空")
|
||||||
|
@Valid
|
||||||
private List<ReceivePerson> receivePersons;
|
private List<ReceivePerson> receivePersons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,6 +70,7 @@ public class SendTemplateMessageParam {
|
|||||||
/**
|
/**
|
||||||
* 接收消息的personId
|
* 接收消息的personId
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "personId不能为空")
|
||||||
private String personId;
|
private String personId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,6 +86,7 @@ public class SendTemplateMessageParam {
|
|||||||
*
|
*
|
||||||
* @See cn.axzo.im.center.common.enums.AppTypeEnum
|
* @See cn.axzo.im.center.common.enums.AppTypeEnum
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "appType不能为空")
|
||||||
private AppTypeEnum appType;
|
private AppTypeEnum appType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,6 +157,10 @@ public class RobotInfoService {
|
|||||||
|
|
||||||
List<String> robotIds = resolveRobotIds(robotInfoQuery);
|
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);
|
IPage<RobotInfo> robotInfoPage = robotInfoDao.queryRobotInfoOfPage(robotInfoQuery, robotIds);
|
||||||
List<RobotInfoResp> robotInfoRespList = BeanMapper.copyList(robotInfoPage.getRecords(), RobotInfoResp.class);
|
List<RobotInfoResp> robotInfoRespList = BeanMapper.copyList(robotInfoPage.getRecords(), RobotInfoResp.class);
|
||||||
PageResp<RobotInfoResp> pageOfRobotInfoResp = PageResp.list(robotInfoPage.getCurrent(), robotInfoPage.getSize(),
|
PageResp<RobotInfoResp> pageOfRobotInfoResp = PageResp.list(robotInfoPage.getCurrent(), robotInfoPage.getSize(),
|
||||||
|
|||||||
@ -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 `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 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_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';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user