提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.controller.admin.socail.vo.client; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.StrUtil; |
|
4 |
import com.iailab.framework.common.enums.CommonStatusEnum; |
|
5 |
import com.iailab.framework.common.enums.UserTypeEnum; |
|
6 |
import com.iailab.framework.common.validation.InEnum; |
|
7 |
import com.iailab.module.system.enums.social.SocialTypeEnum; |
|
8 |
import com.fasterxml.jackson.annotation.JsonIgnore; |
|
9 |
import io.swagger.v3.oas.annotations.media.Schema; |
|
10 |
import lombok.Data; |
|
11 |
|
|
12 |
import javax.validation.constraints.AssertTrue; |
|
13 |
import javax.validation.constraints.NotNull; |
|
14 |
import java.util.Objects; |
|
15 |
|
|
16 |
@Schema(description = "管理后台 - 社交客户端创建/修改 Request VO") |
|
17 |
@Data |
|
18 |
public class SocialClientSaveReqVO { |
|
19 |
|
|
20 |
@Schema(description = "编号", example = "27162") |
|
21 |
private Long id; |
|
22 |
|
|
23 |
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "iailab商城") |
|
24 |
@NotNull(message = "应用名不能为空") |
|
25 |
private String name; |
|
26 |
|
|
27 |
@Schema(description = "社交平台的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "31") |
|
28 |
@NotNull(message = "社交平台的类型不能为空") |
|
29 |
@InEnum(SocialTypeEnum.class) |
|
30 |
private Integer socialType; |
|
31 |
|
|
32 |
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
|
33 |
@NotNull(message = "用户类型不能为空") |
|
34 |
@InEnum(UserTypeEnum.class) |
|
35 |
private Integer userType; |
|
36 |
|
|
37 |
@Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "wwd411c69a39ad2e54") |
|
38 |
@NotNull(message = "客户端编号不能为空") |
|
39 |
private String clientId; |
|
40 |
|
|
41 |
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "peter") |
|
42 |
@NotNull(message = "客户端密钥不能为空") |
|
43 |
private String clientSecret; |
|
44 |
|
|
45 |
@Schema(description = "授权方的网页应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045") |
|
46 |
private String agentId; |
|
47 |
|
|
48 |
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
|
49 |
@NotNull(message = "状态不能为空") |
|
50 |
@InEnum(CommonStatusEnum.class) |
|
51 |
private Integer status; |
|
52 |
|
|
53 |
@AssertTrue(message = "agentId 不能为空") |
|
54 |
@JsonIgnore |
|
55 |
public boolean isAgentIdValid() { |
|
56 |
// 如果是企业微信,必须填写 agentId 属性 |
|
57 |
return !Objects.equals(socialType, SocialTypeEnum.WECHAT_ENTERPRISE.getType()) |
|
58 |
|| !StrUtil.isEmpty(agentId); |
|
59 |
} |
|
60 |
|
|
61 |
} |