Commit 2fb00468 by 陈健智

事件中间件接入代码结构调整,新增热门事件接口

parent 4f64fde4
......@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
......@@ -14,11 +13,9 @@ import com.zhiwei.brandkbs2.pojo.Behavior;
import com.zhiwei.brandkbs2.pojo.vo.ProjectVO;
import com.zhiwei.brandkbs2.service.BehaviorService;
import com.zhiwei.brandkbs2.service.CommonService;
import com.zhiwei.brandkbs2.service.EventService;
import com.zhiwei.brandkbs2.service.ProjectService;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.auth.util.JwtUtil;
import com.zhiwei.middleware.event.core.EventTagClient;
import com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO;
import com.zhiwei.middleware.mark.vo.MarkerTag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -53,9 +50,6 @@ public class ProjectController extends BaseController {
@Autowired
private RestTemplate restTemplate;
@Autowired
private EventTagClient eventTagClient;
@Resource(name = "projectServiceImpl")
private ProjectService ProjectService;
......@@ -65,6 +59,9 @@ public class ProjectController extends BaseController {
@Resource(name = "commonServiceImpl")
private CommonService commonService;
@Resource(name = "eventServiceImpl")
private EventService eventService;
private static final Behavior.Operation OPERATION = new Behavior.Operation("项目管理", true);
@Value("${brandkbs.img.url}")
......@@ -216,7 +213,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam(name = "yuQingProjectId", value = "舆情项目id", required = true, paramType = "query", dataType = "string")
@GetMapping("/get/eventTags")
public ResponseResult getEventTagsInfo(@RequestParam(value = "yuQingProjectId") String yuQingProjectId){
Object eventTags = eventTagClient.getEventTagGroupInfoBrandkbsWithoutEmotion(yuQingProjectId).getData();
Object eventTags = eventService.getEventTagGroupInfoBrandkbsWithoutEmotion(yuQingProjectId).getData();
return ResponseResult.success(eventTags);
}
......
......@@ -49,9 +49,6 @@ public class AppEventController extends BaseController {
@Value("${ef.checkCaptcha.url}")
private String efCheckCaptchaUrl;
@Autowired
private EventMonitorClient eventMonitorClient;
private final EventService eventService;
public AppEventController(EventService eventService) {
......@@ -186,7 +183,7 @@ public class AppEventController extends BaseController {
@ApiOperation("前台事件库-事件监测-新增事件监测")
@PostMapping("/addEventMonitor")
public ResponseResult addEventMonitor(@RequestBody EventDTO dto){
if (eventMonitorClient.countMonitoringEventsBrandkbs(UserThreadLocal.getProjectId()) >= 10){
if (eventService.getMonitoringEventsCount() >= 10){
return ResponseResult.failure("监测事件数量不得超过10");
}
eventService.addEventMonitor(dto);
......
......@@ -197,6 +197,12 @@ public class AppSearchController extends BaseController {
return ResponseResult.success(eventService.getLastEventTop(null, 5));
}
@ApiOperation("搜索-热门事件")
@GetMapping("/lastEventTop")
public ResponseResult getLastEventTopMiddleware() {
return ResponseResult.success(eventService.getLastEventTopMiddleware(null, 5));
}
@ApiOperation("搜索-前台事件库-搜索条件")
@GetMapping("/event/list/criteria")
public ResponseResult getEventsSearchCriteria() {
......
package com.zhiwei.brandkbs2.dao;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.middleware.event.pojo.PageData;
import com.zhiwei.middleware.event.pojo.ReturnData;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
import com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO;
import com.zhiwei.middleware.event.pojo.dto.EventDTO;
import com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO;
import com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo;
import com.zhiwei.middleware.event.pojo.entity.Event;
import com.zhiwei.middleware.event.pojo.entity.EventData;
import com.zhiwei.middleware.event.pojo.entity.EventDisseminationTrend;
import com.zhiwei.middleware.event.pojo.vo.EventListInfoVO;
import com.zhiwei.middleware.event.pojo.vo.EventVO;
import java.util.List;
import java.util.Map;
/**
* @ClassName: EventMiddlewareDao
* @Description 事件中间件
* @author: cjz
* @date: 2023-02-08 10:45
*/
public interface EventMiddlewareDao {
/**
* 按筛选条件获取事件列表
* @param dto
* @return
*/
PageData<EventListInfoVO> getEventListBrandkbs(BrandkbsEventSearchDTO dto);
/**
* 根据id删除事件
* @param eventId
* @return
*/
ReturnData deleteEvent(String eventId);
/**
* 获取事件基础信息
* @param eventId
* @return
*/
EventBaseInfoDTO eventBaseInfo(String eventId);
/**
* 获取传播趋势
* @param eventId
* @param type
* @return
*/
EventDisseminationTrend eventDisseminationTrends(String eventId, String type);
/**
* 持续事件
* @param eventId
* @param submitter
* @param submitterId
* @return
*/
ReturnData continueEvent(String eventId, String submitter, String submitterId);
/**
* 获取事件热门文章分析
* @param eventId
* @param type
* @param emotion
* @param aggTitle
* @return
*/
JSONObject eventTopArticlesAnalysis(String eventId, String type, String emotion, String aggTitle);
/**
* 获取事件渠道发声
* @param eventId
* @param type
* @param page
* @param pageSize
* @param sorter
* @return
*/
PageData<JSONObject> eventChannelVoices(String eventId, String type, int page, int pageSize, String sorter);
/**
* 统计事件数量
* @param eventIds
* @return
*/
Long countInEventIds(List<String> eventIds);
/**
* 统计事件数据数量
* @param event
* @return
*/
Long countEventDataByEventId(Event event);
/**
* 统计事件数据数量
* @param event
* @return
*/
Long countEventDataByEventIdAndFid(Event event, String fid);
/**
* 获取事件列表
* @param eventIds
* @return
*/
List<Event> findListInEventIds(List<String> eventIds, int page, int pageSize);
/**
* 获取事件列表
* @param eventIds
* @return
*/
List<Event> findListInEventIds(List<String> eventIds);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
List<String> getEvents(String fid);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
Map<Long, List<Event>> getEventDay(String fid, Long startTime, Long endTime);
/**
* 获取参与事件数
*
* @param fid
* @return 参与事件数
*/
Map<Long, List<Event>> getEventMonth(String fid, Long startTime, Long endTime);
/**
* 获取参与的反常事件数
*
* @param fid 渠道标识
* @param eventEmotions 事件情感倾向
* @param articleEmotion 文章情感倾向
* @return 参与的反常事件数
*/
Long getEventCount(String fid, List<String> eventEmotions, String articleEmotion);
/**
* 根据特征值获取事件数
*
* @param startTime
* @param endTime
* @param emotion
* @param projectId
* @param contendId
* @return
*/
Long getEventCountByProjectIdAndContendId(Long startTime, Long endTime, String emotion, String projectId, String contendId);
/**
* 根据特征值获取事件
*
* @param startTime
* @param endTime
* @param emotion
* @param projectId
* @param contendId
* @return
*/
List<Event> getEventsByProjectIdAndContendId(Long startTime, Long endTime, String emotion, String projectId, String contendId, int limit);
/**
* 根据特征值获取事件
*
* @param startTime
* @param endTime
* @param emotions
* @param projectId
* @param contendId
* @return
*/
List<Event> getEventsByProjectIdAndContendId(Long startTime, Long endTime, List<String> emotions, String projectId, String contendId, int limit);
List<Event> getEventsByTotalChannelVolumeTop(Long startTime, Long endTime, String emotion, String projectId, String contendId, int limit);
/**
* 获得最新的事件
*
* @return
*/
List<JSONObject> getLastEventTop(String keyword, int limit, String brandkbsProjectId);
/**
* 获取传播量
*
* @param event 事件
* @return 传播量
*/
Long getEventArticleCount(Event event);
/**
* 获取渠道参与传播量
*
* @param event 事件
* @return 传播量
*/
Long getEventArticleWithChannelCount(Event event, String source, String realSource, String platform);
/**
* 获取事件监测列表
* @param brandkbsBrandId
* @param page
* @param pageSize
* @return
*/
PageData<EventVO> getEventMonitorBrandkbs(String brandkbsBrandId, int page, int pageSize);
/**
* 新增事件监测
* @param eventDTO
* @return
*/
ReturnData addEventMonitor(EventDTO eventDTO);
/**
* 编辑单个监测事件
* @param eventId
* @param eventDTO
* @param brandkbsInfos
* @return
*/
ReturnData modifyEventMonitor(String eventId, EventDTO eventDTO, List<BrandkbsBasicInfo> brandkbsInfos);
/**
* 结束事件监测
* @param eventId
* @param submitter
* @param submitterId
* @return
*/
ReturnData endEventMonitor(String eventId, String submitter, String submitterId);
/**
* 统计状态为监测中的事件数量
* @param brandId
* @return
*/
Long countMonitoringEventsBrandkbs(String brandId);
/**
* 获取标签组信息
* @param projectId
* @return
*/
ReturnData getEventTagGroupInfoBrandkbs(String projectId);
/**
*
* @param yuQingProject
* @param yuQingProjectId
* @param eventTags
* @param brandkbsProject
* @param brandkbsProjectId
* @param brandkbsBrand
* @param brandkbsBrandId
* @param submitter
* @param submitterId
* @return
*/
ReturnData bindBrandkbs(String yuQingProject, String yuQingProjectId, List<EventTagRelatedDTO> eventTags, String brandkbsProject, String brandkbsProjectId, String brandkbsBrand, String brandkbsBrandId, String submitter, String submitterId);
/**
* 获取品见项目标签绑定情况
* @param brandkbsProjectId
* @return
*/
ReturnData getBrandkbsBindingEventTags(String brandkbsProjectId);
/**
* 修改品见关联关系,若存在则修改,否则新增
* @param yuQingProject
* @param yuQingProjectId
* @param eventTags
* @param brandkbsProject
* @param brandkbsProjectId
* @param brandkbsBrand
* @param brandkbsBrandId
* @param submitter
* @param submitterId
* @return
*/
ReturnData modifyBrandkbsEventTags(String yuQingProject, String yuQingProjectId, List<EventTagRelatedDTO> eventTags, String brandkbsProject, String brandkbsProjectId, String brandkbsBrand, String brandkbsBrandId, String submitter, String submitterId);
/**
* 获取标签组信息
* @param projectId
* @return
*/
ReturnData getEventTagGroupInfoBrandkbsWithoutEmotion(String projectId);
}
package com.zhiwei.brandkbs2.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.dao.EventMiddlewareDao;
import com.zhiwei.middleware.event.core.EventClient;
import com.zhiwei.middleware.event.core.EventMonitorClient;
import com.zhiwei.middleware.event.core.EventTagClient;
import com.zhiwei.middleware.event.pojo.PageData;
import com.zhiwei.middleware.event.pojo.ReturnData;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
import com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO;
import com.zhiwei.middleware.event.pojo.dto.EventDTO;
import com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO;
import com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo;
import com.zhiwei.middleware.event.pojo.entity.Event;
import com.zhiwei.middleware.event.pojo.entity.EventDisseminationTrend;
import com.zhiwei.middleware.event.pojo.vo.EventListInfoVO;
import com.zhiwei.middleware.event.pojo.vo.EventVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* @ClassName: EventMiddlewareDaoImpl
* @Description 事件中间件业务实现类
* @author: cjz
* @date: 2023-02-08 10:45
*/
@Component("eventMiddlewareDao")
public class EventMiddlewareDaoImpl implements EventMiddlewareDao {
@Autowired
private EventClient eventClient;
@Autowired
private EventTagClient eventTagClient;
@Autowired
private EventMonitorClient eventMonitorClient;
@Override
public PageData<EventListInfoVO> getEventListBrandkbs(BrandkbsEventSearchDTO dto) {
return eventClient.getEventListBrandkbs(dto);
}
@Override
public ReturnData deleteEvent(String eventId) {
return eventClient.deleteEvent(eventId);
}
@Override
public EventBaseInfoDTO eventBaseInfo(String eventId) {
return eventClient.eventBaseInfo(eventId);
}
@Override
public EventDisseminationTrend eventDisseminationTrends(String eventId, String type) {
return eventClient.eventDisseminationTrends(eventId, type);
}
@Override
public ReturnData continueEvent(String eventId, String submitter, String submitterId) {
return eventClient.continueEvent(eventId, submitter, submitterId);
}
@Override
public JSONObject eventTopArticlesAnalysis(String eventId, String type, String emotion, String aggTitle) {
return eventClient.eventTopArticlesAnalysis(eventId, type, emotion, aggTitle);
}
@Override
public PageData<JSONObject> eventChannelVoices(String eventId, String type, int page, int pageSize, String sorter) {
return eventClient.eventChannelVoices(eventId, type, page, pageSize, sorter);
}
@Override
public Long countInEventIds(List<String> eventIds) {
return eventClient.countInEventIds(eventIds);
}
@Override
public Long countEventDataByEventId(Event event) {
return eventClient.countEventDataByEventId(event);
}
@Override
public Long countEventDataByEventIdAndFid(Event event, String fid) {
return eventClient.countEventDataByEventIdAndFid(event, fid);
}
@Override
public List<Event> findListInEventIds(List<String> eventIds, int page, int pageSize) {
return eventClient.findListInEventIds(eventIds, page, pageSize);
}
@Override
public List<Event> findListInEventIds(List<String> eventIds) {
return eventClient.findListInEventIds(eventIds);
}
@Override
public List<String> getEvents(String fid) {
return eventClient.getEvents(fid);
}
@Override
public Map<Long, List<Event>> getEventDay(String fid, Long startTime, Long endTime) {
return eventClient.getEventDay(fid, startTime, endTime);
}
@Override
public Map<Long, List<Event>> getEventMonth(String fid, Long startTime, Long endTime) {
return eventClient.getEventMonth(fid, startTime, endTime);
}
@Override
public Long getEventCount(String fid, List<String> eventEmotions, String articleEmotion) {
return eventClient.getEventCount(fid, eventEmotions, articleEmotion);
}
@Override
public Long getEventCountByProjectIdAndContendId(Long startTime, Long endTime, String emotion, String projectId, String contendId) {
return eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, emotion, projectId, contendId);
}
@Override
public List<Event> getEventsByProjectIdAndContendId(Long startTime, Long endTime, String emotion, String projectId, String contendId, int limit) {
return eventClient.getEventsByProjectIdAndContendId(startTime, endTime, emotion, projectId, contendId, limit);
}
@Override
public List<Event> getEventsByProjectIdAndContendId(Long startTime, Long endTime, List<String> emotions, String projectId, String contendId, int limit) {
return eventClient.getEventsByProjectIdAndContendId(startTime, endTime, emotions, projectId, contendId, limit);
}
@Override
public List<Event> getEventsByTotalChannelVolumeTop(Long startTime, Long endTime, String emotion, String projectId, String contendId, int limit) {
return eventClient.getEventsByTotalChannelVolumeTop(startTime, endTime, emotion, projectId, contendId, limit);
}
@Override
public List<JSONObject> getLastEventTop(String keyword, int limit, String brandkbsProjectId) {
return eventClient.getLastEventTop(keyword, limit, brandkbsProjectId);
}
@Override
public Long getEventArticleCount(Event event) {
return eventClient.getEventArticleCount(event);
}
@Override
public Long getEventArticleWithChannelCount(Event event, String source, String realSource, String platform) {
return eventClient.getEventArticleWithChannelCount(event, source, realSource, platform);
}
@Override
public PageData<EventVO> getEventMonitorBrandkbs(String brandkbsBrandId, int page, int pageSize) {
return eventMonitorClient.getEventMonitorBrandkbs(brandkbsBrandId, page, pageSize);
}
@Override
public ReturnData addEventMonitor(EventDTO eventDTO) {
return eventMonitorClient.addEventMonitor(eventDTO);
}
@Override
public ReturnData modifyEventMonitor(String eventId, EventDTO eventDTO, List<BrandkbsBasicInfo> brandkbsInfos) {
return eventMonitorClient.modifyEventMonitor(eventId, eventDTO, brandkbsInfos);
}
@Override
public ReturnData endEventMonitor(String eventId, String submitter, String submitterId) {
return eventMonitorClient.endEventMonitor(eventId, submitter, submitterId);
}
@Override
public Long countMonitoringEventsBrandkbs(String brandId) {
return eventMonitorClient.countMonitoringEventsBrandkbs(brandId);
}
@Override
public ReturnData getEventTagGroupInfoBrandkbs(String projectId) {
return eventTagClient.getEventTagGroupInfoBrandkbs(projectId);
}
@Override
public ReturnData bindBrandkbs(String yuQingProject, String yuQingProjectId, List<EventTagRelatedDTO> eventTags, String brandkbsProject, String brandkbsProjectId, String brandkbsBrand, String brandkbsBrandId, String submitter, String submitterId) {
return eventTagClient.bindBrandkbs(yuQingProject, yuQingProjectId, eventTags, brandkbsProject, brandkbsProjectId, brandkbsBrand, brandkbsBrandId, submitter, submitterId);
}
@Override
public ReturnData getBrandkbsBindingEventTags(String brandkbsProjectId) {
return eventTagClient.getBrandkbsBindingEventTags(brandkbsProjectId);
}
@Override
public ReturnData modifyBrandkbsEventTags(String yuQingProject, String yuQingProjectId, List<EventTagRelatedDTO> eventTags, String brandkbsProject, String brandkbsProjectId, String brandkbsBrand, String brandkbsBrandId, String submitter, String submitterId) {
return eventTagClient.modifyBrandkbsEventTags(yuQingProject, yuQingProjectId, eventTags, brandkbsProject, brandkbsProjectId, brandkbsBrand, brandkbsBrandId, submitter, submitterId);
}
@Override
public ReturnData getEventTagGroupInfoBrandkbsWithoutEmotion(String projectId) {
return eventTagClient.getEventTagGroupInfoBrandkbsWithoutEmotion(projectId);
}
}
......@@ -4,6 +4,7 @@ import com.zhiwei.middleware.event.pojo.entity.Event;
import com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
import java.util.Map;
......@@ -74,8 +75,11 @@ public class BrandkbsHotEventWarn {
hotEvent.setInfluence(event.getInfluence());
// List<String> tagList = event.getEventTag().entrySet().stream().filter(entry -> !"情感倾向".equals(entry.getKey()))
// .map(entry -> String.valueOf(entry.getValue())).collect(Collectors.toList());
List<String> tagList = event.getEventTags().stream().filter(eventTagBasicInfo -> !"情感倾向".equals(eventTagBasicInfo.getGroupName()))
.map(EventTagBasicInfo::getName).collect(Collectors.toList());
List<String> tagList = null;
if (CollectionUtils.isNotEmpty(event.getEventTags())) {
tagList = event.getEventTags().stream().filter(eventTagBasicInfo -> !"情感倾向".equals(eventTagBasicInfo.getGroupName()))
.map(EventTagBasicInfo::getName).collect(Collectors.toList());
}
hotEvent.setTagList(tagList);
return hotEvent;
}
......
......@@ -14,6 +14,7 @@ import com.zhiwei.brandkbs2.pojo.vo.EventVO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO;
import com.zhiwei.middleware.event.pojo.PageData;
import com.zhiwei.middleware.event.pojo.ReturnData;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
import com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO;
import com.zhiwei.middleware.event.pojo.dto.EventDTO;
......@@ -290,6 +291,19 @@ public interface EventService {
List<JSONObject> getLastEventTop(String keyword,int limit);
/**
* 事件中间件获得最新的事件
*
* @return
*/
List<JSONObject> getLastEventTopMiddleware(String keyword,int limit);
/**
* 事件中间件获取标签组信息
* @return
*/
ReturnData getEventTagGroupInfoBrandkbsWithoutEmotion(String yuqingProjectId);
/**
* 获取未结束的事件
* @param projectId
* @return
......
......@@ -110,6 +110,9 @@ public class ChannelServiceImpl implements ChannelService {
@Resource(name = "markDataServiceImpl")
MarkDataService markDataService;
@Resource(name = "eventMiddlewareDao")
EventMiddlewareDao eventMiddlewareDao;
@Resource(name = "mongoUtil")
MongoUtil mongoUtil;
......@@ -119,9 +122,6 @@ public class ChannelServiceImpl implements ChannelService {
@Resource(name = "esSearchExecutor")
ThreadPoolTaskExecutor esSearchExecutor;
@Autowired
private EventClient eventClient;
@Override
public PageVO<JSONObject> findChannelList(int page, int size, String contendId, String emotion, String platform,
Boolean show, String keyword, String sorter) {
......@@ -236,10 +236,10 @@ public class ChannelServiceImpl implements ChannelService {
@Override
public PageVO<JSONObject> findEventList(int page, int size, String channelId) {
Channel channel = channelDao.findOneById(channelId);
List<String> eventIds = eventClient.getEvents(channel.getChannelIndex().getFid());
long total = eventClient.countInEventIds(eventIds);
List<String> eventIds = eventMiddlewareDao.getEvents(channel.getChannelIndex().getFid());
long total = eventMiddlewareDao.countInEventIds(eventIds);
// mongoUtil.start(page, size, query);
List<com.zhiwei.middleware.event.pojo.entity.Event> list = eventClient.findListInEventIds(eventIds, page, size);
List<com.zhiwei.middleware.event.pojo.entity.Event> list = eventMiddlewareDao.findListInEventIds(eventIds, page, size);
List<JSONObject> resList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) {
resList = list.stream().map(event -> {
......@@ -250,10 +250,10 @@ public class ChannelServiceImpl implements ChannelService {
json.put("emotion", event.getEmotionEventTag().getName());
// Query query1 = new Query();
// query1.addCriteria(Criteria.where("eventId").is(event.getId()));
json.put("total", eventClient.countEventDataByEventId(event));
json.put("total", eventMiddlewareDao.countEventDataByEventId(event));
// query1.addCriteria(channelDao.addChannelIndex(channel.getChannelIndex()));
// query1.addCriteria(Criteria.where("eventBrandkbsChannels.channelFid").is(channel.getChannelIndex().getFid()));
json.put("channelTotal", eventClient.countEventDataByEventIdAndFid(event, channel.getChannelIndex().getFid()));
json.put("channelTotal", eventMiddlewareDao.countEventDataByEventIdAndFid(event, channel.getChannelIndex().getFid()));
return json;
}).collect(Collectors.toList());
}
......@@ -336,11 +336,11 @@ public class ChannelServiceImpl implements ChannelService {
public List<ExportAdminChannelEventDTO> findDownloadChannelEventList(String channelId) {
List<ExportAdminChannelEventDTO> resList = new ArrayList<>();
Channel channel = channelDao.findOneById(channelId);
List<String> eventIds = eventClient.getEvents(channel.getChannelIndex().getFid());
List<String> eventIds = eventMiddlewareDao.getEvents(channel.getChannelIndex().getFid());
if (CollectionUtils.isEmpty(eventIds)) {
return resList;
}
List<com.zhiwei.middleware.event.pojo.entity.Event> events = eventClient.findListInEventIds(eventIds);
List<com.zhiwei.middleware.event.pojo.entity.Event> events = eventMiddlewareDao.findListInEventIds(eventIds);
return events.stream().map(event -> {
ExportAdminChannelEventDTO dto = Tools.convertMap(event, ExportAdminChannelEventDTO.class);
dto.setTitle(event.getName());
......@@ -351,9 +351,9 @@ public class ChannelServiceImpl implements ChannelService {
dto.setFirstRealSource(firstData.getRealSource());
dto.setFirstSource(firstData.getSource());
}
dto.setEventArticleCount(eventClient.getEventArticleCount(event));
dto.setEventArticleCount(eventMiddlewareDao.getEventArticleCount(event));
ChannelIndex channelIndex = Tools.convertMap(channel, ChannelIndex.class);
dto.setChannelArticleCount(eventClient.getEventArticleWithChannelCount(event, channelIndex.getSource(), channelIndex.getRealSource(), channelIndex.getPlatform()));
dto.setChannelArticleCount(eventMiddlewareDao.getEventArticleWithChannelCount(event, channelIndex.getSource(), channelIndex.getRealSource(), channelIndex.getPlatform()));
dto.setEventType(null);
for (EventTagBasicInfo eventTag : event.getEventTags()) {
if (eventTag.getGroupName().equals(EventTagEnum.EVENT_TYPE.getName())){
......@@ -820,7 +820,7 @@ public class ChannelServiceImpl implements ChannelService {
List<JSONObject> dayList = new ArrayList<>();
Channel channel = channelDao.findOneById(channelId);
Map<Long, List<com.zhiwei.middleware.event.pojo.entity.Event>> eventDay =
eventClient.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
eventMiddlewareDao.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
eventDay = Tools.sortTimeKeyMap(eventDay, true);
eventDay.forEach((time, list) -> dayList.add(getDayResultWithEvent(list, page, pageSize, time)));
res.put("list", dayList);
......@@ -833,7 +833,7 @@ public class ChannelServiceImpl implements ChannelService {
List<ExportAppChannelEventDTO> res = new ArrayList<>();
Channel channel = channelDao.findOneById(channelId);
Map<Long, List<com.zhiwei.middleware.event.pojo.entity.Event>> eventDay =
eventClient.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
eventMiddlewareDao.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
Tools.sortTimeKeyMap(eventDay, true).values().forEach(events -> {
events.forEach(event -> {
res.add(ExportAppChannelEventDTO.createFromEvent(event));
......@@ -863,10 +863,10 @@ public class ChannelServiceImpl implements ChannelService {
// 是否友好渠道
boolean isPositive = false;
boolean isNegative = false;
long specNegativeCount = eventClient.getEventCount(new ChannelIndex(channel).getFid(),
long specNegativeCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
Arrays.asList(EmotionEnum.POSITIVE.getName(), EmotionEnum.NEUTRAL.getName()),
EmotionEnum.NEGATIVE.getName());
long specPositiveCount = eventClient.getEventCount(new ChannelIndex(channel).getFid(),
long specPositiveCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
Collections.singletonList(EmotionEnum.NEGATIVE.getName()), EmotionEnum.POSITIVE.getName());
// 特殊情况:若皆有发布过反常稿件
if (specNegativeCount > 0 && specPositiveCount > 0) {
......@@ -1128,7 +1128,7 @@ public class ChannelServiceImpl implements ChannelService {
}
channel.setEmotionIndex(index);
channel.setEmotion(emotion);
channel.setEventCount(eventClient.getEvents(new ChannelIndex(channel).getFid()).size());
channel.setEventCount(eventMiddlewareDao.getEvents(new ChannelIndex(channel).getFid()).size());
}
/**
......@@ -1152,7 +1152,7 @@ public class ChannelServiceImpl implements ChannelService {
// 正面-负面得分
double negativeScore = this.getNegativeScore(value);
// 正面事件
value = eventClient.getEventCount(new ChannelIndex(channel).getFid(),
value = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(),
Collections.singletonList(EmotionEnum.POSITIVE.getName()), null);
// 正面事件得分
double positiveEventScore = this.getPositiveEventScore(value);
......@@ -1329,7 +1329,7 @@ public class ChannelServiceImpl implements ChannelService {
// 负面稿件数得分
double negativeArticlesScore = this.getNegativeArticlesScore(value);
// 参与负面事件
value = eventClient.getEventCount(channel.getFid(), Collections.singletonList(EmotionEnum.NEGATIVE.getName()), null);
value = eventMiddlewareDao.getEventCount(channel.getFid(), Collections.singletonList(EmotionEnum.NEGATIVE.getName()), null);
// 参与负面事件得分
double negativeEventScore = this.getNegativeEventScore(value);
// 特殊稿件
......@@ -1450,7 +1450,7 @@ public class ChannelServiceImpl implements ChannelService {
}
private double inEventCountMonthAverage(Channel channel, String eventEmotion) {
long eventCount = eventClient.getEventCount(new ChannelIndex(channel).getFid(), Collections.singletonList(eventEmotion), null);
long eventCount = eventMiddlewareDao.getEventCount(new ChannelIndex(channel).getFid(), Collections.singletonList(eventEmotion), null);
Period periodDays = new Period(channel.getCTime(), System.currentTimeMillis(), PeriodType.months());
return (double) eventCount / periodDays.getMonths();
}
......@@ -1512,9 +1512,9 @@ public class ChannelServiceImpl implements ChannelService {
JSONObject res = new JSONObject();
Map<Long, List<com.zhiwei.middleware.event.pojo.entity.Event>> eventCount;
if (endTime - startTime > Constant.ONE_MONTH) {
eventCount = eventClient.getEventMonth(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
eventCount = eventMiddlewareDao.getEventMonth(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
} else {
eventCount = eventClient.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
eventCount = eventMiddlewareDao.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime);
}
// 事件部分
long positiveEventCount = 0;
......@@ -1552,9 +1552,9 @@ public class ChannelServiceImpl implements ChannelService {
private List<JSONObject> spreadingTendEvent(Long startTime, Long endTime, Channel channel, String contendId, String timePattern) {
Map<Long, List<Event>> eventCount = completeTimes(startTime, endTime, timePattern);
if (Constant.MONTH_PATTERN.equals(timePattern)) {
eventCount.putAll(eventClient.getEventMonth(new ChannelIndex(channel, contendId).getFid(), startTime, endTime));
eventCount.putAll(eventMiddlewareDao.getEventMonth(new ChannelIndex(channel, contendId).getFid(), startTime, endTime));
} else {
eventCount.putAll(eventClient.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime));
eventCount.putAll(eventMiddlewareDao.getEventDay(new ChannelIndex(channel, contendId).getFid(), startTime, endTime));
}
return eventCount.entrySet().stream().sorted(Comparator.comparingLong(Map.Entry::getKey)).map(e -> {
JSONObject spreadJson = new JSONObject();
......
......@@ -7,10 +7,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.dao.EventDao;
import com.zhiwei.brandkbs2.dao.EventDataDao;
import com.zhiwei.brandkbs2.dao.EventDisseminationTrendDao;
import com.zhiwei.brandkbs2.dao.EventTopArticlesAnalysisDao;
import com.zhiwei.brandkbs2.dao.*;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO;
import com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO;
......@@ -39,10 +36,8 @@ import com.zhiwei.brandkbs2.util.MongoUtil;
import com.zhiwei.brandkbs2.util.RedisUtil;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.auth.util.JwtUtil;
import com.zhiwei.middleware.event.core.EventClient;
import com.zhiwei.middleware.event.core.EventMonitorClient;
import com.zhiwei.middleware.event.core.EventTagClient;
import com.zhiwei.middleware.event.pojo.PageData;
import com.zhiwei.middleware.event.pojo.ReturnData;
import com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO;
import com.zhiwei.middleware.event.pojo.dto.EventBaseInfoDTO;
import com.zhiwei.middleware.event.pojo.dto.EventDTO;
......@@ -101,6 +96,9 @@ public class EventServiceImpl implements EventService {
@Resource(name = "eventDao")
private EventDao eventDao;
@Resource(name = "eventMiddlewareDao")
private EventMiddlewareDao eventMiddlewareDao;
@Resource(name = "eventDataDao")
private EventDataDao eventDataDao;
......@@ -131,15 +129,6 @@ public class EventServiceImpl implements EventService {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private EventMonitorClient eventMonitorClient;
@Autowired
private EventClient eventClient;
@Autowired
private EventTagClient eventTagClient;
@Resource
private RedisUtil redisUtil;
......@@ -711,6 +700,17 @@ public class EventServiceImpl implements EventService {
}
@Override
public List<JSONObject> getLastEventTopMiddleware(String keyword, int limit) {
return eventMiddlewareDao.getLastEventTop(keyword, limit, UserThreadLocal.getProjectId());
}
@Override
public ReturnData getEventTagGroupInfoBrandkbsWithoutEmotion(String yuqingProjectId) {
return eventMiddlewareDao.getEventTagGroupInfoBrandkbsWithoutEmotion(yuqingProjectId);
}
@Override
public List<Event> findNotEndEventByProjectId(String projectId) {
Query query = Query.query(Criteria.where("projectId").is(projectId).and("endStatus").is(false));
return eventDao.findList(query);
......@@ -751,7 +751,7 @@ public class EventServiceImpl implements EventService {
result.put("brands", projectService.getBrands(projectId, true));
// 事件调性
AbstractProject abstractProject = projectService.getProjectByContendId(UserThreadLocal.getProjectId(), brandId);
List<EventTagBrandkbsVO> eventTags = (List<EventTagBrandkbsVO>)eventTagClient.getEventTagGroupInfoBrandkbs(abstractProject.getBrandLinkedGroupId()).getData();
List<EventTagBrandkbsVO> eventTags = (List<EventTagBrandkbsVO>)eventMiddlewareDao.getEventTagGroupInfoBrandkbs(abstractProject.getBrandLinkedGroupId()).getData();
List<EventTagBrandkbsVO> emotion = eventTags.stream().filter(eventTag -> EventTagEnum.EVENT_ATTRIBUTE.getName().equals(eventTag.getGroupName())).collect(Collectors.toList());
result.put("emotions", emotion);
// 时间
......@@ -766,18 +766,18 @@ public class EventServiceImpl implements EventService {
if (Constant.PRIMARY_CONTEND_ID.equals(dto.getBrandId())){
dto.setBrandId(UserThreadLocal.getProjectId());
}
return eventClient.getEventListBrandkbs(dto);
return eventMiddlewareDao.getEventListBrandkbs(dto);
}
@Override
public List<EventTagBrandkbsVO> getEventTagsCriteria() {
Project project = projectService.getProjectById(UserThreadLocal.getProjectId());
return (List<EventTagBrandkbsVO>)eventTagClient.getEventTagGroupInfoBrandkbs(project.getBrandLinkedGroupId()).getData();
return (List<EventTagBrandkbsVO>)eventMiddlewareDao.getEventTagGroupInfoBrandkbs(project.getBrandLinkedGroupId()).getData();
}
@Override
public PageData<com.zhiwei.middleware.event.pojo.vo.EventVO> getEventMonitor(int page, int pageSize) {
return eventMonitorClient.getEventMonitorBrandkbs(UserThreadLocal.getProjectId(), page, pageSize);
return eventMiddlewareDao.getEventMonitorBrandkbs(UserThreadLocal.getProjectId(), page, pageSize);
}
@Override
......@@ -805,7 +805,7 @@ public class EventServiceImpl implements EventService {
brandkbsBasicInfo.setBrandkbsBrandId(project.getId());
brandkbsBasicInfos.add(brandkbsBasicInfo);
dto.setBrandkbsInfos(brandkbsBasicInfos);
eventMonitorClient.addEventMonitor(dto);
eventMiddlewareDao.addEventMonitor(dto);
}
@Override
......@@ -819,7 +819,7 @@ public class EventServiceImpl implements EventService {
dto.setProjectId(project.getBrandLinkedGroupId());
dto.setSubmitter(submitter);
dto.setSubmitterId(submitterId);
eventMonitorClient.modifyEventMonitor(dto.getId(), dto, null);
eventMiddlewareDao.modifyEventMonitor(dto.getId(), dto, null);
}
@Override
......@@ -829,37 +829,37 @@ public class EventServiceImpl implements EventService {
String submitterId = JwtUtil.unsign(request.getHeader(jwtKey), Map.class).get(GenericAttribute.USER_ID).toString();
String submitter = userService.queryUserInfo(submitterId, UserThreadLocal.getProjectId()).getNickname();
eventMonitorClient.endEventMonitor(eventId, submitter, submitterId);
eventMiddlewareDao.endEventMonitor(eventId, submitter, submitterId);
}
@Override
public void deleteEventMonitor(String eventId) {
eventClient.deleteEvent(eventId);
eventMiddlewareDao.deleteEvent(eventId);
}
@Override
public Long getMonitoringEventsCount() {
return eventMonitorClient.countMonitoringEventsBrandkbs(UserThreadLocal.getProjectId());
return eventMiddlewareDao.countMonitoringEventsBrandkbs(UserThreadLocal.getProjectId());
}
@Override
public EventBaseInfoDTO eventBaseInfo(String eventId) {
return eventClient.eventBaseInfo(eventId);
return eventMiddlewareDao.eventBaseInfo(eventId);
}
@Override
public com.zhiwei.middleware.event.pojo.entity.EventDisseminationTrend eventDisseminationTrends(String eventId, String type) {
return eventClient.eventDisseminationTrends(eventId, type);
return eventMiddlewareDao.eventDisseminationTrends(eventId, type);
}
@Override
public PageData<JSONObject> eventChannelVoices(String eventId, String type, int page, int pageSize, String sorter) {
return eventClient.eventChannelVoices(eventId, type, page, pageSize, sorter);
return eventMiddlewareDao.eventChannelVoices(eventId, type, page, pageSize, sorter);
}
@Override
public JSONObject eventTopArticlesAnalysis(String eventId, String type, String emotion, String aggTitle) {
return eventClient.eventTopArticlesAnalysis(eventId, type, emotion, aggTitle);
return eventMiddlewareDao.eventTopArticlesAnalysis(eventId, type, emotion, aggTitle);
}
@Override
......@@ -869,7 +869,7 @@ public class EventServiceImpl implements EventService {
String submitterId = JwtUtil.unsign(request.getHeader(jwtKey), Map.class).get(GenericAttribute.USER_ID).toString();
String submitter = userService.queryUserInfo(submitterId, UserThreadLocal.getProjectId()).getNickname();
eventClient.continueEvent(eventId, submitter, submitterId);
eventMiddlewareDao.continueEvent(eventId, submitter, submitterId);
}
@Data
......
......@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.GlobalPojo;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.dao.EventDao;
import com.zhiwei.brandkbs2.dao.EventDataDao;
import com.zhiwei.brandkbs2.dao.EventMiddlewareDao;
import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import com.zhiwei.brandkbs2.exception.ExceptionCast;
import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
......@@ -60,12 +61,12 @@ public class IndexServiceImpl implements IndexService {
@Resource
private EventDataDao eventDataDao;
@Resource(name = "eventMiddlewareDao")
EventMiddlewareDao eventMiddlewareDao;
@Resource
private RedisUtil redisUtil;
@Autowired
private EventClient eventClient;
@Override
public JSONObject getYuqingAmount(Long startTime, Long endTime, boolean cache) {
if (null == startTime || null == endTime) {
......@@ -190,9 +191,9 @@ public class IndexServiceImpl implements IndexService {
int selectMonths = new Period(startTime, endTime, PeriodType.months()).getMonths();
selectMonths = 0 == selectMonths ? 1 : selectMonths;
// 调用事件中间件时,主品牌id使用项目id
long total = eventClient.getEventCountByProjectIdAndContendId(null, null, EmotionEnum.ALL.getName(), projectId, projectId);
long eventTotal = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long oldEventTotal = eventClient.getEventCountByProjectIdAndContendId(oldStartTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long total = eventMiddlewareDao.getEventCountByProjectIdAndContendId(null, null, EmotionEnum.ALL.getName(), projectId, projectId);
long eventTotal = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long oldEventTotal = eventMiddlewareDao.getEventCountByProjectIdAndContendId(oldStartTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
jsonObject.put("eventTotal", eventTotal);
jsonObject.put("avgEventTotal", total * selectMonths / (totalMonths + 1));
jsonObject.put("compare", oldEventTotal == 0 ? 0d : (eventTotal - oldEventTotal) / (double) oldEventTotal);
......@@ -424,10 +425,10 @@ public class IndexServiceImpl implements IndexService {
JSONObject result = new JSONObject();
contendId = Objects.equals(contendId, Constant.PRIMARY_CONTEND_ID) ? projectId : contendId;
List<com.zhiwei.middleware.event.pojo.entity.Event> eventList =
eventClient.getEventsByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, contendId, 1);
eventMiddlewareDao.getEventsByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, contendId, 1);
if (CollectionUtils.isNotEmpty(eventList)) {
com.zhiwei.middleware.event.pojo.entity.Event event = eventList.get(0);
long articleCount = eventClient.getEventArticleCount(event);
long articleCount = eventMiddlewareDao.getEventArticleCount(event);
result.put("id", event.getId());
result.put("title", event.getName());
result.put("influence", event.getInfluence());
......@@ -542,7 +543,7 @@ public class IndexServiceImpl implements IndexService {
result.put("time", startTime);
//统计时间段总事件数
// 调用事件中间件时,主品牌id使用项目id
long eventCount = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long eventCount = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
result.put("eventCount", eventCount);
lineList.add(result);
}
......@@ -564,10 +565,10 @@ public class IndexServiceImpl implements IndexService {
Long endTime = map.get("endTime");
//统计时间段总事件数
// 调用事件中间件时,主品牌id使用项目id
long totalEventCount = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long posEventCount = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, projectId);
long neuEventCount = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.NEUTRAL.getName(), projectId, projectId);
long negEventCount = eventClient.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, projectId);
long totalEventCount = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.ALL.getName(), projectId, projectId);
long posEventCount = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, projectId);
long neuEventCount = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.NEUTRAL.getName(), projectId, projectId);
long negEventCount = eventMiddlewareDao.getEventCountByProjectIdAndContendId(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, projectId);
JSONObject result = new JSONObject();
result.put("totalCount", totalEventCount);
result.put("posCount", posEventCount);
......
......@@ -5,6 +5,7 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.common.GlobalPojo;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.dao.EventMiddlewareDao;
import com.zhiwei.brandkbs2.dao.ProjectDao;
import com.zhiwei.brandkbs2.dao.QbjcPojoDao;
import com.zhiwei.brandkbs2.dao.UserDao;
......@@ -79,12 +80,12 @@ public class ProjectServiceImpl implements ProjectService {
@Resource(name = "userServiceImpl")
private UserService userService;
@Resource(name = "eventMiddlewareDao")
private EventMiddlewareDao eventMiddlewareDao;
@Value("${jwt.key}")
private String jwtKey;
@Autowired
private EventTagClient eventTagClient;
@Value("${brandkbs.file.url}")
private String brandkbsFileUrl;
......@@ -116,14 +117,14 @@ public class ProjectServiceImpl implements ProjectService {
// 主品牌绑定事件标签,主品牌品牌id使用项目id
List<EventTagRelatedDTO> eventTagsList = projectVO.getEventTagsList();
eventTagClient.bindBrandkbs(project.getBrandLinkedGroup(), project.getBrandLinkedGroupId(), eventTagsList,
eventMiddlewareDao.bindBrandkbs(project.getBrandLinkedGroup(), project.getBrandLinkedGroupId(), eventTagsList,
project.getProjectName(), project.getId(), project.getBrandName(), project.getId(), submitter, submitterId);
// 竞品绑定事件标签
List<Contend> contendList = project.getContendList();
if (CollectionUtils.isNotEmpty(contendList)) {
for (Contend contend : contendList) {
List<EventTagRelatedDTO> contendEventTagsList = contend.getEventTagsList();
eventTagClient.bindBrandkbs(contend.getBrandLinkedGroup(), contend.getBrandLinkedGroupId(), contendEventTagsList, project.getProjectName(),
eventMiddlewareDao.bindBrandkbs(contend.getBrandLinkedGroup(), contend.getBrandLinkedGroupId(), contendEventTagsList, project.getProjectName(),
project.getId(), contend.getBrandName(), contend.getId(), submitter, submitterId);
}
}
......@@ -165,7 +166,7 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public ProjectVO getProjectVOWithEventTagsById(String pid) {
ProjectVO projectVO = getProjectVOById(pid);
Map<String, List<EventTagRelatedDTO>> eventTagsMap = (Map<String, List<EventTagRelatedDTO>>) eventTagClient.getBrandkbsBindingEventTags(pid).getData();
Map<String, List<EventTagRelatedDTO>> eventTagsMap = (Map<String, List<EventTagRelatedDTO>>) eventMiddlewareDao.getBrandkbsBindingEventTags(pid).getData();
List<EventTagRelatedDTO> eventTagsList = new ArrayList<>();
if (!Tools.isEmpty(eventTagsMap)) {
// 获取主品牌标签
......@@ -210,14 +211,14 @@ public class ProjectServiceImpl implements ProjectService {
// 主品牌修改绑定事件标签, 主品牌id使用项目id
List<EventTagRelatedDTO> eventTagsList = projectVO.getEventTagsList();
eventTagClient.modifyBrandkbsEventTags(project.getBrandLinkedGroup(), project.getBrandLinkedGroupId(), eventTagsList,
eventMiddlewareDao.modifyBrandkbsEventTags(project.getBrandLinkedGroup(), project.getBrandLinkedGroupId(), eventTagsList,
project.getProjectName(), project.getId(), project.getBrandName(), project.getId(), submitter, submitterId);
// 竞品修改绑定事件标签
List<Contend> contendList = project.getContendList();
if (CollectionUtils.isNotEmpty(contendList)) {
for (Contend contend : contendList) {
List<EventTagRelatedDTO> contendEventTagsList = contend.getEventTagsList();
eventTagClient.modifyBrandkbsEventTags(contend.getBrandLinkedGroup(), contend.getBrandLinkedGroupId(), contendEventTagsList, project.getProjectName(),
eventMiddlewareDao.modifyBrandkbsEventTags(contend.getBrandLinkedGroup(), contend.getBrandLinkedGroupId(), contendEventTagsList, project.getProjectName(),
project.getId(), contend.getBrandName(), contend.getId(), submitter, submitterId);
}
}
......
......@@ -7,6 +7,7 @@ import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.dao.ChannelDao;
import com.zhiwei.brandkbs2.dao.EventDao;
import com.zhiwei.brandkbs2.dao.EventMiddlewareDao;
import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import com.zhiwei.brandkbs2.es.EsClientDao;
import com.zhiwei.brandkbs2.es.EsQueryTools;
......@@ -78,12 +79,12 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
@Resource(name = "eventDao")
EventDao eventDao;
@Resource(name = "eventMiddlewareDao")
EventMiddlewareDao eventMiddlewareDao;
@Resource(name = "redisUtil")
RedisUtil redisUtil;
@Autowired
private EventClient eventClient;
private static final Map<String, String> TYPE_SEARCH = new HashMap<>();
static {
......@@ -729,14 +730,14 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
if (CollectionUtils.isNotEmpty(config.getOwnEvent())) {
// 调用事件中间件时,使用项目id作为主品牌id
List<com.zhiwei.middleware.event.pojo.entity.Event> ownEvents =
eventClient.getEventsByProjectIdAndContendId(start, end, config.getOwnEvent(), projectId, projectId, config.getEventTop());
eventMiddlewareDao.getEventsByProjectIdAndContendId(start, end, config.getOwnEvent(), projectId, projectId, config.getEventTop());
eventMap.put("品牌动态", ownEvents);
}
if (CollectionUtils.isNotEmpty(config.getContendsEvent())) {
List<com.zhiwei.middleware.event.pojo.entity.Event> contentEvents = new ArrayList<>();
for (String contendId : config.getContendsEvent()) {
contendId = Objects.equals(Constant.PRIMARY_CONTEND_ID, contendId) ? projectId : contendId;
contentEvents.addAll(eventClient.getEventsByProjectIdAndContendId(start, end, config.getOwnEvent(), projectId, contendId, config.getEventTop()));
contentEvents.addAll(eventMiddlewareDao.getEventsByProjectIdAndContendId(start, end, config.getOwnEvent(), projectId, contendId, config.getEventTop()));
}
eventMap.put("友商动态", contentEvents);
}
......
......@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import com.zhiwei.brandkbs2.dao.EventDao;
import com.zhiwei.brandkbs2.dao.EventDataDao;
import com.zhiwei.brandkbs2.dao.ReportDao;
import com.zhiwei.brandkbs2.dao.ReportSettingsDao;
import com.zhiwei.brandkbs2.dao.*;
import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import com.zhiwei.brandkbs2.enmus.ReportTypeEnum;
import com.zhiwei.brandkbs2.enmus.response.ReportCodeEnum;
......@@ -82,6 +79,9 @@ public class ReportServiceImpl implements ReportService {
@Resource(name = "indexServiceImpl")
IndexService indexService;
@Resource(name = "eventMiddlewareDao")
EventMiddlewareDao eventMiddlewareDao;
@Resource(name = "mongoUtil")
com.zhiwei.brandkbs2.util.MongoUtil mongoUtil;
......@@ -91,9 +91,6 @@ public class ReportServiceImpl implements ReportService {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
private EventClient eventClient;
@Override
public Map<String, ReportSettingsDTO> getReportSettings() {
Map<String, ReportSettingsDTO> res = new HashMap<>();
......@@ -395,7 +392,7 @@ public class ReportServiceImpl implements ReportService {
//正面事件传播量top
// 调用事件中间件时,主品牌id使用项目id
List<com.zhiwei.middleware.event.pojo.entity.Event> topPosEventList =
eventClient.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, projectId, 3);
eventMiddlewareDao.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, projectId, 3);
if (CollectionUtils.isEmpty(topPosEventList)) {
List<Map.Entry<String, Integer>> topPosArticleList = markDataService.getMarkTopTitle(startTime, endTime, EmotionEnum.POSITIVE.getName(), projectId, linkedGroupId, contendId, 3);
result.put("topPosSummary", this.getTopArticlesMsg(startTime, endTime, projectId, linkedGroupId, contendId, topPosArticleList));
......@@ -413,7 +410,7 @@ public class ReportServiceImpl implements ReportService {
//中性事件传播量top
// 调用事件中间件时,主品牌id使用项目id
List<com.zhiwei.middleware.event.pojo.entity.Event> topNeuEventList =
eventClient.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.NEUTRAL.getName(), projectId, projectId, 4);
eventMiddlewareDao.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.NEUTRAL.getName(), projectId, projectId, 4);
if (CollectionUtils.isEmpty(topNeuEventList)) {
List<Map.Entry<String, Integer>> topNeuArticleList = markDataService.getMarkTopTitle(startTime, endTime, EmotionEnum.NEUTRAL.getName(), projectId, linkedGroupId, contendId, 4);
result.put("topNeuSummary", this.getTopArticlesMsg(startTime, endTime, projectId, linkedGroupId, contendId, topNeuArticleList));
......@@ -431,7 +428,7 @@ public class ReportServiceImpl implements ReportService {
//中性事件传播量top
// 调用事件中间件时,主品牌id使用项目id
List<com.zhiwei.middleware.event.pojo.entity.Event> topNegEventList =
eventClient.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, projectId, 4);
eventMiddlewareDao.getEventsByTotalChannelVolumeTop(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, projectId, 4);
if (CollectionUtils.isEmpty(topNegEventList)) {
List<Map.Entry<String, Integer>> topNegArticleList = markDataService.getMarkTopTitle(startTime, endTime, EmotionEnum.NEGATIVE.getName(), projectId, linkedGroupId, contendId, 4);
result.put("topNegSummary", this.getTopArticlesMsg(startTime, endTime, projectId, linkedGroupId, contendId, topNegArticleList));
......@@ -510,7 +507,7 @@ public class ReportServiceImpl implements ReportService {
result.put("name", Objects.equals(emotion, EmotionEnum.POSITIVE.getName()) ? "正面事件" : Objects.equals(emotion, EmotionEnum.NEGATIVE.getName()) ? "负面事件" : "中性事件");
// 调用事件中间件时,主品牌id使用项目id
List<com.zhiwei.middleware.event.pojo.entity.Event> topEventList =
eventClient.getEventsByTotalChannelVolumeTop(startTime, endTime, emotion, projectId, projectId, 10);
eventMiddlewareDao.getEventsByTotalChannelVolumeTop(startTime, endTime, emotion, projectId, projectId, 10);
result.put("events", topEventList.stream().map(event -> {
JSONObject topEvent = new JSONObject();
boolean hasAnalyze = false;
......
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