FollowAttachmentDTO.java 1.73 KB
package cn.fw.valhalla.domain.dto;

import cn.fw.common.validator.EnumValue;
import cn.fw.valhalla.domain.enums.AttTypeEnum;
import cn.fw.valhalla.domain.enums.FeedbackTypeEnum;
import cn.fw.valhalla.domain.enums.FollowTypeEnum;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * @author : kurisu
 * @className : FollowAttachmentDTO
 * @description : 跟进附件
 * @date: 2020-08-17 17:25
 */
@Data
@ToString
public class FollowAttachmentDTO {
    private Long id;
    /**
     * 跟进记录id
     */
    @NotNull(message = "跟进记录id不能为空")
    private Long recordId;
    /**
     * 附件类型
     */
    @EnumValue(enumClass = AttTypeEnum.class, message = "附件类型不正确")
    private Integer attType;
    /**
     * 跟进类型
     */
    @EnumValue(enumClass = FollowTypeEnum.class, message = "跟进类型不正确")
    private Integer followType;
    /**
     * 附件ids
     */
    @NotBlank(message = "附件不能为空")
    private String attachments;
    /**
     * 反馈类型
     */
    @EnumValue(enumClass = FeedbackTypeEnum.class, message = "反馈类型不正确")
    @NotNull(message = "反馈类型不能为空")
    private Integer feedbackType;
    /**
     * 描述
     */
    private String describes;

    public AttTypeEnum getAttTypeEnum() {
        return AttTypeEnum.ofValue(attType);
    }

    public FollowTypeEnum getFollowTypeEnum() {
        return FollowTypeEnum.ofValue(followType);
    }

    public FeedbackTypeEnum getFeedbackTypeEnum() {
        if (Objects.isNull(feedbackType)) {
            return null;
        }
        return FeedbackTypeEnum.ofValue(feedbackType);
    }
}