zxl
2026-03-25 8819762ad58f77e606431fca4072c19e542e6055
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
package com.tievd.jyz.entity;
 
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
 
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.format.DateTimeFormatter;
import java.util.Date;
 
/**
 * <p>
 * 车流量表
 * </p>
 *
 * @author
 * @since 2023-02-24
 */
@Data
@Accessors(chain = true)
@TableName("t_traffic_flow")
@Schema(name = "TrafficFlow", description = "车流量表")
public class TrafficFlow extends Model<TrafficFlow> {
 
    private static final long serialVersionUID = 1L;
 
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
 
    @Schema(description = "汽车数量")
    @TableField(value = "car_count", update = "%s + #{param1.carCount}")
    private Integer carCount;
    
    @Schema(description = "车型")
    @TableField("model_code")
    private String modelCode;
    
    @Schema(description = "视频设备code")
    @TableField("camera_code")
    private String cameraCode;
    
    @Schema(description = "设备id")
    @TableField("device_id")
    private Long deviceId;
    
    @Schema(description = "机构代码")
    @TableField("org_code")
    private String orgCode;
 
    @Schema(description = "创建时间")
    @TableField("create_time")
    private Date createTime;
 
    @Schema(description = "抓取时间")
    @TableField("capture_time")
    private Timestamp captureTime;
    
    @Schema(description = "抓取所在天yyyy-MM-dd")
    @TableField("capture_day")
    private String captureDay;
 
    @Override
    public Serializable pkVal() {
        return this.id;
    }
 
    public TrafficFlow(Integer carCount, String cameraCode, Long deviceId, String orgCode, Date createTime, Timestamp captureTime,String captureDay) {
        this.carCount = carCount;
        this.cameraCode = cameraCode;
        this.deviceId = deviceId;
        this.orgCode = orgCode;
        this.createTime = createTime;
        this.captureTime = captureTime;
        this.captureDay = captureDay;
    }
 
    public TrafficFlow() {
    }
    
    public TrafficFlow generateId() {
        assert orgCode!=null && modelCode != null;
        String date = captureTime.toLocalDateTime().format(DateTimeFormatter.ofPattern("YYMMddHH"));
        int hash = Math.abs((orgCode + modelCode).hashCode());
        id = Integer.valueOf(date + hash);
        return this;
    }
}