|
@@ -134,6 +134,7 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
}
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
for (String date : dateList) {
|
|
|
+ Integer total = 0;
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
dataMap.put("date", date);
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
@@ -142,11 +143,17 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("startTime", timeCalculation.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm")));
|
|
|
map.put("endTime", timeCalculation.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm")));
|
|
|
- map.put("duration", timeCalculation.getDuration());
|
|
|
+ Integer todayTime = timeCalculation.getDuration();
|
|
|
+ map.put("duration", convertSecond(todayTime));
|
|
|
+ total += todayTime;
|
|
|
list.add(map);
|
|
|
}
|
|
|
}
|
|
|
dataMap.put("time", list);
|
|
|
+ //这里检查如果只有一天记录的话那就再多计算一个当天总工作时间
|
|
|
+ if (resultList.size() == 1) {
|
|
|
+ dataMap.put("total", convertSecond(total));
|
|
|
+ }
|
|
|
resultList.add(dataMap);
|
|
|
}
|
|
|
httpRespMsg.data = resultList;
|
|
@@ -157,4 +164,14 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
+
|
|
|
+ //秒数转化为时间字符串
|
|
|
+ private String convertSecond(Integer time) {
|
|
|
+ Integer hour = 0, minute = 0, second = 0;
|
|
|
+ hour = time / 3600;
|
|
|
+ time = time % 3600;
|
|
|
+ minute = time / 60;
|
|
|
+ second = minute % 60;
|
|
|
+ return hour + "时 " + minute + "分 " + second + "秒";
|
|
|
+ }
|
|
|
}
|