// If the status is 1, the time will be recorded and stored in the database, MySQL database
if (status == 1) {
long start = System.currentTimeMillis();
} else if (status != 1) {
// 具体的实现逻辑
// If the status is 0, the recording time is stopped and the start time and stop time are intercepted into the database
// long end = System.currentTimeMillis();
// 具体的实现逻辑
}
// 数据保存到数据库中
data.setStVal(Integer.valueOf(status));
data.setUpdateTime(new Date());
iec61850DataService.updateById(data);
问题描述
这个需求是需要对一个程序进行的状态进行判定,如果状态为1,就进行计时,格式为:记录时间 2020-11-09 17:25:21,如果状态为0,则停止计时,请各位大佬帮忙想想办法,谢谢
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…