Browse Source

REPORT-70483 cid配置第二天推送,但是alphafine即刻就可以收到推送

feature/x
hades 3 years ago
parent
commit
2ff33cf948
  1. 25
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

25
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.ProductNews;
@ -16,17 +17,33 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
public class ProductNewsSearchManager {
private static final ProductNewsSearchManager INSTANCE = new ProductNewsSearchManager();
private static final int TIME_GAP = 12;
private List<ProductNews> productNewsResultList;
private List<ProductNews> productNewsList = new ArrayList<>();
private ProductNewsSearchManager() {
private ScheduledExecutorService service;
private ProductNewsSearchManager() {
service = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ProductNewsSearchManager", true));
service.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
getProductNewsList();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}, TIME_GAP, TIME_GAP, TimeUnit.HOURS);
}
public static ProductNewsSearchManager getInstance() {
@ -67,7 +84,11 @@ public class ProductNewsSearchManager {
setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget(
ProductNews.Target.parseCode(obj.getInt("target"))).
setCreator(obj.getInt("creator")).setPushDate(new Date(obj.getLong("push_time")));
productNewsList.add(productNews);
Date currentDate = new Date(System.currentTimeMillis());
// 推送时间check
if (productNews.getPushDate().before(currentDate)) {
productNewsList.add(productNews);
}
}
return productNewsList;
}

Loading…
Cancel
Save