提交 e034277d 作者: 925993793@qq.com

【fix】批量添加至精选接口,兼容复合专题逻辑

上级 09c5e342
......@@ -293,7 +293,6 @@ public class InformationServiceImpl implements InformationService {
String dataSetId = searchCondition.getDataSetId();
dataSet.setRelationId(dataSetId);
Map<String, List<SpecialInformation>> map = new HashMap<>();
Integer num = searchCondition.getNum();
List<SpecialInformation> informationList = this.informationAllList(searchCondition);
formatUpdateMap(map,informationList,dataSet);
map.forEach((k, v) -> esOpUtil.docUpdateBulk(k, v));
......@@ -940,7 +939,7 @@ public class InformationServiceImpl implements InformationService {
for (int i = 1; ; i++) {
searchCondition.setPageNo(i);
List<SpecialInformation> list = esService.informationList(searchCondition);
log.info("保存数据集:本次循环-{},数据量为-{}", i, list.size());
log.info("本次循环-{},数据量为-{}", i, list.size());
if (CollectionUtils.isEmpty(list)) {
break;
}
......
......@@ -18,6 +18,7 @@ import com.zzsn.event.util.PythonUtil;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.Label;
import com.zzsn.event.vo.es.SpecialInformation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
......@@ -368,13 +369,35 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
@Override
public void selected(InfoDataSearchCondition searchCondition) {
String[] fetchFields = new String[]{"id", "checkStatus"};
//勾选的主题信息列表
List<Label> themeList = searchCondition.getThemeList();
String[] fetchFields = new String[]{"id", "checkStatus","labels"};
searchCondition.setFetchFields(fetchFields);
Map<String, List<SpecialInformation>> updateMap = new HashMap<>();
List<SpecialInformation> informationList = informationService.informationAllList(searchCondition);
for (SpecialInformation information : informationList) {
String index = information.getDbIndex();
information.setCheckStatus(1);
if (CollectionUtils.isNotEmpty(themeList)) {
List<Label> labels = information.getLabels();
//主题标签
List<Label> collect = labels.stream().filter(e -> "thematic_information_column".equals(e.getLabelMark())).collect(Collectors.toList());
//其他类型的标签
labels.removeAll(collect);
List<String> oldThemeIds = collect.stream().map(Label::getRelationId).collect(Collectors.toList());
List<String> newThemeIds = themeList.stream().map(Label::getRelationId).collect(Collectors.toList());
for (Label label : collect) {
if (newThemeIds.contains(label.getRelationId())) {
labels.add(label);
}
}
for (Label label : themeList) {
if (!oldThemeIds.contains(label.getRelationId())) {
labels.add(label);
}
}
information.setLabels(labels);
}
if (updateMap.containsKey(index)) {
updateMap.get(index).add(information);
} else {
......
......@@ -147,4 +147,10 @@ public class InfoDataSearchCondition {
//聚合排除的字段值的集合
private String[] excludeValues;
/*------专题分析类参数---end-------------------*/
/*------添加至精选时,主题列表---start-------------------*/
//聚合分组类型-按日期集合分析时使用
private List<Label> themeList;
/*------添加至精选时,主题列表---end-------------------*/
}
......@@ -24,4 +24,7 @@ public class Label {
//关联标签名称
private String relationName;
//得分
private Integer status;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论