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 { //制定调整计划:设定月份、矿别、客户、产品、数量。不可以选择当月月份。 @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; } }