提交 ce78a979 作者: 925993793@qq.com

自定义专题绑定信息源变更通知采集,另起线程处理,不影响主业务逻辑

上级 4afc74d5
...@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -197,35 +198,37 @@ public class ConfigurationMessageService { ...@@ -197,35 +198,37 @@ public class ConfigurationMessageService {
public void bindInfoSourceSend(String subjectId){ public void bindInfoSourceSend(String subjectId){
try { CompletableFuture.runAsync(() -> {
remoteModelService.delSubjectCache(subjectId); try {
} catch (Exception e) { remoteModelService.delSubjectCache(subjectId);
log.error("删除专题缓存失败{}",e.getMessage(),e); } catch (Exception e) {
} log.error("删除专题缓存失败{}",e.getMessage(),e);
Subject byId = subjectService.getSubjectOrEventById(subjectId); }
if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) { Subject byId = subjectService.getSubjectOrEventById(subjectId);
log.info("未查询到专题或专题未启用"); if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) {
return; log.info("未查询到专题或专题未启用");
} return;
//只有启用状态的专题才需要通知采集更新绑定数据 }
List<String> bindIds = getAllInfoSourceIds(subjectId); //只有启用状态的专题才需要通知采集更新绑定数据
String getparam ; List<String> bindIds = getAllInfoSourceIds(subjectId);
if (CollectionUtil.isNotEmpty(bindIds)) { String getparam ;
getparam = getparam(byId, null, bindIds); if (CollectionUtil.isNotEmpty(bindIds)) {
}else { getparam = getparam(byId, null, bindIds);
log.info("专题未绑定信息源,通知采集清空"); }else {
log.info("专题未绑定信息源,通知采集清空");
getparam = getparam(byId, null, new ArrayList<>());
} getparam = getparam(byId, null, new ArrayList<>());
String post = caiJiCenterHttpService.allInfosourcebindUrl(getparam); }
JSONObject entries = JSONUtil.parseObj(post); String post = caiJiCenterHttpService.allInfosourcebindUrl(getparam);
//获取code状态码 JSONObject entries = JSONUtil.parseObj(post);
Integer code = entries.getInt("code"); //获取code状态码
if (ObjectUtil.isEmpty(code) || code != 200) { Integer code = entries.getInt("code");
log.error("专题信息源配置通知采集失败{}",post); if (ObjectUtil.isEmpty(code) || code != 200) {
throw new RuntimeException("专题信息源配置通知采集失败"); log.error("专题信息源配置通知采集失败{}",post);
} throw new RuntimeException("专题信息源配置通知采集失败");
log.info("{}专题信息源配置通知采集结束",byId.getSubjectName()); }
log.info("{}专题信息源配置通知采集结束",byId.getSubjectName());
});
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论