车辆实训记录 - Java 类实现
/**
-
车辆实训记录
-
@TableName car_real_record / @Data @ProtobufClass public class CarRealRecord implements Serializable { /*
- 车辆实训记录编号 */ private Long carRealRecordId;
/**
- 流动站编号(车-车牌/手动挡) */ private Long mobileDeviceId;
/**
- 上线日期(2023-08-30 10:00:00) */ private Date onlineDatetime;
/**
- 离线日期(2023-08-30 10:00:00) */ private Date offlineDatetime;
/**
- 时长(60分钟) */ private Integer totalTime;
/**
- 总观看人数 */ private Integer viewers;
/**
- 总点赞数 */ private Integer likes;
/**
- 训练场编号 */ private Long trainingGroundId;
/**
- 练车类型(手动挡/自动挡) */ private String drivingType;
/**
- 视频回放文件地址(文件夹)-D:\实训记录文件\流动站编号(车)\2023-08-31\车辆实训记录编号 */ private String videoPlaybackPath;
private static final long serialVersionUID = 1L;
private Timer timer;
// 当设备下线事件时候调用 public void startTimer() { // 写一个定时器,定时器设定10分钟倒计时 // 当设定的时间内设备没有再次上线即定时器时间到了,那么就触发真正的设备离线操作 // 调用--->保存直播间观看人数据和用户实训数据 try { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { Encryption.removeEncryptionCode(); } }, 600000); // 设置定时器时间为10分钟 } catch (Exception ignored) { } }
// 当设备上线事件时候调用 public void stopTimer() { // 停止当前设备的离线持续时间的倒计时 timer.cancel(); // 停止定时器 } }
原文地址: https://www.cveoy.top/t/topic/qDH3 著作权归作者所有。请勿转载和采集!