فهرست منبع

fix 提前下架车队

zoujiajian 3 سال پیش
والد
کامیت
8fbdd30838

+ 1 - 1
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -117,5 +117,5 @@ public interface Constant {
 
 	String ZK_MOBILE = "18268325725";
 
-	static List<Long> AI_goodsIds = List.of(18l, 26l);
+	List<Long> AI_goodsIds = List.of(18l, 26l);
 }

+ 24 - 15
netflix-service/src/main/java/com/cyksj/task/Scheduler.java

@@ -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());
+				}
+			});
 		});
 	}