|
@@ -16,9 +16,11 @@ import org.springframework.stereotype.Component;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Component
|
|
@Component
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -38,12 +40,15 @@ public class InspectCreateOrderJob implements JobHandler {
|
|
TenantUtils.execute(1L, () -> {
|
|
TenantUtils.execute(1L, () -> {
|
|
List<IotInspectPlanDO> plans = iotInspectPlanMapper.selectList();
|
|
List<IotInspectPlanDO> plans = iotInspectPlanMapper.selectList();
|
|
plans.stream().filter(e -> e.getStatus()==0).forEach(plan -> {
|
|
plans.stream().filter(e -> e.getStatus()==0).forEach(plan -> {
|
|
- if (plan.getLastCreateTime()==null) {
|
|
|
|
- Date date = Date.from(
|
|
|
|
- plan.getCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
|
- .toInstant() // 转为 Instant(时间戳)
|
|
|
|
- );
|
|
|
|
- deal(plan, date);
|
|
|
|
|
|
+ if (plan.getLastCreateTime()==null&& Objects.nonNull(plan.getBeginCreateTime())) {
|
|
|
|
+ //当首次执行时间大于当前时间
|
|
|
|
+ if (plan.getBeginCreateTime().isAfter(LocalDateTime.now())) {
|
|
|
|
+ Date date = Date.from(
|
|
|
|
+ plan.getCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
|
+ .toInstant() // 转为 Instant(时间戳)
|
|
|
|
+ );
|
|
|
|
+ deal(plan, date);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
Date lastdate = Date.from(
|
|
Date lastdate = Date.from(
|
|
plan.getLastCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
plan.getLastCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
@@ -78,5 +83,4 @@ public class InspectCreateOrderJob implements JobHandler {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|