| New file |
| | |
| | | package com.xiaopeng.maintenance.schedule; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.maintenance.XpClockIn; |
| | | import com.xiaopeng.api.model.maintenance.XpSchedulingDetail; |
| | | import com.xiaopeng.maintenance.mapper.XpClockInMapper; |
| | | import com.xiaopeng.maintenance.mapper.XpTaskMapper; |
| | | import com.xiaopeng.maintenance.mapper.XpTaskRuleMapper; |
| | | import com.xiaopeng.maintenance.mapper.XpTaskRuleRoleMapper; |
| | | import com.xiaopeng.maintenance.service.IXpClockInService; |
| | | import com.xiaopeng.maintenance.service.IXpSchedulingDetailService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 打卡定时任务 |
| | | * <p> |
| | | * 判断是否迟到或者缺卡 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2026-02-27 |
| | | */ |
| | | @Component |
| | | public class ClockInScheduleTask { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(ClockInScheduleTask.class); |
| | | |
| | | @Autowired |
| | | private IXpClockInService xpClockInService; |
| | | @Autowired |
| | | private IXpSchedulingDetailService xpSchedulingDetailService; |
| | | |
| | | |
| | | /** |
| | | * 每5分钟执行一次 |
| | | */ |
| | | @Scheduled(cron = "0 */5 * * * ?") |
| | | public void clockInScheduleTask() { |
| | | log.info("========== 开始执行打卡检查 =========="); |
| | | try { |
| | | |
| | | // 查询上班卡在今天的 |
| | | List<XpSchedulingDetail> clockInPlanList = xpSchedulingDetailService.list(Wrappers.lambdaQuery(XpSchedulingDetail.class) |
| | | .likeRight(XpSchedulingDetail::getPlanTime, LocalDate.now())); |
| | | if(!CollectionUtils.isEmpty(clockInPlanList)){ |
| | | List<Long> fleetIds = clockInPlanList.stream().map(XpSchedulingDetail::getFleetId).collect(Collectors.toList()); |
| | | // 查询所有车队 |
| | | |
| | | } |
| | | |
| | | // 查询下班卡在今天的 |
| | | List<XpSchedulingDetail> clockOutPlanList = xpSchedulingDetailService.list(Wrappers.lambdaQuery(XpSchedulingDetail.class) |
| | | .likeRight(XpSchedulingDetail::getPlanTime, LocalDate.now())); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("执行打卡检查任务执行失败", e); |
| | | } |
| | | } |
| | | } |