Commit 6fe16ea2 by shenjunjie

Merge branch 'feature' into 'dev'

Feature

See merge request !488
parents c60988a4 65dc384b
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<qbjc.bean.version>1.1.7.1-SNAPSHOT</qbjc.bean.version> <qbjc.bean.version>1.1.7.1-SNAPSHOT</qbjc.bean.version>
<springfox.version>2.9.2</springfox.version> <springfox.version>2.9.2</springfox.version>
<fastjson.version>1.2.47</fastjson.version> <fastjson.version>1.2.47</fastjson.version>
<easyexcel.version>3.0.5</easyexcel.version> <easyexcel.version>3.3.4</easyexcel.version>
<marker.client.version>1.1.9-SNAPSHOT</marker.client.version> <marker.client.version>1.1.9-SNAPSHOT</marker.client.version>
<base-objects.version>2.1.6.1-SNAPSHOT</base-objects.version> <base-objects.version>2.1.6.1-SNAPSHOT</base-objects.version>
<es.version>7.9.2</es.version> <es.version>7.9.2</es.version>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<dubbo.version>2.7.4.1</dubbo.version> <dubbo.version>2.7.4.1</dubbo.version>
<curator.version>2.12.0</curator.version> <curator.version>2.12.0</curator.version>
<push.log.version>2.17.0-SNAPSHOT</push.log.version> <push.log.version>2.17.0-SNAPSHOT</push.log.version>
<event-client.version>1.0.9.8-SNAPSHOT</event-client.version> <event-client.version>1.0.9.9-SNAPSHOT</event-client.version>
<cleaner-unified-filter.version>1.1.5-SNAPSHOT</cleaner-unified-filter.version> <cleaner-unified-filter.version>1.1.5-SNAPSHOT</cleaner-unified-filter.version>
</properties> </properties>
...@@ -187,6 +187,17 @@ ...@@ -187,6 +187,17 @@
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version> <version>${easyexcel.version}</version>
<exclusions>
<exclusion>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.7.1</version>
</dependency> </dependency>
<!-- lombok --> <!-- lombok -->
<dependency> <dependency>
......
...@@ -2,10 +2,7 @@ package com.zhiwei.brandkbs2.common; ...@@ -2,10 +2,7 @@ package com.zhiwei.brandkbs2.common;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.ChannelTag; import com.zhiwei.brandkbs2.pojo.*;
import com.zhiwei.brandkbs2.pojo.HighlightWord;
import com.zhiwei.brandkbs2.pojo.Project;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
import com.zhiwei.brandkbs2.service.ChannelService; import com.zhiwei.brandkbs2.service.ChannelService;
import com.zhiwei.brandkbs2.service.SystemInfoService; import com.zhiwei.brandkbs2.service.SystemInfoService;
import com.zhiwei.brandkbs2.util.Tools; import com.zhiwei.brandkbs2.util.Tools;
...@@ -103,6 +100,11 @@ public class GlobalPojo { ...@@ -103,6 +100,11 @@ public class GlobalPojo {
*/ */
public static Map<String, SensitiveChannel> COMMON_SENSITIVE_CHANNEL = new HashMap<>(); public static Map<String, SensitiveChannel> COMMON_SENSITIVE_CHANNEL = new HashMap<>();
/**
* 字节定制指定渠道影响力信息
*/
public static Map<String, BytedanceCustomChannelInfluence> BYTEDANCE_CHANNEL_INFLUENCE = new HashMap<>();
@PostConstruct @PostConstruct
public void start() { public void start() {
try { try {
...@@ -139,9 +141,10 @@ public class GlobalPojo { ...@@ -139,9 +141,10 @@ public class GlobalPojo {
PROJECT_EMOTION_CHANNEL_DATA = channelService.getProjectEmotionChannelListData(); PROJECT_EMOTION_CHANNEL_DATA = channelService.getProjectEmotionChannelListData();
PROJECT_SENSITIVE_CHANNEL = systemInfoService.getProjectSensitiveChannel(); PROJECT_SENSITIVE_CHANNEL = systemInfoService.getProjectSensitiveChannel();
COMMON_SENSITIVE_CHANNEL = systemInfoService.getCommonSensitiveChannel(); COMMON_SENSITIVE_CHANNEL = systemInfoService.getCommonSensitiveChannel();
BYTEDANCE_CHANNEL_INFLUENCE = systemInfoService.getByteDanceChannelInfluence();
updateHighlightGraphs(); updateHighlightGraphs();
log.info("{}-获取PLATFORMS-size:{},TAGS-size:{},LINKED_GROUP_ID_TAGS:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{},YUQING-PROJECTS-size:{},PROJECT_EMOTION_CHANNEL_DATA-size:{},PROJECT_SENSITIVE_CHANNEL-size:{}, COMMON_SENSITIVE_CHANNEL-size:{}", logMsg, PLATFORMS.size(), TAGS.size(), log.info("{}-获取PLATFORMS-size:{},TAGS-size:{},LINKED_GROUP_ID_TAGS:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{},YUQING-PROJECTS-size:{},PROJECT_EMOTION_CHANNEL_DATA-size:{},PROJECT_SENSITIVE_CHANNEL-size:{}, COMMON_SENSITIVE_CHANNEL-size:{},BYTEDANCE_CHANNEL_INFLUENCE-size:{}", logMsg, PLATFORMS.size(), TAGS.size(),
LINKED_GROUP_ID_TAGS.size(), CHANNEL_TAGS.size(), MEDIA_TYPE.size(), PROJECT_MAP.size(), YU_QING_PROJECTS.size(), PROJECT_EMOTION_CHANNEL_DATA.size(), PROJECT_SENSITIVE_CHANNEL.size(), COMMON_SENSITIVE_CHANNEL.size()); LINKED_GROUP_ID_TAGS.size(), CHANNEL_TAGS.size(), MEDIA_TYPE.size(), PROJECT_MAP.size(), YU_QING_PROJECTS.size(), PROJECT_EMOTION_CHANNEL_DATA.size(), PROJECT_SENSITIVE_CHANNEL.size(), COMMON_SENSITIVE_CHANNEL.size(), BYTEDANCE_CHANNEL_INFLUENCE.size());
} catch (Exception e) { } catch (Exception e) {
log.info("{}-获取缓存值异常", logMsg, e); log.info("{}-获取缓存值异常", logMsg, e);
} }
......
...@@ -27,6 +27,7 @@ public class RedisKeyPrefix { ...@@ -27,6 +27,7 @@ public class RedisKeyPrefix {
public static final String INDEX_PLATFORM = "BRANDKBS:INDEX:PLATFORM:"; public static final String INDEX_PLATFORM = "BRANDKBS:INDEX:PLATFORM:";
public static final String INDEX_SPREAD = "BRANDKBS:INDEX:SPREAD:"; public static final String INDEX_SPREAD = "BRANDKBS:INDEX:SPREAD:";
public static final String INDEX_COMPARE_SUMMARY_MOBILE = "BRANDKBS:INDEX:COMPARE_SUMMARY:MOBILE:"; public static final String INDEX_COMPARE_SUMMARY_MOBILE = "BRANDKBS:INDEX:COMPARE_SUMMARY:MOBILE:";
public static final String INDEX_EMOTION = "BRANDKBS:INDEX:EMOTION:";
/** /**
* 渠道榜单缓存 * 渠道榜单缓存
*/ */
......
...@@ -55,17 +55,8 @@ public class InterfaceController { ...@@ -55,17 +55,8 @@ public class InterfaceController {
@ApiOperation("获取舆情动态-预警结果") @ApiOperation("获取舆情动态-预警结果")
@PostMapping("/warn/yuqing") @PostMapping("/warn/yuqing")
@Deprecated
public ResponseResult getYuqingWaring(@RequestBody JSONObject json) { public ResponseResult getYuqingWaring(@RequestBody JSONObject json) {
String projectId = json.getString("projectId"); String projectId = json.getString("projectId");
BrandkbsYuQingConfig config = json.getObject("config", BrandkbsYuQingConfig.class);
return projectWarnService.getYuqingWaring(projectId, config);
}
@ApiOperation("获取舆情动态-预警结果")
@PostMapping("/warn/yuqingNew")
public ResponseResult getYuqingWaringNew(@RequestBody JSONObject json) {
String projectId = json.getString("projectId");
BrandkbsYuQingConfigNew config = json.getObject("config", BrandkbsYuQingConfigNew.class); BrandkbsYuQingConfigNew config = json.getObject("config", BrandkbsYuQingConfigNew.class);
return projectWarnService.getYuqingWaringNew(projectId, config); return projectWarnService.getYuqingWaringNew(projectId, config);
} }
......
...@@ -519,15 +519,22 @@ public class AppDownloadController extends BaseController { ...@@ -519,15 +519,22 @@ public class AppDownloadController extends BaseController {
@DownloadTask(taskName = "事件影响力更新模板下载", description = "事件影响力更新模板") @DownloadTask(taskName = "事件影响力更新模板下载", description = "事件影响力更新模板")
public ResponseResult downloadEventUpdateTemplate(){ public ResponseResult downloadEventUpdateTemplate(){
List<List<String>> head = new ArrayList<>(); List<List<String>> head = new ArrayList<>();
head.add(Collections.singletonList("序号"));
head.add(Collections.singletonList("平台类型")); head.add(Collections.singletonList("平台类型"));
head.add(Collections.singletonList("渠道名称")); head.add(Collections.singletonList("发布平台"));
head.add(Collections.singletonList("链接")); head.add(Collections.singletonList("渠道"));
head.add(Collections.singletonList("事件名")); head.add(Collections.singletonList("时间"));
head.add(Collections.singletonList("微博转发")); head.add(Collections.singletonList("标题"));
head.add(Collections.singletonList("微博评论")); head.add(Collections.singletonList("文本"));
head.add(Collections.singletonList("微博点赞")); head.add(Collections.singletonList("地址"));
head.add(Collections.singletonList("微信阅读")); head.add(Collections.singletonList("命中词"));
head.add(Collections.singletonList("微信在看")); head.add(Collections.singletonList("情感倾向"));
head.add(Collections.singletonList("事件标签"));
head.add(Collections.singletonList("在看"));
head.add(Collections.singletonList("阅读"));
head.add(Collections.singletonList("点赞"));
head.add(Collections.singletonList("评论"));
head.add(Collections.singletonList("转发"));
// excel写入至指定路径 // excel写入至指定路径
String projectName = projectService.getProjectById(UserThreadLocal.getProjectId()).getProjectName(); String projectName = projectService.getProjectById(UserThreadLocal.getProjectId()).getProjectName();
String filePath = EasyExcelUtil.generateExcelFilePath(brandkbsFilePath, projectName, UserThreadLocal.getNickname(), "事件更新模板"); String filePath = EasyExcelUtil.generateExcelFilePath(brandkbsFilePath, projectName, UserThreadLocal.getNickname(), "事件更新模板");
......
...@@ -9,6 +9,7 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum; ...@@ -9,6 +9,7 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.ResponseResult; import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO; import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO;
import com.zhiwei.brandkbs2.service.EventService; import com.zhiwei.brandkbs2.service.EventService;
import com.zhiwei.brandkbs2.service.MarkDataService;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO; import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
import com.zhiwei.middleware.event.pojo.dto.EventDTO; import com.zhiwei.middleware.event.pojo.dto.EventDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -20,6 +21,7 @@ import org.springframework.http.ResponseEntity; ...@@ -20,6 +21,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -64,6 +66,9 @@ public class AppEventController extends BaseController { ...@@ -64,6 +66,9 @@ public class AppEventController extends BaseController {
private final EventService eventService; private final EventService eventService;
@Resource(name = "markDataServiceImpl")
MarkDataService markDataService;
public AppEventController(EventService eventService) { public AppEventController(EventService eventService) {
this.eventService = eventService; this.eventService = eventService;
} }
...@@ -355,4 +360,43 @@ public class AppEventController extends BaseController { ...@@ -355,4 +360,43 @@ public class AppEventController extends BaseController {
public ResponseResult aggTitleAnalyze(@RequestBody EventDTO dto){ public ResponseResult aggTitleAnalyze(@RequestBody EventDTO dto){
return eventService.aggTitleAnalyze(dto); return eventService.aggTitleAnalyze(dto);
} }
@ApiOperation("新-舆情分析-高频标题-基础信息")
@GetMapping("/analyze/frequent-title/info")
public ResponseResult getAggTitleBaseInfo(@RequestParam(value = "startTime") Long startTime,
@RequestParam(value = "endTime") Long endTime,
@RequestParam(value = "aggTitle") String aggTitle,
@RequestParam(value = "planId", required = false) String planId) {
return ResponseResult.success(markDataService.getAggTitleBaseInfo(aggTitle, startTime, endTime, planId));
}
@ApiOperation("新-舆情分析-高频标题-发布节点")
@GetMapping("/analyze/frequent-title/article-point")
public ResponseResult getArticlePoints(@RequestParam(value = "startTime") Long startTime,
@RequestParam(value = "endTime") Long endTime,
@RequestParam(value = "aggTitle") String aggTitle,
@RequestParam(value = "planId", required = false) String planId) {
return ResponseResult.success(markDataService.getAggTitleArticlePoints(aggTitle, startTime, endTime, planId));
}
@ApiOperation("新-舆情分析-高频标题-平台分布")
@GetMapping("/analyze/frequent-title/platform-percent")
public ResponseResult getAggTitlePlatformPercentage(@RequestParam(value = "startTime") Long startTime,
@RequestParam(value = "endTime") Long endTime,
@RequestParam(value = "aggTitle") String aggTitle,
@RequestParam(value = "planId", required = false) String planId) {
return ResponseResult.success(markDataService.getAggTitlePlatformPercentage(aggTitle, startTime, endTime, planId));
}
@ApiOperation("新-舆情分析-高频标题-发文列表")
@GetMapping("/analyze/frequent-title/articles")
public ResponseResult getArticleList(@RequestParam(value = "startTime") Long startTime,
@RequestParam(value = "endTime") Long endTime,
@RequestParam(value = "aggTitle") String aggTitle,
@RequestParam(value = "platform") String platform,
@RequestParam(value = "planId", required = false) String planId,
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return ResponseResult.success(markDataService.getArticleList(aggTitle, startTime, endTime, planId, platform, page, pageSize));
}
} }
...@@ -90,5 +90,15 @@ public class AppIndexController extends BaseController { ...@@ -90,5 +90,15 @@ public class AppIndexController extends BaseController {
return ResponseResult.success(indexService.getSpreadingTend(startTime, endTime, true)); return ResponseResult.success(indexService.getSpreadingTend(startTime, endTime, true));
} }
@ApiOperation("首页-净情感度")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "long")
})
@GetMapping("/emotion-percent")
public ResponseResult getEmotionPercent(@RequestParam(value = "startTime", required = false) Long startTime,
@RequestParam(value = "endTime", required = false) Long endTime) {
return ResponseResult.success(indexService.getEmotionPercent(startTime, endTime, true));
}
} }
package com.zhiwei.brandkbs2.dao;
import com.zhiwei.brandkbs2.pojo.BytedanceCustomChannelLevelInfo;
/**
* @ClassName: BytedanceCustomChannelDao
* @Description BytedanceCustomChannelDao
* @author: cjz
* @date: 2023-10-13 15:43
*/
public interface BytedanceCustomChannelLevelInfoDao extends BaseMongoDao<BytedanceCustomChannelLevelInfo>{
}
package com.zhiwei.brandkbs2.dao;
import com.zhiwei.brandkbs2.pojo.MarkSearchAnalyzeTask;
public interface MarkSearchAnalyzeTaskDao extends BaseMongoDao<MarkSearchAnalyzeTask>{
}
package com.zhiwei.brandkbs2.dao.impl;
import com.zhiwei.brandkbs2.dao.BytedanceCustomChannelLevelInfoDao;
import com.zhiwei.brandkbs2.pojo.BytedanceCustomChannelLevelInfo;
import org.springframework.stereotype.Component;
@Component("bytedanceCustomChannelLevelInfoDao")
public class BytedanceCustomChannelLevelInfoDaoImpl extends BaseMongoDaoImpl<BytedanceCustomChannelLevelInfo> implements BytedanceCustomChannelLevelInfoDao {
private static final String COLLECTION_NAME = "brandkbs_bytedance_custom_channel_level_info";
public BytedanceCustomChannelLevelInfoDaoImpl() {
super(COLLECTION_NAME);
}
}
package com.zhiwei.brandkbs2.dao.impl;
import com.zhiwei.brandkbs2.dao.MarkSearchAnalyzeTaskDao;
import com.zhiwei.brandkbs2.pojo.MarkSearchAnalyzeTask;
import org.springframework.stereotype.Component;
@Component("markSearchAnalyzeTaskDao")
public class MarkSearchAnalyzeTaskDaoImpl extends BaseMongoDaoImpl<MarkSearchAnalyzeTask> implements MarkSearchAnalyzeTaskDao {
private static final String COLLECTION_NAME = "brandkbs_search_analyze_task";
public MarkSearchAnalyzeTaskDaoImpl() {
super(COLLECTION_NAME);
}
}
...@@ -16,13 +16,15 @@ public class ExportBytedanceEventComputeResultDTO { ...@@ -16,13 +16,15 @@ public class ExportBytedanceEventComputeResultDTO {
@ExcelProperty("事件名") @ExcelProperty("事件名")
private String name; private String name;
@ExcelProperty("影响力指数") @ExcelProperty("渠道指标")
private Double inf; private Double inf;
@ExcelProperty("实时传播力") @ExcelProperty("流量指标")
private Double RMI; private Double RMI;
@ExcelProperty("传播影响力") @ExcelProperty("综合影响力")
private Double finalInf; private Double finalInf;
@ExcelProperty("传播量")
private Integer dataCount;
} }
...@@ -11,31 +11,51 @@ import lombok.Data; ...@@ -11,31 +11,51 @@ import lombok.Data;
*/ */
@Data @Data
public class UploadBytedanceEventDTO { public class UploadBytedanceEventDTO {
@ExcelProperty("序号")
private String number;
@ExcelProperty("平台类型") @ExcelProperty("平台类型")
private String platformType;
@ExcelProperty("发布平台")
private String platform; private String platform;
@ExcelProperty("渠道名称") @ExcelProperty("渠道")
private String channel; private String channel;
@ExcelProperty("链接") @ExcelProperty("时间")
private String time;
@ExcelProperty("标题")
private String title;
@ExcelProperty("文本")
private String content;
@ExcelProperty("地址")
private String url; private String url;
@ExcelProperty("事件名") @ExcelProperty("命中词")
private String hitWord;
@ExcelProperty("情感倾向")
private String emotion;
@ExcelProperty("事件标签")
private String eventName; private String eventName;
@ExcelProperty("微博转发") @ExcelProperty("在看")
private Integer weiboForward; private String reading;
@ExcelProperty("微博评论") @ExcelProperty("阅读")
private Integer weiboComment; private String read;
@ExcelProperty("微博点赞") @ExcelProperty("点赞")
private Integer weiboLike; private String like;
@ExcelProperty("微信阅读") @ExcelProperty("评论")
private Integer wechatRead; private String comment;
@ExcelProperty("微信在看") @ExcelProperty("转发")
private Integer wechatReading; private String forward;
} }
...@@ -4,11 +4,8 @@ import com.alibaba.excel.context.AnalysisContext; ...@@ -4,11 +4,8 @@ import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import com.zhiwei.brandkbs2.easyexcel.dto.UploadBytedanceEventDTO; import com.zhiwei.brandkbs2.easyexcel.dto.UploadBytedanceEventDTO;
import com.zhiwei.brandkbs2.pojo.BytedanceCustomEventUpdateTaskData; import com.zhiwei.brandkbs2.pojo.BytedanceCustomEventUpdateTaskData;
import com.zhiwei.brandkbs2.util.Tools;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -33,20 +30,20 @@ public class BytedanceEventListener extends AnalysisEventListener<UploadBytedanc ...@@ -33,20 +30,20 @@ public class BytedanceEventListener extends AnalysisEventListener<UploadBytedanc
public void invoke(UploadBytedanceEventDTO dto, AnalysisContext context) { public void invoke(UploadBytedanceEventDTO dto, AnalysisContext context) {
BytedanceCustomEventUpdateTaskData taskData = new BytedanceCustomEventUpdateTaskData(); BytedanceCustomEventUpdateTaskData taskData = new BytedanceCustomEventUpdateTaskData();
taskData.setTaskId(taskId); taskData.setTaskId(taskId);
taskData.setEventName(dto.getEventName()); taskData.setPlatformType(dto.getPlatformType());
taskData.setChannel(dto.getChannel());
taskData.setPlatform(dto.getPlatform()); taskData.setPlatform(dto.getPlatform());
taskData.setUrl(dto.getUrl()); taskData.setChannel(dto.getChannel());
taskData.setWeiboComment(dto.getWeiboComment()); taskData.setEventName(dto.getEventName());
taskData.setWeiboForward(dto.getWeiboForward()); // 填 "/" 当作0处理
taskData.setWeiboLike(dto.getWeiboLike()); taskData.setReading(Objects.isNull(dto.getReading()) || Objects.equals("/", dto.getReading()) ? 0 : Integer.parseInt(dto.getReading()));
taskData.setWechatRead(dto.getWechatRead()); taskData.setRead(Objects.isNull(dto.getRead()) || Objects.equals("/", dto.getRead()) ? 0 : Integer.parseInt(dto.getRead()));
taskData.setWechatReading(dto.getWechatReading()); taskData.setLike(Objects.isNull(dto.getLike()) || Objects.equals("/", dto.getLike()) ? 0 : Integer.parseInt(dto.getLike()));
taskData.setComment(Objects.isNull(dto.getComment()) || Objects.equals("/", dto.getComment()) ? 0 : Integer.parseInt(dto.getComment()));
taskData.setForward(Objects.isNull(dto.getForward()) || Objects.equals("/", dto.getForward()) ? 0 : Integer.parseInt(dto.getForward()));
data.add(taskData); data.add(taskData);
} }
@Override @Override
public void doAfterAllAnalysed(AnalysisContext context) { public void doAfterAllAnalysed(AnalysisContext context) {
} }
} }
...@@ -417,18 +417,18 @@ public class EsQueryTools { ...@@ -417,18 +417,18 @@ public class EsQueryTools {
public static void addSensitiveChannel(BrandkbsYuQingConfigNew config, BoolQueryBuilder boolQueryBuilder) { public static void addSensitiveChannel(BrandkbsYuQingConfigNew config, BoolQueryBuilder boolQueryBuilder) {
BoolQueryBuilder hitBoolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder hitBoolQuery = QueryBuilders.boolQuery();
if (!Tools.isEmpty(config.getPoliticsLevels())) { if (!Tools.isEmpty(config.getPoliticsLevels()) && !config.getPoliticsLevels().contains("全部")) {
List<String> hitList = config.getPoliticsLevels(); List<String> hitList = config.getPoliticsLevels();
if (config.getPoliticsLevels().contains("全部")) { // if (config.getPoliticsLevels().contains("全部")) {
hitList = ChannelType.POLITICS_LEVELS; // hitList = ChannelType.POLITICS_LEVELS;
} // }
hitList.forEach(politicsLevel -> hitBoolQuery.should(QueryBuilders.termQuery(GenericAttribute.ES_SENSITIVE_CHANNEL + "." + GenericAttribute.ES_POLITICS_LEVEL + ".keyword", politicsLevel))); hitList.forEach(politicsLevel -> hitBoolQuery.should(QueryBuilders.termQuery(GenericAttribute.ES_SENSITIVE_CHANNEL + "." + GenericAttribute.ES_POLITICS_LEVEL + ".keyword", politicsLevel)));
} }
if (!Tools.isEmpty(config.getFields())) { if (!Tools.isEmpty(config.getFields()) && !config.getFields().contains("全部")) {
List<String> hitList = config.getFields(); List<String> hitList = config.getFields();
if (config.getFields().contains("全部")) { // if (config.getFields().contains("全部")) {
hitList = ChannelType.COMMON_FIELDS; // hitList = ChannelType.COMMON_FIELDS;
} // }
hitList.forEach(field -> hitBoolQuery.should(QueryBuilders.termQuery(GenericAttribute.ES_SENSITIVE_CHANNEL + "." + GenericAttribute.ES_FIELD + ".keyword", field))); hitList.forEach(field -> hitBoolQuery.should(QueryBuilders.termQuery(GenericAttribute.ES_SENSITIVE_CHANNEL + "." + GenericAttribute.ES_FIELD + ".keyword", field)));
} }
boolQueryBuilder.must(hitBoolQuery); boolQueryBuilder.must(hitBoolQuery);
......
...@@ -50,7 +50,7 @@ public class ExceptionCatch { ...@@ -50,7 +50,7 @@ public class ExceptionCatch {
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public ResponseResult exception(Exception exception) { public ResponseResult exception(Exception exception) {
//记录日志 //记录日志
log.info("catch exception:", exception); log.error("catch exception:", exception);
//返回400操作失败 //返回400操作失败
return new ResponseResult(CommonCodeEnum.FAIL, Collections.EMPTY_LIST); return new ResponseResult(CommonCodeEnum.FAIL, Collections.EMPTY_LIST);
} }
......
...@@ -11,6 +11,7 @@ import lombok.Setter; ...@@ -11,6 +11,7 @@ import lombok.Setter;
*/ */
@Getter @Getter
@Setter @Setter
@Deprecated // 2024.3.22 计算公式调整 弃用
public class BytedanceCustomChannel extends AbstractBaseMongo{ public class BytedanceCustomChannel extends AbstractBaseMongo{
/** /**
......
...@@ -27,4 +27,9 @@ public class BytedanceCustomChannelInfluence extends AbstractBaseMongo{ ...@@ -27,4 +27,9 @@ public class BytedanceCustomChannelInfluence extends AbstractBaseMongo{
* 影响力 * 影响力
*/ */
private double influence; private double influence;
/**
* 渠道等级
*/
private String level;
} }
package com.zhiwei.brandkbs2.pojo;
import lombok.Getter;
import lombok.Setter;
/**
* @ClassName: BytedanceCustomChannelLevelInfo
* @Description 字节定制渠道等级、拐点、极值、权重对照表
* @author: cjz
* @date: 2024-3-20 14:09
*/
@Getter
@Setter
public class BytedanceCustomChannelLevelInfo extends AbstractBaseMongo{
/**
* 等级
*/
private String level;
/**
* HMax
*/
private double HMax;
/**
* 权重
*/
private double weight;
/**
* 临界
*/
private double threshold;
/**
* 系数
*/
private double coefficient;
}
package com.zhiwei.brandkbs2.pojo; package com.zhiwei.brandkbs2.pojo;
import com.zhiwei.brandkbs2.auth.UserThreadLocal; import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.easyexcel.dto.UploadBytedanceEventDTO;
import lombok.*; import lombok.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @ClassName: BytedanceCustomEventInfluenceTask * @ClassName: BytedanceCustomEventInfluenceTask
...@@ -40,14 +38,6 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{ ...@@ -40,14 +38,6 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
*/ */
private List<EventInfo> eventInfo; private List<EventInfo> eventInfo;
/** /**
* 事件数据
*/
// private Map<String, List<UploadBytedanceEventDTO>> eventData;
/**
* 报错数据
*/
private List<BytedanceCustomEventUpdateTaskData> errorData;
/**
* 竞品影响力指数 * 竞品影响力指数
*/ */
private Double contendInfluence; private Double contendInfluence;
...@@ -88,6 +78,10 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{ ...@@ -88,6 +78,10 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
*/ */
private String name; private String name;
/** /**
* 传播量(该事件的数据量)
*/
private Integer dataCount;
/**
* 影响力指数 * 影响力指数
*/ */
private Double influence; private Double influence;
...@@ -145,7 +139,7 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{ ...@@ -145,7 +139,7 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
task.setProcessStatus(ProcessStatus.CHANNEL_MATCH.getStatus()); task.setProcessStatus(ProcessStatus.CHANNEL_MATCH.getStatus());
task.setExtraCompute(extraCompute); task.setExtraCompute(extraCompute);
task.setEventInfo(new ArrayList<>()); task.setEventInfo(new ArrayList<>());
task.setErrorData(new ArrayList<>()); // task.setErrorData(new ArrayList<>());
task.setCancel(false); task.setCancel(false);
task.setSchedule(0); task.setSchedule(0);
task.setTotalSchedule(0); task.setTotalSchedule(0);
...@@ -165,7 +159,7 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{ ...@@ -165,7 +159,7 @@ public class BytedanceCustomEventUpdateTask extends AbstractBaseMongo{
task.setProcessStatus(ProcessStatus.QUERY_YUQING.getStatus()); task.setProcessStatus(ProcessStatus.QUERY_YUQING.getStatus());
task.setExtraCompute(false); task.setExtraCompute(false);
task.setEventInfo(null); task.setEventInfo(null);
task.setErrorData(null); // task.setErrorData(null);
task.setCancel(false); task.setCancel(false);
task.setSchedule(0); task.setSchedule(0);
task.setTotalSchedule(0); task.setTotalSchedule(0);
......
...@@ -6,7 +6,7 @@ import lombok.Setter; ...@@ -6,7 +6,7 @@ import lombok.Setter;
/** /**
* @ClassName: BytedanceCustomEventInfluenceTask * @ClassName: BytedanceCustomEventInfluenceTask
* @Description 字节定制事件影响力计算rw * @Description 字节定制事件影响力计算
* @author: cjz * @author: cjz
* @date: 2023-10-16 15:12 * @date: 2023-10-16 15:12
*/ */
...@@ -16,21 +16,21 @@ import lombok.Setter; ...@@ -16,21 +16,21 @@ import lombok.Setter;
public class BytedanceCustomEventUpdateTaskData extends AbstractBaseMongo { public class BytedanceCustomEventUpdateTaskData extends AbstractBaseMongo {
private String taskId; private String taskId;
private String platformType;
private String platform; private String platform;
private String channel; private String channel;
private String url;
private String eventName; private String eventName;
private Integer weiboForward; private Integer reading;
private Integer weiboComment; private Integer read;
private Integer weiboLike; private Integer like;
private Integer wechatRead; private Integer comment;
private Integer wechatReading; private Integer forward;
} }
package com.zhiwei.brandkbs2.pojo;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @ClassName: YuqingSearchAnalyzeTask
* @Description 查舆情数据分析任务
* @author: cjz
* @date: 2024-04-16 14:21
*/
@Getter
@Setter
@AllArgsConstructor
public class MarkSearchAnalyzeTask extends AbstractBaseMongo {
/**
* 查舆情搜索条件
*/
private MarkSearchDTO markSearchDTO;
/**
* 数据分析结果-词云
*/
List<JSONObject> highWord;
/**
* 词云计算是否已完成
*/
private Boolean finish;
/**
* 创建时间
*/
private Long cTime;
}
...@@ -195,4 +195,9 @@ public class MarkSearchDTO { ...@@ -195,4 +195,9 @@ public class MarkSearchDTO {
*/ */
@ApiModelProperty(value = "gid限制") @ApiModelProperty(value = "gid限制")
private Long pageGid; private Long pageGid;
/**
* 聚合标题
*/
@ApiModelProperty(value = "聚合标题")
private String aggTitle;
} }
...@@ -19,6 +19,16 @@ public class BrandkbsYuQingConfigNew { ...@@ -19,6 +19,16 @@ public class BrandkbsYuQingConfigNew {
private String channel; private String channel;
/** /**
* 屏蔽关键字命中
*/
private String noiseKeyword;
/**
* 屏蔽自定义渠道
*/
private String noiseChannel;
/**
* 行政级别 * 行政级别
*/ */
private List<String> politicsLevels; private List<String> politicsLevels;
......
...@@ -81,4 +81,12 @@ public interface IndexService { ...@@ -81,4 +81,12 @@ public interface IndexService {
*/ */
JSONObject getMobileWholeCriteria(Long startTime, Long endTime); JSONObject getMobileWholeCriteria(Long startTime, Long endTime);
/**
* 获取主品牌净情感度
* @param startTime 开始时间
* @param endTime 结束时间
* @param cache 是否优先读取缓存
* @return
*/
JSONObject getEmotionPercent(Long startTime, Long endTime, boolean cache);
} }
...@@ -5,11 +5,7 @@ import com.zhiwei.brandkbs2.model.ResponseResult; ...@@ -5,11 +5,7 @@ import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.BaseMap; import com.zhiwei.brandkbs2.pojo.BaseMap;
import com.zhiwei.brandkbs2.pojo.Event; import com.zhiwei.brandkbs2.pojo.Event;
import com.zhiwei.brandkbs2.pojo.MarkFlowEntity; import com.zhiwei.brandkbs2.pojo.MarkFlowEntity;
import com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO; import com.zhiwei.brandkbs2.pojo.dto.*;
import com.zhiwei.brandkbs2.pojo.dto.ExportSearchWholeDTO;
import com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO;
import com.zhiwei.brandkbs2.pojo.dto.SearchFilterDTO;
import com.zhiwei.brandkbs2.pojo.dto.NonManualProjectPlanDTO;
import com.zhiwei.brandkbs2.pojo.vo.LineVO; import com.zhiwei.brandkbs2.pojo.vo.LineVO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO; import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
...@@ -545,95 +541,88 @@ public interface MarkDataService { ...@@ -545,95 +541,88 @@ public interface MarkDataService {
/** /**
* 新-舆情分析-舆情总量 * 新-舆情分析-舆情总量
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
* @throws IOException * @throws IOException
*/ */
JSONObject getYuqingAmount(Long startTime, Long endTime, String planId); JSONObject getYuqingAmount(MarkSearchDTO dto);
/** /**
* 新-舆情分析-情感分布 * 新-舆情分析-情感分布
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
* @throws IOException * @throws IOException
*/ */
JSONObject getYuqingEmotionDistribution(Long startTime, Long endTime, String planId); JSONObject getYuqingEmotionDistribution(MarkSearchDTO dto);
/** /**
* 新-舆情分析-重点平台 * 新-舆情分析-重点平台
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
JSONObject getImportantPlatformPercentage(Long startTime, Long endTime, String planId); JSONObject getImportantPlatformPercentage(MarkSearchDTO dto);
/** /**
* 新-舆情分析-平台占比 * 新-舆情分析-平台占比
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
List<JSONObject> getPlatformPercentage(Long startTime, Long endTime, String planId); List<JSONObject> geAnalyzePlatformPercentage(MarkSearchDTO dto);
/** /**
* 新-舆情分析-舆情走势图 * 新-舆情分析-舆情走势图
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
JSONObject getSpreadTendency(Long startTime, Long endTime, String planId); JSONObject getSpreadTendency(MarkSearchDTO dto);
/** /**
* 新-舆情分析-活跃渠道 * 新-舆情分析-活跃渠道
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
List<JSONObject> getActiveChannels(Long startTime, Long endTime, String planId); List<JSONObject> getActiveChannels(MarkSearchDTO dto);
/** /**
* 新-舆情分析-ip分布 * 新-舆情分析-ip分布
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
List<JSONObject> getArticleIpLocated(Long startTime, Long endTime, String planId, int size); List<JSONObject> getArticleIpLocated(MarkSearchDTO dto);
/** /**
* 新-舆情分析-活跃渠道、ip分布、词云详情页面 * 新-舆情分析-活跃渠道、ip分布、词云详情页面
* @param dto * @param dto 标注数据搜索传输类
* @return * @return
*/ */
PageVO<MarkFlowEntity> getYuqingAnalyzeDetail(MarkSearchDTO dto); PageVO<MarkFlowEntity> getYuqingAnalyzeDetail(MarkSearchDTO dto);
void cacheHighWord(Long startTime, Long endTime, String planId, boolean cache);
/** /**
* 新-舆情分析-词云 * 新-舆情分析-词云
* @param startTime * @param dto 标注数据搜索传输类
* @param endTime
* @param planId
* @return * @return
*/ */
List<JSONObject> getHighWord(Long startTime, Long endTime, String planId, boolean cache); List<JSONObject> getAnalyzeHighWord(MarkSearchDTO dto, boolean cache);
/**
* 查舆情-数据分析-生成词云
* @param dto
* @return
*/
List<JSONObject> getSearchAnalyzeHighWord(MarkSearchDTO dto);
/** /**
* 新-舆情分析-高频标题 * 新-舆情分析-高频标题
* @param startTime * @param startTime
* @param endTime * @param endTime
* @param planId
* @param size * @param size
* @param include
* @return * @return
*/ */
List<JSONObject> getLastNews(Long startTime, Long endTime, String planId, int size, boolean include); List<JSONObject> getLastNews(Long startTime, Long endTime, int size);
List<JSONObject> getLastNews(MarkSearchDTO dto, int size);
/** /**
* 舆情分析-高频标题详情页-基础信息 * 舆情分析-高频标题详情页-基础信息
...@@ -645,6 +634,8 @@ public interface MarkDataService { ...@@ -645,6 +634,8 @@ public interface MarkDataService {
*/ */
JSONObject getAggTitleBaseInfo(String aggTitle, Long startTime, Long endTime, String planId); JSONObject getAggTitleBaseInfo(String aggTitle, Long startTime, Long endTime, String planId);
JSONObject getAggTitleBaseInfo(MarkSearchDTO dto);
/** /**
* 舆情分析-高频标题详情页-发布节点 * 舆情分析-高频标题详情页-发布节点
* @param aggTitle * @param aggTitle
...@@ -655,6 +646,8 @@ public interface MarkDataService { ...@@ -655,6 +646,8 @@ public interface MarkDataService {
*/ */
List<JSONObject> getAggTitleArticlePoints(String aggTitle, Long startTime, Long endTime, String planId); List<JSONObject> getAggTitleArticlePoints(String aggTitle, Long startTime, Long endTime, String planId);
List<JSONObject> getAggTitleArticlePoints(MarkSearchDTO dto);
/** /**
* 舆情分析-高频标题详情页-平台分布 * 舆情分析-高频标题详情页-平台分布
* @param aggTitle * @param aggTitle
...@@ -665,6 +658,8 @@ public interface MarkDataService { ...@@ -665,6 +658,8 @@ public interface MarkDataService {
*/ */
List<JSONObject> getAggTitlePlatformPercentage(String aggTitle, Long startTime, Long endTime, String planId); List<JSONObject> getAggTitlePlatformPercentage(String aggTitle, Long startTime, Long endTime, String planId);
List<JSONObject> getAggTitlePlatformPercentage(MarkSearchDTO dto);
/** /**
* 舆情分析-高频标题详情页-发文列表 * 舆情分析-高频标题详情页-发文列表
* @param aggTitle * @param aggTitle
...@@ -676,4 +671,6 @@ public interface MarkDataService { ...@@ -676,4 +671,6 @@ public interface MarkDataService {
* @return * @return
*/ */
PageVO<JSONObject> getArticleList(String aggTitle, Long startTime, Long endTime, String planId, String platform, int page, int pageSize); PageVO<JSONObject> getArticleList(String aggTitle, Long startTime, Long endTime, String planId, String platform, int page, int pageSize);
PageVO<JSONObject> getArticleList(MarkSearchDTO dto);
} }
...@@ -23,14 +23,6 @@ public interface ProjectWarnService { ...@@ -23,14 +23,6 @@ public interface ProjectWarnService {
ResponseResult getProjectWarnCriteriaDefault(String projectId, String type); ResponseResult getProjectWarnCriteriaDefault(String projectId, String type);
/** /**
* 获取舆情动态预警
* @param projectId
* @param brandkbsYuQingConfig
* @return
*/
ResponseResult getYuqingWaring(String projectId, BrandkbsYuQingConfig brandkbsYuQingConfig);
/**
* 获取舆情动态预警-新 * 获取舆情动态预警-新
* @param projectId * @param projectId
* @param brandkbsYuQingConfigNew * @param brandkbsYuQingConfigNew
......
package com.zhiwei.brandkbs2.service; package com.zhiwei.brandkbs2.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.BytedanceCustomChannelInfluence;
import com.zhiwei.brandkbs2.pojo.ChannelTag; import com.zhiwei.brandkbs2.pojo.ChannelTag;
import com.zhiwei.brandkbs2.pojo.Project; import com.zhiwei.brandkbs2.pojo.Project;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel; import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
...@@ -70,4 +71,10 @@ public interface SystemInfoService { ...@@ -70,4 +71,10 @@ public interface SystemInfoService {
* @return * @return
*/ */
Map<String, SensitiveChannel> getCommonSensitiveChannel(); Map<String, SensitiveChannel> getCommonSensitiveChannel();
/**
* 获取字节定制指定渠道影响力信息
* @return
*/
Map<String, BytedanceCustomChannelInfluence> getByteDanceChannelInfluence();
} }
...@@ -994,69 +994,70 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -994,69 +994,70 @@ public class ChannelServiceImpl implements ChannelService {
@Override @Override
public Channel calculateChannelEmotionIndex(Channel channel) { public Channel calculateChannelEmotionIndex(Channel channel) {
try { // 渠道倾向及渠道影响力指数计算关闭
Project project = projectService.getProjectById(channel.getProjectId()); // try {
// 数据格式变化未含有contendId部分 // Project project = projectService.getProjectById(channel.getProjectId());
if (null == channel.getContendId()) { // // 数据格式变化未含有contendId部分
channel.setContendId("0"); // if (null == channel.getContendId()) {
} // channel.setContendId("0");
// 不做统计 // }
if (!hasEmotion(channel)) { // // 不做统计
return channel; // if (!hasEmotion(channel)) {
} // return channel;
// 该渠道发布正面稿件 // }
Long positiveCount = markCountByEmotion(channel, EmotionEnum.POSITIVE.getName()); // // 该渠道发布正面稿件
// 该渠道发布中性稿件 // Long positiveCount = markCountByEmotion(channel, EmotionEnum.POSITIVE.getName());
Long neutralCount = markCountByEmotion(channel, EmotionEnum.NEUTRAL.getName()); // // 该渠道发布中性稿件
// 该渠道发布负面稿件 // Long neutralCount = markCountByEmotion(channel, EmotionEnum.NEUTRAL.getName());
Long negativeCount = markCountByEmotion(channel, EmotionEnum.NEGATIVE.getName()); // // 该渠道发布负面稿件
// 是否友好渠道 // Long negativeCount = markCountByEmotion(channel, EmotionEnum.NEGATIVE.getName());
boolean isPositive = false; // // 是否友好渠道
boolean isNegative = false; // boolean isPositive = false;
long specNegativeCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(), // boolean isNegative = false;
Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()), // long specNegativeCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
EmotionEnum.NEGATIVE.getName()); // Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()),
long specPositiveCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(), // EmotionEnum.NEGATIVE.getName());
Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName()); // long specPositiveCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
// 特殊情况:若皆有发布过反常稿件 // Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName());
if (specNegativeCount > 0 && specPositiveCount > 0) { // // 特殊情况:若皆有发布过反常稿件
// 正面稿件数>负面稿件数,为正面 // if (specNegativeCount > 0 && specPositiveCount > 0) {
if (positiveCount > negativeCount) { // // 正面稿件数>负面稿件数,为正面
isPositive = true; // if (positiveCount > negativeCount) {
// 正面稿件数<负面稿件数,为负面 // isPositive = true;
} else if (positiveCount < negativeCount) { // // 正面稿件数<负面稿件数,为负面
isNegative = true; // } else if (positiveCount < negativeCount) {
} // isNegative = true;
} else { // }
// 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件) // } else {
if (negativeCount > positiveCount) { // // 在正/中性事件中发布负面稿件||负面报道数>正面报道数(满足任一条件)
isNegative = true; // if (negativeCount > positiveCount) {
// 如果有在正面事件中发布负面稿件 // isNegative = true;
} else if (specNegativeCount > 0) { // // 如果有在正面事件中发布负面稿件
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64 // } else if (specNegativeCount > 0) {
if (positiveCount > negativeCount && positiveCount >= neutralCount // // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
&& (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) { // if (positiveCount > negativeCount && positiveCount >= neutralCount
isPositive = true; // && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
} else { // isPositive = true;
isNegative = true; // } else {
} // isNegative = true;
} else { // }
// 在负面事件中发布过正面稿件即满足 // } else {
if (specPositiveCount > 0) { // // 在负面事件中发布过正面稿件即满足
isPositive = true; // if (specPositiveCount > 0) {
// 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64 // isPositive = true;
} else if (positiveCount > negativeCount && positiveCount >= neutralCount // // 或满足三者复合条件:发布正面稿件>负面稿件&&正面稿件>=中性稿件&&月均参与正面事件数≥4.64
&& (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) { // } else if (positiveCount > negativeCount && positiveCount >= neutralCount
isPositive = true; // && (this.inEventCountMonthAverage(channel, EmotionEnum.POSITIVE.getName()) >= 4.64)) {
} // isPositive = true;
} // }
} // }
// 更新渠道指数,渠道等级,情感倾向并记录变化 // }
this.updateChannel(channel, project, positiveCount, neutralCount, negativeCount, isPositive, isNegative, // // 更新渠道指数,渠道等级,情感倾向并记录变化
specPositiveCount, specNegativeCount); // this.updateChannel(channel, project, positiveCount, neutralCount, negativeCount, isPositive, isNegative,
} catch (Exception e) { // specPositiveCount, specNegativeCount);
log.error("calculateChannelEmotionIndex-", e); // } catch (Exception e) {
} // log.error("calculateChannelEmotionIndex-", e);
// }
return channel; return channel;
} }
......
...@@ -903,7 +903,7 @@ public class EventServiceImpl implements EventService { ...@@ -903,7 +903,7 @@ public class EventServiceImpl implements EventService {
if (cache && StringUtils.isNotEmpty(resultStr)) { if (cache && StringUtils.isNotEmpty(resultStr)) {
return JSON.parseArray(resultStr, JSONObject.class); return JSON.parseArray(resultStr, JSONObject.class);
} }
List<JSONObject> resultList = markDataService.getLastNews(startTime, endTime, null, 50, true); List<JSONObject> resultList = markDataService.getLastNews(startTime, endTime, 50);
redisUtil.setExpire(redisKey, JSON.toJSONString(resultList)); redisUtil.setExpire(redisKey, JSON.toJSONString(resultList));
return resultList; return resultList;
} }
......
...@@ -334,6 +334,58 @@ public class IndexServiceImpl implements IndexService { ...@@ -334,6 +334,58 @@ public class IndexServiceImpl implements IndexService {
return result; return result;
} }
@Override
public JSONObject getEmotionPercent(Long startTime, Long endTime, boolean cache) {
if (Objects.isNull(startTime) || Objects.isNull(endTime)) {
Long[] timeRangeMonth = commonService.getTimeRangeMonth();
startTime = timeRangeMonth[0];
endTime = timeRangeMonth[1];
}
String projectId = UserThreadLocal.getProjectId();
String redisKey = RedisUtil.getIndexEmotionKey(projectId, startTime, endTime);
String resultStr;
// 返回缓存
if (cache && StringUtils.isNotEmpty(resultStr = redisUtil.get(redisKey))) {
return JSON.parseObject(resultStr);
}
JSONObject jsonObject = new JSONObject();
try {
// 关于NSR计算:NSR净情感度=(正面-负面)/(正面+负面)*100%
// 项目总正面稿件数
long totalPositiveCount = markDataService.getYuqingMarkCount(null, null, EmotionEnum.POSITIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
// 项目总负面稿件数
long totalNegativeCount = markDataService.getYuqingMarkCount(null, null, EmotionEnum.NEGATIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
// 项目均值NSR
double avg = 0 == totalPositiveCount + totalNegativeCount ? 0 :(totalPositiveCount - totalNegativeCount) / (double) (totalPositiveCount + totalNegativeCount);
jsonObject.put("avgNSR", avg);
// 正面稿件数
long positiveCount = markDataService.getYuqingMarkCount(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
jsonObject.put("positiveCount", positiveCount);
// 负面稿件数
long negativeCount = markDataService.getYuqingMarkCount(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
jsonObject.put("negativeCount", negativeCount);
// 本次NSR
double NSR = 0 == positiveCount + negativeCount ? 0 :(positiveCount - negativeCount) / (double) (positiveCount + negativeCount);
jsonObject.put("NSR", NSR);
// 上一周期开始时间
long previousStartTime = startTime - (endTime - startTime);
// 上一周期正面稿件数
long previousPositiveCount = markDataService.getYuqingMarkCount(previousStartTime, startTime, EmotionEnum.POSITIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
// 上一周期负面稿件数
long previousNegativeCount = markDataService.getYuqingMarkCount(previousStartTime, startTime, EmotionEnum.NEGATIVE.getName(), projectId, Constant.PRIMARY_CONTEND_ID);
// 上一周期NSR
double previousNSR = 0 == previousPositiveCount + previousNegativeCount ? 0 :(previousPositiveCount - previousNegativeCount) / (double) (previousPositiveCount + previousNegativeCount);
// 环比
jsonObject.put("compare", NSR - previousNSR);
redisUtil.setExpire(redisKey, JSON.toJSONString(jsonObject));
} catch (Exception e) {
ExceptionCast.cast(CommonCodeEnum.FAIL, "getEmotionPercent异常", e);
}
return jsonObject;
}
public List<JSONObject> getPlatformProportionWithPlatform(Long startTime, Long endTime, String emotion, String projectId, String contendId, long normalCount) { public List<JSONObject> getPlatformProportionWithPlatform(Long startTime, Long endTime, String emotion, String projectId, String contendId, long normalCount) {
List<String> platformIds = GlobalPojo.PLATFORMS.stream().map(MessagePlatform::getId).collect(Collectors.toList()); List<String> platformIds = GlobalPojo.PLATFORMS.stream().map(MessagePlatform::getId).collect(Collectors.toList());
List<JSONObject> resultList = new ArrayList<>(platformIds.size()); List<JSONObject> resultList = new ArrayList<>(platformIds.size());
......
...@@ -302,89 +302,6 @@ public class ProjectWarnServiceImpl implements ProjectWarnService { ...@@ -302,89 +302,6 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
return new BrandkbsWarnTemplate(firstCount, key1, key2, key3, key4, new BrandkbsYuQingWarn(collect)); return new BrandkbsWarnTemplate(firstCount, key1, key2, key3, key4, new BrandkbsYuQingWarn(collect));
} }
@Deprecated
private BrandkbsWarnTemplate brandkbsWarnTemplate4Yuqing(BrandkbsYuQingConfig config, List<BaseMap> datas, long start, long end, AbstractProject project) {
if (datas.isEmpty()) {
return null;
}
int firstCount = datas.size();
// key1
String key1 = "【品见】舆情动态-" + project.getProjectName();
// key2
// String key2Header = "全部";
String key2Header = "";
StringBuilder mediaChannel = new StringBuilder();
List<String> politicsLevels = config.getPoliticsLevels();
List<String> fields = config.getFields();
if(Tools.isEmpty(politicsLevels)){
key2Header += "【全部级别】";
}else if(politicsLevels.contains("全部")){
key2Header += "【重点级别】";
}else{
politicsLevels.forEach(politicsLevel -> mediaChannel.append(politicsLevel).append("、"));
}
if (Tools.isEmpty(fields)) {
if (0 != key2Header.length()) {
key2Header += "、";
key2Header += "【全部领域】,";
} else {
key2Header += "【全部领域】";
}
} else if (fields.contains("全部")) {
if (0 != key2Header.length()) {
key2Header += "、";
key2Header += "【重点领域】,";
} else {
key2Header += "【重点领域】";
}
} else {
fields.forEach(field -> mediaChannel.append(field).append("、"));
}
if (0 != mediaChannel.length()) {
if (0 != key2Header.length()) {
key2Header += "、";
}
// 替换“全部” 并去掉末位的、
key2Header += mediaChannel.deleteCharAt(mediaChannel.length() - 1).toString();
key2Header += "媒体,";
}
StringBuilder dataType = new StringBuilder();
config.getMarkerTags().forEach(emotion -> dataType.append(emotion).append(" "));
dataType.append("(本品)");
// 如果有竞品
if (CollectionUtils.isNotEmpty(config.getContends())) {
dataType.append(",");
config.getContends().forEach(contend -> dataType.append(projectService.getProjectByContendId(project.getId(), contend).getBrandName()).append(" "));
dataType.append("(竞品)");
}
String key2 = key2Header + dataType;
// key3
String key3 = Constant.SPEC_MINUTE_FORMAT.format(start) + " ~ " + Constant.SPEC_MINUTE_FORMAT.format(end);
// key4
String key4;
StringBuilder keyBuilder4 = new StringBuilder();
for (int i = 0; i < Math.min(datas.size(), 2); i++) {
BaseMap baseMap = datas.get(i);
String platform = baseMap.getPlatform();
String source = baseMap.getSource();
String title = baseMap.getTitle();
keyBuilder4.append(platform).append("-").append(source).append("\r\n");
// 最后一条
if (datas.size() == i + 1) {
keyBuilder4.append(i + 1).append("、").append(title);
} else {
keyBuilder4.append(i + 1).append("、").append(title).append("\r\n");
}
}
if (datas.size() > 2) {
key4 = keyBuilder4.append("...").toString();
} else {
key4 = keyBuilder4.toString();
}
List<BaseMapCompound> collect = datas.stream().map(baseMap -> BaseMapCompound.createFromBaseMap(baseMap, project.getId())).collect(Collectors.toList());
return new BrandkbsWarnTemplate(firstCount, key1, key2, key3, key4, new BrandkbsYuQingWarn(collect));
}
private BrandkbsWarnTemplate brandkbsWarnTemplate4Channel(BrandkbsChannelConfig config, List<BaseMap> datas, long start, long end, AbstractProject project) { private BrandkbsWarnTemplate brandkbsWarnTemplate4Channel(BrandkbsChannelConfig config, List<BaseMap> datas, long start, long end, AbstractProject project) {
if (datas.isEmpty()) { if (datas.isEmpty()) {
return null; return null;
...@@ -703,65 +620,6 @@ public class ProjectWarnServiceImpl implements ProjectWarnService { ...@@ -703,65 +620,6 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
} }
@Override @Override
@Deprecated
public ResponseResult getYuqingWaring(String projectId, BrandkbsYuQingConfig config) {
Project project = null;
long end = System.currentTimeMillis();
long start = end - config.getPushInterval();
try {
project = projectService.getProjectById(projectId);
log.info("获取舆情动态预警开始,project:{}", project.getProjectName());
EsClientDao.SearchHelper helper = EsClientDao.createSearchHelper();
// 发声渠道
BoolQueryBuilder postFilter = EsQueryTools.assembleCacheMapsQueryWithProject(projectId, config);
// 时间(标注时间)
postFilter.must(QueryBuilders.rangeQuery("mtime").gte(start).lt(end));
// 文章类型
if (CollectionUtils.isNotEmpty(config.getPrimary()) && config.getPrimary().size() == 1) {
postFilter.must(EsQueryTools.assembleForwardQuery(config.getPrimary().get(0)));
}
// 本品舆情+竞品舆情
BoolQueryBuilder sourceBuilder = QueryBuilders.boolQuery();
if (CollectionUtils.isNotEmpty(config.getMarkerTags())) {
config.getMarkerTags().forEach(tagName -> sourceBuilder.should(QueryBuilders.termQuery("brandkbs_mark_cache_maps.name.keyword", tagName)));
}
postFilter.must(sourceBuilder);
EsQueryTools.assembleContendsQuery(postFilter, config.getContends());
// postFilter.must(EsQueryTools.assembleNormalKeywordQuery(config.getKeyword(), new String[]{GenericAttribute.ES_IND_FULL_TEXT}));
helper.setPostFilter(postFilter);
SearchHits searchHits = esClientDao.searchHits(helper);
log.info("获取舆情动态预警-es搜索到数据:{}条,剩余关键词筛选未进行,project:{}", searchHits.getHits().length, project.getProjectName());
List<BaseMap> datas = Arrays.stream(searchHits.getHits()).map(hit -> {
Map<String, Object> sourceMap = hit.getSourceAsMap();
BaseMap baseMap = Tools.getBaseFromEsMap(sourceMap);
// 关键词命中
if (!Tools.isContains(config.getKeyword(), baseMap.getTitle() + baseMap.getContent())) {
return null;
}
JSONObject hitMap = Tools.getBrandkbsHitMapWithProjectId(sourceMap, projectId);
String contendId = hitMap.getString("contend_id");
if (!hitMap.isEmpty() && (null != config.getContends() && config.getContends().contains(contendId))) {
baseMap.setBrandName(projectService.getProjectByContendId(projectId, contendId).getBrandName());
}
baseMap.setTitle(baseMap.getTitleNullOptionalContent());
baseMap.subStringContentTop();
return baseMap;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 开启去重
if (Boolean.TRUE.equals(config.getDuplicate())) {
datas = duplicateBaseMapList(datas);
}
log.info("获取舆情动态预警结束,project:{}", project.getProjectName());
// 封装返回值
return ResponseResult.success(brandkbsWarnTemplate4Yuqing(config, datas, start, end, project));
} catch (Exception e) {
log.info("获取舆情动态预警失败,project:{}", project.getProjectName(), e);
}
return ResponseResult.failure("获取舆情动态预警失败");
}
@Override
public ResponseResult getYuqingWaringNew(String projectId, BrandkbsYuQingConfigNew config) { public ResponseResult getYuqingWaringNew(String projectId, BrandkbsYuQingConfigNew config) {
Project project; Project project;
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
...@@ -788,6 +646,10 @@ public class ProjectWarnServiceImpl implements ProjectWarnService { ...@@ -788,6 +646,10 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
if (StringUtils.isNotBlank(config.getChannel())){ if (StringUtils.isNotBlank(config.getChannel())){
postFilter.must(EsQueryTools.assembleSourceQuery(config.getChannel())); postFilter.must(EsQueryTools.assembleSourceQuery(config.getChannel()));
} }
// 屏蔽渠道
if (StringUtils.isNotBlank(config.getNoiseChannel())){
postFilter.mustNot(EsQueryTools.assembleSourceQuery(config.getNoiseChannel()));
}
helper.setPostFilter(postFilter); helper.setPostFilter(postFilter);
SearchHits searchHits = esClientDao.searchHits(helper); SearchHits searchHits = esClientDao.searchHits(helper);
log.info("获取新舆情动态预警-es搜索到数据:{}条,剩余关键词筛选未进行,project:{}", searchHits.getHits().length, project.getProjectName()); log.info("获取新舆情动态预警-es搜索到数据:{}条,剩余关键词筛选未进行,project:{}", searchHits.getHits().length, project.getProjectName());
...@@ -795,7 +657,11 @@ public class ProjectWarnServiceImpl implements ProjectWarnService { ...@@ -795,7 +657,11 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
Map<String, Object> sourceMap = hit.getSourceAsMap(); Map<String, Object> sourceMap = hit.getSourceAsMap();
BaseMap baseMap = Tools.getBaseFromEsMap(sourceMap); BaseMap baseMap = Tools.getBaseFromEsMap(sourceMap);
// 关键词命中 // 关键词命中
if (!Tools.isContains(config.getKeyword(), baseMap.getTitle() + baseMap.getContent())) { if (!Tools.isEmpty(config.getKeyword()) && !Tools.isContains(config.getKeyword(), baseMap.getTitle() + baseMap.getContent())) {
return null;
}
// 屏蔽关键词命中
if (!Tools.isEmpty(config.getNoiseKeyword()) && Tools.isContains(config.getNoiseKeyword(), baseMap.getTitle() + baseMap.getContent())) {
return null; return null;
} }
baseMap.setTitle(baseMap.getTitleNullOptionalContent()); baseMap.setTitle(baseMap.getTitleNullOptionalContent());
......
...@@ -3,19 +3,15 @@ package com.zhiwei.brandkbs2.service.impl; ...@@ -3,19 +3,15 @@ package com.zhiwei.brandkbs2.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.zhiwei.brandkbs2.dao.ChannelTagDao; import com.zhiwei.brandkbs2.dao.*;
import com.zhiwei.brandkbs2.dao.MediaTypeDao; import com.zhiwei.brandkbs2.pojo.*;
import com.zhiwei.brandkbs2.dao.ProjectDao;
import com.zhiwei.brandkbs2.dao.QbjcPojoDao;
import com.zhiwei.brandkbs2.pojo.ChannelTag;
import com.zhiwei.brandkbs2.pojo.MediaType;
import com.zhiwei.brandkbs2.pojo.Project;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
import com.zhiwei.brandkbs2.service.SystemInfoService; import com.zhiwei.brandkbs2.service.SystemInfoService;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform; import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
import com.zhiwei.qbjc.bean.pojo.common.Tag; import com.zhiwei.qbjc.bean.pojo.common.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -48,6 +44,9 @@ public class SystemInfoServiceImpl implements SystemInfoService { ...@@ -48,6 +44,9 @@ public class SystemInfoServiceImpl implements SystemInfoService {
@Resource @Resource
private ProjectDao projectDao; private ProjectDao projectDao;
@Resource(name = "bytedanceCustomChannelInfluenceDao")
private BytedanceCustomChannelInfluenceDao bytedanceCustomChannelInfluenceDao;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
...@@ -132,4 +131,10 @@ public class SystemInfoServiceImpl implements SystemInfoService { ...@@ -132,4 +131,10 @@ public class SystemInfoServiceImpl implements SystemInfoService {
List<SensitiveChannel> commonSensitiveChannel = qbjcPojoDao.findCommonSensitiveChannel(); List<SensitiveChannel> commonSensitiveChannel = qbjcPojoDao.findCommonSensitiveChannel();
return commonSensitiveChannel.stream().collect(Collectors.toMap(SensitiveChannel::getName, o-> o, (k1, k2) -> k1)); return commonSensitiveChannel.stream().collect(Collectors.toMap(SensitiveChannel::getName, o-> o, (k1, k2) -> k1));
} }
@Override
public Map<String, BytedanceCustomChannelInfluence> getByteDanceChannelInfluence() {
return bytedanceCustomChannelInfluenceDao.findList(new Query())
.stream().collect(Collectors.toMap(data -> Tools.concat(data.getPlatform(), data.getChannel()), o -> o, (v1, v2) -> v1));
}
} }
...@@ -188,6 +188,8 @@ public class TaskServiceImpl implements TaskService { ...@@ -188,6 +188,8 @@ public class TaskServiceImpl implements TaskService {
indexService.getPlatformInfo(null, null, false); indexService.getPlatformInfo(null, null, false);
// 首页-传播趋势 // 首页-传播趋势
indexService.getSpreadingTend(null, null, false); indexService.getSpreadingTend(null, null, false);
// 首页-净情感度
indexService.getEmotionPercent(null, null, false);
log.info("项目:{}-首页缓存已完成:{}个", project.getProjectName(), total.incrementAndGet()); log.info("项目:{}-首页缓存已完成:{}个", project.getProjectName(), total.incrementAndGet());
return null; return null;
}, cacheServiceExecutor)).toArray(CompletableFuture[]::new)).join(); }, cacheServiceExecutor)).toArray(CompletableFuture[]::new)).join();
...@@ -382,14 +384,14 @@ public class TaskServiceImpl implements TaskService { ...@@ -382,14 +384,14 @@ public class TaskServiceImpl implements TaskService {
Long[] time = commonService.getTimeRangeMonth(); Long[] time = commonService.getTimeRangeMonth();
List<CompletableFuture<Object>> projectFutures = GlobalPojo.PROJECT_MAP.values().stream().map(project -> CompletableFuture.supplyAsync(() -> { List<CompletableFuture<Object>> projectFutures = GlobalPojo.PROJECT_MAP.values().stream().map(project -> CompletableFuture.supplyAsync(() -> {
UserThreadLocal.set(new UserInfo().setProjectId(project.getId())); UserThreadLocal.set(new UserInfo().setProjectId(project.getId()));
markDataService.getHighWord(time[0], time[1], null, false); markDataService.cacheHighWord(time[0], time[1], null, false);
log.info("项目:{}-{}-词云缓存已完成:{}个", project.getProjectName(), project.getId(), total.incrementAndGet()); log.info("项目:{}-{}-词云缓存已完成:{}个", project.getProjectName(), project.getId(), total.incrementAndGet());
return null; return null;
}, cacheServiceExecutor)).collect(Collectors.toList()); }, cacheServiceExecutor)).collect(Collectors.toList());
AtomicInteger total2 = new AtomicInteger(); AtomicInteger total2 = new AtomicInteger();
List<CompletableFuture<Object>> planFutures = nonManualProjectPlanDao.findList(new Query()).stream().map(plan -> CompletableFuture.supplyAsync(() -> { List<CompletableFuture<Object>> planFutures = nonManualProjectPlanDao.findList(new Query()).stream().map(plan -> CompletableFuture.supplyAsync(() -> {
UserThreadLocal.set(new UserInfo().setProjectId(plan.getProjectId())); UserThreadLocal.set(new UserInfo().setProjectId(plan.getProjectId()));
markDataService.getHighWord(time[0], time[1], plan.getId(), false); markDataService.cacheHighWord(time[0], time[1], plan.getId(), false);
log.info("方案:{}-{}-词云缓存已完成:{}个", plan.getName(), plan.getId(), total2.incrementAndGet()); log.info("方案:{}-{}-词云缓存已完成:{}个", plan.getName(), plan.getId(), total2.incrementAndGet());
return null; return null;
}, cacheServiceExecutor)).collect(Collectors.toList()); }, cacheServiceExecutor)).collect(Collectors.toList());
......
...@@ -59,6 +59,10 @@ public class RedisUtil { ...@@ -59,6 +59,10 @@ public class RedisUtil {
return RedisKeyPrefix.INDEX_SPREAD + Tools.concat(projectId, startTime, endTime); return RedisKeyPrefix.INDEX_SPREAD + Tools.concat(projectId, startTime, endTime);
} }
public static String getIndexEmotionKey(String projectId, Long startTime, Long endTime) {
return RedisKeyPrefix.INDEX_EMOTION + Tools.concat(projectId, startTime, endTime);
}
public static String getChannelRecordList(String projectId, Long startTime, Long endTime, String platform, int emotion) { public static String getChannelRecordList(String projectId, Long startTime, Long endTime, String platform, int emotion) {
return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime, platform, emotion); return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime, platform, emotion);
} }
......
...@@ -52,7 +52,7 @@ import java.util.stream.Stream; ...@@ -52,7 +52,7 @@ import java.util.stream.Stream;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import static com.zhiwei.brandkbs2.common.GenericAttribute.ES_MARK_CACHE_MAPS; import static com.zhiwei.brandkbs2.common.GenericAttribute.*;
import static com.zhiwei.brandkbs2.config.Constant.*; import static com.zhiwei.brandkbs2.config.Constant.*;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
...@@ -75,6 +75,16 @@ public class Tools { ...@@ -75,6 +75,16 @@ public class Tools {
private static final DozerBeanMapper DOZER_BEAN_MAPPER = new DozerBeanMapper(); private static final DozerBeanMapper DOZER_BEAN_MAPPER = new DozerBeanMapper();
/**
* 须过滤的标题
*/
public static final List<String> FILTER_TITLE = Arrays.asList("Notitle", "分享一篇文章", "分享一篇文章。", "暂无标题");
/**
* 须过滤的渠道
*/
public static final List<String> FILTER_SOURCE = Arrays.asList("匿名");
/** /**
* 上传文件 * 上传文件
...@@ -1345,4 +1355,22 @@ public class Tools { ...@@ -1345,4 +1355,22 @@ public class Tools {
} }
return Arrays.stream(str.split("[\\u007c]+")).filter(StringUtils::isNotBlank).collect(Collectors.joining("|")); return Arrays.stream(str.split("[\\u007c]+")).filter(StringUtils::isNotBlank).collect(Collectors.joining("|"));
} }
/**
* 过滤 “分享一篇文章”,”暂无标题“,”Notitle“ 的无用标题
* @param title
* @return
*/
public static Boolean filterUselessTitle(String title){
return FILTER_TITLE.contains(title);
}
/**
* 过滤 “匿名“ 的无用渠道
* @param source
* @return
*/
public static Boolean filterUselessSource(String source){
return FILTER_SOURCE.contains(source);
}
} }
\ No newline at end of file
...@@ -2,9 +2,9 @@ application.name = brandkbs2 ...@@ -2,9 +2,9 @@ application.name = brandkbs2
server.port=8888 server.port=8888
spring.flyway.encoding=UTF-8 spring.flyway.encoding=UTF-8
#\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=100MB
#\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-request-size=20MB spring.servlet.multipart.max-request-size=200MB
server.servlet.context-path=/brandkbs server.servlet.context-path=/brandkbs
#jwt #jwt
jwt.key=Token jwt.key=Token
......
...@@ -2,9 +2,9 @@ application.name = brandkbs2 ...@@ -2,9 +2,9 @@ application.name = brandkbs2
server.port=8888 server.port=8888
spring.flyway.encoding=UTF-8 spring.flyway.encoding=UTF-8
#\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=100MB
#\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-request-size=20MB spring.servlet.multipart.max-request-size=200MB
server.servlet.context-path=/brandkbs server.servlet.context-path=/brandkbs
#jwt #jwt
jwt.key=Token jwt.key=Token
......
...@@ -2,9 +2,9 @@ application.name = brandkbs2 ...@@ -2,9 +2,9 @@ application.name = brandkbs2
server.port=8888 server.port=8888
spring.flyway.encoding=UTF-8 spring.flyway.encoding=UTF-8
#\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u5355\u4E2A\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=100MB
#\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E #\u603B\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u8BBE\u7F6E
spring.servlet.multipart.max-request-size=20MB spring.servlet.multipart.max-request-size=200MB
server.servlet.context-path=/brandkbs server.servlet.context-path=/brandkbs
#jwt #jwt
jwt.key=Token jwt.key=Token
......
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