package cn.iocoder.yudao.module.wxcp.enums.activity;
|
|
import cn.hutool.core.util.ArrayUtil;
|
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
import java.util.Arrays;
|
|
/**
|
* 企业微信活动模板类型
|
*
|
* 不同模板决定:表单需要填哪些字段、推送时发什么形态的消息、是否需要报名页。
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum WxCpActivityTypeEnum implements ArrayValuable<Integer> {
|
|
TEXT(1, "纯通知", "只推送一条纯文本消息,不展示报名表单"),
|
MESSAGE(2, "单条消息", "推送一张可点击的卡片消息,点击打开活动详情页"),
|
IMAGE(3, "图片通知", "上传图片后推送图片消息,可附带文字说明"),
|
FILE(4, "附件通知", "上传文件后推送文件消息,接收人可直接下载查看"),
|
FORM(5, "数据采集/评价", "推送卡片到采集页,成员填写自定义字段并可提交评价"),
|
;
|
|
public static final Integer[] ARRAYS = Arrays.stream(values())
|
.map(WxCpActivityTypeEnum::getType).toArray(Integer[]::new);
|
|
private final Integer type;
|
private final String name;
|
/**
|
* 模板说明,前端选择模板时展示
|
*/
|
private final String description;
|
|
@Override
|
public Integer[] array() {
|
return ARRAYS;
|
}
|
|
public static WxCpActivityTypeEnum valueOf(Integer type) {
|
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());
|
}
|
|
/**
|
* 是否需要展示报名/采集表单
|
*/
|
public static boolean needSignup(Integer type) {
|
return FORM.getType().equals(type);
|
}
|
|
}
|