Commit 3bd813a8 by shenjunjie

Merge branch 'feature' into 'dev'

非人工项目-舆情库调整

See merge request !426
parents e9b0cace fb2a085f
...@@ -60,6 +60,7 @@ public class NonManualProjectPlan extends AbstractBaseMongo{ ...@@ -60,6 +60,7 @@ public class NonManualProjectPlan extends AbstractBaseMongo{
private String submitter; private String submitter;
public NonManualProjectPlan(NonManualProjectPlanDTO dto){ public NonManualProjectPlan(NonManualProjectPlanDTO dto){
this.id = dto.getId();
this.projectId = UserThreadLocal.getProjectId(); this.projectId = UserThreadLocal.getProjectId();
this.name = dto.getName(); this.name = dto.getName();
this.keyword = dto.getKeyword(); this.keyword = dto.getKeyword();
......
...@@ -169,12 +169,12 @@ public class MarkSearchDTO { ...@@ -169,12 +169,12 @@ public class MarkSearchDTO {
* 内容类型(原创/转发),仅非人工项目 * 内容类型(原创/转发),仅非人工项目
*/ */
@ApiModelProperty(value = "内容类型(原创/转发)") @ApiModelProperty(value = "内容类型(原创/转发)")
private String forward; private Boolean forward;
/** /**
* 信息浏览(已读/未读),仅非人工项目 * 信息浏览(已读/未读),仅非人工项目
*/ */
@ApiModelProperty(value = "信息浏览(已读/未读)") @ApiModelProperty(value = "信息浏览(已读/未读)")
private String read; private Boolean read;
/** /**
* 数据类型(长文本/短文本/问答/视频),仅非人工项目 * 数据类型(长文本/短文本/问答/视频),仅非人工项目
*/ */
......
...@@ -183,7 +183,6 @@ public class ProjectVO { ...@@ -183,7 +183,6 @@ public class ProjectVO {
} else { } else {
project.setAvatarUrl(vo.getAvatarUrl()); project.setAvatarUrl(vo.getAvatarUrl());
} }
project.setModuleShowList(Collections.emptyList());
project.setToolsetShowList(Arrays.asList("articleSummary", "interactionUpdate", "highWord")); project.setToolsetShowList(Arrays.asList("articleSummary", "interactionUpdate", "highWord"));
// 新建项目时默认数据量50w // 新建项目时默认数据量50w
project.setDataBalance(500000); project.setDataBalance(500000);
......
...@@ -81,6 +81,7 @@ public interface MarkFlowService { ...@@ -81,6 +81,7 @@ public interface MarkFlowService {
private String contendId; private String contendId;
private String linkedGroupId; private String linkedGroupId;
private String planId; private String planId;
private Long gid;
public MarkInfoSource(JSONObject json, String projectId, String contendId) { public MarkInfoSource(JSONObject json, String projectId, String contendId) {
this.json = json; this.json = json;
...@@ -93,11 +94,12 @@ public interface MarkFlowService { ...@@ -93,11 +94,12 @@ public interface MarkFlowService {
this.linkedGroupId = linkedGroupId; this.linkedGroupId = linkedGroupId;
} }
public MarkInfoSource(JSONObject json, String projectId, String contendId, String planId) { public MarkInfoSource(JSONObject json, String projectId, String contendId, String planId, Long gid) {
this.json = json; this.json = json;
this.projectId = projectId; this.projectId = projectId;
this.contendId = contendId; this.contendId = contendId;
this.planId = planId; this.planId = planId;
this.gid = gid;
} }
} }
......
...@@ -301,11 +301,11 @@ public class EsSearchServiceImpl implements EsSearchService { ...@@ -301,11 +301,11 @@ public class EsSearchServiceImpl implements EsSearchService {
} }
// forward // forward
if (Objects.nonNull(dto.getForward())){ if (Objects.nonNull(dto.getForward())){
postFilter.must(EsQueryTools.assembleForward2Query(Objects.equals(dto.getForward(), "转发"))); postFilter.must(EsQueryTools.assembleForward2Query(dto.getForward()));
} }
// gid 已读 未读 // gid 已读 未读
if (Objects.nonNull(dto.getRead()) && Objects.nonNull(dto.getGid())){ if (Objects.nonNull(dto.getRead())){
if (Objects.equals(dto.getRead(), "已读")){ if (dto.getRead()){
postFilter.must(QueryBuilders.rangeQuery(GenericAttribute.ES_GID).lte(dto.getGid())); postFilter.must(QueryBuilders.rangeQuery(GenericAttribute.ES_GID).lte(dto.getGid()));
}else { }else {
postFilter.must(QueryBuilders.rangeQuery(GenericAttribute.ES_GID).gt(dto.getGid())); postFilter.must(QueryBuilders.rangeQuery(GenericAttribute.ES_GID).gt(dto.getGid()));
......
...@@ -620,6 +620,13 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -620,6 +620,13 @@ public class MarkDataServiceImpl implements MarkDataService {
projectService.getProjectVOById(projectId).getContendList().stream().filter(contend -> contend.getId().equals(markSearchDTO.getContendId())).findFirst(); projectService.getProjectVOById(projectId).getContendList().stream().filter(contend -> contend.getId().equals(markSearchDTO.getContendId())).findFirst();
contendOptional.ifPresent(contend -> markSearchDTO.setLinkedGroupId(contend.getBrandLinkedGroupId())); contendOptional.ifPresent(contend -> markSearchDTO.setLinkedGroupId(contend.getBrandLinkedGroupId()));
} }
// gid
String gid = redisUtil.get(RedisUtil.getNonManualProjectMarkMaxGidKey(UserThreadLocal.getProjectId(), markSearchDTO.getPlanId(), UserThreadLocal.getUserId()));
if (Objects.isNull(gid)) {
markSearchDTO.setGid(-1L);
}else {
markSearchDTO.setGid(Long.parseLong(gid));
}
} }
private List<List<JSONObject>> aggregation(SearchHits[] searchHitsList) { private List<List<JSONObject>> aggregation(SearchHits[] searchHitsList) {
...@@ -1704,7 +1711,6 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1704,7 +1711,6 @@ public class MarkDataServiceImpl implements MarkDataService {
if (nonManualProjectPlanDao.count(new Query(Criteria.where("projectId").is(UserThreadLocal.getProjectId()))) >= 5) { if (nonManualProjectPlanDao.count(new Query(Criteria.where("projectId").is(UserThreadLocal.getProjectId()))) >= 5) {
return ResponseResult.failure("超过方案数量上限5"); return ResponseResult.failure("超过方案数量上限5");
} }
// TODO 数据预估超限返回
NonManualProjectPlan plan = new NonManualProjectPlan(dto); NonManualProjectPlan plan = new NonManualProjectPlan(dto);
nonManualProjectPlanDao.insertOne(plan); nonManualProjectPlanDao.insertOne(plan);
return ResponseResult.success(); return ResponseResult.success();
...@@ -1725,7 +1731,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1725,7 +1731,7 @@ public class MarkDataServiceImpl implements MarkDataService {
NonManualProjectPlan existPlan = nonManualProjectPlanDao.findOneById(dto.getId()); NonManualProjectPlan existPlan = nonManualProjectPlanDao.findOneById(dto.getId());
NonManualProjectPlan plan = new NonManualProjectPlan(dto); NonManualProjectPlan plan = new NonManualProjectPlan(dto);
plan.setCTime(existPlan.getCTime()); plan.setCTime(existPlan.getCTime());
nonManualProjectPlanDao.updateOne(existPlan); nonManualProjectPlanDao.updateOne(plan);
return ResponseResult.success(); return ResponseResult.success();
} }
...@@ -1847,10 +1853,6 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1847,10 +1853,6 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("dataType", dataType.stream().filter(jsonObject -> !jsonObject.getString("name").equals("图片"))); result.put("dataType", dataType.stream().filter(jsonObject -> !jsonObject.getString("name").equals("图片")));
// 信息浏览 // 信息浏览
result.put("read", Arrays.asList("已读", "未读")); result.put("read", Arrays.asList("已读", "未读"));
// 其他标签组(筛选器)
// result.put("tagFilterList", tagFilterService.getTagFilter());
// 地域
// result.put("regionList", getFilterRegionList());
// 自定义标签列表 // 自定义标签列表
List<CustomTagVo> customTagList = customTagService.findCustomTagList(1, 1).getList(); List<CustomTagVo> customTagList = customTagService.findCustomTagList(1, 1).getList();
if (CollectionUtils.isNotEmpty(customTagList)) { if (CollectionUtils.isNotEmpty(customTagList)) {
...@@ -1864,11 +1866,6 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1864,11 +1866,6 @@ public class MarkDataServiceImpl implements MarkDataService {
try { try {
//设置默认的时间、页码、排序方式等 //设置默认的时间、页码、排序方式等
defaultMarkSearch(markSearchDTO); defaultMarkSearch(markSearchDTO);
// gid
String gid = redisUtil.get(RedisUtil.getNonManualProjectMarkMaxGidKey(UserThreadLocal.getProjectId(), markSearchDTO.getPlanId(), UserThreadLocal.getUserId()));
if (Objects.nonNull(gid)) {
markSearchDTO.setGid(Long.parseLong(gid));
}
// 搜索es数据 // 搜索es数据
Pair<SearchHits[], Map<String, Long>> hitsAndCounts = esSearchService.searchNonManualHitsAndCount(markSearchDTO, false); Pair<SearchHits[], Map<String, Long>> hitsAndCounts = esSearchService.searchNonManualHitsAndCount(markSearchDTO, false);
// 总量 // 总量
...@@ -2101,11 +2098,15 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -2101,11 +2098,15 @@ public class MarkDataServiceImpl implements MarkDataService {
List<JSONObject> res = new ArrayList<>(); List<JSONObject> res = new ArrayList<>();
String projectId = UserThreadLocal.getProjectId(); String projectId = UserThreadLocal.getProjectId();
List<NonManualProjectPlan> planList = nonManualProjectPlanDao.findList(new Query(Criteria.where("projectId").is(projectId))); List<NonManualProjectPlan> planList = nonManualProjectPlanDao.findList(new Query(Criteria.where("projectId").is(projectId)));
long startTime = Constant.DF_yyyyMMdd.parse(Constant.DF_yyyyMMdd.format(new Date())).getTime();
long endTime = System.currentTimeMillis();
for (NonManualProjectPlan plan : planList) { for (NonManualProjectPlan plan : planList) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("id", plan.getId()); jsonObject.put("id", plan.getId());
jsonObject.put("name", plan.getName()); jsonObject.put("name", plan.getName());
jsonObject.put("count", esClientDao.count(EsQueryTools.assembleCacheMapsPlanQuery(projectId, plan.getId()))); BoolQueryBuilder query = EsQueryTools.assembleCacheMapsPlanQuery(projectId, plan.getId());
query.must(QueryBuilders.rangeQuery("time").gte(startTime).lt(endTime));
jsonObject.put("count", esClientDao.count(query));
res.add(jsonObject); res.add(jsonObject);
} }
return res; return res;
...@@ -2468,6 +2469,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -2468,6 +2469,7 @@ public class MarkDataServiceImpl implements MarkDataService {
String projectId = markSearchDTO.getProjectId(); String projectId = markSearchDTO.getProjectId();
String contendId = markSearchDTO.getContendId(); String contendId = markSearchDTO.getContendId();
String planId = markSearchDTO.getPlanId(); String planId = markSearchDTO.getPlanId();
Long gid = markSearchDTO.getGid();
// 重复消息折叠 // 重复消息折叠
if (markSearchDTO.isFold()) { if (markSearchDTO.isFold()) {
// 根据旧顺序排序 // 根据旧顺序排序
...@@ -2481,17 +2483,17 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -2481,17 +2483,17 @@ public class MarkDataServiceImpl implements MarkDataService {
return sortList.stream().map(id -> { return sortList.stream().map(id -> {
List<Map<String, Object>> maps = collect.get(id); List<Map<String, Object>> maps = collect.get(id);
if (null != maps) { if (null != maps) {
return MarkFlowEntity.getFoldInstance(maps.stream().map(map -> getNonManualMarkFlowEntity(map, projectId, contendId, planId)).collect(Collectors.toList())); return MarkFlowEntity.getFoldInstance(maps.stream().map(map -> getNonManualMarkFlowEntity(map, projectId, contendId, planId, gid)).collect(Collectors.toList()));
} }
return null; return null;
}).filter(Objects::nonNull).collect(Collectors.toList()); }).filter(Objects::nonNull).collect(Collectors.toList());
} }
return Arrays.stream(searchHits.getHits()).map(hit -> getNonManualMarkFlowEntity(hit.getSourceAsMap(), projectId, contendId, planId)).collect(Collectors.toList()); return Arrays.stream(searchHits.getHits()).map(hit -> getNonManualMarkFlowEntity(hit.getSourceAsMap(), projectId, contendId, planId, gid)).collect(Collectors.toList());
} }
private MarkFlowEntity getNonManualMarkFlowEntity(Map<String, Object> map, String projectId, String contendId, String planId) { private MarkFlowEntity getNonManualMarkFlowEntity(Map<String, Object> map, String projectId, String contendId, String planId, Long gid) {
MarkFlowEntity instance = new MarkFlowEntity(new JSONObject(map)); MarkFlowEntity instance = new MarkFlowEntity(new JSONObject(map));
instance.setInfo(markFlowService.createNonManualMarkFlowInfo(new MarkFlowService.MarkInfoSource(new JSONObject(map), projectId, contendId, planId))); instance.setInfo(markFlowService.createNonManualMarkFlowInfo(new MarkFlowService.MarkInfoSource(new JSONObject(map), projectId, contendId, planId, gid)));
return instance; return instance;
} }
...@@ -2605,7 +2607,8 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -2605,7 +2607,8 @@ public class MarkDataServiceImpl implements MarkDataService {
for (AggreeResult aggreeResult : fatherList) { for (AggreeResult aggreeResult : fatherList) {
List<MarkFlowEntity> markFlowEntities = new ArrayList<>(); List<MarkFlowEntity> markFlowEntities = new ArrayList<>();
MarkFlowEntity instance = new MarkFlowEntity(aggreeResult.getData(), dto.getLinkedGroupId()); MarkFlowEntity instance = new MarkFlowEntity(aggreeResult.getData(), dto.getLinkedGroupId());
instance.setInfo(createMarkFlowInfo.create(new MarkFlowService.MarkInfoSource(aggreeResult.getData(), dto.getProjectId(), dto.getContendId(), dto.getPlanId(), dto.getLinkedGroupId()))); instance.setInfo(createMarkFlowInfo.create(new MarkFlowService.MarkInfoSource(aggreeResult.getData(), dto.getProjectId(), dto.getContendId(),
dto.getPlanId(), dto.getLinkedGroupId(), dto.getGid())));
markFlowEntities.add(instance); markFlowEntities.add(instance);
// 添加父标题集下的子标题集 // 添加父标题集下的子标题集
resList.add(MarkFlowEntity.getAggreeInstance(markFlowEntities, aggreeResult, sonDetails)); resList.add(MarkFlowEntity.getAggreeInstance(markFlowEntities, aggreeResult, sonDetails));
......
...@@ -91,6 +91,9 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -91,6 +91,9 @@ public class MarkFlowServiceImpl implements MarkFlowService {
resultInfo.put("highLightWord", getHighLightWords(json, markInfoSource.getProjectId(), markInfoSource.getPlanId())); resultInfo.put("highLightWord", getHighLightWords(json, markInfoSource.getProjectId(), markInfoSource.getPlanId()));
// 词频 // 词频
resultInfo.put("keywordCount", getKeywordCount(json, markInfoSource.getProjectId(), markInfoSource.getPlanId())); resultInfo.put("keywordCount", getKeywordCount(json, markInfoSource.getProjectId(), markInfoSource.getPlanId()));
// 已读
Long esGid = json.getLong(GenericAttribute.ES_GID);
resultInfo.put("read", markInfoSource.getGid() >= esGid);
return resultInfo; return resultInfo;
} }
...@@ -214,10 +217,13 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -214,10 +217,13 @@ public class MarkFlowServiceImpl implements MarkFlowService {
if (Objects.isNull(keyword)){ if (Objects.isNull(keyword)){
continue; continue;
} }
String[] keywordAndFrequency = keyword.split(":"); String[] manyKeywordAndFrequency = keyword.split(",");
String word = keywordAndFrequency[0]; for (String keywordAndFrequency : manyKeywordAndFrequency) {
Integer frequency = Integer.valueOf(keywordAndFrequency[1]); String[] split = keywordAndFrequency.split(":");
res.put(word, frequency); String word = split[0];
Integer frequency = Integer.valueOf(split[1]);
res.put(word, frequency);
}
} }
return res; return res;
} }
...@@ -229,11 +235,14 @@ public class MarkFlowServiceImpl implements MarkFlowService { ...@@ -229,11 +235,14 @@ public class MarkFlowServiceImpl implements MarkFlowService {
if (Objects.isNull(keyword)){ if (Objects.isNull(keyword)){
continue; continue;
} }
String[] keywordAndFrequency = keyword.split(":"); String[] manyKeywordAndFrequency = keyword.split(",");
String words = keywordAndFrequency[0]; for (String keywordAndFrequency : manyKeywordAndFrequency) {
if (Objects.nonNull(words)){ String[] split = keywordAndFrequency.split(":");
String[] word = words.split(" "); String words = split[0];
res.addAll(new ArrayList<>(Arrays.asList(word))); if (Objects.nonNull(words)){
String[] word = words.split(" ");
res.addAll(new ArrayList<>(Arrays.asList(word)));
}
} }
} }
return res.stream().distinct().collect(Collectors.toList()); return res.stream().distinct().collect(Collectors.toList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment