提交 5ab0bed4 编写于 作者: S shiziyuan9527

bug fix

上级 58756c1a
......@@ -147,7 +147,6 @@ public class GenerateReport {
}
public static ReportTimeInfo getReportTimeInfo(String jtlString) {
ReportTimeInfo reportTimeInfo = new ReportTimeInfo();
List<Metric> totalLineList = GenerateReport.resolver(jtlString);
totalLineList.sort(Comparator.comparing(t0 -> Long.valueOf(t0.getTimestamp())));
......@@ -158,16 +157,12 @@ public class GenerateReport {
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 reportTimeInfo = new ReportTimeInfo();
reportTimeInfo.setStartTime(startTime);
reportTimeInfo.setEndTime(endTime);
reportTimeInfo.setDuration(String.valueOf(seconds));
return reportTimeInfo;
......
......@@ -29,29 +29,29 @@ public class ResultDataParse {
ListResultData items = (ListResultData) mapResultData.getResult("items");
if (items.getSize() > 0) {
for (int i = 0; i < items.getSize(); i++) {
try {
MapResultData resultData = (MapResultData) items.get(i);
ListResultData data = (ListResultData) resultData.getResult("data");
int size = data.getSize();
String[] strArray = new String[size];
T t = clazz.newInstance();
if (size > 0) {
for (int j = 0; j < size; j++) {
ValueResultData valueResultData = (ValueResultData) data.get(j);
if (valueResultData.getValue() == null) {
strArray[j] = "";
} else {
String accept = valueResultData.accept(new JsonizerVisitor());
strArray[j] = accept.replace("\\", "");
}
MapResultData resultData = (MapResultData) items.get(i);
ListResultData data = (ListResultData) resultData.getResult("data");
int size = data.getSize();
String[] strArray = new String[size];
if (size > 0) {
T t = null;
for (int j = 0; j < size; j++) {
ValueResultData valueResultData = (ValueResultData) data.get(j);
if (valueResultData.getValue() == null) {
strArray[j] = "";
} else {
String accept = valueResultData.accept(new JsonizerVisitor());
strArray[j] = accept.replace("\\", "");
}
}
try {
t = setParam(clazz, strArray);
} catch (Exception e) {
e.printStackTrace();
}
list.add(t);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册