|
@@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.format.DateTimeParseException;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -111,9 +112,21 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
+ //根据日期段获取本人的工作时间段
|
|
|
@Override
|
|
|
public HttpRespMsg getDuration(String startDate, String endDate, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ try {
|
|
|
+ httpRespMsg.data = timeCalculationMapper.selectList(new QueryWrapper<TimeCalculation>()
|
|
|
+ .eq("user_id", request.getHeader("Token"))
|
|
|
+ .between("date",
|
|
|
+ LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")),
|
|
|
+ LocalDate.parse(endDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
|
+ } catch (DateTimeParseException e) {
|
|
|
+ httpRespMsg.setError("日期格式有误");
|
|
|
+ }
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
}
|