|
@@ -47,13 +47,13 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
LocalDate todayDate = LocalDate.now(ZoneOffset.of("+8"));
|
|
|
resultMap.put("date", todayDate);
|
|
|
//时间占比 预先定义好长度为9的数组再向里面添加
|
|
|
- Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
|
|
+ Integer[] timeArray = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
for (TimeCalculation timeCalculation : timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
|
|
|
.eq("user_id", userId)
|
|
|
.eq("date", todayDate))) {
|
|
|
- doubleArray[timeCalculation.getActionType()] += timeCalculation.getDuration();
|
|
|
+ timeArray[timeCalculation.getActionType()] += timeCalculation.getDuration();
|
|
|
}
|
|
|
- resultMap.put("timeDistribution", doubleArray);
|
|
|
+ resultMap.put("timeDistribution", timeArray);
|
|
|
httpRespMsg.data = resultMap;
|
|
|
return httpRespMsg;
|
|
|
}
|
|
@@ -92,15 +92,15 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
map.put("name", userMap.get("name"));
|
|
|
map.put("phone", userMap.get("phone"));
|
|
|
//然后根据日期和用户id获取到所有的记录 然后手动累加在一起
|
|
|
- Double[] doubleArray = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
|
|
+ Integer[] timeArray = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
for (Map<String, Object> dataMap : timeCalculationMapper
|
|
|
.getTodayStatistics((String) userMap.get("id"), date, companyId)) {
|
|
|
- doubleArray[(int) dataMap.get("type")] += (Double) dataMap.get("duration");
|
|
|
+ timeArray[(int) dataMap.get("type")] += (int) dataMap.get("duration");
|
|
|
}
|
|
|
- map.put("statistics", doubleArray);
|
|
|
+ map.put("statistics", timeArray);
|
|
|
//最后是数组的和
|
|
|
- Double sum = 0.0;
|
|
|
- for (Double singleNumber : doubleArray) {
|
|
|
+ Integer sum = 0;
|
|
|
+ for (Integer singleNumber : timeArray) {
|
|
|
sum += singleNumber;
|
|
|
}
|
|
|
map.put("sum", sum);
|