package com.zd.laboratory.onemachine.domain;

import cn.hutool.core.collection.CollUtil;
import com.zd.common.security.utils.DictUtils;
import com.zd.laboratory.domain.vo.LabViolationVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.List;

/**
 * @Author: zhoupan
 * @Date: 2021/09/15/13:58
 * @Description:
 */
@ApiModel("签到违规信息")
public class SingInViolation {

    /**
     * 违规内容
     */
    @ApiModelProperty("违规内容")
    private String violationContent;

    /**
     * 实验室名称
     */
    @ApiModelProperty("实验室名称")
    private String subjectName;

    /**
     * 违约时间
     */
    @ApiModelProperty("违约时间")
    private Date createTime;

    public SingInViolation(List<LabViolationVO> list) {

        if (CollUtil.isNotEmpty(list)) {
            LabViolationVO labViolationVO = list.get(0);
            this.initSingInViolation(labViolationVO);
        }


    }

    public void initSingInViolation(LabViolationVO labViolationVO) {
        if(labViolationVO.getViolationType()!=null)
        {
            String lab_violation_rules = DictUtils.getDictCacheLable("lab_violation_rules", labViolationVO.getViolationType().toString());
            this.violationContent = lab_violation_rules;
        }

        this.subjectName = labViolationVO.getSubjectName();
        this.createTime = labViolationVO.getCreateTime();
    }

    public String getViolationContent() {
        return violationContent;
    }


    public String getSubjectName() {
        return subjectName;
    }


    public Date getCreateTime() {
        return createTime;
    }

}
