|
@@ -16,7 +16,6 @@ import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
-import java.time.ZoneOffset;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeParseException;
|
|
import java.time.format.DateTimeParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -44,20 +43,20 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
|
|
|
//根据id获取用户名 日期 时间分布
|
|
//根据id获取用户名 日期 时间分布
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg getTodayWorkingTime(String userId) {
|
|
|
|
|
|
+ public HttpRespMsg getTodayWorkingTime(String userId, String date) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
//用户名
|
|
//用户名
|
|
resultMap.put("username", userMapper.selectById(userId).getName());
|
|
resultMap.put("username", userMapper.selectById(userId).getName());
|
|
//日期
|
|
//日期
|
|
- LocalDate todayDate = LocalDate.now(ZoneOffset.of("+8"));
|
|
|
|
- resultMap.put("date", todayDate);
|
|
|
|
|
|
+// LocalDate todayDate = LocalDate.now(ZoneOffset.of("+8"));
|
|
|
|
+ resultMap.put("date", date);
|
|
//时间占比 预先定义好长度为11的数组再向里面添加
|
|
//时间占比 预先定义好长度为11的数组再向里面添加
|
|
Integer[] timeArray = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
Integer[] timeArray = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
//把当天所有行为分别加在一起装进数组
|
|
//把当天所有行为分别加在一起装进数组
|
|
List<TimeCalculation> list = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
|
|
List<TimeCalculation> list = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
|
|
.eq("user_id", userId)
|
|
.eq("user_id", userId)
|
|
- .eq("date", todayDate));
|
|
|
|
|
|
+ .eq("date", date));
|
|
for (TimeCalculation timeCalculation : list) {
|
|
for (TimeCalculation timeCalculation : list) {
|
|
timeArray[timeCalculation.getActionType() + 1] += timeCalculation.getDuration();
|
|
timeArray[timeCalculation.getActionType() + 1] += timeCalculation.getDuration();
|
|
}
|
|
}
|