Commit e2183a3e by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !416
parents ddda0b0e 23029ed9
......@@ -11,9 +11,11 @@ import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.MarkFlowEntity;
import com.zhiwei.brandkbs2.pojo.WholeSearchRecord;
import com.zhiwei.brandkbs2.pojo.dto.*;
import com.zhiwei.brandkbs2.pojo.vo.ChannelListVO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import com.zhiwei.brandkbs2.service.*;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
......@@ -199,14 +201,28 @@ public class AppSearchController extends BaseController {
@LogRecord(values = "keyword", description = "查舆情", arguments = true, entity = true)
@PostMapping("/mark/list")
public ResponseResult getYuqingMarkList(@RequestBody MarkSearchDTO markSearchDTO) {
return ResponseResult.success(markDataService.getYuqingMarkList(markSearchDTO));
PageVO<MarkFlowEntity> yuqingMarkList = markDataService.getYuqingMarkList(markSearchDTO);
// 仅第一页增加平台进量(声量)统计
if (1 == markSearchDTO.getPage()) {
JSONObject info = yuqingMarkList.getInfo();
info.put("counts", markDataService.countMarkPlatform(markSearchDTO));
yuqingMarkList.setInfo(info);
}
return ResponseResult.success(yuqingMarkList);
}
@ApiOperation("原始数据列表")
@LogRecord(values = "keyword", description = "查原始数据", arguments = true, entity = true)
@PostMapping("/origin/list")
public ResponseResult getOriginList(@RequestBody MarkSearchDTO markSearchDTO) {
return ResponseResult.success(markDataService.getOriginList(markSearchDTO));
PageVO<MarkFlowEntity> originList = markDataService.getOriginList(markSearchDTO);
// 仅第一页增加平台进量(声量)统计
if (1 == markSearchDTO.getPage()) {
JSONObject info = originList.getInfo();
info.put("counts", markDataService.countOriginPlatform(markSearchDTO));
originList.setInfo(info);
}
return ResponseResult.success(originList);
}
@ApiOperation("搜索-舆情列表-搜索条件")
......
......@@ -60,6 +60,14 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
*/
private Boolean cancel;
/**
* 已处理的数据量
*/
private int schedule;
/**
* 待处理的数据总量
*/
private int totalSchedule;
/**
* 项目id
*/
private String projectId;
......@@ -139,6 +147,8 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
task.setEventInfo(new ArrayList<>());
task.setErrorData(new ArrayList<>());
task.setCancel(false);
task.setSchedule(0);
task.setTotalSchedule(0);
task.setProjectId(UserThreadLocal.getProjectId());
task.setUserId(UserThreadLocal.getUserId());
task.setNickName(UserThreadLocal.getNickname());
......@@ -157,6 +167,8 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
task.setEventInfo(null);
task.setErrorData(null);
task.setCancel(false);
task.setSchedule(0);
task.setTotalSchedule(0);
task.setProjectId(UserThreadLocal.getProjectId());
task.setUserId(UserThreadLocal.getUserId());
task.setNickName(UserThreadLocal.getNickname());
......
......@@ -21,4 +21,8 @@ public class BytedanceCustomPlatformWeight extends AbstractBaseMongo{
* 权重
*/
private double weight;
/**
* 常量
*/
private double constant;
}
package com.zhiwei.brandkbs2.service;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import org.apache.commons.lang3.tuple.Pair;
import org.elasticsearch.search.SearchHits;
......@@ -18,7 +19,7 @@ public interface EsSearchService {
/**
* 搜索标注数据
*
* @param dto 搜实体类
* @param dto 搜实体类
* @param scroll 滚动查询
* @return 搜索结果
*/
......@@ -27,7 +28,7 @@ public interface EsSearchService {
/**
* 搜索竞品标注数据
*
* @param dto 搜实体类
* @param dto 搜实体类
* @param scroll 滚动查询
* @return 搜索结果
*/
......@@ -36,10 +37,25 @@ public interface EsSearchService {
/**
* 搜索原始数据
*
* @param dto 搜实体类
* @param dto 搜实体类
* @param scroll 滚动查询
* @return 搜索结果
*/
Pair<SearchHits[], Map<String, Long>> searchOriginHitsAndCount(MarkSearchDTO dto, boolean scroll) throws IOException;
/**
* 查舆情舆情库-平台进量(声量)统计
* @param dto 搜索实体类
* @return
* @throws IOException
*/
JSONObject countMarkPlatform(MarkSearchDTO dto) throws IOException;
/**
* 查舆情原始数据-平台进量(声量)统计
* @param dto 搜索实体类
* @return
* @throws IOException
*/
JSONObject countOriginPlatform(MarkSearchDTO dto) throws IOException;
}
......@@ -378,4 +378,18 @@ public interface MarkDataService {
* @return
*/
Long interactionUpdatePrediction(MarkSearchDTO dto);
/**
* 查舆情舆情库-平台进量(声量)统计
* @param dto 标注数据搜索传输类
* @return
*/
JSONObject countMarkPlatform(MarkSearchDTO dto);
/**
* 查舆情原始数据-平台进量(声量)统计
* @param dto 标注数据搜索传输类
* @return
*/
JSONObject countOriginPlatform(MarkSearchDTO dto);
}
package com.zhiwei.brandkbs2.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.common.GlobalPojo;
import com.zhiwei.brandkbs2.es.EsClientDao;
import com.zhiwei.brandkbs2.es.EsQueryTools;
import com.zhiwei.brandkbs2.function.ArticleFunction;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import com.zhiwei.brandkbs2.service.EsSearchService;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
......@@ -21,9 +24,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @ClassName: EsSearchServiceImpl
......@@ -55,6 +57,18 @@ public class EsSearchServiceImpl implements EsSearchService {
return searchHitsAndCount(dto, this::createOriginSearchHelper, hotEsDao, scroll);
}
@Override
public JSONObject countMarkPlatform(MarkSearchDTO dto) throws IOException {
EsClientDao.SearchHelper helper = createSearchHelper(dto);
return platformCount(helper.getPostFilter(), esClientDao);
}
@Override
public JSONObject countOriginPlatform(MarkSearchDTO dto) throws IOException {
EsClientDao.SearchHelper helper = createOriginSearchHelper(dto);
return platformCount(helper.getPostFilter(), hotEsDao);
}
private Pair<SearchHits[], Map<String, Long>> searchHitsAndCount(MarkSearchDTO dto, ArticleFunction.CreateSearchHelper createSearchHelper,
EsClientDao clientDao, boolean scroll) throws IOException {
EsClientDao.SearchHelper helper = createSearchHelper.create(dto);
......@@ -63,8 +77,8 @@ public class EsSearchServiceImpl implements EsSearchService {
return Pair.of(clientDao.searchScrollResponse(helper).stream().map(SearchResponse::getHits).toArray(SearchHits[]::new), null);
}
SearchHits searchHits = clientDao.searchHits(helper);
Map<String, Long> platformCount = platformCount(dto.getPage(), dto.getPlatforms(), helper.getPostFilter(), clientDao);
return Pair.of(new SearchHits[]{searchHits}, platformCount);
// Map<String, Long> platformCount = platformCount(dto.getPage(), dto.getPlatforms(), helper.getPostFilter(), clientDao);
return Pair.of(new SearchHits[]{searchHits}, new HashMap<>());
}
private EsClientDao.SearchHelper createSearchHelper(MarkSearchDTO dto) {
......@@ -250,18 +264,23 @@ public class EsSearchServiceImpl implements EsSearchService {
*
* @return
*/
private Map<String, Long> platformCount(int page, List<String> platforms, BoolQueryBuilder postFilter, EsClientDao esClientDao) throws IOException {
Map<String, Long> counts = new HashMap<>();
// TODO 平台进量暂不统计
private JSONObject platformCount(BoolQueryBuilder postFilter, EsClientDao esClientDao) throws IOException {
List<JSONObject> list = new ArrayList<>();
//平台计量统计 仅第一页且无平台限制
// if (1 == page && CollectionUtils.isEmpty(platforms)) {
// for (MessagePlatform platform : GlobalPojo.PLATFORMS) {
// BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().must(postFilter).must(EsQueryTools.assemblePlatformQuery(Collections.singletonList(platform)));
// Long count = esClientDao.count(esClientDao.getIndexes(), queryBuilder, null);
// counts.put(platform.getName(), count);
// }
// }
return counts;
for (MessagePlatform platform : GlobalPojo.PLATFORMS.stream().filter(messagePlatform -> !"外媒".equals(messagePlatform.getName())).collect(Collectors.toList())) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().must(postFilter).must(EsQueryTools.assemblePlatformQuery(Collections.singletonList(platform)));
Long count = esClientDao.count(esClientDao.getIndexes(), queryBuilder, null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", platform.getId());
jsonObject.put("name", platform.getName());
jsonObject.put("count", count);
list.add(jsonObject);
}
Long total = list.stream().map(jsonObject -> jsonObject.getLongValue("count")).reduce(Long::sum).orElse(0L);
JSONObject res = new JSONObject();
res.put("count", list);
res.put("total", total);
return res;
}
}
......@@ -77,7 +77,7 @@ qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platfo
qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-application
qbjc.channel.influence=https://yuqing.test.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
qbjc.channel.influence=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
......@@ -80,7 +80,7 @@ qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platfo
qbjc.userCenter.url=http://login.zhiweidata.top/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=http://192.168.0.79:11000/qbjcbackPhoenix/interface/middleware/channel-application
qbjc.channel.influence=https://yuqing.test.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
qbjc.channel.influence=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
......@@ -77,7 +77,7 @@ qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platfo
qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-application
qbjc.channel.influence=https://yuqing.test.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
qbjc.channel.influence=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-influence?platform={1}&channel={2}
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
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