|
|
@@ -8,14 +8,17 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.template.common.utils.CommonUtil;
|
|
|
import com.template.common.utils.RequestUtils;
|
|
|
import com.template.config.ParkConfig;
|
|
|
+import com.template.config.ScheduleConfig;
|
|
|
import com.template.model.pojo.SmartCarAccess;
|
|
|
import com.template.mapper.SmartCarAccessMapper;
|
|
|
import com.template.services.SmartCarAccessService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.List;
|
|
|
@@ -33,18 +36,23 @@ public class SmartCarAccessServiceImpl extends ServiceImpl<SmartCarAccessMapper,
|
|
|
@Autowired
|
|
|
ParkConfig parkConfig;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ScheduleConfig scheduleConfig;
|
|
|
+
|
|
|
private Integer page = 0;
|
|
|
private Integer size = 20;
|
|
|
|
|
|
@Scheduled(cron = "0 0/45 * * * ? ")
|
|
|
+ @Async
|
|
|
public void car() {
|
|
|
- try {
|
|
|
- getEnterCar(page, size);
|
|
|
- getOutCar(page, size);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ if(scheduleConfig.getIsOpen().equals("1")) {
|
|
|
+ try {
|
|
|
+ getEnterCar(page, size);
|
|
|
+ getOutCar(page, size);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|