报告时间
This commit is contained in:
parent
7ba029b96d
commit
97662e56f3
|
@ -13,6 +13,11 @@ import java.math.BigDecimal;
|
|||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -414,16 +419,16 @@ public class JtlResolver {
|
|||
|
||||
String startTimeStamp = totalLineList.get(0).getTimestamp();
|
||||
String endTimeStamp = totalLineList.get(totalLineList.size()-1).getTimestamp();
|
||||
String startTime = stampToDate(startTimeStamp);
|
||||
String endTime = stampToDate(endTimeStamp);
|
||||
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
String startTime = dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(startTimeStamp)), ZoneId.systemDefault()));
|
||||
String endTime = dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(endTimeStamp)), ZoneId.systemDefault()));
|
||||
reportTimeInfo.setStartTime(startTime);
|
||||
reportTimeInfo.setEndTime(endTime);
|
||||
|
||||
Date startDate = new Date(Long.parseLong(startTimeStamp));
|
||||
Date endDate = new Date(Long.parseLong(endTimeStamp));
|
||||
long timestamp = endDate.getTime() - startDate.getTime();
|
||||
reportTimeInfo.setDuration(String.valueOf(timestamp*1.0 / 1000 / 60));
|
||||
|
||||
// todo 时间问题
|
||||
long seconds = Duration.between(Instant.ofEpochMilli(Long.parseLong(startTimeStamp)), Instant.ofEpochMilli(Long.parseLong(endTimeStamp))).getSeconds();
|
||||
reportTimeInfo.setDuration(String.valueOf(seconds));
|
||||
|
||||
return reportTimeInfo;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span class="ms-report-time-desc">
|
||||
持续时间: {{duration}} 分钟
|
||||
持续时间: {{minutes}} 分钟 {{seconds}} 秒
|
||||
</span>
|
||||
<span class="ms-report-time-desc">
|
||||
开始时间: {{startTime}}
|
||||
|
@ -78,7 +78,8 @@
|
|||
projectName: '',
|
||||
startTime: '0',
|
||||
endTime: '0',
|
||||
duration: '0'
|
||||
minutes: '0',
|
||||
seconds: '0'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -101,7 +102,9 @@
|
|||
if(data){
|
||||
this.startTime = data.startTime;
|
||||
this.endTime = data.endTime;
|
||||
this.duration = data.duration;
|
||||
let duration = data.duration;
|
||||
this.minutes = Math.floor(duration / 60);
|
||||
this.seconds = duration % 60;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue