|
|
@ -203,6 +203,17 @@ public class ExamModel {
|
|
|
|
public Page<Record> getPageSummary(int page, int limit) {
|
|
|
|
public Page<Record> getPageSummary(int page, int limit) {
|
|
|
|
SqlPara sqlPara = Db.getSqlPara("Exam.getPageSummary");
|
|
|
|
SqlPara sqlPara = Db.getSqlPara("Exam.getPageSummary");
|
|
|
|
Page<Record> pageRecord = Db.paginate(page, limit, sqlPara);
|
|
|
|
Page<Record> pageRecord = Db.paginate(page, limit, sqlPara);
|
|
|
|
|
|
|
|
//1、扩展排名序号
|
|
|
|
|
|
|
|
for (int i = 0; i < pageRecord.getList().size(); i++) {
|
|
|
|
|
|
|
|
Record record = pageRecord.getList().get(i);
|
|
|
|
|
|
|
|
record.set("num", (page - 1) * limit + i + 1);
|
|
|
|
|
|
|
|
LocalDateTime st=record.getLocalDateTime("start_time");
|
|
|
|
|
|
|
|
LocalDateTime ed=record.getLocalDateTime("end_time");
|
|
|
|
|
|
|
|
//2、扩展答题时长
|
|
|
|
|
|
|
|
record.set("ys",getYs(st,ed));
|
|
|
|
|
|
|
|
record.set("start_time",st.toLocalDate()+" "+st.toLocalTime());
|
|
|
|
|
|
|
|
record.set("end_time",st.toLocalDate()+" "+st.toLocalTime());
|
|
|
|
|
|
|
|
}
|
|
|
|
return pageRecord;
|
|
|
|
return pageRecord;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -250,24 +261,24 @@ public class ExamModel {
|
|
|
|
LocalDateTime end_time = r.getLocalDateTime("end_time");
|
|
|
|
LocalDateTime end_time = r.getLocalDateTime("end_time");
|
|
|
|
res.set("start_time", start_time);
|
|
|
|
res.set("start_time", start_time);
|
|
|
|
res.set("end_time", end_time);
|
|
|
|
res.set("end_time", end_time);
|
|
|
|
|
|
|
|
res.set("ys", getYs(start_time, end_time));
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getYs(LocalDateTime start_time, LocalDateTime end_time) {
|
|
|
|
// 计算时间差
|
|
|
|
// 计算时间差
|
|
|
|
Duration duration = Duration.between(start_time, end_time);
|
|
|
|
Duration duration = Duration.between(start_time, end_time);
|
|
|
|
long seconds = duration.getSeconds(); // 获取时间差秒数
|
|
|
|
long seconds = duration.getSeconds(); // 获取时间差秒数
|
|
|
|
long hour = seconds / 3600;
|
|
|
|
long hour = seconds / 3600;
|
|
|
|
long minute = (seconds - hour * 3600) / 60;
|
|
|
|
long minute = (seconds - hour * 3600) / 60;
|
|
|
|
long second = seconds - hour * 3600 - minute * 60;
|
|
|
|
long second = seconds - hour * 3600 - minute * 60;
|
|
|
|
res.set("hour", hour);
|
|
|
|
|
|
|
|
res.set("minute", minute);
|
|
|
|
|
|
|
|
res.set("second", second);
|
|
|
|
|
|
|
|
String ys = "";
|
|
|
|
String ys = "";
|
|
|
|
if (hour > 0) ys += hour + "小时";
|
|
|
|
if (hour > 0) ys += hour + "小时";
|
|
|
|
|
|
|
|
|
|
|
|
if (hour == 0 && minute > 0) ys += minute + "分钟";
|
|
|
|
if (hour == 0 && minute > 0) ys += minute + "分钟";
|
|
|
|
if (hour > 0) ys += minute + "分钟";
|
|
|
|
if (hour > 0) ys += minute + "分钟";
|
|
|
|
|
|
|
|
|
|
|
|
if (second > 0) ys += second + "秒";
|
|
|
|
if (second > 0) ys += second + "秒";
|
|
|
|
res.set("ys", ys);
|
|
|
|
return ys;
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|