package com.jjt.calc.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jjt.common.annotation.Excel;
import com.jjt.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 印花机1小时统计数据对象 TWIN_CALC_HOUR_YHJ
 *
 * @author wukai
 * @date 2025-03-06
 */
@ApiModel(value = "TwinCalcHourYhj", description = "印花机1小时统计数据")
@Data
public class TwinCalcHourYhj extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @ApiModelProperty("ID")
    @TableId
    private Long id;

    /**
     * 日期
     */
    @ApiModelProperty("日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date dataDate;

    /**
     * 小时;0-23
     */
    @ApiModelProperty("小时;0-23")
    @Excel(name = "小时;0-23")
    private Integer hour;

    /**
     * 设备ID
     */
    @ApiModelProperty("设备ID")
    @Excel(name = "设备ID")
    private Integer deviceId;

    /**
     * 织造米数
     */
    @ApiModelProperty("织造米数")
    @Excel(name = "织造米数")
    private Integer length;

    /**
     * 版距
     */
    @ApiModelProperty("版距")
    @Excel(name = "版距")
    private Integer distance;
    @ApiModelProperty("班组")
    private String team;

    public void setTeam() {
        if (this.hour >= 7 && this.hour < 19) {
            //A班
            this.team = "A";
        } else {
            //B班
            this.team = "B";
        }
    }
}
