提交 3bf36b9c 作者: chenshiqiang

commit 3.24

上级 9cb29731
......@@ -85,6 +85,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
......@@ -149,8 +153,40 @@
<artifactId>mammoth</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>2.8.7</version>
</dependency>
<!--stream kafka-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
<version>3.0.8.RELEASE</version>
</dependency>
<dependency>
<groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId>
<version>9.1.5</version>
</dependency>
<!-- mini文件存储服务 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.2</version>
</dependency>
<!-- 动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
......@@ -161,19 +197,25 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<resources>
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
<repositories>
<repository>
......@@ -188,4 +230,5 @@
</releases>
</repository>
</repositories>
</project>
package com.zzsn.event;
import com.zzsn.event.config.TaskExecutor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
......
......@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
@Component
public class TaskExecutor implements CommandLineRunner {
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
private final Integer PERIOD=1;
private final Integer PERIOD=10000;
@Autowired
private IEventService eventService;
......
......@@ -7,6 +7,44 @@ public class Constants {
//redis缓存 key常量
public static final String FINANCE = "SAVE_ES:";
public static final String RESEARCH = "RESEARCH:";
//事件专题-redis缓存key前缀
public static final String SUBJECT_ANALYSIS_PRE = "SUBJECT_ANALYSIS::";
//传播路径
public static final String PROPAGATION_KEY = "PROPAGATION_PATH::";
/**
* 关键词数据入缓存 key前缀
*/
public static final String KEY_WORDS_TO_REDIS_PREFIX = "KEY_WORDS_TO_REDIS::";
public static String[] FETCH_FIELDS_STATISTIC = {"id", "subjectId","title","origin", "publishDate", "sourceAddress", "masterEntryId","infoSourceType"};
public static String[] FETCH_FIELDS_DATA = {"id", "subjectId", "title", "content", "publishDate", "origin", "sourceAddress", "masterEntryId","infoSourceType"};
//es 专题库索引
public static final String SUBJECT_INDEX = "subjectdatabase";
//es 采集库索引
public static final String COLLECT_INDEX = "basedata";
//专题事件脉络展示 伪事件脉络 的资讯数量阈值
public static final int FAKE_NUM = 6;
//kafka 发送分析命令 主题
public static final String EVENT_ANALYSIS_TOPIC = "event-analysis";
//kafka 发送 事件脉络所需信息 主题
public static final String EVENT_CONTEXT_SEND_TOPIC = "event_context_send_topic";
//kafka 发送 伪事件脉络所需信息 主题
public static final String FAKE_EVENT_CONTEXT_SEND_TOPIC = "fake_event_context_send_data";
//统计分析
public static final String TW_STATISTIC_ANALYSIS_KEY = "TW_STATISTIC_ANALYSIS::";
//统计分析
public static final String STATISTIC_ANALYSIS_KEY = "STATISTIC_ANALYSIS::";
//kafka 接收 观点分析结果 主题
public static final String VIEWPOINT_RECEIVE_TOPIC = "event_viewpoint_result_data";
//kafka 接收 事件脉络结果 主题
public static final String EVENT_CONTEXT_RECEIVE_TOPIC = "event_topic_result_data";
//kafka 接收 伪事件脉络结果 主题
public static final String FAKE_EVENT_CONTEXT_RECEIVE_TOPIC = "fake_event_context-result_data";
//重复数索引ku
public final static String ES_REPEAT_OLD = "repeathold";
//旧同步数据时索引
public final static String ES_DATA_NEW_INDEX = "newclbdatabase";
......
package com.zzsn.event.consumer;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.service.EsService;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.SubjectAnalysisService;
import com.zzsn.event.vo.SubjectDataVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
* @author lkg
* 监听消费kafka消息
* 消费topic中消息(注意:如果监听的topic不存在则会自动创建)
* @date 2022/7/15
*/
@Slf4j
@Component
public class KafkaConsumer {
@Autowired
private EsService esService;
@Autowired
private SubjectAnalysisService subjectAnalysisService;
@Autowired
private IEventService eventService;
/**
* 获取-观点分析-分析结果数据,并入库
*
* @param record 接受的kafka数据
*/
@KafkaListener(topics = {Constants.VIEWPOINT_RECEIVE_TOPIC})
public void viewPointAnalysis(ConsumerRecord<String, String> record) {
String value = record.value();
if (StringUtils.isNotEmpty(value)) {
String subjectId = null;
try {
List<SubjectAnalysis> subjectAnalyses = JSON.parseArray(value, SubjectAnalysis.class);
subjectAnalyses.forEach(e -> {
SubjectDataVo subjectDataVo = esService.queryInfo(e.getDataId());
Integer repeatNum = e.getRepeatNum();
if (repeatNum == 0) {
String repeatId = subjectDataVo.getRepeatId();
if (StringUtils.isNotEmpty(repeatId)) {
repeatNum = esService.getRepeatNum(repeatId);
}
}
if (repeatNum == 0) {
e.setRepeatNum(1);
} else {
e.setRepeatNum(repeatNum);
}
e.setTitle(removeNonBmpUniCodes(e.getTitle()));
});
Integer category = subjectAnalyses.get(0).getCategory();
subjectId = subjectAnalyses.get(0).getSubjectId();
Date analysisDate = subjectAnalyses.get(0).getAnalysisDate();
LambdaQueryWrapper<SubjectAnalysis> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectAnalysis::getSubjectId, subjectId).eq(SubjectAnalysis::getCategory, category);
subjectAnalysisService.remove(queryWrapper);
subjectAnalysisService.saveBatch(subjectAnalyses);
//更新专题最近一次观点分析的时间
Event subject = new Event();
subject.setId(subjectId);
subject.setAnalysisTime(analysisDate);
eventService.updateById(subject);
} catch (Exception e) {
e.printStackTrace();
}
log.info("id为-{}-的专题,此次-观点分析-数据更新完成", subjectId);
}
}
/**
* 获取-事件脉络-分析结果数据,并入库
*
* @param record 接受的kafka数据
*/
@KafkaListener(topics = {Constants.EVENT_CONTEXT_RECEIVE_TOPIC})
public void eventContext(ConsumerRecord<String, String> record) {
String value = record.value();
if (StringUtils.isNotEmpty(value)) {
try {
List<SubjectAnalysis> subjectAnalyses = JSON.parseArray(value, SubjectAnalysis.class);
subjectAnalyses.forEach(e -> {
if (exist(e)) {
e.setTitle(removeNonBmpUniCodes(e.getTitle()));
subjectAnalysisService.save(e);
}
});
log.info("id为-{}-的专题,此次-事件脉络-数据更新完成", subjectAnalyses.get(0).getSubjectId());
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 获取-伪事件脉络-分析结果数据,并入库
*
* @param record 接受的kafka数据
*/
@KafkaListener(topics = {Constants.FAKE_EVENT_CONTEXT_RECEIVE_TOPIC})
public void eventContext_fake(ConsumerRecord<String, String> record) {
String value = record.value();
if (StringUtils.isNotEmpty(value)) {
String subjectId = null;
Integer category = 3;
try {
List<SubjectAnalysis> subjectAnalyses = JSON.parseArray(value, SubjectAnalysis.class);
subjectId = subjectAnalyses.get(0).getSubjectId();
subjectAnalyses.forEach(e -> {
e.setCategory(category);
e.setTitle(removeNonBmpUniCodes(e.getTitle()));
});
LambdaQueryWrapper<SubjectAnalysis> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectAnalysis::getSubjectId,subjectId).eq(SubjectAnalysis::getCategory,category);
int count = subjectAnalysisService.count(queryWrapper);
if (count>0) {
subjectAnalysisService.remove(queryWrapper);
}
subjectAnalysisService.saveBatch(subjectAnalyses);
} catch (Exception e) {
e.printStackTrace();
}
log.info("id为-{}-的专题,此次-伪事件脉络-数据更新完成", subjectId);
}
}
private boolean exist(SubjectAnalysis subjectAnalyse){
LambdaQueryWrapper<SubjectAnalysis> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectAnalysis::getCategory,2).eq(SubjectAnalysis::getDataId,subjectAnalyse.getDataId())
.eq(SubjectAnalysis::getSubjectId,subjectAnalyse.getSubjectId());
SubjectAnalysis one = subjectAnalysisService.getOne(queryWrapper);
return one == null;
}
//去除特殊的字符,例如表情符
private String removeNonBmpUniCodes(String str) {
return StringUtils.isEmpty(str) ? null : str.replaceAll("[^\\u0000-\\uFFFF]", "");
}
}
package com.zzsn.event.controller;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.entity.Report;
import com.zzsn.event.service.EsStatisticsService;
import com.zzsn.event.service.LabelEntityService;
import com.zzsn.event.service.ReportService;
import com.zzsn.event.util.CalculateUtil;
import com.zzsn.event.util.MinioUtil;
import com.zzsn.event.util.RestUtil;
import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.MediaVO;
import com.zzsn.event.vo.Result;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
/**
* 舆情分析
*
* @author lkg
* @date 2024/1/24
*/
@RestController
@RequestMapping("/public/opinion/analysis")
public class EventAnalysisController {
@Autowired
private EsStatisticsService esStatisticsService;
@Autowired
private LabelEntityService labelEntityService;
@Autowired
private ReportService reportService;
@Value("${subject.analysis-url:}")
private String analysisUrl;
/**
* 下载报告
*
* @param subjectId 专题id
* @author lkg
* @date 2024/2/1
*/
@GetMapping("/download")
public void download(@RequestParam String subjectId,HttpServletResponse response){
try {
LambdaQueryWrapper<Report> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.select(Report::getReportName, Report::getFilePath)
.eq(Report::getSubjectId,subjectId);
Report one = reportService.getOne(queryWrapper);
String filePath = one.getFilePath();
if (StringUtils.isNotEmpty(filePath)) {
int index = filePath.indexOf("/");
String bucketName = filePath.substring(0, index);
String filename = filePath.substring(index);
InputStream inputStream = MinioUtil.getMinioFile(bucketName, filename);
byte[] bytes = IOUtils.toByteArray(inputStream);
String fileName = one.getReportName() + ".docx";
fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", " ");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentLength(bytes.length);
OutputStream out = response.getOutputStream();
out.write(bytes);
out.flush();
out.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 总体分析
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/24
*/
@GetMapping("/total")
public Result<?> totalAndMax(@RequestParam String subjectId, @RequestParam String startTime, @RequestParam String endTime) {
Map<String, Object> map = esStatisticsService.totalAndMax(subjectId, null, null);
long hours = DateUtil.between(DateUtil.parseDateTime(startTime), DateUtil.parseDateTime(endTime), DateUnit.HOUR);
map.put("duration",hours);
Object count = map.get("totalCount");
String divide = CalculateUtil.divide(String.valueOf(count), String.valueOf(hours), 2);
map.put("spread", divide);
String mainReport = esStatisticsService.mainReport(subjectId);
map.put("mainReport",mainReport);
return Result.OK(map);
}
/**
* 情感判断分析
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @author lkg
* @date 2024/1/25
*/
@GetMapping("/orientation")
public Result<?> orientation(@RequestParam String subjectId, @RequestParam String startTime,
@RequestParam String endTime, @RequestParam Integer type) {
List<CountVO> list = new ArrayList<>();
String labelTypeId = "1631119596744265729";
List<LabelEntity> labelEntities = labelEntityService.listByType(labelTypeId);
AtomicLong total = new AtomicLong();
labelEntities.forEach(e -> {
CompletableFuture<CountVO> async = CompletableFuture.supplyAsync(() -> {
CountVO countVO = esStatisticsService.orientation(subjectId, e.getId(), startTime, endTime, type);
total.addAndGet(countVO.getValue());
supply(countVO, startTime,endTime,type);
return countVO;
});
try {
CountVO countVO = async.get();
list.add(countVO);
} catch (Exception ex) {
ex.printStackTrace();
}
});
for (CountVO countVO : list) {
long value = countVO.getValue();
long totalCount = total.get();
String divide = CalculateUtil.divide(String.valueOf(value), String.valueOf(totalCount));
String percentage = "0%";
if (StringUtils.isNotEmpty(divide)) {
percentage = CalculateUtil.percentage(Double.parseDouble(divide),false);
}
countVO.setPercentage(percentage);
}
return Result.OK(list);
}
/**
* 影响力分析
*
* @param subjectId 专题id
* @author lkg
* @date 2024/1/25
*/
@GetMapping("/influence")
public Result<?> influence(@RequestParam String subjectId){
List<CountVO> list = esStatisticsService.influence(subjectId, null, null);
return Result.OK(list);
}
/**
* 来源分析
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @author lkg
* @date 2024/1/25
*/
@GetMapping("/source")
public Result<?> source(@RequestParam String subjectId,@RequestParam String startTime,
@RequestParam String endTime, @RequestParam Integer type){
List<CountVO> list = esStatisticsService.source(subjectId, startTime, endTime, type);
for (CountVO countVO : list) {
supply(countVO, startTime,endTime,type);
}
return Result.OK(list);
}
/**
* 平台活跃度占比
*
* @param subjectId 专题id
* @author lkg
* @date 2024/1/25
*/
@GetMapping("/origin")
public Result<?> origin(@RequestParam String subjectId){
List<CountVO> list = esStatisticsService.origin(subjectId, null, null);
return Result.OK(list);
}
//补充缺失的时间
private void supply(CountVO countVO, String startTime,String endTime,Integer type) {
List<CountVO> list = new ArrayList<>();
List<CountVO> children = countVO.getChildren();
Map<String, CountVO> map = children.stream().collect(Collectors.toMap(CountVO::getName, item -> item, (k1, k2) -> k2));
DateTime startDate = DateUtil.parseDateTime(startTime);
DateTime endDate = DateUtil.parseDateTime(endTime);
List<DateTime> rangeToList = new ArrayList<>();
String format = null;
if (type == 1) {
rangeToList = DateUtil.rangeToList(startDate, endDate, DateField.HOUR_OF_DAY);
format = "yyyy-MM-dd HH";
} else if (type == 2) {
rangeToList = DateUtil.rangeToList(startDate, endDate, DateField.DAY_OF_YEAR);
format = "yyyy-MM-dd";
}
for (DateTime dateTime : rangeToList) {
String date = DateUtil.format(dateTime,format);
if (map.containsKey(date)) {
list.add(countVO);
} else {
CountVO vo = new CountVO();
vo.setName(date);
vo.setValue(0L);
list.add(vo);
}
}
countVO.setChildren(list);
}
}
package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -14,8 +15,11 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
/**
* 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
......@@ -49,7 +53,41 @@ public class EventCategoryController {
IPage<EventCategory> pageList = eventCategoryService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 通过父级id查询列表
*
* @return
*/
@ApiOperation(value="通过父级id查询列表", notes="通过父级id查询列表")
@GetMapping(value = "/getByParentId")
public Result<?> getByParentId(String pid) {
return Result.OK(eventCategoryService.list(new LambdaQueryWrapper<EventCategory>().eq(EventCategory::getPid,pid)));
}
/**
* 获取树状数据
*
* @return
*/
@ApiOperation(value="获取树状数据", notes="获取树状数据")
@GetMapping(value = "/treeData")
public Result<?> treeData() {
Map<String, List<EventCategory>> collect = eventCategoryService.list().stream().collect(Collectors.groupingBy(EventCategory::getPid));
EventCategory parent = EventCategory.builder().id("0").typeName("所有").hasChild(1).build();
buildData(parent,collect);
return Result.OK(parent);
}
private void buildData(EventCategory parent, Map<String, List<EventCategory>> collect) {
if(parent.getHasChild()==1){
parent.setChildren(collect.get(parent.getId()));
collect.remove(parent.getId());
for (EventCategory child : parent.getChildren()) {
buildData(child,collect);
}
}
}
/**
* 添加
*
......
package com.zzsn.event.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.producer.ProduceInfo;
import com.zzsn.event.service.AnalysisService;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.util.ObjectUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.RestUtil;
import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.vo.Result;
import com.zzsn.event.vo.SubjectKeywordsMap;
import com.zzsn.event.vo.SubjectPage;
import com.zzsn.event.vo.*;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import netscape.javascript.JSObject;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.*;
/**
/**
* 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
......@@ -36,8 +37,17 @@ import java.util.Arrays;
public class EventController {
@Autowired
private IEventService eventService;
@Value(("${enterprise-service.url:}"))
private String ENTERPRISE_URL;
@Value(("${serviceProject.url:}"))
private String SERVICE_PROJECT_URL;
@Autowired
private RedisUtil redisUtil;
@Autowired
private AnalysisService analysisService;
@Autowired
private IXxlJobInfoService iXxlJobInfoService;
@Autowired
private ProduceInfo produceInfo;
/**
* 分页列表查询
......@@ -54,9 +64,8 @@ public class EventController {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Event> queryWrapper = new QueryWrapper<>();
Page<Event> page = new Page<Event>(pageNo, pageSize);
IPage<Event> pageList = eventService.page(page, queryWrapper);
IPage<Event> pageList = eventService.pageList(event, pageNo,pageSize);
return Result.OK(pageList);
}
......@@ -68,21 +77,42 @@ public class EventController {
*/
@ApiOperation(value="事件-添加", notes="事件-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Event event) {
eventService.save(event);
public Result<?> add(@RequestBody AddEventParam eventParam) {
eventParam.setCreateTime(new Date());
eventParam.setUpdateTime(new Date());
Event event = eventService.saveMain(eventParam);
//插入xxlJob
iXxlJobInfoService.subjectInsert(event);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param event
* @param addEventParam
* @return
*/
@ApiOperation(value="事件-编辑", notes="事件-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Event event) {
eventService.updateById(event);
public Result<?> edit(@RequestBody AddEventParam addEventParam) {
Event byId = eventService.getById(addEventParam.getId());
addEventParam.setUpdateTime(new Date());
eventService.updateMain(addEventParam);
//更新xxljob
List<String> subjectCodes = new ArrayList<>();
if(null!=addEventParam.getEventCode()){
subjectCodes.add(addEventParam.getEventCode());
iXxlJobInfoService.keyWordsUpdate(subjectCodes, String.valueOf(addEventParam.getStatus()));
}else {
return Result.error("eventCode 必传!");
}
//判断是否提取热词
eventService.extractHotWords(addEventParam);
if (!Objects.equals(byId.getStatus(), addEventParam.getStatus()) && addEventParam.getStatus() == 1){
produceInfo.sendSubjectMsg(addEventParam.getEventCode());
}
return Result.OK("编辑成功!");
}
......@@ -133,7 +163,7 @@ public class EventController {
public Object infoSourceBind(@RequestBody SubjectPage subjectPage) {
try {
JSONObject params = ObjectUtil.objectToJSONObject(subjectPage);;
String url = ENTERPRISE_URL + "enterpriseData/getYearReportList";
String url = SERVICE_PROJECT_URL + "enterpriseData/getYearReportList";
return RestUtil.post(url, null, params);
} catch (Exception e) {
return null;
......@@ -149,7 +179,7 @@ public class EventController {
@RequestParam(name="groupId") String groupId,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
String url = ENTERPRISE_URL + "event/infoSource/bindList";
String url = SERVICE_PROJECT_URL + "event/infoSource/bindList";
JSONObject params = ObjectUtil.objectToJSONObject(infoSourceVo);
params.put("ynBind",ynBind);
params.put("groupId",groupId);
......@@ -164,7 +194,7 @@ public class EventController {
@GetMapping("/keywordsType/rootListNoPage")
public Object keywordsList(@RequestParam(name = "contain", defaultValue = "false") Boolean contain,
@RequestParam(name = "subjectId", defaultValue = "0") String subjectId) {
String url = ENTERPRISE_URL + "event/keywordsType/rootListNoPage";
String url = SERVICE_PROJECT_URL + "event/keywordsType/rootListNoPage";
JSONObject params = new JSONObject();
params.put("contain",contain);
params.put("subjectId",subjectId);
......@@ -177,7 +207,7 @@ public class EventController {
public Object keyWordsBind(@RequestBody SubjectPage subjectPage) {
try {
JSONObject params = ObjectUtil.objectToJSONObject(subjectPage);;
String url = ENTERPRISE_URL + "event/keyWordsBind";
String url = SERVICE_PROJECT_URL + "event/keyWordsBind";
return RestUtil.post(url, null, params);
} catch (Exception e) {
return null;
......@@ -190,10 +220,57 @@ public class EventController {
public Object keyWordsEdit(@RequestBody SubjectKeywordsMap subjectKeywordsMap) {
try {
JSONObject params = ObjectUtil.objectToJSONObject(subjectKeywordsMap);;
String url = ENTERPRISE_URL + "event/keyWords/edit";
String url = SERVICE_PROJECT_URL + "event/keyWords/edit";
return RestUtil.post(url, null, params);
} catch (Exception e) {
return null;
}
}
/**
* 标签查询
*/
@PostMapping("/label/treeList")
public Object labelTreeList(@RequestBody SubjectKeywordsMap subjectKeywordsMap) {
try {
JSONObject params = ObjectUtil.objectToJSONObject(subjectKeywordsMap);;
String url = SERVICE_PROJECT_URL + "event/label/treeList";
return RestUtil.post(url, null, params);
} catch (Exception e) {
return null;
}
}
/**
* 传播路径
*
* @param eventId 事件id
*/
@GetMapping("/propagationPath")
public Result propagationPath(@RequestParam String eventId) {
String key = Constants.SUBJECT_ANALYSIS_PRE + Constants.PROPAGATION_KEY + eventId;
PropagationPathVo pathVo = (PropagationPathVo) redisUtil.get(key);
if (ObjectUtils.isEmpty(pathVo)) {
pathVo = analysisService.propagationPath(eventId);
}
return Result.OK(pathVo);
}
/**
* 事件脉络
*
* @param subjectId 专题id
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @return com.zzsn.subjectAnalysis.common.Result
*/
@GetMapping("/eventContext")
public Result eventContext(@RequestParam String subjectId,
@RequestParam(value = "fakeNum", required = false) Integer fakeNum) {
if (fakeNum == null) {
fakeNum = Constants.FAKE_NUM;
}
List<SubjectAnalysis> cacheList = analysisService.eventContext(subjectId, fakeNum);
return Result.OK(cacheList);
}
}
package com.zzsn.event.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description: 通用多字段基类
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class BaseEntity extends BaseEntityId {
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author zs
* @Description: 通用id
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class BaseEntityId implements Serializable {
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
}
......@@ -43,7 +43,7 @@ public class Event {
/**事件类型*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private Integer eventType;
private String eventType;
/**开始时间*/
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
......@@ -60,10 +60,12 @@ public class Event {
@Excel(name = "事件地域", width = 15)
@ApiModelProperty(value = "事件地域")
private String eventArea;
private String eventAreaId;
/**标签*/
@Excel(name = "标签", width = 15)
@ApiModelProperty(value = "标签")
private String eventLabel;
private String eventLabelIds;
/**关键词*/
@Excel(name = "关键词", width = 15)
@ApiModelProperty(value = "关键词")
......@@ -97,4 +99,24 @@ public class Event {
@ApiModelProperty(value = "修改人id")
private String updateBy;
private Integer status=1;
/**
* 分析事件脉络-最新资讯的时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date analysisTime;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date eventTime;
@TableField(exist = false)
private String typeName;
private String eventCode;
private String cron;
/**事件专题增量分析规则*/
@ApiModelProperty(value = "事件专题增量分析规则")
private Integer increAnaRule;
/**事件专题总量分析规则*/
@ApiModelProperty(value = "事件专题总量分析规则")
private Integer totalAnaRule;
/**事件专题时间间隔分析规则(天)*/
@ApiModelProperty(value = "事件专题时间间隔分析规则(天)")
private Integer timeAnaRule;
}
......@@ -2,14 +2,15 @@ package com.zzsn.event.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -26,12 +27,14 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event_category对象", description="事件分类")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EventCategory {
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private Integer id;
private String id;
/**事件分类名称*/
@Excel(name = "事件分类名称", width = 15)
@ApiModelProperty(value = "事件分类名称")
......@@ -43,7 +46,7 @@ public class EventCategory {
/**是否有子节点0,没有 1,有*/
@Excel(name = "是否有子节点0,没有 1,有", width = 15)
@ApiModelProperty(value = "是否有子节点0,没有 1,有")
private String hasChild;
private Integer hasChild;
/**状态*/
@Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态")
......@@ -80,4 +83,6 @@ public class EventCategory {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@TableField(exist = false)
private List<EventCategory> children;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: 标签相关的实体
* @Author: jeecg-boot
* @Date: 2022-11-30
* @Version: V1.0
*/
@Data
@TableName("label_entity")
@ApiModel(value="label_entity对象", description="标签相关的实体")
public class LabelEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String name;
/**近义词*/
@Excel(name = "近义词", width = 15)
@ApiModelProperty(value = "近义词")
private String synonym;
/**说明*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private String explanation;
/**层级*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private Integer level;
/**一级主键id*/
@Excel(name = "一级主键id", width = 15)
@ApiModelProperty(value = "一级主键id")
private String topId;
/**所有id*/
@Excel(name = "所有id", width = 15)
@ApiModelProperty(value = "所有id")
private String pathIds;
/**状态*/
@Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态")
private Integer status;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**父级节点*/
@Excel(name = "父级节点", width = 15)
@ApiModelProperty(value = "父级节点")
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
@TableField(exist = false)
private String labelTypeId;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzsn.event.vo.ReportExtendVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 报告表
*
* @author lkg
* @date 2023/3/16
*/
@Data
@TableName("clb_report")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "clb_report", description = "报告表")
public class Report implements Serializable {
/**
* 主键id
*/
@ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 报告名称
*/
@ApiModelProperty(value = "报告名称")
@TableField("report_name")
private String reportName;
/**
* 报告刊期
*/
@ApiModelProperty(value = "报告刊期")
@TableField("report_issue")
private String reportIssue;
/**
* 报告内容
*/
@ApiModelProperty(value = "报告内容")
@TableField("content")
private String content;
/**
* 开始时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间")
@TableField("start_time")
private Date startTime;
/**
* 结束时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束时间")
@TableField("end_time")
private Date endTime;
/**
* 文件地址
*/
@ApiModelProperty(value = "文件地址")
@TableField("file_path")
private String filePath;
/**
* 预览地址
*/
@ApiModelProperty(value = "预览地址")
@TableField("preview")
private String preview;
/**
* 模板id
*/
@ApiModelProperty(value = "模板id")
@TableField("template_id")
private String templateId;
/**
* 报告类型id
*/
@ApiModelProperty(value = "报告类型id")
@TableField("type_id")
private String typeId;
/**
* 描述
*/
@ApiModelProperty(value = "描述")
@TableField("description")
private String description;
/**
* 专题id
*/
@ApiModelProperty(value = "专题id")
@TableField("subject_id")
private String subjectId;
/**
* 项目id
*/
@ApiModelProperty(value = "项目id")
@TableField("project_id")
private String projectId;
/**
* 项目下的栏目id
*/
@ApiModelProperty(value = "项目下的栏目id")
@TableField("column_id")
private String columnId;
/**
* 发布状态(0-不发布;1-发布)
*/
@ApiModelProperty(value = "发布状态(0-不发布;1-发布)")
@TableField("publish")
private Integer publish;
/**
* 生成方式(1-自动;2-手动)
*/
@ApiModelProperty(value = "生成方式(1-自动;2-手动)")
@TableField("create_way")
private Integer createWay;
/**
* 报告状态(0-禁用;1-正常)
*/
@ApiModelProperty(value = "报告状态(0-禁用;1-正常)")
@TableField("status")
private Integer status;
/**
* 报告任务id
*/
@ApiModelProperty(value = "报告任务id")
@TableField("task_id")
private String taskId;
/**
* 任务执行时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "任务执行时间")
@TableField("task_execution_time")
private Date taskExecutionTime;
/**
* 是否删除(0-否;1-是)
*/
@ApiModelProperty(value = "是否删除(0-否;1-是)")
@TableField("delete_status")
private Integer deleteStatus;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
private Date createTime;
/**报告所属栏目信息*/
@TableField(exist = false)
private List<ReportExtendVo> reportExtendVoList;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @author : wp
* @title : Subject
* @description: 专题
* @date : Created in 2022/7/7 10:04
* @modified By:
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "subject",autoResultMap = true)
public class Subject implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String subjectCode;
/**
* 专题名称
*/
private String subjectName;
/**
* 专题图片名称
*/
private String picturePolicy;
/**
* 启用时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date timeEnable;
/**
* 停用时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date timeDisable;
/**
* 专题增量分析规则
*/
private Integer increAnaRule;
/**
* 专题总量分析规则
*/
private Integer totalAnaRule;
/**
* 专题时间间隔分析规则
*/
private Integer timeAnaRule;
/**
* 专题最近一次分析时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date analysisTime;
/**
* 分析事件脉络-最新资讯的时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date eventTime;
/**
* 外事办映射id
*/
private Integer wsbMapId;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 所属客户
*/
private String customerId;
private Integer status;
/**
* 专题类别(1:通用专题 2:事件专题)
*/
public Integer subjectType;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @author lkg
* @description: 专题分析表
* @date 2022/7/14 17:10
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "subject_analysis",autoResultMap = true)
public class SubjectAnalysis implements Serializable {
/*主键id*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/*专题id*/
private String subjectId;
/*资讯id*/
private String dataId;
/*标题*/
private String title;
/*来源*/
private String origin;
/*发布时间*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date publishDate;
/*链接*/
private String sourceAddress;
/*重复数*/
private Integer repeatNum;
/*观点分析下的类型(1-新闻;2-论坛;3-微博)*/
private Integer type;
/*分类(1-观点分析;2-事件脉络;3-伪事件脉络)*/
//伪事件脉络 即当事件脉络资讯数量少于约定数量,通过python算法生成临时的资讯数量大于/等于约定数量的事件脉络。
private Integer category;
/*分析时间*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date analysisDate;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 专题与搜索引擎关联表
* @Author: jeecg-boot
* @Date: 2022-06-21
* @Version: V1.0
*/
@Data
@TableName("subject_search_engines_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="subject_search_engines_map对象", description="专题与搜索引擎关联表")
public class SubjectSearchEnginesMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
/**搜索引擎id*/
@Excel(name = "搜索引擎id", width = 15)
@ApiModelProperty(value = "搜索引擎id")
private String searchEngineId;
}
package com.zzsn.event.enums;
/**
* @author zhang ya nuo
* @Description 编码前缀枚举
* @since 2021/6/8
*/
public enum CodePrefixEnum {
INFO_SOURCE_DEFAULT("IN","信息源编码默认前缀"),
SUBJECT_DEFAULT("SJ", "专题编码默认前缀"),
PROJECT_DEFAULT("PJ", "项目编码默认前缀"),
CUSTOMER_DEFAULT("CS", "客户编码默认前缀"),
SPECIAL_INFO_SOURCE_DEFAULT("PY","信息源编码默认前缀"),
INFO_SOURCE_GROUP_DEFAULT("ING","信息源组编码默认前缀"),
KEY_WORDS_DEFAULT("KW", "关键词默认前缀"),
SOCIAL_CREDIT_CODE_DEFAULT("ZZSN", "统一社会信用代码前缀"),
QCC_ENTERPRISE_ID_DEFAULT("QCC", "老企业库ID"),
COLUMN_CODE_DEFAULT("COL", "栏目编码默认前缀"),
LABEL_CODE_DEFAULT("LABEL", "标签编码默认前缀");
// 前缀
private String value;
// 描述信息
private String des;
CodePrefixEnum(String value, String des) {
this.value = value;
this.des = des;
}
public String getValue() {
return value;
}
public String getDes() {
return des;
}
}
package com.zzsn.event.enums;
/**
* 影响力字段枚举
*
* @author lkg
* @date 2024/1/24
*/
public enum InfluenceEnum {
LIKE("likeNum", "点赞数"),
COMMENT("commentNum", "评论数"),
COLLECT("collectNum", "收藏数"),
SHARE("shareNum", "分享数");
/**值*/
private final String field;
/**描述*/
private final String description;
public String getField() {
return field;
}
public String getDescription() {
return description;
}
InfluenceEnum(String field, String description) {
this.field = field;
this.description = description;
}
}
package com.zzsn.event.enums;
/**
* @author zhang ya nuo
* @Description 信息源状态枚举
* @since 2021/6/9
*/
public enum InfoSourceStatusEnum {
ENABLE("1","启用"),
DISABLE("0","禁用");
private String value;
private String des;
InfoSourceStatusEnum(String value, String des) {
this.value = value;
this.des = des;
}
public String getvalue() {
return value;
}
public String getDes() {
return des;
}
}
package com.zzsn.event.enums;
import lombok.Getter;
/**
* 货币计量单位枚举
*
* @author lkg
* @date 2023/8/25
*/
@Getter
public enum SourceEnum {
OTHER("0", "其他"),
WEBSITE("1", "网站"),
WEIBO("2", "微博"),
WECHAT("3", "微信公众号"),
DOUYIN("4", "抖音"),
TIEBA("5", "贴吧");
/**值*/
private final String value;
/**描述*/
private final String description;
SourceEnum(String value, String description) {
this.value = value;
this.description = description;
}
public static String getDescription(String value){
String description = null;
SourceEnum[] values = SourceEnum.values();
for (SourceEnum sourceEnum : values) {
if (sourceEnum.value.equals(value)) {
description = sourceEnum.description;
break;
}
}
return description;
}
}
package com.zzsn.event.enums;
/**
* @author zhang ya nuo
* @Description xxljobinfo status 枚举
* @since 2021/6/9
*/
public enum XxljobInfoStatusEnum {
RUNNING(1,"运行"),
STOP(0,"停止");
private Integer value;
private String des;
XxljobInfoStatusEnum(int value, String des) {
this.value = value;
this.des = des;
}
public Integer getvalue() {
return value;
}
public String getDes() {
return des;
}
}
......@@ -2,8 +2,12 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.Event;
import com.zzsn.event.vo.SubjectKafkaVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
/**
* @Description: 事件
* @Author: jeecg-boot
......@@ -13,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EventMapper extends BaseMapper<Event> {
List<SubjectKafkaVo> eventSubjectList(int i);
List<Event> pageList(Event event, Integer offset, Integer pageSize);
Integer totalCount(Event event);
List<SubjectKafkaVo> prosessList(Date disableDate);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.xxljob.entity.KeyWords;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 关键词管理
* @Author: jeecg-boot
* @Date: 2021-11-26
* @Version: V1.0
*/
@Mapper
public interface KeyWordsMapper extends BaseMapper<KeyWords> {
List<KeyWordsPage> selectKeyWordsListById(@Param("subjectId") String subjectId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.LabelEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author lenovo
* @description 针对表【label_entity】的数据库操作Mapper
* @createDate 2023-08-28 15:02:50
* @Entity com.zzsn.clb.scheduletask.entity.LabelEntity
*/
@Mapper
public interface LabelEntityMapper extends BaseMapper<LabelEntity> {
/**
* 根据分类获取标签列表
*
* @param labelTypeId 标签分类id
* @author lkg
* @date 2024/1/22
*/
List<LabelEntity> listByType(@Param("labelTypeId") String labelTypeId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.Report;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 报告表
*
* @author lkg
* @date 2023/3/16
*/
@Mapper
public interface ReportMapper extends BaseMapper<Report> {
// /**
// * 报告表-分页列表
// *
// * @param typeId 报告分类id
// * @param offset 偏移量
// * @param pageSize 返回条数
// * @author lkg
// * @date 2023/3/24
// */
// List<ReportVO> pageList(@Param("typeId") String typeId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
//
// /**
// * 报告表-总数量
// *
// * @param typeId 报告分类id
// * @author lkg
// * @date 2023/3/24
// */
// Integer count(@Param("typeId") String typeId);
//
//
// /**
// * 报告表-分页列表(客户)
// *
// * @param typeIds 报告分类id集合
// * @param projectIds 项目id集合
// * @param reportName 报告名称
// * @param startTime 开始时间
// * @param endTime 结束时间
// * @param offset 偏移量
// * @param pageSize 返回条数
// * @author lkg
// * @date 2023/3/24
// */
// List<UserReportVO> userPageList(@Param("typeIds") List<String> typeIds, @Param("projectIds") List<String> projectIds,
// @Param("reportName") String reportName,
// @Param("startTime") String startTime, @Param("endTime") String endTime,
// @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
//
// /**
// * 报告表-总数量(客户)
// *
// * @param typeIds 报告分类id集合
// * @param projectIds 项目id集合
// * @param reportName 报告名称
// * @param startTime 开始时间
// * @param endTime 结束时间
// * @author lkg
// * @date 2023/3/24
// */
// Integer total(@Param("typeIds") List<String> typeIds, @Param("projectIds") List<String> projectIds,
// @Param("reportName") String reportName,
// @Param("startTime") String startTime, @Param("endTime") String endTime);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectAnalysis;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lkg
* @description:
* @date 2022/7/14 17:17
*/
@Mapper
public interface SubjectAnalysisMapper extends BaseMapper<SubjectAnalysis> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 专题关键词关联表
* @Author: jeecg-boot
* @Date: 2021-12-09
* @Version: V1.0
*/
@Mapper
public interface SubjectKeywordsMapMapper extends BaseMapper<SubjectKeywordsMap> {
KeyWordsDTO selectMinByKeyWordsId(@Param("keyWordsId") String keyWordsId);
int selectCountByKeyWordsId(@Param("keyWordsId") String keyWordsId);
KeyWordsDTO selectMaxByKeyWordsId(@Param("keyWordsId") String keyWordsId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.Subject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* @author : wp
* @title : subjectMapper
* @description:专题mapper接口
* @date : Created in 2022/7/7 10:25
* @modified By:
*/
@Mapper
public interface SubjectMapper extends BaseMapper<Subject> {
// /**
// * 获取用户授权得事件专题列表
// *
// * @param userId: 用户id
// * @param subjectType: 专题类别(1:通用专题 2:事件专题)
// * @param title: 专题标题
// * @author lkg
// * @date 2023/2/22
// */
// List<Subject> searchSubjectList(@Param("userId") String userId, @Param("subjectType") Integer subjectType, @Param("title") String title);
//
// /**
// * 获取进行中(未结束)的事件专题列表
// *
// * @param subjectType 专题类别(1:通用专题 2:事件专题)
// * @param endDate 结束时间
// * @return java.util.List<com.zzsn.subjectAnalysis.vo.SubjectKafkaVo>
// * @author lkg
// */
// List<SubjectKafkaVo> progressList(@Param("subjectType") Integer subjectType, @Param("endDate") Date endDate);
//
// /**
// * 获取所有的事件专题列表
// *
// * @param subjectType 专题类别(1:通用专题 2:事件专题)
// * @return java.util.List<com.zzsn.subjectAnalysis.vo.SubjectKafkaVo>
// * @author lkg
// */
// List<SubjectKafkaVo> eventSubjectList(@Param("subjectType") Integer subjectType);
//
// /**
// * 获取最大外事办映射id
// *
// * @return java.lang.Integer
// * @author lkg
// */
// Integer getMaxWsbMapId();
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectSearchEnginesMap;
import com.zzsn.event.vo.SearchEnginesVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 专题与搜索引擎关联表
* @Author: jeecg-boot
* @Date: 2022-06-21
* @Version: V1.0
*/
@Mapper
public interface SubjectSearchEnginesMapMapper extends BaseMapper<SubjectSearchEnginesMap> {
void deleteBySubjectId(@Param("subjectId") String subjectId);
List<SearchEnginesVo> bindSearchEngineList(@Param("searchEnginesVo") SearchEnginesVo searchEnginesVo);
List<String> querySearchList(@Param("subjectId") String subjectId);
}
......@@ -2,4 +2,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.EventMapper">
<select id="eventSubjectList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,s.event_name as subject_name,s.start_time as time_enable,s.end_time as time_disable,s.incre_ana_rule,
s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time
from event s
</select>
<select id="pageList" resultType="com.zzsn.event.entity.Event">
select t2.type_name,t1.* from event t1
left join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="event.eventName!=null and event.eventName != ''">
and t1.event_name like CONCAT('%',#{event.eventName},'%')
</if>
<if test="event.eventType!=null and event.eventType != ''">
and dt1.event_type = #{event.eventType}
</if>
limit #{offset}, #{pageSize}
</select>
<select id="totalCount" resultType="java.lang.Integer">
select count(1) from event t1
left join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="event.eventName!=null and event.eventName != ''">
and t1.event_name like CONCAT('%',#{event.eventName},'%')
</if>
<if test="event.eventType!=null and event.eventType != ''">
and dt1.event_type = #{event.eventType}
</if>
</select>
<select id="prosessList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,s.event_name as subject_name,s.start_time as time_enable,s.end_time as time_disable,s.incre_ana_rule,
s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time
from event s
where 1=1
<if test="endDate != null">
and (s.end_time is null or s.end_time <![CDATA[ >= ]]> #{endDate})
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.KeyWordsMapper">
<select id="selectKeyWordsListById" resultType="com.zzsn.event.vo.KeyWordsPage">
SELECT b.*, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId FROM subject_keywords_map a
INNER JOIN key_words b ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where a.subject_id = #{subjectId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.LabelEntityMapper">
<resultMap id="BaseResultMap" type="com.zzsn.event.entity.LabelEntity">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="synonym" column="synonym" jdbcType="VARCHAR"/>
<result property="explanation" column="explanation" jdbcType="VARCHAR"/>
<result property="level" column="level" jdbcType="INTEGER"/>
<result property="topId" column="top_id" jdbcType="VARCHAR"/>
<result property="pathIds" column="path_ids" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="sysOrgCode" column="sys_org_code" jdbcType="VARCHAR"/>
<result property="pid" column="pid" jdbcType="VARCHAR"/>
<result property="hasChild" column="has_child" jdbcType="VARCHAR"/>
</resultMap>
<select id="listByType" resultType="com.zzsn.event.entity.LabelEntity">
SELECT e.id, e.name
FROM label_entity e
inner join sys_base_label_type_map m on e.id = m.relation_id
where m.label_id = #{labelTypeId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectAnalysisMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectKeywordsMapMapper">
<delete id="deleteBySubjectId" >
delete from subject_keywords_map
WHERE subject_id = #{subjectId}
</delete>
<delete id="deleteBySubjectIds" >
delete from subject_keywords_map
WHERE subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
<delete id="deleteByKeyWordsIds" >
delete from subject_keywords_map
WHERE subject_id = #{subjectId}
and keywords_id in
<foreach collection="keyWordsIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
<select id="selectByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
SELECT b.words_code, GROUP_CONCAT(a.subject_id SEPARATOR ',') as subjectId FROM subject_keywords_map a
left join key_words b on a.keywords_id = b.id
WHERE a.keywords_id = #{keyWordsId}
</select>
<select id="selectMinByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
SELECT b.words_code, min(time_enable) as startTime FROM subject_keywords_map a
LEFT JOIN key_words b ON a.keywords_id = b.id
LEFT JOIN subject c ON a.subject_id = c.id
WHERE a.keywords_id = #{keyWordsId}
</select>
<select id="selectCountByKeyWordsId" resultType="int">
SELECT count(1) from subject_keywords_map a
LEFT JOIN subject b ON a.subject_id = b.id
WHERE a.keywords_id = #{keyWordsId} and time_disable is null
</select>
<select id="selectMaxByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
SELECT b.words_code, max(time_disable) as endTime from subject_keywords_map a
LEFT JOIN key_words b ON a.keywords_id = b.id
LEFT JOIN subject c ON a.subject_id = c.id
WHERE a.keywords_id = #{keyWordsId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectMapper">
<!-- <select id="searchSubjectList" resultType="com.zzsn.subjectAnalysis.entity.Subject">-->
<!-- select s.id,s.subject_name,s.time_enable,s.time_disable,s.picture_policy,s.wsb_map_id from subject s-->
<!-- <if test="userId !=null and userId != ''">-->
<!-- inner join sys_user_data_permission dp on s.id = dp.permission_id-->
<!-- </if>-->
<!-- where s.subject_type = #{subjectType}-->
<!-- <if test="title !=null and title != ''">-->
<!-- and s.subject_name like concat('%',#{title},'%')-->
<!-- </if>-->
<!-- <if test="userId !=null and userId != ''">-->
<!-- and dp.user_id = #{userId}-->
<!-- </if>-->
<!-- order by s.create_time desc-->
<!-- </select>-->
<!-- <select id="progressList" resultType="com.zzsn.subjectAnalysis.vo.SubjectKafkaVo">-->
<!-- select s.id,s.subject_name,s.time_enable,s.time_disable,s.incre_ana_rule,-->
<!-- s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time-->
<!-- from subject s-->
<!-- where s.subject_type = #{subjectType}-->
<!-- <if test="endDate != null">-->
<!-- and (s.time_disable is null or s.time_disable <![CDATA[ >= ]]> #{endDate})-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="eventSubjectList" resultType="com.zzsn.subjectAnalysis.vo.SubjectKafkaVo">-->
<!-- &lt;!&ndash;select a.*,w.key_word from (-->
<!-- select s.id,s.subject_name,s.time_enable,s.time_disable,s.incre_ana_rule,-->
<!-- s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time-->
<!-- from subject s-->
<!-- where s.subject_type = #{subjectType}-->
<!-- ) a-->
<!-- INNER JOIN subject_keywords_map k ON a.id=k.subject_id-->
<!-- INNER JOIN key_words w ON k.keywords_id=w.id&ndash;&gt;-->
<!-- select s.id,s.subject_name,s.time_enable,s.time_disable,s.incre_ana_rule,-->
<!-- s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time-->
<!-- from subject s-->
<!-- where s.subject_type = #{subjectType}-->
<!-- </select>-->
<!-- <select id="getMaxWsbMapId" resultType="Integer">-->
<!-- select max(wsb_map_id) from subject-->
<!-- </select>-->
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectSearchEnginesMapMapper">
<select id="bindSearchEngineList" resultType="com.zzsn.event.vo.SearchEnginesVo">
SELECT b.subject_id as subjectId, a.* FROM search_engines a
LEFT JOIN subject_search_engines_map b ON a.id = b.search_engine_id and b.subject_id = #{searchEnginesVo.subjectId}
where 1 = 1
<if test="searchEnginesVo.type!=null">
and a.type = #{searchEnginesVo.type}
</if>
</select>
<delete id="deleteBySubjectId" >
delete from subject_search_engines_map
WHERE subject_id = #{subjectId}
</delete>
<select id="querySearchList" resultType="String">
SELECT a.dictionary_code FROM search_engines a
INNER JOIN subject_search_engines_map b ON a.id = b.search_engine_id and b.subject_id = #{subjectId}
</select>
</mapper>
package com.zzsn.event.producer;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import javax.sound.midi.Receiver;
/**
* @author zs
* @Description 信息通道
* @since 2021/6/10
*/
public interface IInfosourceSource {
/**
* 专题通道
*/
@Output
MessageChannel subjectModel();
/**
* 关键词通道
*
* @return org.springframework.messaging.MessageChannel
*/
@Output
MessageChannel keyWordsCrawl();
}
package com.zzsn.event.producer;
import com.alibaba.fastjson.JSON;
import com.zzsn.event.vo.KeyWordsDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Slf4j
@EnableBinding(IInfosourceSource.class)
public class ProduceInfo {
@Autowired
private IInfosourceSource source;
/*
* 专题拉取数据
* @param info 专题编码
* */
public void sendSubjectMsg(String subjectCode) {
Message<String> message = MessageBuilder.withPayload(subjectCode).build();
source.subjectModel().send(message);
log.info("专题投递到kafka成功,topic:subjectModel, subjectCode=[{}]", subjectCode);
}
/**
* 关键词执行
* @param keyWordsDTO 关键词信息源
*/
public void sendKeyWordsInfoSourceMsg(KeyWordsDTO keyWordsDTO) {
try{
String msg = JSON.toJSONString(keyWordsDTO);
Message<String> message = MessageBuilder.withPayload(msg).build();
source.keyWordsCrawl().send(message);
}catch (Exception e){
log.error("关键词:"+ keyWordsDTO.getWordsCode() + "推送kafka失败");
}
}
}
package com.zzsn.event.service;
import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.vo.PropagationPathVo;
import com.zzsn.event.vo.StatisticAnalysisVo;
import com.zzsn.event.vo.ViewPointAnalysisVo;
import java.util.List;
import java.util.Map;
/**
* @author lkg
* @description: 专题分析
* @date 2022/7/20 11:25
*/
public interface AnalysisService {
// /**
// * 观点分析
// * @param subjectId 专题id
// * @return java.util.Map<java.lang.String,java.util.List<com.zzsn.subjectAnalysis.vo.ViewPointAnalysisVo>>
// */
// Map<String, List<ViewPointAnalysisVo>> viewPointAnalysis(String subjectId);
//
/**
* 事件脉络
* @param subjectId 专题id
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @return java.util.List<com.zzsn.subjectAnalysis.entity.SubjectAnalysis>
*/
List<SubjectAnalysis> eventContext(String subjectId, int fakeNum);
/**
* 传播路径
* @param subjectId 专题id
* @return com.zzsn.subjectAnalysis.vo.PropagationPathVo
*/
PropagationPathVo propagationPath(String subjectId);
// /**
// * 统计分析-所有
// * @param subjectId 专题id
// * @return java.util.Map<java.lang.String,java.lang.Object>
// */
// Map<String, Object> statisticAnalysis(String subjectId);
//
// /**
// * 统计分析-按时间范围
// * @param subjectId 专题id
// * @param startTime 开始时间
// * @param endTime 结束时间
// */
// List<StatisticAnalysisVo> statisticAnalysis(String subjectId, String startTime, String endTime);
}
package com.zzsn.event.service;
import com.zzsn.event.vo.SpecialInformationParam;
import org.elasticsearch.search.builder.SearchSourceBuilder;
/**
* @Description: 门户自定义模型配置
* @Author: jeecg-boot
* @Date: 2023-11-21
* @Version: V1.0
*/
public interface EsDataSearchService {
/**
* 组装es查询条件
*
* @param param 查询参数
* @author lkg
* @date 2024/1/29
*/
SearchSourceBuilder packageSearQuery(SpecialInformationParam param);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.MediaVO;
import com.zzsn.event.vo.NegativeDataVO;
import java.util.List;
import java.util.Map;
/**
* es统计查询
*
* @author lkg
* @date 2024/1/24
*/
public interface EsStatisticsService {
/**
* 总体信息
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @author lkg
* @date 2024/1/25
*/
CountVO total(String startTime, String endTime, Integer type);
/**
* 总体分析,获取总量和波峰值
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/25
*/
Map<String, Object> totalAndMax(String subjectId, String startTime, String endTime);
/**
* 时间段内最新或最早的资讯
*
* @param subjectId 专题id
* @param labelId 标签id
* @param type 1-正序;2-倒序
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/25
*/
Map<String, Object> findOne(String subjectId, String labelId, int type, String startTime, String endTime);
/**
* 情感判断分析
*
* @param subjectId 专题id
* @param labelId 情感标签id
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @author lkg
* @date 2024/1/25
*/
CountVO orientation(String subjectId, String labelId, String startTime, String endTime, Integer type);
/**
* 影响力分析
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/25
*/
List<CountVO> influence(String subjectId, String startTime, String endTime);
// /**
// * 媒体分布
// *
// * @param subjectId 专题id
// * @param startTime 开始时间
// * @param endTime 结束时间
// * @author lkg
// * @date 2024/1/24
// */
// List<MediaVO> media(String subjectId, String startTime, String endTime);
/**
* 来源分析
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @author lkg
* @date 2024/1/23
*/
List<CountVO> source(String subjectId, String startTime, String endTime, Integer type);
/**
* 平台活跃度--前十
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/24
*/
List<CountVO> origin(String subjectId, String startTime, String endTime);
// /**
// * 地域分析
// *
// * @param subjectId 专题id
// * @param startTime 开始时间
// * @param endTime 结束时间
// * @author lkg
// * @date 2024/1/25
// */
// List<CountVO> region(String subjectId, String startTime, String endTime);
/**
* 专题下的主流报道
*
* @param subjectId 专题id
* @author lkg
* @date 2024/1/29
*/
String mainReport(String subjectId);
/**
* 某标签下资讯分页列表
*
* @param labelId 标签id
* @param startTime 开始时间
* @param endTime 结束时间
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/2/29
*/
Page<NegativeDataVO> labelPageList(String labelId, String startTime, String endTime, Integer pageNo, Integer pageSize);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzsn.event.entity.Event;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.AddEventParam;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.SubjectKafkaVo;
import java.util.Date;
import java.util.List;
/**
* @Description: 事件
......@@ -14,4 +21,20 @@ public interface IEventService extends IService<Event> {
* 计算热度
*/
void compute();
List<SubjectKafkaVo> progressList(Date disableDate);
List<SubjectKafkaVo> eventSubjectList();
IPage<Event> pageList(Event event, Integer pageNo, Integer pageSize);
void extractHotWords(AddEventParam event);
Event saveMain(AddEventParam addEventParam);
void updateMain(AddEventParam addEventParam);
/**
* 获取专题绑定的关键词组列表
*/
List<KeyWordsPage> bindKeyWordsList(String id);
}
package com.zzsn.event.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.xxljob.entity.KeyWords;
import java.util.List;
/**
* @Description: 关键词管理
* @Author: jeecg-boot
* @Date: 2021-11-26
* @Version: V1.0
*/
public interface IKeyWordsService extends IService<KeyWords> {
/**
* 获取专题绑定的信息源列表
*/
List<KeyWordsPage> bindKeyWordsList(String subjectId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import java.util.List;
/**
* @Description: 专题关键词关联表
* @Author: jeecg-boot
* @Date: 2021-12-09
* @Version: V1.0
*/
public interface ISubjectKeywordsMapService extends IService<SubjectKeywordsMap> {
/**
* 查询这个词组绑定的专题的最小时间
* @param keyWordsId
* @return
*/
KeyWordsDTO selectMinByKeyWordsId(String keyWordsId);
/**
* 查询这个词组绑定的专题时间为空的个数
* @param keyWordsId
* @return
*/
int selectCountByKeyWordsId(String keyWordsId);
/**
* 查询这个词组绑定的专题结束的最大时间
* @param keyWordsId
* @return
*/
KeyWordsDTO selectMaxByKeyWordsId(String keyWordsId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectSearchEnginesMap;
import com.zzsn.event.vo.SearchEnginesVo;
import java.util.List;
/**
* @Description: 专题与搜索引擎关联表
* @Author: jeecg-boot
* @Date: 2022-06-21
* @Version: V1.0
*/
public interface ISubjectSearchEnginesMapService extends IService<SubjectSearchEnginesMap> {
void deleteBySubjectId(String subjectId);
List<SearchEnginesVo> bindSearchEngineList(SearchEnginesVo searchEnginesVo);
/**
* 根据专题id查询出专题绑定的搜索引擎编码
* @param subjectId
* @return
*/
List<String> querySearchList(String subjectId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.Subject;
import java.util.Date;
import java.util.List;
/**
* @author : wp
* @title : ISubjectService
* @description: 专题接口
* @date : Created in 2022/7/7 10:21
* @modified By:
*/
public interface ISubjectService extends IService<Subject> {
// /**
// * 获取用户授权得事件专题列表
// *
// * @param userId: 用户id
// * @param title: 专题标题
// * @author lkg
// * @date 2023/2/22
// */
// List<Subject> searchSubjectList(String userId, String title);
//
// IPage<SubjectDataVo> queryInfoListBySid(SubjectVo subjectInfo, Integer pageNo, Integer pageSize) throws Exception;
//
// /**
// * 获取进行中(未结束)的事件专题列表
// *
// * @param endDate 结束时间
// * @return java.util.List<com.zzsn.subjectAnalysis.vo.SubjectKafkaVo>
// * @author lkg
// */
// List<SubjectKafkaVo> progressList(Date endDate);
//
// /**
// * 获取所有的事件专题列表
// *
// * @return java.util.List<com.zzsn.subjectAnalysis.vo.SubjectKafkaVo>
// * @author lkg
// */
// List<SubjectKafkaVo> eventSubjectList();
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.LabelEntity;
import java.util.List;
/**
* @author lkg
* @date 2023/3/2
*/
public interface LabelEntityService extends IService<LabelEntity> {
/**
* 根据分类获取标签列表
*
* @param labelTypeId 标签分类id
* @author lkg
* @date 2024/1/22
*/
List<LabelEntity> listByType(String labelTypeId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.Report;
/**
* 报告表
*
* @author lkg
* @date 2023/3/16
*/
public interface ReportService extends IService<Report> {
//
// /**
// * 报告分页列表
// *
// * @param typeId 分类id
// * @param pageNo 当前页
// * @param pageSize 返回条数
// * @author lkg
// * @date 2024/1/31
// */
// IPage<ReportVO> pageList(String typeId, Integer pageNo, Integer pageSize);
//
//
// /**
// * 报告表-分页列表(客户)
// *
// * @param typeId 报告分类id
// * @param projectId 项目id集合
// * @param reportName 报告名称
// * @param startTime 开始时间
// * @param endTime 结束时间
// * @param pageNo 当前页
// * @param pageSize 返回条数
// * @author lkg
// * @date 2023/3/24
// */
// IPage<UserReportVO> userPageList(String typeId, String projectId, String reportName, String startTime, String endTime, Integer pageNo, Integer pageSize);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectAnalysis;
/**
* @author lkg
* @description:
* @date 2022/7/14 17:17
*/
public interface SubjectAnalysisService extends IService<SubjectAnalysis> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectSearchEnginesMap;
import com.zzsn.event.mapper.SubjectSearchEnginesMapMapper;
import com.zzsn.event.vo.SearchEnginesVo;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 专题与搜索引擎关联表
* @Author: jeecg-boot
* @Date: 2022-06-21
* @Version: V1.0
*/
@Service
public class SubjectSearchEnginesMapServiceImpl extends ServiceImpl<SubjectSearchEnginesMapMapper, SubjectSearchEnginesMap> implements ISubjectSearchEnginesMapService {
@Override
public void deleteBySubjectId(String subjectId){
baseMapper.deleteBySubjectId(subjectId);
}
@Override
public List<SearchEnginesVo> bindSearchEngineList(SearchEnginesVo searchEnginesVo){
return baseMapper.bindSearchEngineList(searchEnginesVo);
}
@Override
public List<String> querySearchList(String subjectId){
return baseMapper.querySearchList(subjectId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.Event;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.mapper.EventMapper;
import com.zzsn.event.producer.ProduceInfo;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.service.ISubjectKeywordsMapService;
import com.zzsn.event.service.ISubjectSearchEnginesMapService;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.vo.AddEventParam;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.SubjectKafkaVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.*;
/**
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Date: 2024-03-14
* @Version: V1.0
*/
@Service
public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements IEventService {
@Value("${hotWords.extractUrl}")
private String extractHotWordsUrl;
@Autowired
private CodeGenerateUtil codeGenerateUtil;
@Autowired
private IKeyWordsService iKeyWordsService;
@Autowired
private ISubjectSearchEnginesMapService iSubjectSearchEnginesMapService;
@Autowired
private ISubjectKeywordsMapService iSubjectKeywordsMapService;
@Autowired
private ProduceInfo produceInfo;
@Autowired
private RedisUtil redisUtil;
@Override
public void compute() {
//get the events need to compute
//get the events need to compute
List<Event> list = this.list(new LambdaQueryWrapper<Event>().eq(Event::getStatus, 1));
for (Event event : list) {
// latest week data
......@@ -31,4 +67,113 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
// data before a year
}
}
@Override
public List<SubjectKafkaVo> progressList(Date disableDate) {
return this.baseMapper.prosessList(disableDate);
}
@Override
public List<SubjectKafkaVo> eventSubjectList() {
return this.baseMapper.eventSubjectList(2);
}
@Override
public IPage<Event> pageList(Event event, Integer pageNo, Integer pageSize) {
Integer offset = (pageNo - 1) * pageSize;
if (pageNo == 0) {
offset = 0;
}
List<Event> pageList = baseMapper.pageList(event, offset, pageSize);
//获取总条数
Integer count = baseMapper.totalCount(event);
IPage<Event> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList);
return null;
}
@Override
public void extractHotWords(AddEventParam event) {
if (!StringUtils.isEmpty(event.getExtractHotWords()) && "1".equals(event.getExtractHotWords())) {
Map<String, String> param = new HashMap<>();
param.put("status", "0,1,2,3");
param.put("timeFiled", "ALL");
param.put("subjectId", event.getId());
HttpUtil.doGet(extractHotWordsUrl, param, "utf-8");
}
}
@Override
public Event saveMain(AddEventParam addEventParam) {
String cron = null;
Event event = new Event();
//事件专题的默认分析规则参数-必填
BeanUtils.copyProperties(addEventParam, event);
event.setIncreAnaRule(20);
event.setTotalAnaRule(50);
event.setTimeAnaRule(5);
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue());
event.setEventCode(subjectCode);
cron = CronUtil.getRandomCron();
event.setCron(cron);
baseMapper.insert(event);
return event;
}
@Override
public void updateMain(AddEventParam addEventParam) {
Event subject = new Event();
BeanUtils.copyProperties(addEventParam, subject);
//先记录老的信息状态
Event oldSubject = baseMapper.selectById(subject.getId());
baseMapper.updateById(subject);
//判断开始时间和结束时间是否发生变动
if ((StringUtils.isEmpty(addEventParam.getStartTime()) && StringUtils.isEmpty(oldSubject.getStartTime())) ||
(!StringUtils.isEmpty(addEventParam.getStartTime()) && !StringUtils.isEmpty(oldSubject.getStartTime())
&& oldSubject.getStartTime().compareTo(addEventParam.getStartTime()) == 0)) {
} else {
//查询出该专题绑定的关键词组
List<KeyWordsPage> keyWordsPages = bindKeyWordsList(subject.getId());
List<String> keyWordIds = new ArrayList<>();
for (KeyWordsPage keyWordsPage : keyWordsPages) {
keyWordIds.add(keyWordsPage.getId());
}
//更新redis中关键词时间
updateRedisKeyWordsDate(addEventParam.getId(), keyWordIds);
}
}
@Override
public List<KeyWordsPage> bindKeyWordsList(String subjectId) {
return iKeyWordsService.bindKeyWordsList(subjectId);
}
//更新专题绑定的关键词组的缓存信息
private void updateRedisKeyWordsDate(String subjectId, List<String> keyWordsIds) {
for (String keyWordsId : keyWordsIds) {
KeyWordsDTO keyWordsDTO = iSubjectKeywordsMapService.selectMinByKeyWordsId(keyWordsId);
KeyWordsDTO redisKeyWordsDTO = (KeyWordsDTO) redisUtil.get(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWordsDTO.getWordsCode());
int count = iSubjectKeywordsMapService.selectCountByKeyWordsId(keyWordsId);
KeyWordsDTO keyWordsDTO1;
if (count <= 0) {
keyWordsDTO1 = iSubjectKeywordsMapService.selectMaxByKeyWordsId(keyWordsId);
redisKeyWordsDTO.setStartTime(keyWordsDTO.getStartTime());
redisKeyWordsDTO.setEndTime(keyWordsDTO1.getEndTime());
} else {
if (redisKeyWordsDTO == null) {
redisKeyWordsDTO = keyWordsDTO;
} else {
redisKeyWordsDTO.setEndTime(null);
redisKeyWordsDTO.setStartTime(keyWordsDTO.getStartTime());
}
}
//查询出该专题绑定了哪些搜索引擎
List<String> stringList = iSubjectSearchEnginesMapService.querySearchList(subjectId);
redisKeyWordsDTO.setSearchEngines(stringList);
redisUtil.set(Constants.KEY_WORDS_TO_REDIS_PREFIX + redisKeyWordsDTO.getWordsCode(), redisKeyWordsDTO);
//立即执行一次
produceInfo.sendKeyWordsInfoSourceMsg(redisKeyWordsDTO);
}
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.mapper.KeyWordsMapper;
import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.xxljob.entity.KeyWords;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 关键词管理
* @Author: jeecg-boot
* @Date: 2021-11-26
* @Version: V1.0
*/
@Service
public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> implements IKeyWordsService {
@Override
public List<KeyWordsPage> bindKeyWordsList(String subjectId) {
return baseMapper.selectKeyWordsListById(subjectId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.mapper.LabelEntityMapper;
import com.zzsn.event.service.LabelEntityService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author lkg
* @date 2023/3/2
*/
@Service
public class LabelEntityServiceImpl extends ServiceImpl<LabelEntityMapper, LabelEntity> implements LabelEntityService {
@Override
public List<LabelEntity> listByType(String labelTypeId) {
return baseMapper.listByType(labelTypeId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Report;
import com.zzsn.event.mapper.ReportMapper;
import com.zzsn.event.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 报告表
*
* @author lkg
* @date 2023/3/23
*/
@Service
@Slf4j
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements ReportService {
// @Autowired
// private ReportBusinessTypeService reportBusinessTypeService;
// @Autowired
// private IProjectService projectService;
// @Autowired
// private ISubjectService subjectService;
//
// @Override
// public IPage<ReportVO> pageList(String typeId, Integer pageNo, Integer pageSize) {
// int offset = (pageNo - 1) * pageSize;
// List<ReportVO> pageList = baseMapper.pageList(typeId, offset, pageSize);
// Integer count = baseMapper.count(typeId);
// Page<ReportVO> page = new Page<>(pageNo, pageSize, count);
// page.setRecords(pageList);
// return page;
// }
//
// @Override
// public IPage<UserReportVO> userPageList(String typeId, String projectId, String reportName, String startTime, String endTime, Integer pageNo, Integer pageSize) {
// int offset = (pageNo - 1) * pageSize;
// List<String> typeIds = new ArrayList<>();
// List<String> projectIds = new ArrayList<>();
// if (StringUtils.isEmpty(projectId) && StringUtils.isEmpty(typeId)) {
// //获取当前登录用户
// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// Integer category = currentUser.getCategory();
// if (!category.equals(CommonConstant.SUPER_USER)) {
// String userId = null;
// String customerId = null;
// if (category.equals(CommonConstant.ADMIN_USER)) {
// customerId = currentUser.getRelTenantIds();
// } else if (category.equals(CommonConstant.COMMON_USER)) {
// userId = currentUser.getId();
// }
// List<ProjectVO> projectVOS = projectService.permissionList(customerId, userId);
// projectVOS.forEach(e->projectIds.add(e.getId()));
// }
// } else {
// if (StringUtils.isNotEmpty(typeId)) {
// typeIds = reportBusinessTypeService.getBelowList(typeId);
// }
// if (StringUtils.isNotEmpty(projectId)) {
// projectIds.add(projectId);
// }
// }
// List<UserReportVO> pageList = baseMapper.userPageList(typeIds, projectIds,reportName, startTime, endTime, offset, pageSize);
// for (UserReportVO reportVO : pageList) {
// String subjectId = reportVO.getSubjectId();
// String subjectName = getSubject(subjectId);
// reportVO.setSubjectName(subjectName);
// }
// Integer count = baseMapper.total(typeIds, projectIds,reportName, startTime, endTime);
// Page<UserReportVO> page = new Page<>(pageNo, pageSize, count);
// page.setRecords(pageList);
// return page;
// }
// private String getSubject(String subjectId) {
// String subjectName = null;
// if (StringUtils.isNotEmpty(subjectId)) {
// StringBuilder stringBuilder = new StringBuilder();
// String[] split = subjectId.split(",");
// LambdaQueryWrapper<Subject> query = Wrappers.lambdaQuery();
// query.in(Subject::getId, Arrays.asList(split));
// List<Subject> list = subjectService.list(query);
// list.forEach(e -> stringBuilder.append(",").append(e.getSubjectName()));
// subjectName = stringBuilder.length() == 0 ? null : stringBuilder.substring(1);
// }
// return subjectName;
// }
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.mapper.SubjectAnalysisMapper;
import com.zzsn.event.service.SubjectAnalysisService;
import org.springframework.stereotype.Service;
/**
* @author lkg
* @description:
* @date 2022/7/14 17:17
*/
@Service
public class SubjectAnalysisServiceImpl extends ServiceImpl<SubjectAnalysisMapper, SubjectAnalysis> implements SubjectAnalysisService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.mapper.SubjectKeywordsMapMapper;
import com.zzsn.event.service.ISubjectKeywordsMapService;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.springframework.stereotype.Service;
/**
* @Description: 专题关键词关联表
* @Author: jeecg-boot
* @Date: 2021-12-09
* @Version: V1.0
*/
@Service
public class SubjectKeywordsMapServiceImpl extends ServiceImpl<SubjectKeywordsMapMapper, SubjectKeywordsMap> implements ISubjectKeywordsMapService {
@Override
public KeyWordsDTO selectMinByKeyWordsId(String keyWordsId){
return baseMapper.selectMinByKeyWordsId(keyWordsId);
}
@Override
public int selectCountByKeyWordsId(String keyWordsId){
return baseMapper.selectCountByKeyWordsId(keyWordsId);
}
@Override
public KeyWordsDTO selectMaxByKeyWordsId(String keyWordsId){
return baseMapper.selectMaxByKeyWordsId(keyWordsId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.mapper.SubjectMapper;
import com.zzsn.event.service.ISubjectService;
import org.springframework.stereotype.Service;
/**
* @author : wp
* @title : subjectServiceImpl
* @description: 专题实现类
* @date : Created in 2022/7/7 10:23
* @modified By:
*/
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements ISubjectService {
// @Autowired
// private IKeyWordsService keyWordsService;
// @Autowired
// private EsService esService;
//
// @Override
// public List<Subject> searchSubjectList(String userId, String title) {
// return baseMapper.searchSubjectList(userId, 2,title);
// }
//
// public IPage<SubjectDataVo> queryInfoListBySid(SubjectVo subjectInfo, Integer pageNo, Integer pageSize) {
// IPage<SubjectDataVo> pageData;
// String keyWords = keyWordsService.getBySubjectId(subjectInfo.getId());
// if (StringUtils.isNotEmpty(keyWords)) {
// String keywords = keyWords.replaceAll("\\(","").replaceAll("\\)","")
// .replaceAll("\\+",";").replaceAll("\\|",";");
// pageData = esService.pageList(subjectInfo.getId(), subjectInfo.getTitle(), keywords, subjectInfo.getStartTime(), subjectInfo.getEndTime(), pageNo, pageSize);
// List<SubjectDataVo> records = pageData.getRecords();
// for (SubjectDataVo dataVo :records) {
// String title = dataVo.getTitle();
// String[] keyWordArr = keywords.split(";");
// for (String keyWord :keyWordArr) {
// if (title.contains(keyWord)) {
// title = title.replaceAll(keyWord,"<font style=\"color:red;\">"+keyWord+"</font>");
// }
// }
// dataVo.setTitle(title);
// }
// } else {
// pageData = esService.pageList(subjectInfo.getId(), subjectInfo.getTitle(), null, subjectInfo.getStartTime(), subjectInfo.getEndTime(), pageNo, pageSize);
// }
// return pageData;
// }
//
// @Override
// public List<SubjectKafkaVo> progressList(Date endDate) {
// return baseMapper.progressList(2,endDate);
// }
//
// @Override
// public List<SubjectKafkaVo> eventSubjectList() {
// return baseMapper.eventSubjectList(2);
// }
}
package com.zzsn.event.util;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.OptionalDouble;
import java.util.stream.Stream;
/**
* @author lkg
* @description: 指标值计算
* @date 2023/6/19
*/
public class CalculateUtil {
private static final List<String> list = Arrays.asList("-","--");
/**
* 加法
* @param param1 参数1
* @param param2 参数2
* @return java.lang.String
*/
public static String add(String param1,String param2){
String data = null;
if (!list.contains(param1) && !list.contains(param2)){
if (StringUtils.isEmpty(param1)) {
param1 = "0";
}
if (StringUtils.isEmpty(param2)) {
param2 = "0";
}
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal bd2 = new BigDecimal(param2);
BigDecimal add = bd1.add(bd2);
if (add.compareTo(BigDecimal.ZERO) != 0) {
data = add.toString();
}
}
return data;
}
/**
* 减法
* @param param1 参数1
* @param param2 参数2
* @return java.lang.String
*/
public static String subtract(String param1,String param2){
String data = null;
if (!list.contains(param1) && !list.contains(param2) ){
if (StringUtils.isEmpty(param1)) {
param1 = "0";
}
if (StringUtils.isEmpty(param2)) {
param2 = "0";
}
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal bd2 = new BigDecimal(Objects.requireNonNull(param2));
BigDecimal subtract = bd1.subtract(bd2);
if (subtract.compareTo(BigDecimal.ZERO) != 0) {
data = subtract.toString();
}
}
return data;
}
/**
* 乘法
* @param param1 参数1
* @param param2 参数2
* @return java.lang.String
*/
public static String multiply(String param1,String param2){
if(StringUtils.isNotEmpty(param1)&& StringUtils.isNotEmpty(param2)){
if (!list.contains(param1) && !list.contains(param2) ){
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal bd2 = new BigDecimal(param2);
BigDecimal multiply = bd1.multiply(bd2);
return multiply.setScale(2,RoundingMode.HALF_UP).toString();
}
}
return null;
}
/**
* 除法-固定精度(默认保留小数点后四位)
* @param param1 参数1
* @param param2 参数2
* @return java.lang.String
*/
public static String divide(String param1,String param2){
if(StringUtils.isNotEmpty(param1)&& StringUtils.isNotEmpty(param2)){
if (!list.contains(param1) && !list.contains(param2) ){
BigDecimal bd2 = new BigDecimal(param2);
if (bd2.compareTo(BigDecimal.ZERO)==0){
return null;
}else {
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal divide = bd1.divide(bd2,4, RoundingMode.HALF_UP);
return divide.toString();
}
}
}
return null;
}
/**
* 除法-控制精度
* @param param1 参数1
* @param param2 参数2
* @param num 精确到小数点后几位
* @return java.lang.String
*/
public static String divide(String param1,String param2,int num){
if(StringUtils.isNotEmpty(param1)&& StringUtils.isNotEmpty(param2)){
if (!list.contains(param1) && !list.contains(param2) ){
BigDecimal bd2 = new BigDecimal(param2);
if (bd2.compareTo(BigDecimal.ZERO)==0){
return null;
}else {
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal divide = bd1.divide(bd2,num, RoundingMode.HALF_UP);
return divide.toString();
}
}
}
return null;
}
/**
* 转换百分比
* @param param 参数1
* @return java.lang.String
*/
public static String percentage(Double param){
if(param!=null){
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
return decimalFormat.format(param);
}
return null;
}
/**
* 转换百分比
*
* @param param 参数
* @param flag 转换后是否要小数
* @return java.lang.String
*/
public static String percentage(Double param, Boolean flag) {
if (param != null) {
String pattern = "0%";
if (flag) {
pattern = "0.00%";
}
DecimalFormat decimalFormat = new DecimalFormat(pattern);
return decimalFormat.format(param);
}
return null;
}
/**
* 平均数
* @param param1 参数1
* @param param2 参数2
* @return java.lang.String
*/
public static String average(String param1,String param2){
if(StringUtils.isNotEmpty(param1)&& StringUtils.isNotEmpty(param2)){
if (!list.contains(param1) && !list.contains(param2) ){
BigDecimal bd1 = new BigDecimal(param1);
BigDecimal bd2 = new BigDecimal(param2);
OptionalDouble average = Stream.of(bd1, bd2).mapToDouble(BigDecimal::doubleValue).average();
if (average.isPresent()){
return String.valueOf(average.getAsDouble());
}
}
}
return null;
}
/**
* 绝对值
* @param param1 参数1
* @return java.lang.String
*/
public static String abs(String param1){
if(StringUtils.isNotEmpty(param1)){
if (!list.contains(param1) ){
BigDecimal bd1 = new BigDecimal(param1);
return bd1.abs().toString();
}
}
return null;
}
}
package com.zzsn.event.util;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CommonUtils {
/**
* 判断文件名是否带盘符,重新处理
* @param fileName
* @return
*/
public static String getFileName(String fileName){
//判断是否带有盘符信息
// Check for Unix-style path
int unixSep = fileName.lastIndexOf('/');
// Check for Windows-style path
int winSep = fileName.lastIndexOf('\\');
// Cut off at latest possible point
int pos = (winSep > unixSep ? winSep : unixSep);
if (pos != -1) {
// Any sort of path separator found...
fileName = fileName.substring(pos + 1);
}
//替换上传文件名字的特殊字符
fileName = fileName.replace("=","").replace(",","").replace("&","").replace("#", "");
//替换上传文件名字中的空格
fileName=fileName.replaceAll("\\s","");
return fileName;
}
}
\ No newline at end of file
package com.zzsn.event.util;
import com.cronutils.builder.CronBuilder;
import com.cronutils.model.Cron;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.field.expression.FieldExpressionFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.util.Random;
/**
* @author lkg
* @description: cron表达式工具类
* @date 2021/6/19 10:13
*/
@Slf4j
public class CronUtil {
private static final SimpleDateFormat sdf = new SimpleDateFormat("ss mm HH dd MM ? yyyy");
/**
* 根据时间间隔生成cron表达式--暂只支持 秒、分、时
* @param duration 时间间隔(单位:秒)
* @return java.lang.String
*/
public static String geneCronByPeriod(Integer duration){
String cron;
int hours = (duration % (86400)) / 3600;
int minutes = ((duration % (86400)) % 3600) / 60;
if (hours == 0){
if (minutes == 0){
cron = cronSecond(duration);
}else {
cron = cronMinute(minutes);
}
}else {
cron = cronHour(hours);
}
return cron;
}
//按秒
private static String cronSecond(int seconds){
Cron cron = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
.withYear(FieldExpressionFactory.always())
.withDoW(FieldExpressionFactory.questionMark())
.withMonth(FieldExpressionFactory.always())
.withDoM(FieldExpressionFactory.always())
.withHour(FieldExpressionFactory.always())
.withMinute(FieldExpressionFactory.always())
.withSecond(FieldExpressionFactory.every(seconds))
.instance();
return cron.asString();
}
//按分钟
private static String cronMinute(int minutes){
Cron cron = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
.withYear(FieldExpressionFactory.always())
.withDoW(FieldExpressionFactory.questionMark())
.withMonth(FieldExpressionFactory.always())
.withDoM(FieldExpressionFactory.always())
.withHour(FieldExpressionFactory.always())
.withMinute(FieldExpressionFactory.every(minutes))
.withSecond(FieldExpressionFactory.on(0))
.instance();
return cron.asString();
}
//按小时
private static String cronHour(int hours){
Cron cron = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
.withYear(FieldExpressionFactory.always())
.withDoW(FieldExpressionFactory.questionMark())
.withMonth(FieldExpressionFactory.always())
.withDoM(FieldExpressionFactory.always())
.withHour(FieldExpressionFactory.every(hours))
.withMinute(FieldExpressionFactory.on(0))
.withSecond(FieldExpressionFactory.on(0))
.instance();
return cron.asString();
}
//当前时间转换为cron表达式
/***
* 功能描述:日期转换cron表达式
* @param date
* @return
*/
private static String formatDateByPattern(Date date) {
String formatTimeStr = null;
if (Objects.nonNull(date)) {
formatTimeStr = sdf.format(date);
}
return formatTimeStr;
}
/***
* convert Date to cron, eg "0 07 10 15 1 ? 2016"
* @param date : 时间点
* @return
*/
public static String getCron(Date date, int space) {
String cron = formatDateByPattern(date);
//将生成的cron最后一个参数年转化为通配符
String[] cronArray = cron.split(" ");
cronArray[6] = "*";
String result = "";
if(!StringUtils.isEmpty(space)){
cronArray[2] = "0/" + space;
}
for(int i = 0; i < 3; i++){
result += cronArray[i] + " ";
}
cron = result + "* * ?";
// for (String s : cronArray) {
// result += s + " ";
// }
// cron = cronExpressionPlusDuration(result, (int)space*60*60);
return cron;
}
/**
* <p>对cron表达式进行修改,根据传入的时间生成一个新的cron表达式</>
* 两个表达式之间的间隔为duration
*
* @param cron
* @param duration 单位为秒
* @return
*/
private static String cronExpressionPlusDuration(String cron, int duration) {
String[] cronArray = cron.split(" ");
int days = duration / 86400;
int hours = (duration % (86400)) / 3600;
int minutes = ((duration % (86400)) % 3600) / 60;
cronArray[2] = String.valueOf(Integer.valueOf(cronArray[2]) + hours);
cronArray[1] = String.valueOf(Integer.valueOf(cronArray[1]) + minutes);
/* 对小时和分钟进行合法性校验*/
if (Integer.valueOf(cronArray[1]) >= 60 || Integer.valueOf(cronArray[2]) >= 24) {
int extraMinutes = Integer.valueOf(cronArray[1]) % 60;
int extraHours = (Integer.valueOf(cronArray[2])+ Integer.valueOf(cronArray[1]) / 60)%24;
cronArray[2] = String.valueOf(extraHours);
cronArray[1] = String.valueOf(extraMinutes);
}
/* 持续时间一天以内*/
if (duration < 86400 && "*".equals(cronArray[3]) && "*".equals(cronArray[4]) && "?".equals(cronArray[5])) {
} else if (duration > 86400 && duration < 86400 * 7) {
cronArray[5] = String.valueOf((Integer.valueOf(cronArray[5]) + days) % 7 + 1);
} else if (duration > 86400 * 7 && duration < 86400 * 32) {
if("L".equals(cronArray[3])){
cronArray[3]=String.valueOf(days);
}else {
cronArray[3] = String.valueOf(((Integer.valueOf(cronArray[3]) + days) % 31) + 1);
}
}
String result = "";
for (String s : cronArray) {
result += s + " ";
}
return result;
}
/**
* 随机生成一个corn表达式
*/
public static String getRandomCron() {
int min = 2;
int max = 12;
String cron = formatDateByPattern(new Date());
//将生成的cron最后一个参数年转化为通配符
String[] cronArray = cron.split(" ");
Random random = new Random();
int s = random.nextInt(max) % (max - min + 1) + min;
int second = random.nextInt(58) % (57) + 2;
int second1 = random.nextInt(58) % (57) + 2;
String corn = second + " " + second1 + " " + "0/" + String.valueOf(s) + " " + "* * ?";
return corn;
}
/**
* 根据设置方式生成cron
* @param unit (1分;2小时;3日;4月)
* @param space
* @return
*/
public static String generateCron(String unit, Integer space) {
String cron = formatDateByPattern(new Date());
//将生成的cron最后一个参数年转化为通配符
String[] cronArray = cron.split(" ");
if("1".equals(unit)) {
cron = cronArray[0] + " " + "1/" + space + " * * * ?";
}else if("2".equals(unit)){
cron = cronArray[0] + " " + cronArray[1] + " " + "1/" + space + " * * ?";
}else if("3".equals(unit)){
cron = cronArray[0] + " " + cronArray[1] + " " + cronArray[2] + " " + "1/" + space + " * ?";
}else if("4".equals(unit)){
cron = cronArray[0] + " " + cronArray[1] + " " + cronArray[2] + " 1 " + "1/" + space + " ?";
}
return cron;
}
}
package com.zzsn.event.util;
import java.text.SimpleDateFormat;
import java.util.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class DateUtil {
static SimpleDateFormat format;
public static String dateToString(Date date) {
format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(date);
}
public static String getStringDate(Date date){
String format = "yyyy-MM-dd";
return DateUtil.format(date, format);
}
public static String format(Date d, String format)
{
if (d == null)
return "";
SimpleDateFormat myFormatter = new SimpleDateFormat(format);
myFormatter.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
return myFormatter.format(d);
}
private static SimpleDateFormat format;
/**
* 获取每天的开始时间 00:00:00:00
* Date转String
*
* @param date
* @return
* @param date 时间日期
* @param formatStr 格式
* @return java.lang.String
*/
public static Date getStartTime(Date date) {
Calendar dateStart = Calendar.getInstance();
dateStart.setTime(date);
dateStart.set(Calendar.HOUR_OF_DAY, 0);
dateStart.set(Calendar.MINUTE, 0);
dateStart.set(Calendar.SECOND, 0);
return dateStart.getTime();
public static String dateToString(Date date, String formatStr) {
format = new SimpleDateFormat(formatStr);
return format.format(date);
}
/**
* 获取每天的结束时间 23:59:59:999
* String转Date
*
* @param date
* @return
* @param dateStr 时间字符串
* @param formatStr 格式
* @return java.lang.String
*/
public static Date getEndTime(Date date) {
Calendar dateEnd = Calendar.getInstance();
dateEnd.setTime(date);
dateEnd.set(Calendar.HOUR_OF_DAY, 23);
dateEnd.set(Calendar.MINUTE, 59);
dateEnd.set(Calendar.SECOND, 59);
return dateEnd.getTime();
public static Date stringToDate(String dateStr, String formatStr) {
format = new SimpleDateFormat(formatStr);
Date parse = null;
try {
parse = format.parse(dateStr);
} catch (Exception e) {
e.printStackTrace();
}
return parse;
}
/**
* 获取当前年份
* @return
* 增加天数
*
* @param d 目标时间
* @param day 天数
* @return java.util.Date
*/
public static String getSysYear() {
Calendar date = Calendar.getInstance();
return String.valueOf(date.get(Calendar.YEAR));
public static Date addDate(Date d, int day) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.add(Calendar.DATE, day);
return cal.getTime();
}
/**
* 获取当前时间所在日
* 格式化时间字符串
*
* @param dateStr 时间字符串
* @param format1 字符串转时间格式
* @param format2 时间转字符串格式
* @return java.lang.String
* @author lkg
*/
public static Integer getDay(String dateStr) {
Calendar instance = Calendar.getInstance();
Date date = stringToDate(dateStr, "yyyy-MM-dd");
instance.setTime(date);
return instance.get(Calendar.DAY_OF_MONTH);
public static String formatStr(String dateStr, String format1, String format2) {
return dateToString(stringToDate(dateStr, format1), format2);
}
/**
* 获取前一小时的时间
* @param date 时间
* 两个时间相差的天数
*
* @param startDate 开始时间
* @param endDate 结束时间
* @return java.lang.Integer
* @author lkg
*/
public static Date beforeOneHour(Date date){
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.HOUR_OF_DAY,-1);
return instance.getTime();
}
public static Date stringToDate(String date,String formatStr) {
Date parse = null;
format = new SimpleDateFormat(formatStr);
try {
parse = format.parse(date);
} catch (Exception e) {
e.printStackTrace();
}
return parse;
}
public static List<String> betweenDate(String startDate,String endDate) {
List<String> dateList = new ArrayList<>();
String formatStr = "yyyy-MM-dd";
try {
Date dayOne = stringToDate(startDate, formatStr);
Date dayTwo = stringToDate(endDate, formatStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dayOne);
dateList.add(startDate);
while (dayTwo.after(calendar.getTime())) {
calendar.add(Calendar.DAY_OF_MONTH,1);
dateList.add(format(calendar.getTime(),formatStr));
}
} catch (Exception e) {
e.printStackTrace();
}
return dateList;
public static Integer betweenTwoDate(String startDate, String endDate) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate start = LocalDate.parse(startDate, formatter);
LocalDate end = LocalDate.parse(endDate, formatter);
long between = ChronoUnit.DAYS.between(start, end);
return (int) between;
}
/**
* 获取天前凌晨时间
* @param number 几天前
* 两个时间相差的天数
*
* @param startDate 开始时间
* @param endDate 结束时间
* @return java.lang.Integer
* @author lkg
*/
public static Date getSomeDayBegin(int number) {
public static Integer betweenTwoDate(Date startDate, Date endDate) {
String pattern = "yyyy-MM-dd";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
LocalDate start = LocalDate.parse(dateToString(startDate, pattern), formatter);
LocalDate end = LocalDate.parse(dateToString(endDate, pattern), formatter);
long between = ChronoUnit.DAYS.between(start, end);
return Math.abs((int) between);
}
// 获取当前的日期和时间
public static String getDayBeforeOrAfter(String dateStr, int num){
Calendar calendar = Calendar.getInstance();
// 将当前的日期和时间减去一天
calendar.add(Calendar.DAY_OF_MONTH, -number);
// 将时间部分设置为凌晨时间
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
// 获取昨天凌晨时间
return new Date(String.valueOf(calendar.getTime()));
calendar.setTime(stringToDate(dateStr,"yyyy-MM-dd"));
calendar.add(Calendar.DATE,num);
return dateToString(calendar.getTime(),"yyyy-MM-dd 00:00:00");
}
}
package com.zzsn.event.util;
import com.zzsn.event.vo.PropagationPathVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
......@@ -592,4 +590,6 @@ public class RedisUtil {
e.printStackTrace();
}
}
}
package com.zzsn.event.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
/**
* 文件上传字符串过滤特殊字符
*/
public class StrAttackFilter {
public static String filter(String str) throws PatternSyntaxException {
// 清除掉所有特殊字符
String regEx = "[`_《》~!@#$%^&*()+=|{}':;',\\[\\].<>?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return m.replaceAll("").trim();
}
// public static void main(String[] args) {
// String filter = filter("@#jeecg/《》【bo】¥%……&*(o))))!@t<>,.,/?'\'~~`");
// System.out.println(filter);
// }
}
package com.zzsn.event.vo;
import com.zzsn.event.entity.Event;
import lombok.Data;
@Data
public class AddEventParam extends Event {
private String corn;
//0 do not 1 do 1
private Integer extractHotWords;
// time unit minute
private Integer period;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 统计信息封装
*
* @author lkg
* @date 2023/6/20
*/
@Data
public class CountVO {
/**排序*/
private Integer order;
/**名称*/
private String name;
/**数量*/
private Long value;
/**声量/占比*/
private String percentage;
/**按时间分组的子集*/
private List<CountVO> children;
/**预警类型*/
private Integer warningType;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
* @author lkg
* @description: 发送kafka数据封装
* @date 2022/7/20
*/
@Data
public class KafkaDataVo {
/*信息id*/
private String id;
/*标题*/
private String title;
/*内容*/
private String content;
/*来源*/
private String origin;
/*发布时间*/
private String publishDate;
/*链接*/
private String sourceAddress;
/*重复数*/
private Integer repeatNum;
/*专题id*/
private String subjectId;
/*来源分类*/
private String type;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class KeyWordsDTO {
/**主键*/
private String id;
/**词组编码*/
private String wordsCode;
/**词组名称*/
private String wordsName;
/**关键词*/
private String keyWord;
/**排除词*/
private String exclusionWord;
/**状态*/
private String status;
/**数据库查询数据时承接*/
private String subjectId;
/**所属专题*/
private List<String> subjectIds;
private Date startTime;
private Date endTime;
//需要启动的信息采集器
private List<String> searchEngines;
//采集的要求(1:标题 2:正文 3:全文)
private String crawlerType;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class KeyWordsPage {
private String id;
/**词组编码*/
@Excel(name = "词组编码", width = 15)
@ApiModelProperty(value = "词组编码")
private String wordsCode;
/**词组名称*/
@Excel(name = "词组名称", width = 15)
@ApiModelProperty(value = "词组名称")
private String wordsName;
/**词组类别id*/
@Excel(name = "词组类别id", width = 15)
@ApiModelProperty(value = "词组类别id")
private String keyWordsTypeId;
private String keyWordTypeNames;
/**关键词*/
@Excel(name = "关键词", width = 15)
@ApiModelProperty(value = "关键词")
private String keyWord;
/**排除词*/
@Excel(name = "排除词", width = 15)
@ApiModelProperty(value = "排除词")
private String exclusionWord;
/**状态*/
@Excel(name = "状态", width = 15, dicCode = "use_status")
@ApiModelProperty(value = "状态")
private String status;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**今日采集数*/
private Integer numToday;
/**累计采集数*/
private Integer numTotal;
/**今日调度次数*/
private Integer numDispatcherToday;
/**累计调度次数*/
private Integer numDispatcherTotal;
/**成功调度次数*/
private Integer numDispatcherSuccess;
/**失败调度次数*/
private Integer numDispatcherFailed;
/**昨日采集数*/
private Integer numYesterday;
/**最近一次调度时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date latestDispatcherTime;
/**最近一次采集时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date latestCollectionTime;
/**说明 1信息源 2 关键词*/
private String remark;
/**专题绑定关键词时,关键词的采集方式( 1:标题 2:正文 3:全文)*/
private String type;
/**专题绑定的关键词映射表主键id*/
private String subjectKeyWordId;
private String typeId;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 媒体分布统计
*
* @author lkg
* @date 2023/6/20
*/
@Data
public class MediaVO {
//媒体性质
private String name;
//数据量
private Long value;
//占比
private String percentage;
//媒体数量
private Long mediaNum;
//热门媒体
private List<String> hotList;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
* 负面信息
*
* @author lkg
* @date 2024/2/29
*/
@Data
public class NegativeDataVO {
private String id;
private String title;
private String origin;
private String publishDate;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author lkg
* @description: 传播路径响应数据封装
* @date 2022/7/8 11:23
*/
@Data
public class PropagationPathVo implements Serializable {
private String name;
private List<PropagationPathVo> children;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
* 报告所属栏目信息封装
*
* @author lkg
* @date 2023/9/21
*/
@Data
public class ReportExtendVo {
private String projectId;
private String columnId;
}
package com.zzsn.event.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class SearchEnginesVo {
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**搜索引擎名称*/
@Excel(name = "搜索引擎名称", width = 15)
@ApiModelProperty(value = "搜索引擎名称")
private String name;
/**字典码*/
@Excel(name = "字典码", width = 15)
@ApiModelProperty(value = "字典码")
private String dictionaryCode;
/**引擎地址*/
@Excel(name = "引擎地址", width = 15)
@ApiModelProperty(value = "引擎地址")
private String searchUrl;
/**类别*/
@Excel(name = "类别", width = 15, dicCode = "searchEngineType")
@ApiModelProperty(value = "类别")
private Integer type;
/**使用状态*/
@Excel(name = "使用状态", width = 15, dicCode = "use_status")
@ApiModelProperty(value = "使用状态")
private Integer status;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**专题id*/
private String subjectId;
/**专题是否配置*/
private String yn;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
@Data
public class SpecialInformation {
//的索引名
private String dbIndex;
//说明:...Raw 表示原文,即原语言
//作者
private String author;
private String authorRaw;
//正文
private String content;
private String contentRaw;
//带标签正文
private String contentWithTag;
private String contentWithTagRaw;
//入库时间
private String createDate;
//信息id
private String id;
//信息来源id(信息源或者关键词)
private String sid;
//信息源分类id
private String infoSourceNatureId;
//语言
private String lang;
private String langRaw;
//来源(信息来源)
private String origin;
private String originRaw;
//发布时间
private String publishDate;
//原始时间(网页上,没有解析之前的时间)
private String originalTime;
//发布地址
private String sourceAddress;
//摘要
private String summary;
private String summaryRaw;
//关键词
private String keyWords;
//标题
private String title;
private String titleRaw;
//采集来源(如通用、定制、微信公众号等)
private String source;
//附加字段
private String type;
//视频下载链接
private String downLoadUrl;
//视频链接(原链接 网页版)
private String videoUrl;
//视频链接(原链接 手机版)
private String videoPhoneUrl;
//视频时长
private Long videoTime;
//视频第一帧图片
private String videoImg;
//自定义标签
private List<String> customLabel;
private Double score;
//专题库类型(0: 其它 1:政策;2:领导讲话;3:专家观点;4:企业案例)
private Integer classificationType;
//置顶排位(默认为0)
private Integer topNum;
//删除标记(1:删除;0:保留)
private Integer deleteFlag;
private String subjectId;
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private Integer checkStatus;
//阅读数
private Long readNum = 0L;
//是否收藏
private boolean ynCollect = false;
//重复id
private String repeatId;
//(1:主条目 0:非主条目)
private String flag;
//关联的主条目id
private String masterEntryId;
//原始id(去重服务生成的id,因为一条信息可以属于多个专题,原始id会发生改变,所以存储一个原始id,找寻对应关系)
private String originalId;
//快照地址
private String screenShotImg;
//资讯更新时间
private String updateDate;
//信息类别(1:报刊 2:博客 3:客户端 4:论坛 5:视频 6:外媒 7:网站 8:微博 9:微信 10:新闻 11:政务 12:其它)
private String infoSourceType;
//舆情监测:yqjc、舆情预警:yqyj、舆情分析:yqfx、舆情报告:yqbg、竞争情报:jzqb、口碑监测:kbjc
private String dataType;
//资讯关联的附件id
private List<String> attachmentIds;
//数据入专题库时间
private String processDate;
//点赞数字
private Integer likesNum = 0;
//法规号
private String contentNo;
//用户id
private String userId;
//封面附件id
private String coverEnclosureId;
//封面图url地址
private String coverImgUrl;
//发布状态 checkStatus=1时生效(0/null:待发布 1:已发布 2:已下架 默认值为null)
private Integer publishStatus;
//关联附件id
private List<String> enclosureIds;
private String imgDisposeStatus;
/**公开方式 0会员 1公开*/
private Integer publishMethod=0;
/**栏目id*/
private List<String> columnIds;
/**抖音微博作品点赞数*/
private Integer likeNum;
/**抖音微博贴吧作品评论数*/
private Integer commentNum;
/**抖音收藏数*/
private Integer collectNum;
/**抖音微博 分享数*/
private Integer shareNum;
/**作品、帖子唯一标识*/
private String articleId;
/**作品、帖子唯一标识*/
private String index;
/**信息源类别id*/
private String infoSourceTypeId;
/**资讯是否包含图片,1:资讯包含图片 0:资讯不包含图片*/
private String isIncludeImg;
//关键词
private List<String> keyWordsList;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class SpecialInformationParam extends SpecialInformation{
//的索引名
private String dbIndex;
//查询es时需要包含的字段 多个使用,分隔
public String sourceInclude;
//查询es时需要排除的字段 多个使用,分隔
public String sourceExclude;
//舆情推送检索:yqts 舆情预警检索:yqyj
private String searchType;
//检索关键词
private String searchKey;
//分类标签id,多个使用逗号分隔
private String searchLabelIds;
//不查询的分类id,多个使用逗号分隔
private String excludeLabelIds;
//分类标签,多个使用逗号分隔
private String labelMarks;
//状态(多个使用逗号分隔)
private String findStatus;
//发布状态(多个使用逗号分隔)
private String findPublishStatus;
//情报开始时间
private String startTime;
//情报结束时间
private String endTime;
//发布开始时间
private String publishStartTime;
//发布结束时间
private String publishEndTime;
//页码
private Integer pageNo = 1;
//每页数据条数
private Integer pageSize = 10;
//排序规则
private String column = "common";
//排序方式
private String order = "desc";
//高级查询-规则
private String superQueryMatchType;
//高级查询-条件(url转码后的json)
private String superQueryParams;
//是否包含图片
private Integer hasImg;
//栏目id
private String channelId;
//栏目组id
private String channelGroupId;
//取置顶第一条数据的封面图
private Integer hasBanner;
/**舆情推送业务参数:begin*/
//前端传参,关注项id
private String attentionIds;
private String resourceCatalogId;
private String orientation;
//检索条件 用于关注栏目配置 key为栏目id,value为关注类型,0:全部 1:正面 2:中性 3:负面
private Map<String,String> attentionMap;
/**舆情推送业务参数:end*/
/**舆情预警业务参数:begin*/
/**
* 预警类型 2系统预警 3自定义预警
*/
private Integer warningType;
/**
* 信息区域
*/
private Map<String,String> articleAreaMap;
/**
* 互动数
*/
private Map<String,Integer> interactionNumberMap;
/**
* 粉丝数
*/
private Map<String,Integer> fansNumberMap;
/**
* 阅读数
*/
private Map<String,Integer> readNumberMap;
/**
* 相似文章个数
*/
private Map<String,Integer> similarNumberMap;
//检索条件 用于舆情预警配置 key为栏目id,value为舆情预警类型,0:全部 1:正面 2:中性 3:负面
private Map<String,String> pushTypeMap;
/**资讯是否包含图片,1:资讯包含图片 0:资讯不包含图片*/
private Map<String,String> isIncludeImgMap;
/**
* 精准筛选(1 开启 0 关闭)
*/
private Map<String,Integer> accurateFilterMap;
private Map<String,String> infoSourceTypeIdsMap;
/**舆情预警业务参数:end*/
/**抖音微博作品点赞数*/
private Integer likeNum;
/**抖音微博贴吧作品评论数*/
private Integer commentNum;
/**抖音收藏数*/
private Integer collectNum;
/**抖音微博 分享数*/
private Integer shareNum;
/**作品、帖子唯一标识*/
private String articleId;
/**信息源类别id*/
private String infoSourceTypeId;
/**信息源性质id*/
private String infoSourceNatureId;
/**资讯是否包含图片,1:资讯包含图片 0:资讯不包含图片*/
private String isIncludeImg;
//关键词
private List<String> keyWordsList;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* @author lkg
* @description: 旧专题响应数据封装类-统计分析数据
* @date 2022/7/29 14:59
*/
@Data
public class StatisticAnalysisVo {
private String name;
private String key;
private Integer num;
List<StatisticAnalysisVo> list;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author lkg
* @description:
* @date 2022/7/19 15:10
*/
@Data
public class SubjectDataVo {
private String id;
//关联专题id
private String subjectId;
//标题
private String title;
//摘要
private String summary;
//正文
private String content;
//带标签正文
private String contentWithTag;
//来源(信息来源)
private String origin;
//发布地址
private String sourceAddress;
//发布时间
private String publishDate;
//入库时间
private String createDate;
//(flag!=0:主条目 flag=0:非主条目)
private String flag;
//关联的主条目id
private String masterEntryId;
//原始id(去重服务生成的id,因为一条信息可以属于多个专题,原始id会发生改变,所以存储一个原始id,找寻对应关系)
private String originalId;
//关键词
private String keyWords;
//信息源类型(1:报刊 2:博客 3:客户端 4:论坛 5:视频 6:外媒 7:网站 8:微博 9:微信 10:新闻 11:政务 12:其它)
private String infoSourceType;
//重复id
private String repeatId;
public List<String> toList(){
List<String> list = new ArrayList<>();
list.add(id);
list.add(title);
list.add(summary);
list.add(content);
list.add(publishDate);
list.add(origin);
list.add(sourceAddress);
return list;
}
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.Date;
/**
* @author lkg
* @description: 专题列表信息封装-通过kafka发送给python
* @date 2022/7/21
*/
@Data
public class SubjectKafkaVo {
/*专题id*/
private String id;
/*专题名称*/
private String subjectName;
/*专题开始时间*/
private Date timeEnable;
/*专题结束*/
private Date timeDisable;
/*专题增量分析规则*/
private Integer increAnaRule;
/*专题总量分析规则*/
private Integer totalAnaRule;
/*专题时间间隔分析规则*/
private Integer timeAnaRule;
/*专题最近一次分析时间*/
private Date analysisTime;
/*分析事件脉络-最新资讯的时间*/
private Date eventTime;
/*关键词*/
private String keyWord;
/*es索引名*/
private String indexName;
/*es查询语句-查询所有*/
private String query;
/*es查询语句-查询前一天的数据*/
private String beforeQuery;
/*es查询语句-查询重复数据*/
private String repeatNumQuery;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author lkg
* @description: 观点分析响应数据封装
* @date 2022/7/8 11:35
*/
@Data
public class ViewPointAnalysisVo {
//资讯id
private String dataId;
//标题
private String title;
//来源
private String origin;
//发布时间
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date publishDate;
//链接
private String sourceAddress;
/*重复数*/
private Integer repeatNum;
//占比
private String percentage;
//观点分析下的类型(1-新闻;2-论坛;3-微博)
private Integer type;
}
package com.zzsn.event.xxljob.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 信息源表
* @Author: jeecg-boot
* @Date: 2021-10-15
* @Version: V1.0
*/
@ApiModel(value="info_source对象", description="信息源表")
@Data
@TableName("info_source")
public class InfoSource implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**信息源编码*/
@ApiModelProperty(value = "信息源编码")
private String infoSourceCode;
/**信息源名称*/
@ApiModelProperty(value = "信息源名称")
private String webSiteName;
/**栏目名称*/
@ApiModelProperty(value = "栏目名称")
private String siteName;
/**栏目地址*/
@ApiModelProperty(value = "栏目地址")
private String siteUri;
/**网站重要级别*/
@ApiModelProperty(value = "网站重要级别")
private String siteLevel;
/**国家*/
@ApiModelProperty(value = "国家")
private String country;
/**是否境外*/
@ApiModelProperty(value = "是否境外")
private String ynOther;
/**地区*/
@ApiModelProperty(value = "地区")
private String area;
/**是否需要登录*/
@ApiModelProperty(value = "是否需要登录")
private Integer ynLogin;
/**语种*/
@ApiModelProperty(value = "语种")
private String language;
/**是否公共*/
@ApiModelProperty(value = "是否公共")
private String ynPublic;
/**是否需要翻墙*/
@ApiModelProperty(value = "是否需要翻墙")
private Integer ynAbroad;
/**是否需要代理*/
@ApiModelProperty(value = "是否需要代理")
private Integer ynAgent;
/**动态爬取*/
@ApiModelProperty(value = "动态爬取")
private Integer ynBrowser;
/**调度时间间隔*/
@ApiModelProperty(value = "调度时间间隔")
private String period;
/**调度周期(cron自动生成)*/
@ApiModelProperty(value = "调度周期(cron自动生成)")
private String cron;
/**调度周期说明*/
@ApiModelProperty(value = "调度周期说明")
private String remarkCron;
/**信息源状态*/
@ApiModelProperty(value = "信息源状态")
private Integer status;
/**网站可信度*/
@ApiModelProperty(value = "网站可信度")
private Integer siteReliability;
/**信息源综合评分*/
@ApiModelProperty(value = "信息源综合评分")
private Integer score;
/**爬取深度*/
@ApiModelProperty(value = "爬取深度")
private Integer crawlDepth;
/**爬取方式*/
@ApiModelProperty(value = "爬取方式")
private Integer crawlType;
/**历史数据URL*/
@ApiModelProperty(value = "历史数据URL")
private String hisUriExp;
/**历史数据开始时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "历史数据开始时间")
private Date hisDateStarttime;
/**历史数据结束时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "历史数据结束时间")
private Date hisDateEndtime;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
}
package com.zzsn.event.xxljob.entity;
import lombok.Data;
@Data
public class KeyWords {
/**主键*/
private String id;
/**词组编码*/
private String wordsCode;
/**词组名称*/
private String wordsName;
/**关键词*/
private String keyWord;
/**排除词*/
private String exclusionWord;
/**状态*/
private Integer status;
/**创建人*/
private String createBy;
/**创建日期*/
private java.util.Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
private java.util.Date updateTime;
/**所属部门*/
private String sysOrgCode;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论