Merge remote-tracking branch 'origin/main'

This commit is contained in:
史宗金 2025-01-23 17:01:16 +08:00
commit 5c504b6208
2 changed files with 11 additions and 4 deletions

View File

@ -22,6 +22,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -198,10 +200,17 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
@Override
public AjaxResult synchronous(AttDataDetailsBean bean) {
try {
List<String> dateList = attTasks.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
List<String> dateList = AttTasks.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
//只执行今天之前的时间包含今天
// 获取今天的日期
LocalDate today = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
dateList = dateList.stream()
.filter(date -> attTasks.isBeforeToday(date))
.map(date -> LocalDate.parse(date, formatter)) // 将字符串转换为LocalDate
.filter(date -> !date.isAfter(today)) // 筛选出今天及之前的日期
.sorted() // 按日期排序可选
.map(formatter::format) // 将LocalDate转回为字符串
.collect(Collectors.toList());
attTasks.hisAttPush(dateList);
return AjaxResult.success("数据同步成功");

View File

@ -296,7 +296,6 @@
SELECT count(0)
FROM att_data
WHERE user_id = #{userId}
and org_id = #{orgId}
and att_type = #{attType}
and att_current_day = #{attCurrentDay}
</select>
@ -305,7 +304,6 @@
SELECT count(0)
FROM att_data_update
WHERE user_id = #{userId}
and org_id = #{orgId}
and att_type = #{attType}
and att_current_day = #{attCurrentDay}
</select>