|
|
@@ -487,22 +487,31 @@ public class Scheduler {
|
|
|
@Scheduled(cron = "0 0 0 * * ?")
|
|
|
public void closeGroupsTrips() {
|
|
|
DateTime now = DateTime.now();
|
|
|
- DateTime nextDay = DateUtil.offsetDay(DateUtil.beginOfDay(now), 3);
|
|
|
- List<CloseGroupsTripsView> closeGroupsTripsViews = Optional.ofNullable(beanSearcher.searchAll(CloseGroupsTripsView.class, MapUtils.builder()
|
|
|
- .field(CloseGroupsTripsView::getExpiryTime, nextDay).op(Operator.LessThan)
|
|
|
- .field(CloseGroupsTripsView::getGoodsId, Constant.AI_goodsIds).op(Operator.InList)
|
|
|
- .field(CloseGroupsTripsView::getGroupsId).op(Operator.NotNull)
|
|
|
- .field(CloseGroupsTripsView::getGroupsStatus, GroupsTrips.Status.down.name()).op(Operator.NotEqual)
|
|
|
- .build())).orElse(new ArrayList<>());
|
|
|
- log.info("下架过期账号数量:{}", closeGroupsTripsViews.size());
|
|
|
- closeGroupsTripsViews.forEach(account -> {
|
|
|
- int update = groupsMapper.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
|
|
|
- .set(GroupsTrips::getStatus, GroupsTrips.Status.down)
|
|
|
- .ne(GroupsTrips::getStatus, GroupsTrips.Status.down)
|
|
|
- .eq(GroupsTrips::getId, account.getGroupsId()));
|
|
|
- if (update == 1) {
|
|
|
- log.info("将过期账号:{}车队:{}下架", account.getId(), account.getGroupsId());
|
|
|
+ Constant.AI_goodsIds.forEach(goodsId -> {
|
|
|
+ //ChatGPT 10天提前下架
|
|
|
+ //midJourney 提前3天
|
|
|
+ Integer day = 3;
|
|
|
+ if (goodsId == 18) {
|
|
|
+ day = 10;
|
|
|
}
|
|
|
+ DateTime nextDay = DateUtil.offsetDay(DateUtil.beginOfDay(now), day);
|
|
|
+ List<CloseGroupsTripsView> closeGroupsTripsViews = Optional.ofNullable(beanSearcher.searchAll(CloseGroupsTripsView.class, MapUtils.builder()
|
|
|
+ .field(CloseGroupsTripsView::getExpiryTime, nextDay).op(Operator.LessEqual)
|
|
|
+ .field(CloseGroupsTripsView::getGoodsId, goodsId)
|
|
|
+ .field(CloseGroupsTripsView::getGroupsId).op(Operator.NotNull)
|
|
|
+ .field(CloseGroupsTripsView::getGroupsStatus, GroupsTrips.Status.down.name()).op(Operator.NotEqual)
|
|
|
+ .build())).orElse(new ArrayList<>());
|
|
|
+
|
|
|
+ log.info("下架goodsId:{}过期账号数量:{}", goodsId, closeGroupsTripsViews.size());
|
|
|
+ closeGroupsTripsViews.forEach(account -> {
|
|
|
+ int update = groupsMapper.update(null, Wrappers.lambdaUpdate(GroupsTrips.class)
|
|
|
+ .set(GroupsTrips::getStatus, GroupsTrips.Status.down)
|
|
|
+ .ne(GroupsTrips::getStatus, GroupsTrips.Status.down)
|
|
|
+ .eq(GroupsTrips::getId, account.getGroupsId()));
|
|
|
+ if (update == 1) {
|
|
|
+ log.info("将过期账号:{}车队:{}下架", account.getId(), account.getGroupsId());
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|