yangys
2025-08-16 9c483e9be881783af14ad68906e78ee557005eb4
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
package org.springblade.mdm.gkw.programnode.entity;
 
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BizEntity;
 
import java.util.Date;
 
/**
 * 机床文件
 */
@Setter
@Getter
@TableName("mdm_machine_file")
public class MachineFile extends BizEntity {
    /**
     * 正常状态,刚接收
     */
    public static final int STATUS_NORMAL = 1;
    /**
     * 用户接收了
     */
    public static final int STATUS_ACCEPTED = 2;
    /**
     * 用户拒绝接收
     */
    public static final int STATUS_REJECTED = 3;
    /**
     * 文件被清除(被定时任务标记)
     */
    public static final int STATUS_REMOVED = 4;
    /**
     * 节点类型: REC目录
     */
    public static final String DIR_TYPE_REC = "REC";
    /**
     * send目录
     */
    public static final String DIR_TYPE_SEND = "SEND";
 
    /**
     * temp目录
     */
    public static final String DIR_TYPE_TEMP = "TEMP";
 
    /**
     * 文件名
     */
    private String name;
 
 
    /**
     * 节点类型:字典
      */
    //private String nodeType;
 
    /**
     * 所属机床
     */
    private String machineCode;
    /**
     * 目录类型 SEND/REC/TEMP
     */
    private String dirType;
 
    /**
     * 文件创建时间
     */
    private Date fileCreateTime;
 
    private Date fileModifyTime;
 
    /**
     * 文件md5
     */
    private String md5;
    /**
     * 文件字节数
     */
    private Long fileSize;
 
    /**
     * 确认时间,接受或者拒绝的时间
     */
    private Date determineTime;
    /**
     * 生成文件大小的显示文本
     * @return 显示文本
     */
    public String getFileSizeDisplay(){
        String disp = FileUtils.byteCountToDisplaySize(fileSize);
        //disp = StringUtils.replace(disp,"bytes","字节");
        return disp;
    }
 
    /**
     * 标记文件已经删除
     */
    public void markFileDeleted() {
        this.setStatus(STATUS_REMOVED);
    }
 
    /**
     * 接收文件
     */
    public void accept() {
        setStatus(STATUS_ACCEPTED);
        this.determineTime = new Date();
    }
 
    public void reject() {
        setStatus(STATUS_REJECTED);
        this.determineTime = new Date();
    }
}