初始版本
This commit is contained in:
136
src/main/java/com/vverp/entity/AttachFile.java
Normal file
136
src/main/java/com/vverp/entity/AttachFile.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.vverp.entity;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.vverp.annotation.Module;
|
||||
import com.vverp.enums.OrderAttachFileType;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "seq_attach_file")
|
||||
@Module(generate = false)
|
||||
public class AttachFile extends BaseEntity<Long> {
|
||||
|
||||
private String name;
|
||||
|
||||
private Long size;
|
||||
|
||||
private Date date;
|
||||
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 合同附件类型
|
||||
*/
|
||||
private OrderAttachFileType orderAttachFileType;
|
||||
|
||||
public AttachFile() {
|
||||
}
|
||||
|
||||
public AttachFile(String name,
|
||||
Long size,
|
||||
Date date,
|
||||
String path) {
|
||||
this.name = name;
|
||||
this.size = size;
|
||||
this.date = date;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
private Long progressId;
|
||||
|
||||
public enum Type{
|
||||
supplier("供应商"),
|
||||
payment("支付记录"),
|
||||
purchaseOrder("采购合同"),
|
||||
other("其他");
|
||||
Type(String message){
|
||||
this.message= message;
|
||||
}
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
public Type type;
|
||||
|
||||
public Long getProgressId() {
|
||||
return progressId;
|
||||
}
|
||||
|
||||
public void setProgressId(Long progressId) {
|
||||
this.progressId = progressId;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public OrderAttachFileType getOrderAttachFileType() {
|
||||
return orderAttachFileType != null ? orderAttachFileType : OrderAttachFileType.normal;
|
||||
}
|
||||
|
||||
public void setOrderAttachFileType(OrderAttachFileType orderAttachFileType) {
|
||||
this.orderAttachFileType = orderAttachFileType;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public String getFormatSize() {
|
||||
if (size >= 1024 * 1024) {
|
||||
return String.format("%.2fMB", (double) size / 1024 / 1024);
|
||||
} else {
|
||||
return String.format("%.2fKB", (double) size / 1024);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user