|
|
@@ -1,6 +1,7 @@
|
|
|
package com.zhiqiyun.open.core.schedule;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.zhiqiyun.open.core.enmus.Gender;
|
|
|
import com.zhiqiyun.open.core.enmus.PassengerType;
|
|
|
import com.zhiqiyun.open.core.models.DictCity;
|
|
|
@@ -14,6 +15,7 @@ import com.zhiqiyun.open.utils.DateUtil;
|
|
|
import com.zhiqiyun.open.utils.RandomUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.BoundListOperations;
|
|
|
@@ -86,4 +88,21 @@ public class AutoEquipmentPassengerPeople {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Scheduled(cron = "0/10 * * * * ?")
|
|
|
+ public void deletePeople() {
|
|
|
+ QueryWrapper<EquipmentPassengerPeople> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.lt("created_time", DateUtils.addMonths(DateUtil.current(), -1));
|
|
|
+
|
|
|
+ int current = 1;
|
|
|
+ boolean hasNext = true;
|
|
|
+ while (hasNext) {
|
|
|
+ Page<EquipmentPassengerPeople> page = this.equipmentPassengerPeopleService.page(new Page<>(current, 100), wrapper);
|
|
|
+
|
|
|
+ for (EquipmentPassengerPeople people : page.getRecords()) {
|
|
|
+ this.equipmentPassengerPeopleService.removeById(people.getId());
|
|
|
+ }
|
|
|
+ hasNext = page.hasNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|