提交 aa3c962f 作者: 刘凯歌

合并分支 'dev_0710' 到 'event_fusion'

Dev 0710

查看合并请求 !5
...@@ -41,4 +41,4 @@ EXPOSE ${PORT} ...@@ -41,4 +41,4 @@ EXPOSE ${PORT}
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --update ttf-dejavu fontconfig RUN apk add --update ttf-dejavu fontconfig
ENTRYPOINT ["sh","-c","java $JVM_OPTS $APP_OPTS1 $APP_OPTS2 $APP_OPTS3 $APP_OPTS4 $APP_OPTS5 $APP_OPTS6 $APP_OPTS7 $APP_OPTS8 $APP_OPTS9 $APP_OPTS10 -jar /workspace/app.jar"] ENTRYPOINT ["sh","-c","java $JVM_OPTS $APP_OPTS1 $APP_OPTS2 $APP_OPTS3 $APP_OPTS4 $APP_OPTS5 $APP_OPTS6 $APP_OPTS7 $APP_OPTS8 $APP_OPTS9 $APP_OPTS10 -jar /workspace/app.jar"]
\ No newline at end of file
...@@ -227,6 +227,14 @@ ...@@ -227,6 +227,14 @@
<artifactId>neo4j-java-driver</artifactId> <artifactId>neo4j-java-driver</artifactId>
<version>4.1.2</version> <version>4.1.2</version>
</dependency> </dependency>
<!-- 通义千问 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dashscope-sdk-java</artifactId>
<!-- 请将 'the-latest-version' 替换为最新版本号:https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java -->
<version>2.18.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
...@@ -306,5 +314,12 @@ ...@@ -306,5 +314,12 @@
<profile.name>nacos</profile.name> <profile.name>nacos</profile.name>
</properties> </properties>
</profile> </profile>
<profile>
<id>label</id>
<properties>
<!--克虏宝测试环境-->
<profile.name>label</profile.name>
</properties>
</profile>
</profiles> </profiles>
</project> </project>
package com.zzsn.event.config; package com.zzsn.event.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -15,8 +17,9 @@ public class MybatisPlusConfig { ...@@ -15,8 +17,9 @@ public class MybatisPlusConfig {
* mybatis-plus分页插件 * mybatis-plus分页插件
* */ * */
@Bean @Bean
public PaginationInterceptor paginationInterceptor() { public MybatisPlusInterceptor mybatisPlusInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor().setLimit(-1); MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
return paginationInterceptor; interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
} }
} }
...@@ -20,6 +20,7 @@ public class WebConfigure implements WebMvcConfigurer { ...@@ -20,6 +20,7 @@ public class WebConfigure implements WebMvcConfigurer {
//服务部署环境 clb:克虏宝 yjzx:研究中心 //服务部署环境 clb:克虏宝 yjzx:研究中心
@Value("${server.profiles:clb}") @Value("${server.profiles:clb}")
private String profiles; private String profiles;
@Bean @Bean
public LoginInterceptor loginInterceptor() { public LoginInterceptor loginInterceptor() {
return new LoginInterceptor(profiles); return new LoginInterceptor(profiles);
...@@ -28,7 +29,8 @@ public class WebConfigure implements WebMvcConfigurer { ...@@ -28,7 +29,8 @@ public class WebConfigure implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
//用户登录拦截 //用户登录拦截
registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns(ALLOW_URL.split(",")); registry.addInterceptor(loginInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/python/**").excludePathPatterns(ALLOW_URL.split(","));
} }
......
package com.zzsn.event.config.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* 大模型配置参数
* @author wangFeng
* @date 2025/1/9 17:57
*/
@Data
@Component
@ConfigurationProperties(prefix = "model")
public class LlmProperties {
private String defaultModelType;
private List<ModelConfig> configs;
@Data
public static class ModelConfig{
//模型类型
private String modelType;
//模型类型中文名称
private String modelTypeName;
//模型url
private String url;
//模型apiKey
private String apiKey;
//默认模型
private String defaultModel;
//是否开启网络搜索
private Boolean webSearch;
}
/**
* 根据模型类型获取模型配置
*
* @param modelType 模型类型
* @author lkg
* @date 2025/8/6
*/
public ModelConfig getModelConfig(String modelType){
for (ModelConfig config : configs) {
if (config.getModelType().equals(modelType)){
return config;
}
}
return null;
}
}
...@@ -16,6 +16,7 @@ public class Constants { ...@@ -16,6 +16,7 @@ public class Constants {
public static final String SUBJECT_ANALYSIS_PRE = "SUBJECT_ANALYSIS::"; public static final String SUBJECT_ANALYSIS_PRE = "SUBJECT_ANALYSIS::";
//传播路径 //传播路径
public static final String PROPAGATION_KEY = "PROPAGATION_PATH::"; public static final String PROPAGATION_KEY = "PROPAGATION_PATH::";
public static final String CO_OCCURRENCE = "CO_OCCURRENCE::";
public static String[] FETCH_FIELDS_STATISTIC = {"id", "subjectId","title","origin", "publishDate", "sourceAddress"}; public static String[] FETCH_FIELDS_STATISTIC = {"id", "subjectId","title","origin", "publishDate", "sourceAddress"};
public static String[] FETCH_FIELDS_DATA = {"id", "subjectId", "title", "content", "publishDate", "origin", "sourceAddress"}; public static String[] FETCH_FIELDS_DATA = {"id", "subjectId", "title", "content", "publishDate", "origin", "sourceAddress"};
......
package com.zzsn.event.controller.yjzx; package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.SubjectAnalysis; import com.zzsn.event.entity.Event;
import com.zzsn.event.service.SubjectAnalysisService; import com.zzsn.event.entity.EventContext;
import com.zzsn.event.service.EventContextService;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.vo.EventContextModifyVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 事件相关分析维护 * 事件相关分析维护
* *
...@@ -21,47 +23,54 @@ import java.util.List; ...@@ -21,47 +23,54 @@ import java.util.List;
public class EventMaintenanceController { public class EventMaintenanceController {
@Autowired @Autowired
private SubjectAnalysisService subjectAnalysisService; private IEventService eventService;
@Autowired
private EventContextService eventContextService;
/** /**
* 专题事件脉络列表 * 编辑核心摘要
* *
* @param subjectId 专题id * @param event 事件信息
* @author lkg * @author lkg
* @date 2024/5/27 * @date 2025/7/15
*/ */
@GetMapping("/eventContextList") @PostMapping("/event/description/update")
public Result<?> eventContextList(@RequestParam String subjectId){ public Result<?> eventContextList(@RequestBody Event event) {
LambdaQueryWrapper<SubjectAnalysis> queryWrapper = Wrappers.lambdaQuery(); LambdaUpdateWrapper<Event> update = Wrappers.lambdaUpdate();
queryWrapper.eq(SubjectAnalysis::getSubjectId, subjectId).eq(SubjectAnalysis::getCategory, 2) update.set(Event::getEventDescribe, event.getEventDescribe())
.orderByAsc(SubjectAnalysis::getPublishDate); .set(Event::getYnManualEdit,1)
List<SubjectAnalysis> list = subjectAnalysisService.list(queryWrapper); .eq(Event::getId, event.getId());
return Result.OK(list); eventService.update(update);
return Result.OK();
} }
/** /**
* 事件脉络编辑 * 事件脉络新增/编辑
* *
* @param subjectAnalysis 事件脉络信息 * @param eventContextModifyVO 事件脉络信息
* @author lkg * @author lkg
* @date 2024/5/11 * @date 2025/7/15
*/ */
@PostMapping("/eventContextModify") @PostMapping("/eventContext/modify")
public Result<?> eventContextModify(@RequestBody SubjectAnalysis subjectAnalysis){ public Result<?> eventContextModify(@RequestBody EventContextModifyVO eventContextModifyVO){
subjectAnalysisService.eventContextModify(subjectAnalysis); eventContextService.eventContextModify(eventContextModifyVO);
return Result.OK(); return Result.OK();
} }
/** /**
* 删除事件脉络 * 删除事件脉络
* *
* @param id 主键id * @param keyNodeId 脉络关健节点id
* @author lkg * @author lkg
* @date 2024/5/27 * @date 2025/7/15
*/ */
@GetMapping("/eventContextRemove") @GetMapping("/eventContext/remove")
public Result<?> eventContextRemove(String id){ public Result<?> eventContextRemove(@RequestParam String keyNodeId){
subjectAnalysisService.removeById(id); LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
eventContextService.remove(queryWrapper.eq(EventContext::getId, keyNodeId).or().eq(EventContext::getParentId, keyNodeId));
return Result.OK(); return Result.OK();
} }
} }
package com.zzsn.event.controller; package com.zzsn.event.controller;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.ClbModelArrangeSubjectMap; import com.zzsn.event.entity.*;
import com.zzsn.event.entity.Event; import com.zzsn.event.enums.AnalysisColumnEnum;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.entity.SubjectInfoSourceMap;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.service.impl.CaiJiCenterHttpService; import com.zzsn.event.service.impl.CaiJiCenterHttpService;
import com.zzsn.event.service.impl.ConfigurationMessageService; import com.zzsn.event.service.impl.ConfigurationMessageService;
import com.zzsn.event.util.HttpUtil; import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.ObjectUtil; import com.zzsn.event.util.ObjectUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
...@@ -29,14 +23,16 @@ import io.swagger.annotations.Api; ...@@ -29,14 +23,16 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/** /**
...@@ -63,13 +59,14 @@ public class EventManageController { ...@@ -63,13 +59,14 @@ public class EventManageController {
private ConfigurationMessageService configurationMessageService; private ConfigurationMessageService configurationMessageService;
@Autowired @Autowired
private IKeyWordsService keyWordsService; private IKeyWordsService keyWordsService;
@Autowired
private ClbModelArrangeSubjectMapService clbModelArrangeSubjectMapService;
@Autowired
private RedisUtil redisUtil;
@Resource @Resource
private KafkaTemplate<String, String> kafkaTemplate; private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private EventAnalysisVersionRecordService eventAnalysisVersionRecordService;
@Autowired
private AnalysisService analysisService;
@Autowired
private SysUserService sysUserService;
@Value(("${serviceProject.url:}")) @Value(("${serviceProject.url:}"))
private String SERVICE_PROJECT_URL; private String SERVICE_PROJECT_URL;
...@@ -77,6 +74,19 @@ public class EventManageController { ...@@ -77,6 +74,19 @@ public class EventManageController {
private String EVENT_MODEL_KAFKA_CHANNEL; private String EVENT_MODEL_KAFKA_CHANNEL;
/** /**
* 用户列表
*
* @param name 用户名称
* @author lkg
* @date 2025/8/2
*/
@GetMapping(value = "/userList")
public Result<?> userList(@RequestParam(required = false) String name){
List<SysUser> sysUsers = sysUserService.userList(name);
return Result.OK(sysUsers);
}
/**
* 分页列表-后台管理 * 分页列表-后台管理
* *
* @param eventName 事件名称 * @param eventName 事件名称
...@@ -128,12 +138,17 @@ public class EventManageController { ...@@ -128,12 +138,17 @@ public class EventManageController {
/** /**
* 通过id查询 * 通过id查询
* *
* @param id 事件id * @param eventId 事件id
* @return * @return
*/ */
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id") String id) { public Result<?> queryById(@RequestParam String eventId,
EventVO eventVO = eventService.queryInfo(id); @RequestParam(required = false) String versionId) {
EventVO eventVO = eventService.queryInfo(eventId);
if (StringUtils.isNotEmpty(versionId)) {
String versionData = eventAnalysisVersionRecordService.getVersionData(versionId, AnalysisColumnEnum.CORE_SUMMARY.getCode());
eventVO.setEventDescribe(versionData);
}
return Result.OK(eventVO); return Result.OK(eventVO);
} }
...@@ -155,15 +170,21 @@ public class EventManageController { ...@@ -155,15 +170,21 @@ public class EventManageController {
//新增关键词 //新增关键词
keyWordsService.saveBaseAndMap(event, keywordsVO.getKeyword(), keywordsVO.getExclusionWord()); keyWordsService.saveBaseAndMap(event, keywordsVO.getKeyword(), keywordsVO.getExclusionWord());
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
//插入xxlJob try {
log.info("新增事件,插入xxlJob,事件id:{}", event.getId()); //插入xxlJob
iXxlJobInfoService.eventInsert(event); log.info("新增事件,插入xxlJob,事件id:{}", event.getId());
//通知采集 iXxlJobInfoService.eventInsert(event);
log.info("新增事件,通知采集,事件id:{}", event.getId()); //通知采集
configurationMessageService.bindKeyWordsEventSend(event.getId()); log.info("新增事件,通知采集,事件id:{}", event.getId());
//事件分析 configurationMessageService.bindKeyWordsEventSend(event.getId());
// log.info("新增事件,事件分析,事件id:{}", event.getId()); //事件分析
// kafkaTemplate.send(EVENT_MODEL_KAFKA_CHANNEL, event.getEventCode()); //log.info("新增事件,事件分析,事件id:{}", event.getId());
//kafkaTemplate.send(EVENT_MODEL_KAFKA_CHANNEL, event.getEventCode());
} catch (Exception e) {
e.printStackTrace();
}
//立马执行一次事件分析
analysisService.regenerate(event.getId());
}); });
return Result.OK(); return Result.OK();
} else { } else {
...@@ -285,10 +306,6 @@ public class EventManageController { ...@@ -285,10 +306,6 @@ public class EventManageController {
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
EventVO eventVO = eventService.queryInfo(id); EventVO eventVO = eventService.queryInfo(id);
iXxlJobInfoService.deleteByInfosourceCode(eventVO.getEventCode()); iXxlJobInfoService.deleteByInfosourceCode(eventVO.getEventCode());
//删除关键词
keyWordsService.removeBaseAndMap(id);
//删除流程绑定
clbModelArrangeSubjectMapService.remove(Wrappers.<ClbModelArrangeSubjectMap>lambdaQuery().eq(ClbModelArrangeSubjectMap::getSubjectId, id));
}); });
return Result.OK(); return Result.OK();
} }
...@@ -312,8 +329,6 @@ public class EventManageController { ...@@ -312,8 +329,6 @@ public class EventManageController {
for (String id : idArr) { for (String id : idArr) {
EventVO eventVO = eventService.queryInfo(id); EventVO eventVO = eventService.queryInfo(id);
iXxlJobInfoService.deleteByInfosourceCode(eventVO.getEventCode()); iXxlJobInfoService.deleteByInfosourceCode(eventVO.getEventCode());
//删除关键词
keyWordsService.removeBaseAndMap(id);
} }
}); });
return Result.OK(); return Result.OK();
...@@ -321,7 +336,7 @@ public class EventManageController { ...@@ -321,7 +336,7 @@ public class EventManageController {
/** /**
* 1.7 发布 * 发布
* *
* @return * @return
*/ */
...@@ -335,6 +350,20 @@ public class EventManageController { ...@@ -335,6 +350,20 @@ public class EventManageController {
return Result.OK(); return Result.OK();
} }
/**
* 审核公开状态
*
* @param event 参数
* @author lkg
* @date 2025/7/22
*/
@PostMapping(value = "/checkFacePublic")
public Result<?> checkFacePublic(@RequestBody Event event) {
eventService.update(Wrappers.<Event>lambdaUpdate().eq(Event::getId, event.getId())
.set(Event::getFacePublic, event.getFacePublic()));
return Result.OK();
}
/** /**
......
...@@ -1585,7 +1585,7 @@ public class SubjectManageController { ...@@ -1585,7 +1585,7 @@ public class SubjectManageController {
searchWordList.add(searchWord); searchWordList.add(searchWord);
} }
searchCondition.setSearchWordList(searchWordList); searchCondition.setSearchWordList(searchWordList);
List<CountVO> countVOS = esService.groupBySourceId(searchCondition); List<CountVO> countVOS = esService.groupByTerm(searchCondition, "groupSid", "sid.keyword", false,10);
if (CollectionUtils.isNotEmpty(countVOS)) { if (CollectionUtils.isNotEmpty(countVOS)) {
List<String> sourceIdList = new ArrayList<>(); List<String> sourceIdList = new ArrayList<>();
for (CountVO countVO : countVOS) { for (CountVO countVO : countVOS) {
......
...@@ -4,9 +4,11 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -4,9 +4,11 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.KeyWords; import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.entity.KeywordConf;
import com.zzsn.event.entity.KeywordsType; import com.zzsn.event.entity.KeywordsType;
import com.zzsn.event.service.IKeyWordsService; import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.service.IKeywordsTypeService; import com.zzsn.event.service.IKeywordsTypeService;
import com.zzsn.event.service.KeywordConfService;
import com.zzsn.event.vo.KeyWordsPage; import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.KeywordsTypeVo; import com.zzsn.event.vo.KeywordsTypeVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,6 +30,8 @@ public class KeywordController { ...@@ -28,6 +30,8 @@ public class KeywordController {
private IKeywordsTypeService keywordsTypeService; private IKeywordsTypeService keywordsTypeService;
@Autowired @Autowired
private IKeyWordsService keyWordsService; private IKeyWordsService keyWordsService;
@Autowired
private KeywordConfService keywordConfService;
/** /**
* 通过父级id列表查询 * 通过父级id列表查询
...@@ -189,4 +193,17 @@ public class KeywordController { ...@@ -189,4 +193,17 @@ public class KeywordController {
KeyWordsPage keyWords = keyWordsService.getKeyWordsById(id); KeyWordsPage keyWords = keyWordsService.getKeyWordsById(id);
return Result.OK(keyWords); return Result.OK(keyWords);
} }
/**
* 添加关键词过滤配置
*
* @param keywordConf 过滤词信息
* @author lkg
* @date 2025/7/28
*/
@PostMapping("/conf/add")
public Result<?> configAdd(@RequestBody List<KeywordConf> keywordConf){
keywordConfService.saveBatch(keywordConf);
return Result.OK();
}
} }
package com.zzsn.event.controller.common;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.EventAnalysisVersion;
import com.zzsn.event.entity.EventAnalysisVersionRecord;
import com.zzsn.event.entity.EventLlmConfig;
import com.zzsn.event.enums.AnalysisColumnEnum;
import com.zzsn.event.service.*;
import com.zzsn.event.util.DateUtil;
import com.zzsn.event.vo.EventVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* 大模型配置
*
* @author lkg
* @date 2025/7/28
*/
@Slf4j
@RestController
@RequestMapping("/llm/config")
public class LLmConfigController {
@Autowired
private EventLlmConfigService llmConfigService;
@Autowired
private AnalysisService analysisService;
@Autowired
private EventAnalysisVersionService eventAnalysisVersionService;
@Autowired
private EventAnalysisVersionRecordService eventAnalysisVersionRecordService;
@Autowired
private IEventService eventService;
/**
* 事件下大模型配置信息
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/28
*/
@GetMapping("/list")
public Result<?> list(@RequestParam String eventId) {
List<EventLlmConfig> configList = llmConfigService.getConfigList(eventId);
return Result.OK(configList);
}
/**
* 批量编辑事件的大模型配置信息
*
* @param eventLlmConfigList 大模型配置信息
* @author lkg
* @date 2025/7/28
*/
@PostMapping("/modifyBatch")
public Result<?> modifyBatch(@RequestBody List<EventLlmConfig> eventLlmConfigList) {
llmConfigService.modifyBatch(eventLlmConfigList);
return Result.OK();
}
/**
* 编辑事件栏目的大模型配置信息,同时触发大模型更新结果
*
* @param eventLlmConfig 大模型配置信息
* @author lkg
* @date 2025/7/28
*/
@PostMapping("/modifySingle")
public Result<?> modifySingle(@RequestBody EventLlmConfig eventLlmConfig) {
llmConfigService.modifySingle(eventLlmConfig);
CompletableFuture.runAsync(() ->{
AnalysisColumnEnum analysisColumnEnum = AnalysisColumnEnum.getByCode(eventLlmConfig.getColumnCode());
if (analysisColumnEnum != null) {
String eventId = eventLlmConfig.getEventId();
EventVO event = eventService.queryInfo(eventId);
String eventName = event.getEventName();
String content = "事件标题;" + eventName + "\n事件摘要:" + event.getEventDescribe();
//调用大模型更细结果
String llmResult = analysisService.llmResult(eventId,content, null, null, eventLlmConfig.getColumnCode());
EventAnalysisVersion eventAnalysisVersion = eventAnalysisVersionService.latestVersion(eventId);
String versionId;
if (eventAnalysisVersion == null) {
eventAnalysisVersion = new EventAnalysisVersion();
eventAnalysisVersion.setEventId(eventId);
eventAnalysisVersion.setVersionName("版本" + DateUtil.dateToString(new Date()));
eventAnalysisVersionService.save(eventAnalysisVersion);
versionId = eventAnalysisVersion.getId();
} else {
versionId = eventAnalysisVersion.getId();
}
EventAnalysisVersionRecord versionRecord = EventAnalysisVersionRecord.of(versionId, analysisColumnEnum, llmResult);
LambdaQueryWrapper<EventAnalysisVersionRecord> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventAnalysisVersionRecord::getVersionId, versionId).eq(EventAnalysisVersionRecord::getColumnCode, eventLlmConfig.getColumnCode());
EventAnalysisVersionRecord oldVersionRecord = eventAnalysisVersionRecordService.getOne(queryWrapper);
if (oldVersionRecord != null) {
oldVersionRecord.setReturnData(llmResult);
eventAnalysisVersionRecordService.updateById(oldVersionRecord);
} else {
eventAnalysisVersionRecordService.save(versionRecord);
}
log.info("{}-事件分析【{}】重新生成逻辑完成。", eventName, analysisColumnEnum.getName());
} else {
log.info("未找到对应的事件栏目【{}】", eventLlmConfig.getColumnCode());
}
});
return Result.OK();
}
}
...@@ -22,14 +22,12 @@ import com.zzsn.event.service.*; ...@@ -22,14 +22,12 @@ import com.zzsn.event.service.*;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
...@@ -174,7 +174,7 @@ public class StatisticalAnalysisController { ...@@ -174,7 +174,7 @@ public class StatisticalAnalysisController {
List<String> includeValues = dictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); List<String> includeValues = dictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
searchCondition.setIncludeValues(includeValues.toArray(new String[0])); searchCondition.setIncludeValues(includeValues.toArray(new String[0]));
if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) { if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) {
dataList = esService.groupByClassificationType(searchCondition); dataList = esService.groupByTerm(searchCondition, "groupType", "classificationType", false,null);
} else { } else {
String[] fetchFields = new String[]{"id", "classificationType"}; String[] fetchFields = new String[]{"id", "classificationType"};
searchCondition.setFetchFields(fetchFields); searchCondition.setFetchFields(fetchFields);
...@@ -242,7 +242,7 @@ public class StatisticalAnalysisController { ...@@ -242,7 +242,7 @@ public class StatisticalAnalysisController {
if (CollectionUtils.isNotEmpty(sourceIdList)) { if (CollectionUtils.isNotEmpty(sourceIdList)) {
searchCondition.setIncludeValues(sourceIdList.toArray(new String[0])); searchCondition.setIncludeValues(sourceIdList.toArray(new String[0]));
} }
dataList = esService.groupBySourceId(searchCondition); dataList = esService.groupByTerm(searchCondition, "groupSid", "sid.keyword", false,null);
} else { } else {
String[] fetchFields = new String[]{"id", "sid"}; String[] fetchFields = new String[]{"id", "sid"};
searchCondition.setFetchFields(fetchFields); searchCondition.setFetchFields(fetchFields);
......
package com.zzsn.event.controller.python;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.EventContext;
import com.zzsn.event.service.EventContextService;
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 java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* python推送数据
*
* @author lkg
* @date 2025/8/5
*/
@RestController
@RequestMapping("/python/send")
public class AnalysisDataController {
@Autowired
private EventContextService eventContextService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
@GetMapping("/eventContext")
public Result<?> sendEventContext(@RequestParam String eventId) {
Map<String, Object> map = new HashMap<>();
map.put("ynYjzx",yjzxEnable);
LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventContext::getEventId, eventId).orderByDesc(EventContext::getSortNumber);
List<EventContext> eventContexts = eventContextService.list(queryWrapper);
map.put("data", eventContexts);
return Result.OK(map);
}
}
package com.zzsn.event.controller.yjzx; package com.zzsn.event.controller.yjzx;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.EventNetwork;
import com.zzsn.event.llm.LlmService;
import com.zzsn.event.service.EsStatisticsService; import com.zzsn.event.service.EsStatisticsService;
import com.zzsn.event.service.EventNetworkService;
import com.zzsn.event.service.IEventService; import com.zzsn.event.service.IEventService;
import com.zzsn.event.util.LLMUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.EventExcelVO; import com.zzsn.event.vo.EventExcelVO;
...@@ -20,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -20,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
...@@ -45,6 +51,10 @@ public class EventHomeController { ...@@ -45,6 +51,10 @@ public class EventHomeController {
private EsStatisticsService esStatisticsService; private EsStatisticsService esStatisticsService;
@Autowired @Autowired
private IEventService eventService; private IEventService eventService;
@Autowired
private EventNetworkService eventNetworkService;
@Autowired
private LlmService llmService;
@Value(("${yjzx.url.checkToken:http://sasac-rc.com/api/v4/user/urUser/getUserByToken?token=}")) @Value(("${yjzx.url.checkToken:http://sasac-rc.com/api/v4/user/urUser/getUserByToken?token=}"))
private String checkTokenProd; private String checkTokenProd;
...@@ -64,7 +74,7 @@ public class EventHomeController { ...@@ -64,7 +74,7 @@ public class EventHomeController {
UserVo loginUser = UserUtil.getLoginUser(); UserVo loginUser = UserUtil.getLoginUser();
String username = loginUser.getUsername(); String username = loginUser.getUsername();
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
List<EventExcelVO> eventList = eventService.frontAllList(projectId, username, null, null,null,null,null,null); List<EventExcelVO> eventList = eventService.frontAllList(projectId, username, null, null, null, null, null, null);
map.put("eventCount", eventList.size()); map.put("eventCount", eventList.size());
if (!CollectionUtils.isEmpty(eventList)) { if (!CollectionUtils.isEmpty(eventList)) {
List<String> eventIdList = eventList.stream().map(EventExcelVO::getId).collect(Collectors.toList()); List<String> eventIdList = eventList.stream().map(EventExcelVO::getId).collect(Collectors.toList());
...@@ -123,7 +133,7 @@ public class EventHomeController { ...@@ -123,7 +133,7 @@ public class EventHomeController {
UserVo loginUser = UserUtil.getLoginUser(); UserVo loginUser = UserUtil.getLoginUser();
String username = loginUser.getUsername(); String username = loginUser.getUsername();
List<Map<String, Object>> dataList = new ArrayList<>(); List<Map<String, Object>> dataList = new ArrayList<>();
List<EventRegionVO> eventRegionVOList = eventService.listByRegion(projectId,username,type, regionName); List<EventRegionVO> eventRegionVOList = eventService.listByRegion(projectId, username, type, regionName);
Map<String, List<EventRegionVO>> map = eventRegionVOList.stream().collect(Collectors.groupingBy(EventRegionVO::getRegionName)); Map<String, List<EventRegionVO>> map = eventRegionVOList.stream().collect(Collectors.groupingBy(EventRegionVO::getRegionName));
for (Map.Entry<String, List<EventRegionVO>> entry : map.entrySet()) { for (Map.Entry<String, List<EventRegionVO>> entry : map.entrySet()) {
Map<String, Object> regionMap = new HashMap<>(); Map<String, Object> regionMap = new HashMap<>();
...@@ -134,28 +144,69 @@ public class EventHomeController { ...@@ -134,28 +144,69 @@ public class EventHomeController {
} }
return Result.OK(dataList); return Result.OK(dataList);
} }
/**
* 今日网络事件列表
*
* @param type 来源类型(1-百度;2-新浪新闻)
* @author lkg
* @date 2025/7/4
*/
@GetMapping("/networkEventList")
public Result<?> networkEventList(@RequestParam Integer type) {
String today = DateUtil.today();
LambdaQueryWrapper<EventNetwork> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventNetwork::getPublishDate, today)
.eq(EventNetwork::getType, type)
.eq(EventNetwork::getLatest, 1)
.eq(EventNetwork::getYnNeed, 1)
.orderByDesc(EventNetwork::getHot);
return Result.OK(eventNetworkService.list(queryWrapper));
}
/**
* 推荐热词
*
* @param networkName 网络事件标题
* @author lkg
* @date 2025/8/4
*/
@GetMapping("/hotWordRecommend")
public Result<?> hotWordRecommend(@RequestParam String networkName) {
String prompt = "请根据提供的百度/新浪热榜中的网络事件,再结合网络上资讯,推荐一些简短的关键词。以json格式输出:[\"关键词1\",\"关键词2\"]";
String result = llmService.model(null, prompt, networkName);
if (result.startsWith("```json")) {
result = result.substring(7, result.length() - 3);
} else if (result.startsWith("```")) {
result = result.substring(3, result.length() - 3);
}
return Result.OK(result);
}
/** /**
* 权限校验 * 权限校验
*
* @param token 研究中心token * @param token 研究中心token
* @author yanxin * @author yanxin
* @date 2025/2/20 * @date 2025/2/20
*/ */
@GetMapping("/checkAuth") @GetMapping("/checkAuth")
public Result<?> checkAuth(@RequestParam String token,@RequestParam String key) { public Result<?> checkAuth(@RequestParam String token, @RequestParam String key) {
try{ try {
String checkToken = checkTokenProd; String checkToken = checkTokenProd;
if("test".equals(UserUtil.getLoginUser().getTenant())){ if ("test".equals(UserUtil.getLoginUser().getTenant())) {
checkToken = checkTokenTest; checkToken = checkTokenTest;
} }
String res = HttpUtil.get(checkToken + token); String res = HttpUtil.get(checkToken + token);
JSONObject data = JSONObject.parseObject(res).getJSONObject("data"); JSONObject data = JSONObject.parseObject(res).getJSONObject("data");
if(data == null){ if (data == null) {
return Result.FAIL("token失效"); return Result.FAIL("token失效");
} }
JSONArray powerCodeSet = data.getJSONArray("powerCodeSet"); JSONArray powerCodeSet = data.getJSONArray("powerCodeSet");
return Result.OK(powerCodeSet.contains(key)); return Result.OK(powerCodeSet.contains(key));
}catch (Exception e){ } catch (Exception e) {
log.error("研究中心用户权限校验异常,e:{}",e.getMessage(),e); log.error("研究中心用户权限校验异常,e:{}", e.getMessage(), e);
} }
return Result.OK(false); return Result.OK(false);
} }
......
...@@ -57,6 +57,12 @@ public class Event { ...@@ -57,6 +57,12 @@ public class Event {
@ApiModelProperty(value = "事件类型") @ApiModelProperty(value = "事件类型")
private String eventType; private String eventType;
/** /**
* 关键问题
*/
@Excel(name = "关键问题", width = 15)
@ApiModelProperty(value = "关键问题")
private String keyIssue;
/**
* 开始时间 * 开始时间
*/ */
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
...@@ -91,6 +97,12 @@ public class Event { ...@@ -91,6 +97,12 @@ public class Event {
@ApiModelProperty(value = "事件描述") @ApiModelProperty(value = "事件描述")
private String eventDescribe; private String eventDescribe;
/** /**
* 事件描述是否人工编辑(1-是;0-否)
*/
@Excel(name = "事件描述是否人工编辑(1-是;0-否)", width = 15)
@ApiModelProperty(value = "事件描述是否人工编辑(1-是;0-否)")
private Integer ynManualEdit;
/**
* 创建人id * 创建人id
*/ */
@Excel(name = "创建人id", width = 15) @Excel(name = "创建人id", width = 15)
...@@ -226,6 +238,10 @@ public class Event { ...@@ -226,6 +238,10 @@ public class Event {
* 访问环境,prod:正式环境 test:测试环境 * 访问环境,prod:正式环境 test:测试环境
*/ */
private String tenant; private String tenant;
/**预估状态*/
private String estimateStatus;
/** 环境 1-测试 2-正式 */
private String environment;
/** /**
* 关键词信息 * 关键词信息
*/ */
......
package com.zzsn.event.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 事件分析版本表
* @TableName event_analysis_version
*/
@Data
@TableName("event_analysis_version")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class EventAnalysisVersion implements Serializable {
/**
* 版本id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 事件id
*/
private String eventId;
/**
* 版本名称
*/
private String versionName;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
package com.zzsn.event.entity;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
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 com.zzsn.event.enums.AnalysisColumnEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 事件分析版本记录表
*
* @TableName event_analysis_version_record
*/
@Data
@TableName("event_analysis_version_record")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class EventAnalysisVersionRecord implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 版本id
*/
private String versionId;
/**
* 栏目编码
*/
private Integer columnCode;
/**
* 参数
*/
private String params;
/**
* 返回数据
*/
private String returnData;
/**
* 返回数据类型(object、array)
*/
private String resType;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public static EventAnalysisVersionRecord of(String versionId, AnalysisColumnEnum analysisColumnEnum, String returnData) {
EventAnalysisVersionRecord record = new EventAnalysisVersionRecord();
record.setVersionId(versionId);
record.setColumnCode(analysisColumnEnum.getCode());
record.setReturnData(returnData);
record.setResType(analysisColumnEnum.getResType());
return record;
}
}
package com.zzsn.event.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 用户关注事件关系表
* @TableName event_collect_map
*/
@Data
@TableName("event_collect_map")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class EventCollectMap implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 事件id
*/
private String eventId;
/**
* 用户id
*/
private String userId;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 事件脉络表
* @TableName event_context
*/
@Data
@TableName("event_context")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class EventContext implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 专题id
*/
private String eventId;
/**
* 资讯id
*/
private String articleId;
/**
* 标题
*/
private String title;
/**
* 来源
*/
private String origin;
/**
* 发布时间
*/
private String publishDate;
/**
* 链接
*/
private String sourceAddress;
/**
* 排序
*/
private Integer sortNumber;
/**
* 是否关键节点(1-是;0-否)
*/
private Integer ynKeyNode;
/**
* 关键节点唯一编码
*/
private String uniqueCode;
/**
* 上级id(所属关键节点id)
*/
private String parentId;
/**
* es索引名称
*/
private String esIndex;
/**
* 生成方式(1-自动;2-人工)
*/
private Integer createWay;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**关键节点下资讯数量*/
@TableField(exist = false)
private Integer articleCount;
}
package com.zzsn.event.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 事件大模型信息配置表
* @TableName event_llm_config
*/
@Data
@TableName("event_llm_config")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class EventLlmConfig implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 事件id
*/
private String eventId;
/**
* 栏目编码
*/
private Integer columnCode;
/**
* 栏目名称
*/
private String columnName;
/**
* 大模型
*/
private String llmName;
/**
* 角色
*/
private String llmRole;
/**
* 提示词
*/
private String llmPrompt;
/**
* 资讯筛选条件
*/
private String articleCondition;
/**
* 是否默认(1-是;0-否)
*/
private Integer ynDefault;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
package com.zzsn.event.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 网络事件表
* @TableName event_network
*/
@Data
@TableName("event_network")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event_network对象", description="网络事件")
public class EventNetwork implements Serializable {
/**
* 主键id
*/
@TableId(value = "id",type = IdType.ASSIGN_ID)
private String id;
/**
* 标题
*/
private String title;
/**
* 图片地址
*/
private String picture;
/**
* 热度
*/
private Integer hot;
/**
* 发布日期
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date publishDate;
/**
* 是否最新(1-是;0-否)
*/
private Integer latest;
/**
* 是否所要事件(1-是;0-否)[政治经济领域相关]
*/
private Integer ynNeed;
/**
* 来源类型(1-百度;2-新浪)
*/
private Integer type;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
}
package com.zzsn.event.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 关键词过滤配置
* @TableName clb_keyword_conf
*/
@Data
@TableName("clb_keyword_conf")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="clb_keyword_conf对象", description="关键词过滤配置")
public class KeywordConf implements Serializable {
/**
*
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 分类id
*/
private String databaseId;
/**
* 分类类型
*/
private String databaseType;
/**
* 关键词
*/
private String keyword;
/**
* 0:黑名单 1:白名单
*/
private Integer type;
/**
* 作用范围 0:全库 1:本库
*/
private Integer rangeType;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
...@@ -48,4 +48,8 @@ public class SubjectAnalysis implements Serializable { ...@@ -48,4 +48,8 @@ public class SubjectAnalysis implements Serializable {
private Date analysisDate; private Date analysisDate;
/**专家名称*/ /**专家名称*/
private String professionName; private String professionName;
/**是否主要资讯(新版事件脉络)*/
private Integer isMain;
/**生成法方式(1-自动;2-人工)(新版事件脉络)*/
private Integer createWay;
} }
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 用户表
* </p>
*
* @Author scott
* @since 2018-12-20
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 登录账号
*/
@Excel(name = "登录账号", width = 15)
private String username;
/**
* 真实姓名
*/
@Excel(name = "真实姓名", width = 15)
private String realname;
/**
* 密码
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String password;
/**
* md5密码盐
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String salt;
/**
* 头像
*/
@Excel(name = "头像", width = 15,type = 2)
private String avatar;
/**
* 生日
*/
@Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/**
* 性别(1:男 2:女)
*/
@Excel(name = "性别", width = 15,dicCode="sex")
private Integer sex;
/**
* 电子邮件
*/
@Excel(name = "电子邮件", width = 15)
private String email;
/**
* 电话
*/
@Excel(name = "电话", width = 15)
private String phone;
/**
* 部门code(当前选择登录部门)
*/
private String orgCode;
/**部门名称*/
private transient String orgCodeTxt;
/**
* 状态(1:正常 2:冻结 )
*/
@Excel(name = "状态", width = 15,dicCode="user_status")
private Integer status;
/**
* 删除状态(0,正常,1已删除)
*/
@Excel(name = "删除状态", width = 15,dicCode="del_flag")
@TableLogic
private Integer delFlag;
/**
* 工号,唯一键
*/
@Excel(name = "工号", width = 15)
private String workNo;
/**
* 职务,关联职务表
*/
@Excel(name = "职务", width = 15)
private String post;
/**
* 座机号
*/
@Excel(name = "座机号", width = 15)
private String telephone;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 同步工作流引擎1同步0不同步
*/
private Integer activitiSync;
/**
* 身份(0 普通成员 1 上级)
*/
@Excel(name="(1普通成员 2上级)",width = 15)
private Integer userIdentity;
/**
* 负责部门
*/
@Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
private String departIds;
/**
* 多租户id配置,编辑用户的时候设置
*/
private String relTenantIds;
/**设备id uniapp推送用*/
private String clientId;
/**1-超级用户;2-普通用户*/
private Integer category;
/*
* 第一次登录标识
*/
private Integer firstLogin;
/*
* 最近一次修改密码的时间
*/
private Date modifyPwdTime;
/**用户类型(1-平台;2-其他)*/
private Integer userType;
/*第三方用户唯一标识*/
private String thirdId;
/*第三方类型*/
private String thirdType;
}
package com.zzsn.event.enums;
import java.util.ArrayList;
import java.util.List;
/**
* @author zs
* @Description 事件分析栏目(支持版本逻辑) 枚举
* @since 2021/12/9
*/
public enum AnalysisColumnEnum {
CORE_SUMMARY(1, "核心摘要", "string", 1),
EVENT_CONTEXT(2, "事件脉络", "array", 0),
KEYWORD_TREND(3, "关键词趋势分析", "array", 0),
CO_OCCURRENCE(4, "关键词共现", "array", 0),
IMPACT_ASSESSMENT(5, "影响评估", "array", 1),
MEASURE_SUGGEST(6, "应对建议", "array", 1),
KNOWLEDGE_ENTRY(7, "知识词条", "array", 1),
ENTERPRISE_CASE(8, "企业措施", "array", 1),
//COUNTRY_POLICY(9, "各国政策", "array", 1),
DOMESTIC_SIMILAR_EVENT(10, "中国类似事件", "array", 1),
FOREIGN_SIMILAR_EVENT(11, "各国类似事件", "array", 1),
DRIVING_FACTORS(12, "事件核心驱动因素", "object", 1),
RELATED_INDICATOR(13, "事件相关指标", "array", 1),
IMPACT_ASSESSMENT_DETAIL(14, "影响评估详情", "string", 1),
;
//栏目编码
private final Integer code;
//栏目名称
private final String name;
//返回数据类型
private final String resType;
//是否需要大模型(1-是;0-否)
private final Integer ynNeedLlm;
AnalysisColumnEnum(int code, String name, String resType, Integer ynNeedLlm) {
this.code = code;
this.name = name;
this.resType = resType;
this.ynNeedLlm = ynNeedLlm;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
public String getResType() {
return resType;
}
public Integer getYnNeedLlm() {
return ynNeedLlm;
}
public static List<AnalysisColumnEnum> llmList() {
List<AnalysisColumnEnum> list = new ArrayList<>();
for (AnalysisColumnEnum value : AnalysisColumnEnum.values()) {
if (value.ynNeedLlm == 1) {
list.add(value);
}
}
return list;
}
public static AnalysisColumnEnum getByCode(Integer code) {
for (AnalysisColumnEnum value : AnalysisColumnEnum.values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}
}
package com.zzsn.event.kafka; package com.zzsn.event.kafka;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants; import com.zzsn.event.entity.EventContext;
import com.zzsn.event.entity.EventAnalysisReport; import com.zzsn.event.service.EventContextService;
import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.service.EventAnalysisReportService;
import com.zzsn.event.service.SubjectAnalysisService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,91 +25,60 @@ import java.util.List; ...@@ -28,91 +25,60 @@ import java.util.List;
@Component @Component
public class KafkaConsumer { public class KafkaConsumer {
@Autowired @Autowired
private SubjectAnalysisService subjectAnalysisService; private EventContextService eventContextService;
@Autowired
private EventAnalysisReportService eventAnalysisReportService;
/** /**
* 获取-事件脉络-分析结果数据,并入库 * 获取-事件脉络-分析结果数据,并入库
* *
* @param record 接收的kafka数据 * @param record 接收的kafka数据
*/ */
@KafkaListener(topics = {Constants.EVENT_CONTEXT_RECEIVE_TOPIC}) @KafkaListener(topics = {"eventContextTopic"})
public void eventContext(ConsumerRecord<String, String> record) { public void eventContext_new(ConsumerRecord<String, String> record) {
String value = record.value(); String value = record.value();
if (StringUtils.isNotEmpty(value)) { if (StringUtils.isEmpty(value)) {
String subjectId; return;
Integer category = 2;
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);
log.info("id为-{}-的专题,此次-事件脉络-数据更新完成", subjectId);
} catch (Exception e) {
e.printStackTrace();
}
} }
} List<eventContextKafkaVO> eventContextKafkaList = JSON.parseArray(value, eventContextKafkaVO.class);
for (eventContextKafkaVO contextKafkaVO : eventContextKafkaList) {
/** String uniqueCode = contextKafkaVO.getUniqueCode();
* 获取-伪事件脉络-分析结果数据,并入库 String eventId = contextKafkaVO.getEventId();
* LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
* @param record 接收的kafka数据 queryWrapper.eq(EventContext::getEventId, eventId).eq(EventContext::getUniqueCode, uniqueCode);
*/ EventContext one = eventContextService.getOne(queryWrapper);
@KafkaListener(topics = {Constants.FAKE_EVENT_CONTEXT_RECEIVE_TOPIC}) Integer maxSortNumber = eventContextService.getMaxSortNumber(eventId);
public void eventContext_fake(ConsumerRecord<String, String> record) { String keyNodeId;
String value = record.value(); if (one == null) {
if (StringUtils.isNotEmpty(value)) { EventContext keyNode = new EventContext();
String subjectId; keyNode.setEventId(eventId);
Integer category = 3; keyNode.setTitle(contextKafkaVO.getTitle());
try { keyNode.setPublishDate(contextKafkaVO.getPublishDate());
List<SubjectAnalysis> subjectAnalyses = JSON.parseArray(value, SubjectAnalysis.class); keyNode.setUniqueCode(uniqueCode);
subjectId = subjectAnalyses.get(0).getSubjectId(); keyNode.setYnKeyNode(1);
subjectAnalyses.forEach(e -> { keyNode.setParentId("0");
e.setCategory(category); maxSortNumber = maxSortNumber + 1;
e.setTitle(removeNonBmpUniCodes(e.getTitle())); keyNode.setSortNumber(maxSortNumber);
}); eventContextService.save(keyNode);
LambdaQueryWrapper<SubjectAnalysis> queryWrapper = Wrappers.lambdaQuery(); keyNodeId = keyNode.getId();
queryWrapper.eq(SubjectAnalysis::getSubjectId, subjectId).eq(SubjectAnalysis::getCategory, category); } else {
int count = subjectAnalysisService.count(queryWrapper); keyNodeId = one.getId();
if (count > 0) { }
subjectAnalysisService.remove(queryWrapper); List<EventContext> eventContextList = contextKafkaVO.getRelatedArticles();
if (CollectionUtils.isNotEmpty(eventContextList)) {
for (int i = 0; i < eventContextList.size(); i++) {
EventContext eventContext = eventContextList.get(i);
LambdaQueryWrapper<EventContext> query = Wrappers.lambdaQuery();
query.eq(EventContext::getEventId, eventId).eq(EventContext::getArticleId, eventContext.getArticleId());
int count = eventContextService.count(query);
if (count == 0) {
eventContext.setEventId(eventId);
eventContext.setParentId(keyNodeId);
eventContext.setSortNumber(maxSortNumber + i + 1);
}
} }
subjectAnalysisService.saveBatch(subjectAnalyses); eventContextService.saveBatch(eventContextList);
log.info("id为-{}-的专题,此次-伪事件脉络-数据更新完成", subjectId);
} catch (Exception e) {
e.printStackTrace();
} }
} }
} log.info("事件-{},本次事件脉络更新完成",eventContextKafkaList.get(0).getEventId());
/**
* 获取事件的分析报告数据
*
* @param record 接收的kafka数据
* @author lkg
* @date 2024/4/12
*/
@KafkaListener(topics = {Constants.EVENT_REPORT_RECEIVE_TOPIC})
public void eventReport(ConsumerRecord<String, String> record) {
String value = record.value();
EventAnalysisReport eventAnalysisReport = JSONObject.parseObject(value, EventAnalysisReport.class);
eventAnalysisReportService.modify(eventAnalysisReport.getEventId(), eventAnalysisReport.getFilePath());
log.info("id为-{}-的事件,分析报告更新完成", eventAnalysisReport.getEventId());
}
//去除特殊的字符,例如表情符
private String removeNonBmpUniCodes(String str) {
return StringUtils.isEmpty(str) ? null : str.replaceAll("[^\\u0000-\\uFFFF]", "");
} }
} }
package com.zzsn.event.kafka;
import com.zzsn.event.entity.EventContext;
import lombok.Data;
import java.util.List;
/**
* kafka 事件脉络实体
*
* @author lkg
* @date 2025/7/15
*/
@Data
public class eventContextKafkaVO {
/**事件id*/
private String eventId;
/**关键节点唯一编码*/
private String uniqueCode;
/**关键节点标题*/
private String title;
/**关键节点时间*/
private String publishDate;
/**关键节点-关联资讯列表*/
private List<EventContext> relatedArticles;
}
package com.zzsn.event.llm;
/**
* 模型调用
*/
public interface LlmService {
/**
* glm模型调用
*
* @param model 模型类型
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
String model(String model, String system, String content);
}
package com.zzsn.event.llm;
import cn.hutool.http.HttpException;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.config.properties.LlmProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* 大模型调用
*
* @author lkg
* @date 2025/7/4
*/
@Slf4j
@Service
public class LlmServiceImpl implements LlmService {
@Resource
private LlmProperties llmProperties;
@Override
public String model(String modelType, String system, String content) {
if (StringUtils.isEmpty(modelType)) {
modelType = llmProperties.getDefaultModelType();
}
LlmProperties.ModelConfig modelConfig = llmProperties.getModelConfig(modelType);
if (modelType.equalsIgnoreCase("zhipu")) {
return glmModel(modelConfig, system, content);
} else if (modelType.equalsIgnoreCase("qwen")) {
return qwenModel(modelConfig, system, content);
} else if (modelType.equalsIgnoreCase("deepseek")) {
return deepSeekModel(modelConfig, system, content);
} else if (modelType.equalsIgnoreCase("doubao")) {
return douBaoModel(modelConfig, system, content);
}
return null;
}
/**
* glm模型调用
*
* @param modelConfig 模型配置信息
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
public String glmModel(LlmProperties.ModelConfig modelConfig, String system, String content) {
Map<String, Object> params = new HashMap<>();
params.put("model", modelConfig.getDefaultModel());
List<Map<String, Object>> messageList = new ArrayList<>();
Map<String, Object> systemMap = new HashMap<>();
systemMap.put("role", "system");
systemMap.put("content", system);
messageList.add(systemMap);
Map<String, Object> messagesMap = new HashMap<>();
messagesMap.put("role", "user");
messagesMap.put("content", content);
messageList.add(messagesMap);
params.put("messages", messageList);
params.put("history", "[]");
params.put("top_p", 0.7);
//params.put("temperature", 0.75);\
//是否开启联网搜索
Boolean webSearchFlag = modelConfig.getWebSearch();
if (webSearchFlag != null && webSearchFlag) {
Map<String, Object> webSearch = new HashMap<>();
webSearch.put("enable", true);
webSearch.put("search_result", true);
Map<String, Object> chatTool = new HashMap<>();
chatTool.put("web_search", webSearch);
chatTool.put("type", "web_search");
List<Map<String, Object>> tools = new ArrayList<>();
tools.add(chatTool);
params.put("tools", tools);
}
String responseStr = glmPost(modelConfig.getUrl(), modelConfig.getApiKey(), new JSONObject(params));
String choices = JSONObject.parseObject(responseStr).getString("choices");
JSONObject choicesObject = (JSONObject) JSON.parseArray(choices).get(0);
String messageStr = choicesObject.getString("message");
return JSONObject.parseObject(messageStr).getString("content");
}
/**
* 千问模型调用
*
* @param modelConfig 模型
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
public String qwenModel(LlmProperties.ModelConfig modelConfig, String system, String content) {
try {
Generation gen = new Generation();
Message systemMsg = Message.builder()
.role(Role.SYSTEM.getValue())
.content(system)
.build();
Message userMsg = Message.builder()
.role(Role.USER.getValue())
.content(content)
.build();
GenerationParam param = GenerationParam.builder()
// 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:.apiKey("sk-xxx")
.apiKey(modelConfig.getApiKey())
// 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
.model(modelConfig.getDefaultModel())
.messages(Arrays.asList(systemMsg, userMsg))
.resultFormat(GenerationParam.ResultFormat.MESSAGE)
.build();
GenerationResult call = gen.call(param);
return call.getOutput().getChoices().get(0).getMessage().getContent();
} catch (Exception e) {
log.error("qwenModel error:{}", e.getMessage(), e);
}
return "";
}
public String deepSeekModel(LlmProperties.ModelConfig modelConfig, String system, String content) {
try {
Map<String, Object> params = new HashMap<>();
params.put("model", "deepseek-chat");
params.put("stream", false);
Message systemMsg = Message.builder()
.role(Role.SYSTEM.getValue())
.content(system)
.build();
Message userMsg = Message.builder()
.role(Role.USER.getValue())
.content(content)
.build();
List<Message> messages = Arrays.asList(systemMsg, userMsg);
params.put("messages", messages);
HttpResponse execute = HttpUtil.createPost(modelConfig.getUrl())
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + modelConfig.getApiKey())
.body(JSONUtil.toJsonStr(params))
.execute();
return execute.body();
} catch (HttpException e) {
log.error("deepseek error:{}", e.getMessage(), e);
}
return null;
}
public String douBaoModel(LlmProperties.ModelConfig modelConfig, String system, String content) {
try {
Map<String, Object> params = new HashMap<>();
params.put("model", modelConfig.getDefaultModel());
Message systemMsg = Message.builder()
.role(Role.SYSTEM.getValue())
.content(system)
.build();
Message userMsg = Message.builder()
.role(Role.USER.getValue())
.content(content)
.build();
List<Message> messages = Arrays.asList(systemMsg, userMsg);
params.put("messages", messages);
HttpResponse execute = HttpUtil.createPost(modelConfig.getUrl())
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + modelConfig.getApiKey())
.body(JSONUtil.toJsonStr(params))
.execute();
String body = execute.body();
JSONObject jsonObject = JSONObject.parseObject(body);
JSONArray choices = jsonObject.getJSONArray("choices");
JSONObject choice = choices.getJSONObject(0);
JSONObject message = choice.getJSONObject("message");
return message.getString("content");
} catch (HttpException e) {
log.error("doubao error:{}", e.getMessage(), e);
}
return null;
}
private String glmPost(String urlstr, String apiKey, JSONObject jsonObject) {
String responseStr = null;
try {
URL url = new URL(urlstr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json; utf-8");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("Authorization", apiKey);
//conn.setRequestProperty("Authorization", AICHAIN_AUTHOR);
//conn.setRequestProperty("Cookie", AICHAIN_COOKIE);
conn.setDoOutput(true);
String jsonInputString = jsonObject.toJSONString();
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
// 检查响应状态
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
}
// 读取服务器响应
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
responseStr = br.readLine();
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return responseStr;
}
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventAnalysisVersion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Mapper
* @createDate 2025-07-16 16:34:46
* @Entity com.zzsn.event.entity.EventAnalysisVersion
*/
@Mapper
public interface EventAnalysisVersionMapper extends BaseMapper<EventAnalysisVersion> {
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventAnalysisVersionRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Mapper
* @createDate 2025-07-16 16:34:46
* @Entity com.zzsn.event.entity.EventAnalysisVersionRecord
*/
@Mapper
public interface EventAnalysisVersionRecordMapper extends BaseMapper<EventAnalysisVersionRecord> {
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventCollectMap;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Mapper
* @createDate 2025-07-15 10:07:01
* @Entity com.zzsn.event.entity.EventCollectMap
*/
@Mapper
public interface EventCollectMapMapper extends BaseMapper<EventCollectMap> {
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventContext;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Mapper
* @createDate 2025-07-14 18:05:06
* @Entity com.zzsn.event.entity.EventContext
*/
@Mapper
public interface EventContextMapper extends BaseMapper<EventContext> {
/**
* 获取事件下最大的排序号
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/14
*/
@Select("SELECT IFNULL(MAX(sort_number), 1) FROM event_context WHERE event_id = #{eventId}")
Integer getMaxSortNumber(@Param("eventId") String eventId);
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventLlmConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【event_llm_config(事件大模型信息配置表)】的数据库操作Mapper
* @createDate 2025-07-21 14:17:40
* @Entity com.zzsn.event.entity.EventLlmConfig
*/
@Mapper
public interface EventLlmConfigMapper extends BaseMapper<EventLlmConfig> {
}
package com.zzsn.event.mapper; package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.Event; import com.zzsn.event.entity.Event;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
...@@ -89,7 +90,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -89,7 +90,7 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant") String tenant);
/** /**
* 总数量-门户(全部) * 总数量-门户(全部)
...@@ -108,7 +109,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -108,7 +109,7 @@ public interface EventMapper extends BaseMapper<Event> {
Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy, Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName, @Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant")String tenant); @Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant") String tenant);
/** /**
...@@ -132,7 +133,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -132,7 +133,7 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant") String tenant);
/** /**
* 总数量-门户(我的) * 总数量-门户(我的)
...@@ -149,7 +150,27 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -149,7 +150,27 @@ public interface EventMapper extends BaseMapper<Event> {
*/ */
Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName, Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant")String tenant); @Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant") String tenant);
/**
* @param projectId 项目id
* @param userId 用户di
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @param order 排序字段
* @param orderType 排序方式
* @param page 分页参数
* @author lkg
* @date 2025/7/12
*/
Page<EventFrontVO> frontCollectPageList(@Param("projectId") String projectId, @Param("userId") String userId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType,
@Param("tenant") String tenant, Page<EventFrontVO> page);
/** /**
...@@ -208,7 +229,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -208,7 +229,7 @@ public interface EventMapper extends BaseMapper<Event> {
List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy, List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("type") Integer type, @Param("type") Integer type,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant") String tenant);
List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate); List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate);
...@@ -219,7 +240,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -219,7 +240,7 @@ public interface EventMapper extends BaseMapper<Event> {
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name, @Param("tenant")String tenant); List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name, @Param("tenant") String tenant);
/** /**
* 公开且发布的事件信息集合 * 公开且发布的事件信息集合
...@@ -234,7 +255,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -234,7 +255,7 @@ public interface EventMapper extends BaseMapper<Event> {
*/ */
List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList, List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventName") String eventName, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("size") Integer size, @Param("tenant")String tenant); @Param("labelName") String labelName, @Param("type") Integer type, @Param("size") Integer size, @Param("tenant") String tenant);
/** /**
* 默认创建的,公开且发布的事件信息集合 * 默认创建的,公开且发布的事件信息集合
...@@ -247,8 +268,8 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -247,8 +268,8 @@ public interface EventMapper extends BaseMapper<Event> {
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventExcelVO> frontOwnerList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList, List<EventExcelVO> frontOwnerList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventName") String eventName, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size); @Param("labelName") String labelName, @Param("type") Integer type, @Param("size") Integer size);
/** /**
* 模型信息列表 * 模型信息列表
...@@ -265,7 +286,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -265,7 +286,7 @@ public interface EventMapper extends BaseMapper<Event> {
* @author lkg * @author lkg
* @date 2024/4/12 * @date 2024/4/12
*/ */
List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList, @Param("tenant")String tenant); List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList, @Param("tenant") String tenant);
/** /**
* 专题绑定关键词数量 * 专题绑定关键词数量
......
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventNetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【event_network(网络事件表)】的数据库操作Mapper
* @createDate 2025-07-04 11:00:17
* @Entity com.zzsn.event.entity.EventNetwork
*/
@Mapper
public interface EventNetworkMapper extends BaseMapper<EventNetwork> {
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.KeywordConf;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lenovo
* @description 针对表【clb_keyword_conf(关键词过滤配置)】的数据库操作Mapper
* @createDate 2025-07-28 10:25:56
* @Entity com.zzsn.event.entity.KeywordConf
*/
@Mapper
public interface KeywordConfMapper extends BaseMapper<KeywordConf> {
}
...@@ -3,7 +3,6 @@ package com.zzsn.event.mapper; ...@@ -3,7 +3,6 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.LabelEntity; import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.LabelTypeVO; import com.zzsn.event.vo.LabelTypeVO;
import com.zzsn.event.vo.SysLabelVo; import com.zzsn.event.vo.SysLabelVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 用户表 Mapper 接口
* </p>
*
* @Author scott
* @since 2018-12-20
*/
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
/**
* 用户列表
*
* @author lkg
* @date 2025/8/2
*/
List<SysUser> userList(@Param("name") String name);
}
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
select t.id, select t.id,
t.event_code, t.event_code,
t.event_name, t.event_name,
t.key_issue,
t.event_icon, t.event_icon,
t.start_time, t.start_time,
t.end_time, t.end_time,
t.publish_date, t.publish_date,
t.event_describe, t.event_describe,
t.yn_manual_edit,
t.event_label, t.event_label,
t.library, t.library,
t.unit, t.unit,
...@@ -37,6 +39,7 @@ ...@@ -37,6 +39,7 @@
t.yn_collect, t.yn_collect,
t.data_scope, t.data_scope,
t.first_open_time, t.first_open_time,
t.create_by,
stm.type_id as subjectTypeId, stm.type_id as subjectTypeId,
psm.project_id, psm.project_id,
c.type_name, c.type_name,
...@@ -56,7 +59,8 @@ ...@@ -56,7 +59,8 @@
inner join event_category t2 on t1.event_type =t2.id inner join event_category t2 on t1.event_type =t2.id
INNER JOIN INNER JOIN
( (
select stm.subject_id,st.type_name as subjectTypeName from subject_type_map stm inner join subject_type st on stm.type_id = st.id select stm.subject_id,st.type_name as subjectTypeName from subject_type_map stm inner join subject_type st on
stm.type_id = st.id
where 1=1 where 1=1
<if test="typeIds!=null and typeIds.size()>0"> <if test="typeIds!=null and typeIds.size()>0">
and stm.type_id in and stm.type_id in
...@@ -341,6 +345,55 @@ ...@@ -341,6 +345,55 @@
</if> </if>
</if> </if>
</select> </select>
<select id="frontCollectPageList" resultType="com.zzsn.event.vo.EventFrontVO">
select
t1.id,t1.event_name,t1.event_icon,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
inner join event_collect_map ecm on t1.id = ecm.event_id
inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1
and ecm.user_id = #{userId} and m.project_id = #{projectId}
<if test="tenant != null and tenant != ''">
and t1.tenant = #{tenant}
</if>
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and t1.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and t1.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
<choose>
<when test="order != null and order != ''">
order by t1.${order}
<if test="orderType != null and orderType != ''">
${orderType}
</if>
</when>
<otherwise>
order by t1.publish_date desc
</otherwise>
</choose>
</select>
<select id="newPlatPageList" resultType="com.zzsn.event.vo.EventNewPlatVO"> <select id="newPlatPageList" resultType="com.zzsn.event.vo.EventNewPlatVO">
...@@ -935,4 +988,4 @@ ...@@ -935,4 +988,4 @@
and x.key_word like CONCAT('%',#{wordName},'%') and x.key_word like CONCAT('%',#{wordName},'%')
</if> </if>
</select> </select>
</mapper> </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.EventNetworkMapper">
<resultMap id="BaseResultMap" type="com.zzsn.event.entity.EventNetwork">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="picture" column="picture" jdbcType="VARCHAR"/>
<result property="hot" column="hot" jdbcType="VARCHAR"/>
<result property="publishDate" column="publish_date" jdbcType="DATE"/>
<result property="latest" column="latest" jdbcType="INTEGER"/>
<result property="ynNeed" column="yn_need" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,title,picture,
hot,publish_date,latest,
yn_need,type,create_time,
create_by,update_time,update_by
</sql>
</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.SysUserMapper">
<select id="userList" resultType="com.zzsn.event.entity.SysUser">
select id, username, realname from sys_user where del_flag = 0 and status = 1 and user_type = 1
<if test="name != null and name != ''">
and (username like concat('%',#{name},'%') or realname like concat('%',#{name},'%'))
</if>
</select>
</mapper>
package com.zzsn.event.service; package com.zzsn.event.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventLlmConfig;
import com.zzsn.event.entity.SubjectAnalysis; import com.zzsn.event.entity.SubjectAnalysis;
import com.zzsn.event.vo.PropagationPathVo; import com.zzsn.event.vo.*;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author lkg * @author lkg
...@@ -15,16 +22,94 @@ public interface AnalysisService { ...@@ -15,16 +22,94 @@ public interface AnalysisService {
/** /**
* 事件脉络 * 事件脉络
* @param subjectId 专题id *
* @param eventId 事件id
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值 * @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @return java.util.List<com.zzsn.subjectAnalysis.entity.SubjectAnalysis> * @return java.util.List<com.zzsn.subjectAnalysis.entity.SubjectAnalysis>
*/ */
List<SubjectAnalysis> eventContext(String subjectId, int fakeNum); List<SubjectAnalysis> eventContext(String eventId, int fakeNum);
/**
* 事件脉络-新版
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/7
*/
List<JSONObject> eventContext(String eventId);
/**
* 词云
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 返回热词个数
* @author lkg
* @date 2025/7/7
*/
List<CountVO> wordCloud(String eventId, String startTime, String endTime, Integer size);
/**
* 关键词时间趋势
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/9
*/
List<CountVO> wordTrend(String eventId, String startTime, String endTime);
/**
* 关键词共现
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/9
*/
List<CoOccurrenceVO> coOccurrence(String eventId, String startTime, String endTime);
/** /**
* 传播路径 * 传播路径
* @param subjectId 专题id *
* @param eventId 事件id
* @return com.zzsn.subjectAnalysis.vo.PropagationPathVo * @return com.zzsn.subjectAnalysis.vo.PropagationPathVo
*/ */
PropagationPathVo propagationPath(String subjectId); PropagationPathVo propagationPath(String eventId);
/**
* 利用大模型生成的结果
*
* @param event 事件信息
* @param startTime 开始时间
* @param endTime 结束时间
* @param llmConfig 模型配置信息
* @author lkg
* @date 2025/7/17
*/
String llmResult(EventVO event, String content, String startTime, String endTime, EventLlmConfig llmConfig);
String llmResult(String eventId, String content, String startTime, String endTime, Integer columnCode);
/**
* 重新生成
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/7
*/
void regenerate(String eventId);
/**
* 导出ppt
*
* @param eventId 事件id
* @param content 导出内容
* @author lkg
* @date 2025/7/19
*/
String exportPPT(String eventId, JSONArray content);
} }
package com.zzsn.event.service;
import com.zzsn.event.entity.EventAnalysisVersionRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Service
* @createDate 2025-07-16 16:34:46
*/
public interface EventAnalysisVersionRecordService extends IService<EventAnalysisVersionRecord> {
String getVersionData(String versionId, Integer columnCode);
}
package com.zzsn.event.service;
import com.zzsn.event.entity.EventAnalysisVersion;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Service
* @createDate 2025-07-16 16:34:46
*/
public interface EventAnalysisVersionService extends IService<EventAnalysisVersion> {
/**
* 获取事件分析的最新版本
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/28
*/
EventAnalysisVersion latestVersion(String eventId);
}
package com.zzsn.event.service;
import com.zzsn.event.entity.EventCollectMap;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Service
* @createDate 2025-07-15 10:07:01
*/
public interface EventCollectMapService extends IService<EventCollectMap> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.EventContext;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.EventContextModifyVO;
import java.util.List;
import java.util.Map;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Service
* @createDate 2025-07-14 18:05:06
*/
public interface EventContextService extends IService<EventContext> {
List<Map<String,Object>> eventContext(String eventId);
/**
* 事件脉络维护(新增/编辑)
*
* @param eventContextModifyVO 事件脉络维护参数
* @author lkg
* @date 2025/7/15
*/
void eventContextModify(EventContextModifyVO eventContextModifyVO);
/**
* 事件脉络关键节点列表
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
List<EventContext> keNodeList(String eventId);
/**
* 关键节点下的资讯列表
*
* @param eventId 事件id
* @param keyNodeId 关键节点id
* @param pageNo 页码
* @param pageSize 每页返回数量
* @author lkg
* @date 2025/7/15
*/
Page<EventContext> contextArticleList(String eventId, String keyNodeId, Integer pageNo, Integer pageSize);
/**
* 获取最大排序序号
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
Integer getMaxSortNumber(String eventId);
}
package com.zzsn.event.service;
import com.zzsn.event.entity.EventLlmConfig;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author lenovo
* @description 针对表【event_llm_config(事件大模型信息配置表)】的数据库操作Service
* @createDate 2025-07-21 14:17:40
*/
public interface EventLlmConfigService extends IService<EventLlmConfig> {
/**
* 获取事件的大模型配置信息,没有则返回默认的配置信息
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/30
*/
List<EventLlmConfig> getConfigList(String eventId);
/**
* 获取事件下某个栏目的大模型配置信息
*
* @param eventId 事件id
* @param columnCode 栏目id
* @author lkg
* @date 2025/7/30
*/
EventLlmConfig getConfig(String eventId,Integer columnCode);
/**
* 批量更新大模型配置
*
* @param eventLlmConfigList 配置信息
* @author lkg
* @date 2025/7/30
*/
void modifyBatch(List<EventLlmConfig> eventLlmConfigList);
/**
* 更新大模型配置
*
* @param eventLlmConfig 配置信息
* @author lkg
* @date 2025/7/30
*/
void modifySingle(EventLlmConfig eventLlmConfig);
}
package com.zzsn.event.service;
import com.zzsn.event.entity.EventNetwork;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author lenovo
* @description 针对表【event_network(网络事件表)】的数据库操作Service
* @createDate 2025-07-04 11:00:17
*/
public interface EventNetworkService extends IService<EventNetwork> {
}
...@@ -84,6 +84,22 @@ public interface IEventService extends IService<Event> { ...@@ -84,6 +84,22 @@ public interface IEventService extends IService<Event> {
*/ */
IPage<EventFrontVO> frontOwnerPageList(String projectId, String eventName, String eventType, String labelField, String labelName, String order, String orderType, Integer pageNo, Integer pageSize); IPage<EventFrontVO> frontOwnerPageList(String projectId, String eventName, String eventType, String labelField, String labelName, String order, String orderType, Integer pageNo, Integer pageSize);
/**
* 分页列表-门户(我关注的)
*
* @param projectId 项目id
* @param eventName 事件名称
* @param eventType 事件分类id
* @param labelField 搜索字段
* @param labelName 搜索词
* @param order 排序字段
* @param orderType 排序方式
* @param pageNo 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
IPage<EventFrontVO> frontCollectPageList(String projectId, String eventName, String eventType, String labelField, String labelName, String order, String orderType, Integer pageNo, Integer pageSize);
/** /**
* 分页列表(专题类别)-新平台管理 * 分页列表(专题类别)-新平台管理
......
package com.zzsn.event.service;
import com.zzsn.event.entity.KeywordConf;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author lenovo
* @description 针对表【clb_keyword_conf(关键词过滤配置)】的数据库操作Service
* @createDate 2025-07-28 10:25:56
*/
public interface KeywordConfService extends IService<KeywordConf> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysUser;
import java.util.List;
/**
* <p>
* 用户表 服务类
* </p>
*
* @Author scott
* @since 2018-12-20
*/
public interface SysUserService extends IService<SysUser> {
/**
* 用户列表
*
* @author lkg
* @date 2025/8/2
*/
public List<SysUser> userList(String name);
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventAnalysisVersionRecord;
import com.zzsn.event.service.EventAnalysisVersionRecordService;
import com.zzsn.event.mapper.EventAnalysisVersionRecordMapper;
import org.springframework.stereotype.Service;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Service实现
* @createDate 2025-07-16 16:34:46
*/
@Service
public class EventAnalysisVersionRecordServiceImpl extends ServiceImpl<EventAnalysisVersionRecordMapper, EventAnalysisVersionRecord>
implements EventAnalysisVersionRecordService{
@Override
public String getVersionData(String versionId, Integer columnCode) {
String result = null;
LambdaQueryWrapper<EventAnalysisVersionRecord> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventAnalysisVersionRecord::getVersionId, versionId)
.eq(EventAnalysisVersionRecord::getColumnCode, columnCode);
EventAnalysisVersionRecord eventAnalysisVersionRecord = this.getOne(queryWrapper);
if (eventAnalysisVersionRecord != null) {
result = eventAnalysisVersionRecord.getReturnData();
}
return result;
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventAnalysisVersion;
import com.zzsn.event.service.EventAnalysisVersionService;
import com.zzsn.event.mapper.EventAnalysisVersionMapper;
import org.springframework.stereotype.Service;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Service实现
* @createDate 2025-07-16 16:34:46
*/
@Service
public class EventAnalysisVersionServiceImpl extends ServiceImpl<EventAnalysisVersionMapper, EventAnalysisVersion>
implements EventAnalysisVersionService {
@Override
public EventAnalysisVersion latestVersion(String eventId) {
LambdaQueryWrapper<EventAnalysisVersion> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventAnalysisVersion::getEventId, eventId)
.orderByDesc(EventAnalysisVersion::getCreateTime)
.last("limit 1");
return this.getOne(queryWrapper);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventCollectMap;
import com.zzsn.event.service.EventCollectMapService;
import com.zzsn.event.mapper.EventCollectMapMapper;
import org.springframework.stereotype.Service;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Service实现
* @createDate 2025-07-15 10:07:01
*/
@Service
public class EventCollectMapServiceImpl extends ServiceImpl<EventCollectMapMapper, EventCollectMap>
implements EventCollectMapService{
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventContext;
import com.zzsn.event.mapper.EventContextMapper;
import com.zzsn.event.service.EventContextService;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.vo.EventContextModifyVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Service实现
* @createDate 2025-07-14 18:05:06
*/
@Service
public class EventContextServiceImpl extends ServiceImpl<EventContextMapper, EventContext> implements EventContextService{
@Autowired
private CodeGenerateUtil codeGenerateUtil;
@Override
public List<Map<String, Object>> eventContext(String eventId) {
List<Map<String, Object>> dataList = new ArrayList<>();
LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventContext::getEventId, eventId).orderByDesc(EventContext::getSortNumber);
List<EventContext> eventContexts = baseMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(eventContexts)) {
List<EventContext> keyNodeList = eventContexts.stream().filter(eventContext -> eventContext.getYnKeyNode() == 1).collect(Collectors.toList());
for (EventContext eventContext : keyNodeList) {
Map<String,Object> map = new HashMap<>();
List<EventContext> childList = eventContexts.stream().filter(e -> e.getParentId().equals(eventContext.getId())).collect(Collectors.toList());
map.put("keyNode",eventContext);
map.put("dataList",childList);
map.put("count",childList.size());
dataList.add(map);
}
}
return dataList;
}
@Override
@Transactional
public void eventContextModify(EventContextModifyVO eventContextModifyVO) {
EventContext keyNode = eventContextModifyVO.getKeyNode();
String parentId = null;
String eventId = eventContextModifyVO.getEventId();
Integer maxSortNumber = this.getMaxSortNumber(eventId);
if (keyNode != null) {
String id = keyNode.getId();
keyNode.setCreateWay(2);
if (StringUtils.isEmpty(id)) {
maxSortNumber = maxSortNumber + 1;
keyNode.setSortNumber(maxSortNumber);
keyNode.setParentId("0");
keyNode.setEventId(eventId);
keyNode.setYnKeyNode(1);
keyNode.setUniqueCode(codeGenerateUtil.geneCodeNo("CONTEXT_KEY_NODE"));
baseMapper.insert(keyNode);
parentId = keyNode.getId();
} else {
baseMapper.updateById(keyNode);
}
}
List<EventContext> saveList = eventContextModifyVO.getSaveList();
if (CollectionUtils.isNotEmpty(saveList)) {
for (int i = 0; i < saveList.size(); i++) {
EventContext eventContext = saveList.get(i);
if (parentId != null) {
eventContext.setParentId(parentId);
}
eventContext.setCreateWay(2);
eventContext.setEventId(eventId);
eventContext.setSortNumber(maxSortNumber + i + 1);
}
this.saveBatch(saveList);
}
List<EventContext> updateList = eventContextModifyVO.getUpdateList();
if (CollectionUtils.isNotEmpty(updateList)) {
updateList.forEach(e->e.setCreateWay(2));
this.updateBatchById(updateList);
}
}
@Override
public List<EventContext> keNodeList(String eventId) {
LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventContext::getEventId, eventId)
.eq(EventContext::getYnKeyNode, 1)
.orderByDesc(EventContext::getSortNumber);
return baseMapper.selectList(queryWrapper);
}
@Override
public Page<EventContext> contextArticleList(String eventId, String keyNodeId, Integer pageNo, Integer pageSize) {
Page<EventContext> page = new Page<>(pageNo, pageSize);
LambdaQueryWrapper<EventContext> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventContext::getEventId, eventId)
.eq(EventContext::getParentId, keyNodeId)
.orderByDesc(EventContext::getSortNumber);
return baseMapper.selectPage(page,queryWrapper);
}
@Override
public Integer getMaxSortNumber(String eventId) {
return baseMapper.getMaxSortNumber(eventId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventLlmConfig;
import com.zzsn.event.service.EventLlmConfigService;
import com.zzsn.event.mapper.EventLlmConfigMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lenovo
* @description 针对表【event_llm_config(事件大模型信息配置表)】的数据库操作Service实现
* @createDate 2025-07-21 14:17:40
*/
@Service
public class EventLlmConfigServiceImpl extends ServiceImpl<EventLlmConfigMapper, EventLlmConfig> implements EventLlmConfigService{
@Override
public List<EventLlmConfig> getConfigList(String eventId) {
LambdaQueryWrapper<EventLlmConfig> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventLlmConfig::getEventId, eventId).orderByAsc(EventLlmConfig::getColumnCode);
List<EventLlmConfig> configList = this.list(queryWrapper);
if (CollectionUtils.isEmpty(configList)) {
LambdaQueryWrapper<EventLlmConfig> query = Wrappers.lambdaQuery();
query.eq(EventLlmConfig::getYnDefault, 1).orderByAsc(EventLlmConfig::getColumnCode);
configList = this.list(query);
}
return configList;
}
@Override
public EventLlmConfig getConfig(String eventId, Integer columnCode) {
LambdaQueryWrapper<EventLlmConfig> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventLlmConfig::getEventId, eventId).eq(EventLlmConfig::getColumnCode, columnCode);
EventLlmConfig config = this.getOne(queryWrapper);
if (ObjectUtils.isNull(config)) {
LambdaQueryWrapper<EventLlmConfig> query = Wrappers.lambdaQuery();
query.eq(EventLlmConfig::getYnDefault, 1).eq(EventLlmConfig::getColumnCode, columnCode);
config = this.getOne(query);
}
return config;
}
@Override
@Transactional
public void modifyBatch(List<EventLlmConfig> eventLlmConfigList) {
if (CollectionUtils.isEmpty(eventLlmConfigList)) {
return;
}
String eventId = eventLlmConfigList.get(0).getEventId();
LambdaQueryWrapper<EventLlmConfig> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventLlmConfig::getEventId, eventId);
List<EventLlmConfig> configList = this.list(queryWrapper);
if (CollectionUtils.isEmpty(configList)) {
List<Integer> configCodeList = eventLlmConfigList.stream().map(EventLlmConfig::getColumnCode).collect(Collectors.toList());
LambdaQueryWrapper<EventLlmConfig> query = Wrappers.lambdaQuery();
query.eq(EventLlmConfig::getYnDefault, 1).orderByAsc(EventLlmConfig::getColumnCode);
List<EventLlmConfig> defaultConfigList = this.list(query);
if (defaultConfigList.size() > eventLlmConfigList.size()) {
List<EventLlmConfig> collect = defaultConfigList.stream().filter(config -> !configCodeList.contains(config.getColumnCode())).collect(Collectors.toList());
for (EventLlmConfig config : collect) {
config.setId(null);
config.setEventId(eventId);
config.setYnDefault(0);
}
eventLlmConfigList.addAll(collect);
}
this.saveBatch(eventLlmConfigList);
} else {
for (EventLlmConfig eventLlmConfig : eventLlmConfigList) {
LambdaUpdateWrapper<EventLlmConfig> update = Wrappers.lambdaUpdate();
update.eq(EventLlmConfig::getEventId, eventId).eq(EventLlmConfig::getColumnCode, eventLlmConfig.getColumnCode());
this.update(eventLlmConfig,update);
}
}
}
@Override
public void modifySingle(EventLlmConfig eventLlmConfig) {
String eventId = eventLlmConfig.getEventId();
LambdaQueryWrapper<EventLlmConfig> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventLlmConfig::getEventId, eventId);
List<EventLlmConfig> configList = this.list(queryWrapper);
if (CollectionUtils.isEmpty(configList)) {
LambdaQueryWrapper<EventLlmConfig> query = Wrappers.lambdaQuery();
query.eq(EventLlmConfig::getYnDefault, 1).orderByAsc(EventLlmConfig::getColumnCode);
List<EventLlmConfig> defaultConfigList = this.list(query);
List<EventLlmConfig> collect = defaultConfigList.stream().filter(config -> !eventLlmConfig.getColumnCode().equals(config.getColumnCode())).collect(Collectors.toList());
for (EventLlmConfig config : collect) {
config.setId(null);
config.setEventId(eventId);
config.setYnDefault(0);
}
eventLlmConfig.setYnDefault(0);
collect.add(eventLlmConfig);
this.saveBatch(collect);
} else {
LambdaUpdateWrapper<EventLlmConfig> update = Wrappers.lambdaUpdate();
update.eq(EventLlmConfig::getEventId, eventId).eq(EventLlmConfig::getColumnCode, eventLlmConfig.getColumnCode());
this.update(eventLlmConfig,update);
}
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventNetwork;
import com.zzsn.event.service.EventNetworkService;
import com.zzsn.event.mapper.EventNetworkMapper;
import org.springframework.stereotype.Service;
/**
* @author lenovo
* @description 针对表【event_network(网络事件表)】的数据库操作Service实现
* @createDate 2025-07-04 11:00:17
*/
@Service
public class EventNetworkServiceImpl extends ServiceImpl<EventNetworkMapper, EventNetwork> implements EventNetworkService{
}
...@@ -26,7 +26,6 @@ import com.zzsn.event.util.user.UserVo; ...@@ -26,7 +26,6 @@ import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.*; import com.zzsn.event.vo.es.*;
import com.zzsn.event.vo.log.DataLifecycleLog; import com.zzsn.event.vo.log.DataLifecycleLog;
import com.zzsn.event.entity.InfoSource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -34,7 +33,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -34,7 +33,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.search.join.ScoreMode; import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
......
...@@ -338,7 +338,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -338,7 +338,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
@Override @Override
@Transactional @Transactional
public void updateBaseAndMap(Event event, String keyword, String exclusionWord) { public void updateBaseAndMap(Event event, String keyword, String exclusionWord) {
//采集词 //采集词/过滤
LambdaQueryWrapper<SubjectKeywordsMap> queryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<SubjectKeywordsMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectKeywordsMap::getSubjectId, event.getId()).eq(SubjectKeywordsMap::getBindingType, 1); queryWrapper.eq(SubjectKeywordsMap::getSubjectId, event.getId()).eq(SubjectKeywordsMap::getBindingType, 1);
SubjectKeywordsMap one = subjectKeywordsMapService.getOne(queryWrapper); SubjectKeywordsMap one = subjectKeywordsMapService.getOne(queryWrapper);
...@@ -352,7 +352,6 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -352,7 +352,6 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
LambdaQueryWrapper<SubjectKeywordsMap> query = Wrappers.lambdaQuery(); LambdaQueryWrapper<SubjectKeywordsMap> query = Wrappers.lambdaQuery();
query.eq(SubjectKeywordsMap::getSubjectId, event.getId()).eq(SubjectKeywordsMap::getBindingType, 3); query.eq(SubjectKeywordsMap::getSubjectId, event.getId()).eq(SubjectKeywordsMap::getBindingType, 3);
SubjectKeywordsMap excludeOne = subjectKeywordsMapService.getOne(query); SubjectKeywordsMap excludeOne = subjectKeywordsMapService.getOne(query);
if (StringUtils.isNotEmpty(exclusionWord)) { if (StringUtils.isNotEmpty(exclusionWord)) {
if (excludeOne == null) { if (excludeOne == null) {
addMapMain(event, exclusionWord,2); addMapMain(event, exclusionWord,2);
...@@ -410,6 +409,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -410,6 +409,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
//专题和关键词关系 //专题和关键词关系
List<SubjectKeywordsMap> dataList = new ArrayList<>(); List<SubjectKeywordsMap> dataList = new ArrayList<>();
if (type == 1) { if (type == 1) {
//统计绑定采集词和过滤词
for (int i = 1; i < 3; i++) { for (int i = 1; i < 3; i++) {
//专题和词组关系 //专题和词组关系
SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap(); SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap();
...@@ -433,7 +433,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -433,7 +433,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
relation.setParamsStr(JSON.toJSONString(jsonArray)); relation.setParamsStr(JSON.toJSONString(jsonArray));
relationList.add(relation); relationList.add(relation);
} }
} else if (type == 2) { } else if (type == 2) {//排除词
//专题和词组关系 //专题和词组关系
SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap(); SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap();
subjectKeywordsMap.setKeywordsId(keyWordsId); subjectKeywordsMap.setKeywordsId(keyWordsId);
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.KeywordConf;
import com.zzsn.event.service.KeywordConfService;
import com.zzsn.event.mapper.KeywordConfMapper;
import org.springframework.stereotype.Service;
/**
* @author lenovo
* @description 针对表【clb_keyword_conf(关键词过滤配置)】的数据库操作Service实现
* @createDate 2025-07-28 10:25:56
*/
@Service
public class KeywordConfServiceImpl extends ServiceImpl<KeywordConfMapper, KeywordConf>
implements KeywordConfService{
}
...@@ -20,10 +20,11 @@ public class SubjectAnalysisServiceImpl extends ServiceImpl<SubjectAnalysisMappe ...@@ -20,10 +20,11 @@ public class SubjectAnalysisServiceImpl extends ServiceImpl<SubjectAnalysisMappe
@Override @Override
public void eventContextModify(SubjectAnalysis subjectAnalysis) { public void eventContextModify(SubjectAnalysis subjectAnalysis) {
String id = subjectAnalysis.getId(); String id = subjectAnalysis.getId();
subjectAnalysis.setCreateWay(2);
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
baseMapper.updateById(subjectAnalysis); baseMapper.updateById(subjectAnalysis);
} else { } else {
subjectAnalysis.setCategory(2); subjectAnalysis.setCategory(4);
subjectAnalysis.setAnalysisDate(new Date()); subjectAnalysis.setAnalysisDate(new Date());
baseMapper.insert(subjectAnalysis); baseMapper.insert(subjectAnalysis);
} }
......
package com.zzsn.event.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysUser;
import com.zzsn.event.mapper.SysUserMapper;
import com.zzsn.event.service.SysUserService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户
*
* @author lkg
* @date 2025/8/2
*/
@DS("multi-datasource2")
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
@Override
public List<SysUser> userList(String name) {
return baseMapper.userList(name);
}
}
...@@ -3,9 +3,7 @@ package com.zzsn.event.task; ...@@ -3,9 +3,7 @@ package com.zzsn.event.task;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.Event; import com.zzsn.event.entity.Event;
import com.zzsn.event.service.EsStatisticsService; import com.zzsn.event.service.EsStatisticsService;
import com.zzsn.event.service.IEventService; import com.zzsn.event.service.IEventService;
...@@ -55,8 +53,6 @@ public class EventHotTask { ...@@ -55,8 +53,6 @@ public class EventHotTask {
*/ */
@Scheduled(cron = "0 0 0/3 * * ?") @Scheduled(cron = "0 0 0/3 * * ?")
public void hot() { public void hot() {
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(); List<Event> list = eventService.list();
List<HotVO> countList = new ArrayList<>(); List<HotVO> countList = new ArrayList<>();
for (Event event : list) { for (Event event : list) {
......
package com.zzsn.event.task;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.EventNetwork;
import com.zzsn.event.llm.LlmService;
import com.zzsn.event.service.EventNetworkService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* 网络事件处理任务
*
* @author lkg
* @date 2025/7/3
*/
@Slf4j
@Component
public class NetWorkEventTask {
@Autowired
private EventNetworkService eventNetworkService;
@Autowired
private LlmService llmService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
@Value("${python.hot-crawler:}")
private String hotCrawlerPath;
final static String PROMPT = "根据提供的网络事件对象集合json字符串中事件标题-【title】字段,判断是否为政治经济领域相关的事件,并按以下格式返回符合条件的网络事件集合:[{\"title\": \"政治\"}]";
/**
* 定时拉取热榜数据 (1小时一次)
*
* @author lkg
* @date 2025/7/4
*/
@Scheduled(cron = "0 0 0/1 * * ?")
public void execute() {
for (int i = 1; i < 3; i++) {
int finalI = i;
CompletableFuture.runAsync(() -> handler(finalI));
}
}
private void handler(Integer type) {
List<EventNetwork> networkList = getNetWordEventList(type);
if (CollectionUtils.isEmpty(networkList)) {
return;
}
String today = DateUtil.today();
LambdaQueryWrapper<EventNetwork> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventNetwork::getPublishDate, today).eq(EventNetwork::getType, type).eq(EventNetwork::getLatest, 1);
List<EventNetwork> oldList = eventNetworkService.list(queryWrapper);
//最终要处理的数据 过模型判断是否 是所需要的事件[政治经济领域相关]
List<EventNetwork> finalList;
if (CollectionUtils.isEmpty(oldList)) {
finalList = networkList;
} else {
finalList = networkList.stream().filter(network -> oldList.stream()
.noneMatch(old -> old.getTitle().equals(network.getTitle())))
.collect(Collectors.toList());
//变更状态 latest = 0,不是最新
List<EventNetwork> removedList = oldList.stream().filter(network -> networkList.stream()
.noneMatch(fresh -> fresh.getTitle().equals(network.getTitle())))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(removedList)) {
List<EventNetwork> collect = removedList.stream().filter(network -> network.getYnNeed() == 0).collect(Collectors.toList());
collect.forEach(network -> network.setLatest(0));
eventNetworkService.updateBatchById(collect);
}
}
if (CollectionUtils.isNotEmpty(finalList)) {
finalList.forEach(network -> network.setLatest(1));
String response = llmService.model(null, PROMPT, JSONObject.toJSONString(finalList));
if (response.startsWith("```json")) {
response = response.substring(7, response.length() - 3);
}
if (StringUtils.isNotEmpty(response)) {
try {
List<EventNetwork> hitList = JSON.parseArray(response, EventNetwork.class);
finalList.forEach(network -> {
List<String> titleLis = hitList.stream().map(EventNetwork::getTitle).collect(Collectors.toList());
if (titleLis.contains(network.getTitle())) {
network.setYnNeed(1);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
eventNetworkService.saveOrUpdateBatch(finalList);
}
log.info("{}-网络事件数据采集更新完成", type == 1 ? "百度热榜" : "新浪热榜");
}
/**
* 调用采集接口,获取网络事件
*
* @param type 来源类型(1-百度;2-新浪新闻)
* @author lkg
* @date 2025/7/4
*/
private List<EventNetwork> getNetWordEventList(Integer type) {
try {
String option = HttpUtil.get(hotCrawlerPath.replace("OPTION", type.toString()));
if (StringUtils.isNotEmpty(option)) {
List<EventNetwork> eventNetworks = JSON.parseArray(option, EventNetwork.class);
eventNetworks.forEach(network -> network.setType(type));
return eventNetworks;
}
} catch (Exception e) {
log.info("{}-数据采集异常", type == 1 ? "百度热榜" : "新浪热榜");
e.printStackTrace();
}
return new ArrayList<>();
}
}
...@@ -11,7 +11,6 @@ import com.zzsn.event.mapper.EventClbMapper; ...@@ -11,7 +11,6 @@ import com.zzsn.event.mapper.EventClbMapper;
import com.zzsn.event.service.IEventService; import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.IEventTagClbService; import com.zzsn.event.service.IEventTagClbService;
import com.zzsn.event.service.IEventTagService; import com.zzsn.event.service.IEventTagService;
import com.zzsn.event.vo.EventVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -50,8 +49,6 @@ public class SynClbEventDataTask { ...@@ -50,8 +49,6 @@ public class SynClbEventDataTask {
return; return;
} }
log.info("同步克虏宝中事件信息到研究中心数据库开始"); log.info("同步克虏宝中事件信息到研究中心数据库开始");
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(); List<Event> list = eventService.list();
for (Event event : list) { for (Event event : list) {
try{ try{
......
...@@ -294,7 +294,7 @@ public class ExcelExportUtil { ...@@ -294,7 +294,7 @@ public class ExcelExportUtil {
for (int i = 0; i < colData.size(); i++) { for (int i = 0; i < colData.size(); i++) {
cell = row.createCell(i, CellType.STRING); cell = row.createCell(i, CellType.STRING);
cell.setCellStyle(titleStyle); cell.setCellStyle(titleStyle);
cell.setCellValue(new XSSFRichTextString(colData.get(i))); cell.setCellValue(new HSSFRichTextString(colData.get(i)));
} }
// 数据行 // 数据行
for (int m = 0; m < rows.size(); m++) { for (int m = 0; m < rows.size(); m++) {
......
package com.zzsn.event.util;
import java.util.*;
import java.util.Map.Entry;
/**
* 基于词典文章热词推荐
* @author kongliufeng
*
*/
public class HotWordUtil {
public static void main(String[] args) {
List<Entry<String, String>> entries = new ArrayList<>();
entries.add(new AbstractMap.SimpleEntry<>("1", "关键词1"));
entries.add(new AbstractMap.SimpleEntry<>("1", "关键词2"));
entries.add(new AbstractMap.SimpleEntry<>("2", "关键词1"));
entries.add(new AbstractMap.SimpleEntry<>("2", "关键词2"));
entries.add(new AbstractMap.SimpleEntry<>("1", "关键词3"));
Map<String, Integer> coOccurrenceMap = calculateCoOccurrence_map(entries);
for (Entry<String, Integer> coOccurrence : coOccurrenceMap.entrySet()) {
System.out.println(coOccurrence.getKey() + ": " + coOccurrence.getValue());
}
}
/**
* 计算关键词共现次数
* @author liuxiaopeng
* @data 2024-05-31 下午5:18:21
*/
public static Map<String, Integer> calculateCoOccurrence_map(List<Entry<String, String>> entries) {
Map<String, Integer> coOccurrenceMap = new HashMap<>();
// 先将文章ID分组,便于后续处理
Map<String, List<String>> articleKeywords = new HashMap<>();
for (Entry<String, String> entry : entries) {
articleKeywords.putIfAbsent(entry.getKey(), new ArrayList<>());
articleKeywords.get(entry.getKey()).add(entry.getValue());
}
// 计算共现次数
for (List<String> keywords : articleKeywords.values()) {
for (int i = 0; i < keywords.size(); i++) {
for (int j = i + 1; j < keywords.size(); j++) {
String pair = sortKeywords(keywords.get(i), keywords.get(j));
coOccurrenceMap.put(pair, coOccurrenceMap.getOrDefault(pair, 0) + 1);
}
}
}
return coOccurrenceMap;
}
/**
* 计算关键词共现次数
* @author liuxiaopeng
* @data 2024-05-31 下午5:18:21
*/
public static Map<String, Integer> calculateCoOccurrence_list(List<List<String>> wordList) {
Map<String, Integer> coOccurrenceMap = new HashMap<>();
// 计算共现次数
for (List<String> keywords : wordList) {
for (int i = 0; i < keywords.size(); i++) {
for (int j = i + 1; j < keywords.size(); j++) {
String pair = sortKeywords(keywords.get(i), keywords.get(j));
coOccurrenceMap.put(pair, coOccurrenceMap.getOrDefault(pair, 0) + 1);
}
}
}
return coOccurrenceMap;
}
// 辅助方法,确保关键词对以固定的顺序排列,避免("关键词1", "关键词2")和("关键词2", "关键词1")被视为两个不同的键
private static String sortKeywords(String keyword1, String keyword2) {
return keyword1.compareTo(keyword2) < 0 ? (keyword1 + "&" + keyword2) : (keyword2 + "&" + keyword1);
}
}
package com.zzsn.event.util.ppt;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class ApiAuthAlgorithm {
/**
* Gets the signature for the given appId and secret.
*
* @param appId The appId used as a key for the signature.
* @param apiSecret The secret key used for the signature.
* @param ts The timestamp.
* @return The generated signature.
*/
public static String getSignature(String appId, String apiSecret, long ts) {
try {
String auth = md5(appId + ts);
return hmacSHA1Encrypt(auth, apiSecret);
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
// Log the exception for debugging
e.printStackTrace();
return null;
}
}
/**
* HMAC SHA1 encryption.
*
* @param encryptText The text to be encrypted.
* @param encryptKey The encryption key.
* @return The encrypted string.
* @throws NoSuchAlgorithmException If the algorithm is not available.
* @throws InvalidKeyException If the key is invalid.
*/
private static String hmacSHA1Encrypt(String encryptText, String encryptKey)
throws NoSuchAlgorithmException, InvalidKeyException {
SecretKeySpec keySpec = new SecretKeySpec(
encryptKey.getBytes(StandardCharsets.UTF_8), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(keySpec);
byte[] result = mac.doFinal(encryptText.getBytes(StandardCharsets.UTF_8));
return Base64.encodeBase64String(result);
}
/**
* Generates MD5 hash of the given text.
*
* @param text The text to be hashed.
* @return The MD5 hash of the text.
* @throws NoSuchAlgorithmException If the MD5 algorithm is not available.
*/
private static String md5(String text) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(text.getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
package com.zzsn.event.util.ppt;
import lombok.Data;
@Data
public class CreateResponse {
private boolean flag;
private int code;
private String desc;
private Integer count;
private Data data;
@lombok.Data
public static class Data {
private String sid;
private String coverImgSrc;
private String title;
private String subTitle;
private String outline;
}
}
package com.zzsn.event.util.ppt;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import java.io.IOException;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
* ppt工具类
*
* @author lkg
* @date 2025/7/19
*/
@Slf4j
public class PPTUtil {
//讯飞-智能PPT
public static final String baseUrl = "https://zwapi.xfyun.cn/api/ppt/v2";
//默认模板id
public static final String templateId = "20240807EA3CB30";
private final static OkHttpClient client = new OkHttpClient().newBuilder()
.connectionPool(new ConnectionPool(100, 5, TimeUnit.MINUTES))
.readTimeout(60 * 10, TimeUnit.SECONDS)
.build();
/**
* 生成大纲
*
* @param appId 应用id
* @param timestamp 时间戳
* @param signature 签名
* @param query 大模型提问
* @author lkg
* @date 2025/7/19
*/
public static CreateResponse createOutline(String appId, String timestamp, String signature, String query) {
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
builder.addFormDataPart("query", query);
RequestBody requestBody = builder.build();
Request request = new Request.Builder().url(baseUrl + "/createOutline")
.addHeader("appId", appId)
.addHeader("timestamp", timestamp)
.addHeader("signature", signature)
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String string = Objects.requireNonNull(response.body()).string();
return JSONObject.parseObject(string, CreateResponse.class);
} else {
log.info("PPT大纲生成异常:{}", Objects.requireNonNull(response.body()).string());
return null;
}
} catch (IOException e) {
log.info("PPT生成进度查询异常:{}", e.getMessage());
}
return null;
}
/**
* 根据大纲生成ppt
*
* @param appId 应用id
* @param timestamp 时间戳
* @param signature 签名
* @param query 大模型提问
* @param outline ppt大纲
* @author lkg
* @date 2025/7/19
*/
public static CreateResponse createByOutline(String appId, String timestamp, String signature, String query, String outline) {
JSONObject jsonObject = new JSONObject();
JSONObject outlineJson = JSONObject.parseObject(outline);
jsonObject.put("outline", outlineJson);
jsonObject.put("query", query);
jsonObject.put("templateId", templateId);
jsonObject.put("author", "汇报人");
RequestBody requestBody = RequestBody.create(jsonObject.toString(), MediaType.get("application/json; charset=utf-8"));
Request request = new Request.Builder()
.url(baseUrl + "/createPptByOutline")
.addHeader("appId", appId)
.addHeader("timestamp", timestamp)
.addHeader("signature", signature)
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String string = Objects.requireNonNull(response.body()).string();
return JSONObject.parseObject(string, CreateResponse.class);
} else {
log.info("PPT生成异常:{}", Objects.requireNonNull(response.body()).string());
return null;
}
} catch (IOException e) {
log.info("PPT生成进度查询异常:{}", e.getMessage());
}
return null;
}
/**
* 查看ppt生成进度
*
* @param appId 应用id
* @param timestamp 时间戳
* @param signature 签名
* @param sid 请求大纲唯一id
* @author lkg
* @date 2025/7/19
*/
public static ProgressResponse checkProgress(String appId, String timestamp, String signature, String sid) {
String url = baseUrl + "/progress?sid=" + sid;
Request request = new Request.Builder()
.url(url)
.addHeader("appId", appId)
.addHeader("timestamp", timestamp)
.addHeader("signature", signature)
.get()
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String string = Objects.requireNonNull(response.body()).string();
return JSON.parseObject(string,ProgressResponse.class);
} else {
log.info("PPT生成进度查询异常:{}", Objects.requireNonNull(response.body()).string());
return null;
}
} catch (IOException e) {
log.info("PPT生成进度查询异常:{}", e.getMessage());
}
return null;
}
}
package com.zzsn.event.util.ppt;
import lombok.Data;
@Data
public class ProgressResponse {
private boolean flag;
private int code;
private String desc;
private Integer count;
private Data data;
@lombok.Data
public static class Data {
private String pptStatus;
private String aiImageStatus;
private String cardNoteStatus;
private String pptUrl;
private String errMsg;
private Integer totalPages;
private Integer donePages;
}
}
...@@ -25,6 +25,10 @@ public class AddEventVO { ...@@ -25,6 +25,10 @@ public class AddEventVO {
private String eventName; private String eventName;
/**事件类型*/ /**事件类型*/
private String eventType; private String eventType;
/**
* 关键问题
*/
private String keyIssue;
/**事件描述*/ /**事件描述*/
private String eventDescribe; private String eventDescribe;
/**开始时间*/ /**开始时间*/
......
package com.zzsn.event.vo;
import lombok.Data;
/**
* 关键词共现【同时出现在一篇资讯】实体对象
*
* @author lkg
* @date 2025/7/9
*/
@Data
public class CoOccurrenceVO {
//关键词1
private CountVO word_1;
//共现次数
private Long coOccurrenceNum;
//关键词2
private CountVO word_2;
}
package com.zzsn.event.vo;
import com.zzsn.event.entity.EventContext;
import lombok.Data;
import java.util.List;
/**
* 事件脉络编辑对象
*
* @author lkg
* @date 2025/7/15
*/
@Data
public class EventContextModifyVO {
//事件id
private String eventId;
//关键节点
private EventContext keyNode;
//新增集合
private List<EventContext> saveList;
//更换集合
private List<EventContext> updateList;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
* todo
*
* @author lkg
* @date 2025/7/5
*/
@Data
public class EventContextVO {
//资讯id
private String id;
//资讯标题
private String title;
//来源
private String origin;
//发布时间
private String publishDate;
//原文链接
private String sourceAddress;
//相似度算法【编辑距离】返回的值
private Double distance;
//是否关联度最高
private Boolean isMain = false;
//索引名称
private String dbIndex;
}
...@@ -25,6 +25,10 @@ public class EventVO { ...@@ -25,6 +25,10 @@ public class EventVO {
private String eventCode; private String eventCode;
/**事件名称*/ /**事件名称*/
private String eventName; private String eventName;
/**
* 关键问题
*/
private String keyIssue;
/**开始时间*/ /**开始时间*/
private String startTime; private String startTime;
/**jssj*/ /**jssj*/
...@@ -33,6 +37,8 @@ public class EventVO { ...@@ -33,6 +37,8 @@ public class EventVO {
private String publishDate; private String publishDate;
/**事件描述*/ /**事件描述*/
private String eventDescribe; private String eventDescribe;
/**事件描述是否人工编辑(1-是;0-否)*/
private Integer ynManualEdit;
/**事件标签*/ /**事件标签*/
private String eventLabel; private String eventLabel;
/**关联事件*/ /**关联事件*/
...@@ -64,6 +70,8 @@ public class EventVO { ...@@ -64,6 +70,8 @@ public class EventVO {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date firstOpenTime; private Date firstOpenTime;
private String createBy;
/**是否生成分析报告*/ /**是否生成分析报告*/
private Boolean hasReport; private Boolean hasReport;
...@@ -77,4 +85,7 @@ public class EventVO { ...@@ -77,4 +85,7 @@ public class EventVO {
/**关键词*/ /**关键词*/
private KeywordsVO keywordsVO; private KeywordsVO keywordsVO;
private String dataScope; private String dataScope;
/**是否关注*/
private Boolean ynAttention;
} }
...@@ -129,6 +129,7 @@ obs: ...@@ -129,6 +129,7 @@ obs:
endPoint: https://obs.cn-north-1.myhuaweicloud.com endPoint: https://obs.cn-north-1.myhuaweicloud.com
scheduling: scheduling:
enable: false enable: false
yjzxEnable: false
serviceProject: serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/ url: https://clb.ciglobal.cn/clb-api/datapull/
scoreRule: scoreRule:
......
spring:
servlet:
multipart:
max-request-size: 1024MB
max-file-size: 100MB
web:
resources:
static-locations:
- file:${user.dir}/icon/
freemarker:
template-loader-path:
- classpath:/template
datasource:
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: 123456667
allow:
web-stat-filter:
enabled: true
dynamic:
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 10
maxActive: 100
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 600000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://1.95.78.131:3306/clb_project_label?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource1:
url: jdbc:mysql://1.95.78.131:3306/clb_xxl_job_label?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource2:
url: jdbc:mysql://1.95.78.131:3306/clb_system_label?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
elasticsearch:
# uris: ["1.95.69.2:9200"]
uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"]
username: elastic
# password: elastic
password: zzsn9988
connection-timeout: 300000
socket-timeout: 300000
cloud:
stream:
kafka:
binder:
brokers: 1.95.78.131:17092
zkNodes: 1.95.78.131:12181
requiredAcks: 1
redis:
database: 7
host: 1.95.69.2
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
port: 6379
password: zzsn9988
kafka:
bootstrap-servers: 1.95.78.131:17092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
#缓存大小,默认32M
buffer-memory: 335544324
acks: 1
# 指定消息key和消息体的编解码方式
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.apache.kafka.common.serialization.StringSerializer
consumer:
#用于标识此使用者所属的使用者组的唯一字符串
group-id: event-analysis-group-test-label
#当Kafka中没有初始偏移量或者服务器上不再存在当前偏移量时该怎么办,默认值为latest,表示自动将偏移重置为最新的偏移量
#可选的值为latest, earliest, none
auto-offset-reset: latest
#消费者的偏移量将在后台定期提交,默认值为true
enable-auto-commit: true
#如果'enable-auto-commit'为true,则消费者偏移自动提交给Kafka的频率(以毫秒为单位),默认值为5000。
auto-commit-interval: 100
#密钥的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
#值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
main:
allow-circular-references: true
mybatis-plus:
mapper-locations: classpath*:com/zzsn/event/**/xml/*.xml
configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
obs:
ak: VEHN7D0TJ9316H8AHCAV
sk: heR353lvSWVPNU8pe2QxDtd8GDsO5L6PGH5eUoQY
endPoint: https://obs.cn-north-1.myhuaweicloud.com
scheduling:
enable: false
yjzxEnable: false
serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/
scoreRule:
weekScore: 10
monthScore: 5
yearScore: 3
beforeYearScore: 1
translate:
url: http://114.116.116.241:8018/translate/getTranslateInfoWithTag
python:
#python打分接口-弃用
scoreModelUrl: http://114.116.36.231:8080/score
#python开始执行接口--弃用
subjectProcessorUrl: http://114.116.36.231:8085/subject/subject_processor
#判重
judgeDuplicateUrl: http://1.95.13.40:8080/subject/judg_duplicate
#抽取关键词
keyWordsExtractUrl: http://1.95.91.200:7006/get_phrase/
#清空去重服务历史数据
clearDuplicateHistoryUrl: http://1.95.13.40:8080/subject/delete_history_data
hot-crawler: http://139.9.144.106:5000/data?option=OPTION
jeecg:
shiro:
excludeUrls: info/subjectPageListGroupByLabel,/subject/simple/queryInfoNoSign,/subject/manage/visiblePageListNoSign
kafka:
topic:
subject:
run: subjectModelTest
event:
run: eventSubjectModelTest
clb:
subject:
default:
processing:
advanceMonth: 6
data-permit:
dataPermitGetQueryEntityTest: http://1.95.77.159:10089/permission/
dataPermitGetQueryEntityProd: http://1.95.14.24:8060/
infoSource:
pageList: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/pageList
columnList: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnList
add: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/addInfoSourceTask
waitInfoRemove: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/waitInfoRemove
columnListByWait: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnListByWait
columnDetail: http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnDetail
model:
default-modelType: zhipu
configs:
- modelType: zhipu
modelTypeName: 智谱
url: https://open.bigmodel.cn/api/paas/v4/chat/completions
api-key: c5a53bd5f95a4e37a8997deb5d0c6031.orXyRRPNvZiqRaxF
default-model: glm-4-flash #免费
web-search: true
- modelType: qwen
modelTypeName: 千问
url: https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
api-key: sk-01ee9a6efa394178993a950b768e3753
default-model: qwen-plus #收费
- modelType: deepseek
modelTypeName: deepseek
url: https://api.deepseek.com/v1/chat/completions
api-key: sk-656a8ec451dc47aaad3dacf24fe36f20
default-model: deepseek-chat #收费
- modelType: doubao
modelTypeName: 豆包
url: https://ark.cn-beijing.volces.com/api/v3/chat/completions
api-key: ab54c534-4f3c-41b9-9b27-132cb7954b6f
default-model: doubao-1-5-pro-32k-250115 # Doubao-1.5-pro-32k #收费
...@@ -131,6 +131,7 @@ obs: ...@@ -131,6 +131,7 @@ obs:
endPoint: https://obs.cn-north-1.myhuaweicloud.com endPoint: https://obs.cn-north-1.myhuaweicloud.com
scheduling: scheduling:
enable: false enable: false
yjzxEnable: false
serviceProject: serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/ url: https://clb.ciglobal.cn/clb-api/datapull/
scoreRule: scoreRule:
...@@ -151,6 +152,7 @@ python: ...@@ -151,6 +152,7 @@ python:
keyWordsExtractUrl: http://1.95.91.200:7006/get_phrase/ keyWordsExtractUrl: http://1.95.91.200:7006/get_phrase/
#清空去重服务历史数据 #清空去重服务历史数据
clearDuplicateHistoryUrl: http://1.95.13.40:8080/subject/delete_history_data clearDuplicateHistoryUrl: http://1.95.13.40:8080/subject/delete_history_data
hot-crawler: http://139.9.144.106:5000/data?option=OPTION
jeecg: jeecg:
shiro: shiro:
excludeUrls: info/subjectPageListGroupByLabel,/subject/simple/**,/subject/manage/visiblePageListNoSign excludeUrls: info/subjectPageListGroupByLabel,/subject/simple/**,/subject/manage/visiblePageListNoSign
...@@ -182,3 +184,28 @@ ai-article: ...@@ -182,3 +184,28 @@ ai-article:
caiji: caiji:
keywordCrawler: keywordCrawler:
url: http://1.95.136.108:9010/put_keyword url: http://1.95.136.108:9010/put_keyword
model:
default-modelType: zhipu
configs:
- modelType: zhipu
modelTypeName: 智谱
url: https://open.bigmodel.cn/api/paas/v4/chat/completions
api-key: c5a53bd5f95a4e37a8997deb5d0c6031.orXyRRPNvZiqRaxF
default-model: glm-4-flash #免费
web-search: true
- modelType: qwen
modelTypeName: 千问
url: https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
api-key: sk-01ee9a6efa394178993a950b768e3753
default-model: qwen-plus #收费
- modelType: deepseek
modelTypeName: deepseek
url: https://api.deepseek.com/v1/chat/completions
api-key: sk-656a8ec451dc47aaad3dacf24fe36f20
default-model: deepseek-chat #收费
- modelType: doubao
modelTypeName: 豆包
url: https://ark.cn-beijing.volces.com/api/v3/chat/completions
api-key: ab54c534-4f3c-41b9-9b27-132cb7954b6f
default-model: doubao-1-5-pro-32k-250115 # Doubao-1.5-pro-32k #收费
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论