/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.dm.service.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.security.core.userdetails.UserDetails;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://el-admin.vip
* @description /
* @author sunmz
* @date 2021-09-15
**/
@Entity
@Data
@Table(name="dm_service_pj")
public class DmServicePj implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)//设置自增
    private Integer id;

    @Column(name = "user_name")
    @ApiModelProperty(value = "评价用户")
    private String userName;

    @Column(name = "user_code")
    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @Column(name = "user_number")
    @ApiModelProperty(value = "用户工号")
    private String userNumber;

    @Column(name = "total_point")
    @ApiModelProperty(value = "综合评分")
    private String totalPoint;

    @Column(name = "pj_time")
    @ApiModelProperty(value = "评价时间")
    private Timestamp pjTime;

    @Column(name = "wd_point")
    @ApiModelProperty(value = "味道")
    private Integer wdPoint;

    @Column(name = "pz_point")
    @ApiModelProperty(value = "品种")
    private Integer pzPoint;

    @Column(name = "fl_point")
    @ApiModelProperty(value = "分量")
    private Integer flPoint;

    @Column(name = "fwtd_point")
    @ApiModelProperty(value = "服务态度")
    private Integer fwtdPoint;

    @Column(name = "hjws_point")
    @ApiModelProperty(value = "环境卫生")
    private Integer hjwsPoint;

    @Column(name = "zhfw_point")
    @ApiModelProperty(value = "综合服务")
    private Integer zhfwPoint;

    @Column(name = "cxgj_point")
    @ApiModelProperty(value = "持续改进")
    private Integer cxgjPoint;

    @Column(name = "remark")
    @ApiModelProperty(value = "意见建议")
    private String remark;

    @Column(name = "enabled")
    @ApiModelProperty(value = "是否启用")
    private String enabled;

    public void copy(DmServicePj source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    @PrePersist
    public void prePersist() {
        this.pjTime = new Timestamp(new Date().getTime());
    }
}