|
@@ -259,41 +259,51 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getScreenshotDate(String date) {
|
|
|
+ public HttpRespMsg getScreenshotDate(String date, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- if (screenshotMapper.selectCount(new QueryWrapper<Screenshot>().eq("date_str", date)) > 0) {
|
|
|
- //当天有截图
|
|
|
- httpRespMsg.data = date;
|
|
|
- } else {
|
|
|
- String futureDateString = screenshotMapper.selectOne(new QueryWrapper<Screenshot>()
|
|
|
- .gt("date_str", date)
|
|
|
- .orderByAsc("date_str")
|
|
|
- .last("LIMIT 1"))
|
|
|
- .getDateStr();
|
|
|
- String historyDateString = screenshotMapper.selectOne(new QueryWrapper<Screenshot>()
|
|
|
- .lt("date_str", date)
|
|
|
- .orderByDesc("date_str")
|
|
|
- .last("LIMIT 1"))
|
|
|
- .getDateStr();
|
|
|
- if (futureDateString == null && historyDateString == null) {
|
|
|
- httpRespMsg = null;
|
|
|
- } else if (futureDateString == null) {
|
|
|
- httpRespMsg.data = historyDateString;
|
|
|
- } else if (historyDateString == null) {
|
|
|
- httpRespMsg.data = futureDateString;
|
|
|
+ try {
|
|
|
+ List<Integer> userIdList = screenshotMapper.getCompanyUserId(request.getHeader("Token"));
|
|
|
+ if (screenshotMapper.selectCount(new QueryWrapper<Screenshot>()
|
|
|
+ .eq("date_str", date)
|
|
|
+ .in("uid", userIdList)) > 0) {
|
|
|
+ //当天有截图
|
|
|
+ httpRespMsg.data = date;
|
|
|
} else {
|
|
|
- DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- LocalDate localDate = LocalDate.parse(date, dateTimeFormatter);
|
|
|
- LocalDate futureDate = LocalDate.parse(futureDateString, dateTimeFormatter);
|
|
|
- LocalDate historyDate = LocalDate.parse(historyDateString, dateTimeFormatter);
|
|
|
- Long future = ChronoUnit.DAYS.between(localDate, futureDate);
|
|
|
- Long history = ChronoUnit.DAYS.between(historyDate, localDate);
|
|
|
- if (future >= history) {
|
|
|
+ Screenshot futureScreenshot = screenshotMapper.selectOne(new QueryWrapper<Screenshot>()
|
|
|
+ .gt("date_str", date)
|
|
|
+ .in("uid", userIdList)
|
|
|
+ .orderByAsc("date_str")
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ Screenshot historyScreenshot = screenshotMapper.selectOne(new QueryWrapper<Screenshot>()
|
|
|
+ .lt("date_str", date)
|
|
|
+ .in("uid", userIdList)
|
|
|
+ .orderByDesc("date_str")
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ String futureDateString = futureScreenshot != null ? futureScreenshot.getDateStr() : null;
|
|
|
+ String historyDateString = historyScreenshot != null ? historyScreenshot.getDateStr() : null;
|
|
|
+ if (futureDateString == null && historyDateString == null) {
|
|
|
+ httpRespMsg = null;
|
|
|
+ } else if (futureDateString == null) {
|
|
|
httpRespMsg.data = historyDateString;
|
|
|
- } else {
|
|
|
+ } else if (historyDateString == null) {
|
|
|
httpRespMsg.data = futureDateString;
|
|
|
+ } else {
|
|
|
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LocalDate localDate = LocalDate.parse(date, dateTimeFormatter);
|
|
|
+ LocalDate futureDate = LocalDate.parse(futureDateString, dateTimeFormatter);
|
|
|
+ LocalDate historyDate = LocalDate.parse(historyDateString, dateTimeFormatter);
|
|
|
+ Long future = ChronoUnit.DAYS.between(localDate, futureDate);
|
|
|
+ Long history = ChronoUnit.DAYS.between(historyDate, localDate);
|
|
|
+ if (future >= history) {
|
|
|
+ httpRespMsg.data = historyDateString;
|
|
|
+ } else {
|
|
|
+ httpRespMsg.data = futureDateString;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ httpRespMsg.setError("验证失败");
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|