Commit a8a8ef17 by shenjunjie

Merge branch 'feature' into 'release'

Feature

See merge request !465
parents 2da615fd 44eb4486
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.ChannelTag;
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.SystemInfoService;
import com.zhiwei.brandkbs2.util.Tools;
......@@ -92,6 +93,16 @@ public class GlobalPojo {
public static final String ELSE_PLATFORM_NAME = "其他自媒体";
/**
* 舆情项目重要渠道
*/
public static Map<String, Map<String, SensitiveChannel>> PROJECT_SENSITIVE_CHANNEL = new HashMap<>();
/**
* 舆情通用重要渠道
*/
public static Map<String, SensitiveChannel> COMMON_SENSITIVE_CHANNEL = new HashMap<>();
@PostConstruct
public void start() {
try {
......@@ -126,9 +137,11 @@ public class GlobalPojo {
PROJECT_MAP = systemInfoService.getProjects();
YU_QING_PROJECTS = systemInfoService.getYuQingProjects();
PROJECT_EMOTION_CHANNEL_DATA = channelService.getProjectEmotionChannelListData();
PROJECT_SENSITIVE_CHANNEL = systemInfoService.getProjectSensitiveChannel();
COMMON_SENSITIVE_CHANNEL = systemInfoService.getCommonSensitiveChannel();
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:{}", 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());
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(),
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());
} catch (Exception e) {
log.info("{}-获取缓存值异常", logMsg, e);
}
......
......@@ -526,6 +526,45 @@ public class AppArticleController extends BaseController {
return ResponseResult.success(markDataService.getYuqingAnalyzeDetail(markSearchDTO));
}
@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));
}
private boolean checkMTagIllegal(StringBuilder mtag) {
List<MarkerTag> hitTags = projectService.getProjectById(UserThreadLocal.getProjectId()).getHitTags();
if (!Tools.isEmpty(hitTags)) {
......
......@@ -51,4 +51,16 @@ public interface QbjcPojoDao {
* @return
*/
SensitiveChannel findSensitiveChannelBySource(String source);
/**
* qbjc项目重要渠道
* @return
*/
List<SensitiveChannel> findProjectSensitiveChannel();
/**
* qbjc通用重要渠道
* @return
*/
List<SensitiveChannel> findCommonSensitiveChannel();
}
......@@ -55,5 +55,17 @@ public class QbjcPojoDaoImpl implements QbjcPojoDao {
query.addCriteria(Criteria.where("name").is(source));
return mongoTemplate.findOne(query, SensitiveChannel.class, "qbjc_sensitive_channel_system");
}
@Override
public List<SensitiveChannel> findProjectSensitiveChannel() {
Query query = new Query();
return mongoTemplate.find(query, SensitiveChannel.class, "qbjc_sensitive_channel");
}
@Override
public List<SensitiveChannel> findCommonSensitiveChannel() {
Query query = new Query();
return mongoTemplate.find(query, SensitiveChannel.class, "qbjc_sensitive_channel_system");
}
}
......@@ -308,4 +308,6 @@ public interface ChannelService {
* @throws IOException
*/
Map<String, JSONObject> getProjectEmotionChannelListData() throws IOException;
JSONObject matchYuQingSensitiveChannel(String linkedGroupId, String source);
}
......@@ -634,4 +634,46 @@ public interface MarkDataService {
* @return
*/
List<JSONObject> getLastNews(Long startTime, Long endTime, String planId, int size, boolean include);
/**
* 舆情分析-高频标题详情页-基础信息
* @param aggTitle
* @param startTime
* @param endTime
* @param planId
* @return
*/
JSONObject getAggTitleBaseInfo(String aggTitle, Long startTime, Long endTime, String planId);
/**
* 舆情分析-高频标题详情页-发布节点
* @param aggTitle
* @param startTime
* @param endTime
* @param planId
* @return
*/
List<JSONObject> getAggTitleArticlePoints(String aggTitle, Long startTime, Long endTime, String planId);
/**
* 舆情分析-高频标题详情页-平台分布
* @param aggTitle
* @param startTime
* @param endTime
* @param planId
* @return
*/
List<JSONObject> getAggTitlePlatformPercentage(String aggTitle, Long startTime, Long endTime, String planId);
/**
* 舆情分析-高频标题详情页-发文列表
* @param aggTitle
* @param startTime
* @param endTime
* @param planId
* @param page
* @param pageSize
* @return
*/
PageVO<JSONObject> getArticleList(String aggTitle, Long startTime, Long endTime, String planId, String platform, int page, int pageSize);
}
......@@ -3,6 +3,7 @@ package com.zhiwei.brandkbs2.service;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.ChannelTag;
import com.zhiwei.brandkbs2.pojo.Project;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
import com.zhiwei.qbjc.bean.pojo.common.Tag;
......@@ -58,4 +59,15 @@ public interface SystemInfoService {
List<JSONObject> getYuQingProjects();
/**
* 从舆情系统获取项目重要渠道
* @return
*/
Map<String, Map<String, SensitiveChannel>> getProjectSensitiveChannel();
/**
* 从舆情系统获取通用重要渠道
* @return
*/
Map<String, SensitiveChannel> getCommonSensitiveChannel();
}
......@@ -731,15 +731,18 @@ public class ChannelServiceImpl implements ChannelService {
* @param source
* @return
*/
private JSONObject matchYuQingSensitiveChannel(String linkedGroupId, String source){
@Override
public JSONObject matchYuQingSensitiveChannel(String linkedGroupId, String source){
JSONObject sensitiveChannelInfo = new JSONObject();
SensitiveChannel sensitiveChannel;
// 先匹配舆情项目重要渠道,未匹配上时转而匹配舆情通用重要渠道
SensitiveChannel projectSensitiveChannel = qbjcPojoDao.findSensitiveChannelBySource(linkedGroupId, source);
if (Objects.nonNull(projectSensitiveChannel)) {
sensitiveChannel = projectSensitiveChannel;
Map<String, SensitiveChannel> sensitiveChannelMap = GlobalPojo.PROJECT_SENSITIVE_CHANNEL.get(linkedGroupId);
// SensitiveChannel projectSensitiveChannel = GlobalPojo.PROJECT_SENSITIVE_CHANNEL.get(linkedGroupId).get(source);
if (Objects.nonNull(sensitiveChannelMap) && Objects.nonNull(sensitiveChannelMap.get(source))) {
sensitiveChannel = sensitiveChannelMap.get(source);
}else {
sensitiveChannel = qbjcPojoDao.findSensitiveChannelBySource(source);
// sensitiveChannel = qbjcPojoDao.findSensitiveChannelBySource(source);
sensitiveChannel = GlobalPojo.COMMON_SENSITIVE_CHANNEL.get(source);
}
if (Objects.nonNull(sensitiveChannel)){
sensitiveChannelInfo.put("mainBodyType", sensitiveChannel.getMainBodyType());
......
......@@ -10,6 +10,7 @@ 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.qbjc.bean.pojo.common.MessagePlatform;
import com.zhiwei.qbjc.bean.pojo.common.Tag;
......@@ -113,4 +114,22 @@ public class SystemInfoServiceImpl implements SystemInfoService {
return res;
}).collect(Collectors.toList());
}
@Override
public Map<String, Map<String, SensitiveChannel>> getProjectSensitiveChannel() {
Map<String, Map<String, SensitiveChannel>> res = new HashMap<>();
List<SensitiveChannel> projectSensitiveChannel = qbjcPojoDao.findProjectSensitiveChannel();
Map<String, List<SensitiveChannel>> projectMap = projectSensitiveChannel.stream().collect(Collectors.groupingBy(SensitiveChannel::getProjectId));
for (Map.Entry<String, List<SensitiveChannel>> entry : projectMap.entrySet()) {
Map<String, SensitiveChannel> sourceMap = entry.getValue().stream().collect(Collectors.toMap(SensitiveChannel::getName, o-> o, (k1, k2) -> k1));
res.put(entry.getKey(), sourceMap);
}
return res;
}
@Override
public Map<String, SensitiveChannel> getCommonSensitiveChannel() {
List<SensitiveChannel> commonSensitiveChannel = qbjcPojoDao.findCommonSensitiveChannel();
return commonSensitiveChannel.stream().collect(Collectors.toMap(SensitiveChannel::getName, o-> o, (k1, k2) -> k1));
}
}
......@@ -235,6 +235,7 @@ public class UserServiceImpl implements UserService {
OptionalInt.of(userDTO.getExportAmount()).ifPresent(userRole::setExportAmount);
userDao.updateOneByIdWithField(userDTO.getId(), new Update().set("roles", roles));
});
Optional.of(userDTO.getNickname()).ifPresent(nickName -> userDao.updateOneByIdWithField(userDTO.getId(), new Update().set("nickname", nickName)));
}
@Override
......
......@@ -319,6 +319,10 @@ public class Tools {
public static List<Long[]> cutTimeRange(long startTime, long endTime, long range) {
List<Long[]> res = new ArrayList<>();
if (endTime - startTime <= range){
res.add(new Long[]{startTime, endTime});
return res;
}
while (startTime < endTime) {
long rangeEnd = Math.min(startTime + range, endTime);
res.add(new Long[]{startTime, rangeEnd});
......
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