|
@@ -25,8 +25,10 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
@@ -256,6 +258,46 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getScreenshotDate(String date) {
|
|
|
+ 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;
|
|
|
+ } 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg saveAndProcessImage(ScreenshotVO screenshotvo) {
|
|
|
Map<String, Object> fileMap = UploadFileToFileNameUtil.uploadFile(screenshotvo.getFile(), path);
|