zhangzeli
5 天以前 7a8a994feafb8ef8333a9590bd637630c42609d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package com.by4cloud.platform.processing.entity;
 
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.by4cloud.platform.common.data.mybatis.BaseModel;
import com.by4cloud.platform.yunxiao.entity.Coal;
import com.by4cloud.platform.yunxiao.entity.CoalFiled;
import com.by4cloud.platform.yunxiao.entity.Company;
import com.by4cloud.platform.yunxiao.entity.Customer;
import com.by4cloud.platform.yunxiao.utils.RedisCacheYunXiaoHelper;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import java.util.Date;
 
@Data
@TableName("plan")
@Entity
@javax.persistence.Table(name = "plan")
@org.hibernate.annotations.Table(appliesTo = "plan", comment = "计划表")
public class Plan extends BaseModel<Plan> {
    //制定调整计划:设定月份、矿别、客户、产品、数量。不可以选择当月月份。
    @ApiModelProperty(value = "发运矿别")
    @Column(columnDefinition = "int comment '发运矿别'")
    private Integer fyCompId;
 
    @ApiModelProperty(value = "月份")
    @Column(columnDefinition = "date comment '月份'")
    @JsonFormat(pattern = "yyyy-MM")
    private Date month;
 
    @ApiModelProperty(value = "关联客户id")
    @Column(columnDefinition = "int comment '关联客户id'")
    private Integer customerId;
 
    @ApiModelProperty(value = "关联客户id")
    @Column(columnDefinition = "int comment '关联客户id'")
    private Integer filedId;
 
    @ApiModelProperty(value = "关联收货客户id")
    @Column(columnDefinition = "int comment '关联收货客户id'")
    private Integer customerAddressId;
 
    @ApiModelProperty(value = "产品ID")
    @Column(columnDefinition = "int comment '产品ID'")
    private Integer coalId;
 
    @ApiModelProperty(value = "数量")
    @Column(columnDefinition = "double comment '数量'")
    private Double quantity;
 
    @ApiModelProperty(value = "生成状态 0 未生成 1生成中 2生成成功 3生成失败")
    @Column(columnDefinition = "TINYINT comment '生成状态 0 未生成 1生成中 2生成成功 3生成失败'")
    private Integer status;
 
    @ApiModelProperty(value = "成功/失败信息")
    @Column(columnDefinition = "text comment '成功/失败信息'")
    private String msg;
 
    @ApiModelProperty(value = "生成磅单ids")
    @Column(columnDefinition = "text comment '生成磅单ids'")
    private String pIds;
 
    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "关联煤种名称")
    private String coalName;
 
    public String getCoalName() {
        if (coalId != null) {
            Coal c = RedisCacheYunXiaoHelper.getInstance().getCoalById(coalId);
            if (c!=null){
                coalName = c.getCoalName();
            }
        }
        return coalName;
    }
 
    /**
     * 所属煤场名称
     */
    @Transient
    @TableField(exist = false)
    private String filedName;
 
    public String getFiledName(){
        CoalFiled coalFiled = RedisCacheYunXiaoHelper.getInstance().getCoalFiledById(filedId);
        if (coalFiled!=null){
            filedName = coalFiled.getName();
        }
        return filedName;
    }
 
    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "客户名称")
    private String customerName;
 
    public String getCustomerName() {
        if (customerId != null) {
            Customer customer = RedisCacheYunXiaoHelper.getInstance().getCustomerById(customerId);
            if (customer != null) {
                this.customerName = customer.getCustomerFullName();
            }
        }
        return customerName;
    }
 
    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "客户名称")
    private String customerAddressName;
 
    public String getCustomerAddressName() {
        if (customerAddressId != null) {
            Customer customer = RedisCacheYunXiaoHelper.getInstance().getCustomerById(customerAddressId);
            if (customer != null) {
                this.customerAddressName = customer.getCustomerFullName();
            }
        }
        return customerAddressName;
    }
 
    /**
     * 发运矿名
     */
    @Transient
    @TableField(exist = false)
    private String fyCompName;
 
    public String getFyCompName(){
        if (fyCompId==null)return null;
        Company company = RedisCacheYunXiaoHelper.getInstance().getCompanyByDeptId(fyCompId);
        if (company!=null) {
            fyCompName = company.getName();
            return fyCompName;
        }else
            return fyCompName;
    }
}