提交 6713a62d 作者: 925993793@qq.com

研究中心补充接口以及对接bug处理;平台接口逻辑调整

上级 a4016ea5
...@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter; ...@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/** /**
* 平台事件管理页 * 平台事件管理页
...@@ -236,7 +237,7 @@ public class SubjectManageController { ...@@ -236,7 +237,7 @@ public class SubjectManageController {
*/ */
@GetMapping("/queryInfo") @GetMapping("/queryInfo")
public Result<?> queryInfo(@RequestParam String subjectId){ public Result<?> queryInfo(@RequestParam String subjectId){
SubjectSampleFileInfoVO info = subjectService.queryInfo(subjectId); SubjectDetailVO info = subjectService.queryInfo(subjectId);
return Result.OK(info); return Result.OK(info);
} }
...@@ -262,28 +263,43 @@ public class SubjectManageController { ...@@ -262,28 +263,43 @@ public class SubjectManageController {
*/ */
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<?> edit(@RequestBody SubjectPage subjectPage) { public Result<?> edit(@RequestBody SubjectPage subjectPage) {
Subject byId = subjectService.getById(subjectPage.getId());
subjectService.updateMain(subjectPage); subjectService.updateMain(subjectPage);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
//更新xxljob //更新xxljob
List<String> subjectCodes = new ArrayList<>();
subjectCodes.add(subjectPage.getSubjectCode());
String cron = "";
if (StrUtil.isNotBlank(subjectPage.getUnit()) && ObjectUtil.isNotEmpty(subjectPage.getSpace())) { if (StrUtil.isNotBlank(subjectPage.getUnit()) && ObjectUtil.isNotEmpty(subjectPage.getSpace())) {
cron = CronUtil.generateCron(subjectPage.getUnit(), subjectPage.getSpace()); String cron = CronUtil.generateCron(subjectPage.getUnit(), subjectPage.getSpace());
xxlJobInfoService.cronUpdate(subjectPage.getSubjectCode(), cron);
} }
xxlJobInfoService.keyWordsUpdate(subjectCodes, String.valueOf(subjectPage.getStatus()));
xxlJobInfoService.update(Wrappers.<XxlJobInfo>lambdaUpdate().eq(XxlJobInfo::getInfoSourceCode, subjectPage.getSubjectCode()).set(XxlJobInfo::getJobCron, cron));
//判断是否提取热词 //判断是否提取热词
extractHotWords(subjectPage); extractHotWords(subjectPage);
/*Subject byId = subjectService.getById(subjectPage.getId());
if (!Objects.equals(byId.getStatus(), subjectPage.getStatus()) && subjectPage.getStatus() == 1) { if (!Objects.equals(byId.getStatus(), subjectPage.getStatus()) && subjectPage.getStatus() == 1) {
kafkaTemplate.send("subjectModel", subjectPage.getSubjectCode()); kafkaTemplate.send("subjectModel", subjectPage.getSubjectCode());
} }*/
}); });
return Result.OK(); return Result.OK();
} }
/** /**
* 更新状态
*
* @param subject
* @author lkg
* @date 2025/1/9
*/
@PostMapping("/updateStatus")
public Result<?> updateStatus(@RequestBody Subject subject){
subjectService.updateStatus(subject);
xxlJobInfoService.update(Wrappers.<XxlJobInfo>lambdaUpdate()
.eq(XxlJobInfo::getInfoSourceCode, subject.getSubjectCode())
.set(XxlJobInfo::getTriggerStatus,subject.getStatus()));
if (subject.getStatus() == 1) {
kafkaTemplate.send("subjectModel", subject.getSubjectCode());
}
return Result.OK();
}
/**
* 通过id删除 * 通过id删除
* *
* @param id * @param id
...@@ -622,7 +638,7 @@ public class SubjectManageController { ...@@ -622,7 +638,7 @@ public class SubjectManageController {
@PostMapping("/bindInfoSourceLabel") @PostMapping("/bindInfoSourceLabel")
public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) { public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) {
String subjectId = subjectSourceTagVO.getSubjectId(); String subjectId = subjectSourceTagVO.getSubjectId();
if (StringUtils.isNotEmpty(subjectId)) { if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空"); return Result.FAIL("专题id不能为空");
} }
List<InfoSourceLabelVO> labelList = subjectSourceTagVO.getLabelList(); List<InfoSourceLabelVO> labelList = subjectSourceTagVO.getLabelList();
...@@ -760,6 +776,44 @@ public class SubjectManageController { ...@@ -760,6 +776,44 @@ public class SubjectManageController {
} }
/** /**
* 添加定向信息源-推荐信息源(专题绑定定向信息源时使用-研究中心)
*
* @param params 参数
* @author lkg
* @date 2025/1/4
*/
@PostMapping("/bindRecommendInfoSource")
public Result<?> bindRecommendInfoSource(@RequestBody List<SubjectInfoSourceMap> params) {
if (CollectionUtils.isNotEmpty(params)) {
params.forEach(item -> item.setType(1));
subjectInfoSourceMapService.saveBatch(params);
}
return Result.OK();
}
/**
* 删除定向信息源(专题绑定定向信息源时使用-研究中心)
*
* @param params 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping("/removeDirectInfoSource")
public Result<?> removeDirectInfoSource(@RequestBody JSONObject params){
String subjectId = params.get("subjectId").toString();
String webSiteName = params.get("webSiteName").toString();
String status = params.get("status").toString();
if ("1".equals(status)) {
List<InfoSource> infoSources = infoSourceService.directSourceColumnList(webSiteName);
List<String> sourceIds = infoSources.stream().map(InfoSource::getId).collect(Collectors.toList());
subjectInfoSourceMapService.remove(new LambdaQueryWrapper<SubjectInfoSourceMap>().eq(SubjectInfoSourceMap::getSubjectId, subjectId).in(SubjectInfoSourceMap::getSourceId, sourceIds));
} else if ("0".equals(status)) {
subjectInfoSourceMiddleMapService.remove(new LambdaQueryWrapper<SubjectInfoSourceMiddleMap>().eq(SubjectInfoSourceMiddleMap::getSubjectId, subjectId).eq(SubjectInfoSourceMiddleMap::getInfoSourceName, webSiteName));
}
return Result.OK();
}
/**
* 信息源导入模板下载-研究中心 * 信息源导入模板下载-研究中心
* *
* @author lkg * @author lkg
...@@ -910,7 +964,12 @@ public class SubjectManageController { ...@@ -910,7 +964,12 @@ public class SubjectManageController {
List<CountVO> countVOS = esService.groupBySourceId(searchCondition); List<CountVO> countVOS = esService.groupBySourceId(searchCondition);
if (CollectionUtils.isNotEmpty(countVOS)) { if (CollectionUtils.isNotEmpty(countVOS)) {
List<String> sourceIdList = new ArrayList<>(); List<String> sourceIdList = new ArrayList<>();
infoSources = infoSourceService.listByIds(sourceIdList); for (CountVO countVO : countVOS) {
sourceIdList.add(countVO.getName());
}
LambdaQueryWrapper<InfoSource> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.select(InfoSource::getId,InfoSource::getSiteName,InfoSource::getSiteUri).in(InfoSource::getId,sourceIdList);
infoSources = infoSourceService.list(queryWrapper);
} }
return Result.OK(infoSources); return Result.OK(infoSources);
} }
......
package com.zzsn.event.controller;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.service.SubjectService;
import com.zzsn.event.service.SubjectSimpleService;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectDetailVO;
import com.zzsn.event.vo.SubjectSimpleVO;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 专题管理流程简化版
*
* @author lkg
* @date 2025/1/9
*/@Slf4j
@RestController
@RequestMapping("/subject/simple")
public class SubjectSimpleController {
@Autowired
private SubjectSimpleService subjectSimpleService;
@Autowired
private SubjectService subjectService;
@Autowired
private IXxlJobInfoService xxlJobInfoService;
/**
* 创建专题
*
* @param subjectSimpleVO 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping("/createSubject")
public Result<?> createSubject(@RequestBody SubjectSimpleVO subjectSimpleVO) {
Subject subject = subjectSimpleService.createSubject(subjectSimpleVO);
//插入xxlJob
xxlJobInfoService.subjectInsert(subject);
return Result.OK(subject.getId());
}
/**
* 编辑专题
*
* @param subjectSimpleVO 参数
* @author lkg
* @date 2025/1/9
*/
@PostMapping("/editSubject")
public Result<?> editSubject(@RequestBody SubjectSimpleVO subjectSimpleVO) {
subjectSimpleService.editSubject(subjectSimpleVO);
return Result.OK();
}
/**
* 专题详情(包含样例文章以及关键词)
*
* @param subjectId 专题id
* @author lkg
* @date 2025/1/9
*/
@GetMapping("/queryInfo")
public Result<?> queryInfo(@RequestParam String subjectId){
SubjectDetailVO subjectDetailVO = subjectService.queryInfo(subjectId);
List<SearchWordVO> list = subjectSimpleService.subjectBindWordInfo(subjectId);
subjectDetailVO.setKeywords(list);
return Result.OK(subjectDetailVO);
}
}
...@@ -182,7 +182,7 @@ public class EventApi { ...@@ -182,7 +182,7 @@ public class EventApi {
event.setIncreAnaRule(20); event.setIncreAnaRule(20);
event.setTotalAnaRule(50); event.setTotalAnaRule(50);
event.setTimeAnaRule(5); event.setTimeAnaRule(5);
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue()); String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.EVENT_DEFAULT.getValue());
event.setEventCode(subjectCode); event.setEventCode(subjectCode);
//默认发布 //默认发布
event.setPublishStatus(1); event.setPublishStatus(1);
......
...@@ -7,7 +7,8 @@ package com.zzsn.event.enums; ...@@ -7,7 +7,8 @@ package com.zzsn.event.enums;
*/ */
public enum CodePrefixEnum { public enum CodePrefixEnum {
INFO_SOURCE_DEFAULT("IN","信息源编码默认前缀"), INFO_SOURCE_DEFAULT("IN","信息源编码默认前缀"),
SUBJECT_DEFAULT("EVENT_ANALYSIS", "事件编码默认前缀"), EVENT_DEFAULT("EVENT_ANALYSIS", "事件编码默认前缀"),
SUBJECT_DEFAULT("SJ", "专题编码默认前缀"),
PROJECT_DEFAULT("PJ", "项目编码默认前缀"), PROJECT_DEFAULT("PJ", "项目编码默认前缀"),
CUSTOMER_DEFAULT("CS", "客户编码默认前缀"), CUSTOMER_DEFAULT("CS", "客户编码默认前缀"),
SPECIAL_INFO_SOURCE_DEFAULT("PY","信息源编码默认前缀"), SPECIAL_INFO_SOURCE_DEFAULT("PY","信息源编码默认前缀"),
......
...@@ -1641,7 +1641,9 @@ public class EsService { ...@@ -1641,7 +1641,9 @@ public class EsService {
searchSourceBuilder.size(0); searchSourceBuilder.size(0);
//构建查询语句 //构建查询语句
List<String> subjectIds = new ArrayList<>(); List<String> subjectIds = new ArrayList<>();
if (StringUtils.isNotBlank(searchCondition.getSubjectId())) {
subjectIds.add(searchCondition.getSubjectId()); subjectIds.add(searchCondition.getSubjectId());
}
BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds); BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds);
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(groupName); TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(groupName);
...@@ -1914,6 +1916,8 @@ public class EsService { ...@@ -1914,6 +1916,8 @@ public class EsService {
if (searchScope == 1) { if (searchScope == 1) {
buildSplitWordMustQuery(boolQuery, searchInfo, "title", searchAccuracy); buildSplitWordMustQuery(boolQuery, searchInfo, "title", searchAccuracy);
} else if (searchScope == 2) { } else if (searchScope == 2) {
buildSplitWordMustQuery(boolQuery, searchInfo, "content", searchAccuracy);
} else if (searchScope == 3) {
if ("精确".equals(searchAccuracy)) { if ("精确".equals(searchAccuracy)) {
if (searchInfo.contains("|")) { if (searchInfo.contains("|")) {
BoolQueryBuilder splitWordQuery = QueryBuilders.boolQuery(); BoolQueryBuilder splitWordQuery = QueryBuilders.boolQuery();
...@@ -1940,10 +1944,8 @@ public class EsService { ...@@ -1940,10 +1944,8 @@ public class EsService {
boolQuery.must(QueryBuilders.multiMatchQuery(searchInfo, "title", "content")); boolQuery.must(QueryBuilders.multiMatchQuery(searchInfo, "title", "content"));
} }
} }
} else if (searchScope == 3) {
buildSplitWordMustQuery(boolQuery, searchInfo, "origin", searchAccuracy);
} else if (searchScope == 4) { } else if (searchScope == 4) {
buildSplitWordMustQuery(boolQuery, searchInfo, "content", searchAccuracy); buildSplitWordMustQuery(boolQuery, searchInfo, "origin", searchAccuracy);
} }
} }
if (type == 1) { if (type == 1) {
...@@ -1972,6 +1974,8 @@ public class EsService { ...@@ -1972,6 +1974,8 @@ public class EsService {
if (searchScope == 1) { if (searchScope == 1) {
buildSplitWordShouldQuery(boolQuery, searchInfo, "title", searchAccuracy); buildSplitWordShouldQuery(boolQuery, searchInfo, "title", searchAccuracy);
} else if (searchScope == 2) { } else if (searchScope == 2) {
buildSplitWordShouldQuery(boolQuery, searchInfo, "content", searchAccuracy);
} else if (searchScope == 3) {
if ("精确".equals(searchAccuracy)) { if ("精确".equals(searchAccuracy)) {
if (searchInfo.contains("|")) { if (searchInfo.contains("|")) {
for (String word : searchInfo.split("\\|")) { for (String word : searchInfo.split("\\|")) {
...@@ -1993,10 +1997,8 @@ public class EsService { ...@@ -1993,10 +1997,8 @@ public class EsService {
boolQuery.should(QueryBuilders.multiMatchQuery(searchInfo, "title", "content")); boolQuery.should(QueryBuilders.multiMatchQuery(searchInfo, "title", "content"));
} }
} }
} else if (searchScope == 3) {
buildSplitWordShouldQuery(boolQuery, searchInfo, "origin", searchAccuracy);
} else if (searchScope == 4) { } else if (searchScope == 4) {
buildSplitWordShouldQuery(boolQuery, searchInfo, "content", searchAccuracy); buildSplitWordShouldQuery(boolQuery, searchInfo, "origin", searchAccuracy);
} }
} }
allBoolQuery.should(boolQuery); allBoolQuery.should(boolQuery);
......
...@@ -3,6 +3,7 @@ package com.zzsn.event.mapper; ...@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO; import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.KeyWordsPage; import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectKeywordsMap; import com.zzsn.event.vo.SubjectKeywordsMap;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -28,4 +29,5 @@ public interface SubjectKeywordsMapMapper extends BaseMapper<SubjectKeywordsMap> ...@@ -28,4 +29,5 @@ public interface SubjectKeywordsMapMapper extends BaseMapper<SubjectKeywordsMap>
List<KeyWordsPage> bindKeyWordsList(@Param("subjectId") String subjectId); List<KeyWordsPage> bindKeyWordsList(@Param("subjectId") String subjectId);
List<SearchWordVO> subjectBindWordInfo(@Param("subjectId") String subjectId);
} }
...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.Subject; import com.zzsn.event.entity.Subject;
import com.zzsn.event.vo.SubjectCondition; import com.zzsn.event.vo.SubjectCondition;
import com.zzsn.event.vo.SubjectPage; import com.zzsn.event.vo.SubjectPage;
import com.zzsn.event.vo.SubjectSampleFileInfoVO; import com.zzsn.event.vo.SubjectDetailVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -45,7 +45,7 @@ public interface SubjectMapper extends BaseMapper<Subject> { ...@@ -45,7 +45,7 @@ public interface SubjectMapper extends BaseMapper<Subject> {
* @author lkg * @author lkg
* @date 2025/1/8 * @date 2025/1/8
*/ */
SubjectSampleFileInfoVO queryInfo(@Param("subjectId") String subjectId); SubjectDetailVO queryInfo(@Param("subjectId") String subjectId);
/** /**
* 专题详情 * 专题详情
* *
......
...@@ -113,8 +113,8 @@ ...@@ -113,8 +113,8 @@
SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as
labelId,c.label_mark,c.label_name,c.label_type labelId,c.label_mark,c.label_name,c.label_type
FROM subject_model_map a FROM subject_model_map a
inner JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1 INNER JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1
LEFT JOIN sys_base_label_type c on c.id = b.label_id INNER JOIN sys_base_label_type c on c.id = b.label_id
WHERE b.service_name is not null and a.type = 3 WHERE b.service_name is not null and a.type = 3
<if test="subjectIds != null and subjectIds.size() > 0"> <if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in and a.subject_id in
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
ORDER BY lb.order_no ASC ORDER BY c.order_no ASC
</select> </select>
<select id="projectList" resultType="com.zzsn.event.util.tree.Node"> <select id="projectList" resultType="com.zzsn.event.util.tree.Node">
......
...@@ -208,18 +208,18 @@ ...@@ -208,18 +208,18 @@
<select id="subjectBindDirectInfoSourceList" resultType="Map"> <select id="subjectBindDirectInfoSourceList" resultType="Map">
select a.* select a.*
from ( from (
select iso.web_site_name, 1 as `status` select iso.web_site_name as webSiteName, 1 as `status`
from info_source iso from info_source iso
inner join subject_info_source_map sm on iso.id = sm.source_id and sm.type = #{subjectId} inner join subject_info_source_map sm on iso.id = sm.source_id and sm.type = 1
where sm.subject_id = '1' where sm.subject_id = #{subjectId}
group by iso.web_site_name group by iso.web_site_name
union union
select info_source_name as web_site_name, 0 as `status` select info_source_name as webSiteName, 0 as `status`
from subject_info_source_middle_map from subject_info_source_middle_map
where subject_id = #{subjectId} where subject_id = #{subjectId}
group by info_source_name group by info_source_name
) a ) a
order by status desc ,web_site_name asc order by a.status desc, a.webSiteName asc
</select> </select>
<select id="infoSourcePageList" resultType="String"> <select id="infoSourcePageList" resultType="String">
...@@ -227,8 +227,8 @@ ...@@ -227,8 +227,8 @@
from info_source iso where 1=1 from info_source iso where 1=1
<if test="searchWord!=null and searchWord != ''"> <if test="searchWord!=null and searchWord != ''">
and ( and (
iso.web_site_name like CONCAT('%',#{infoSourceCondition.searchWord},'%') iso.web_site_name like CONCAT('%',#{searchWord},'%')
or iso.site_uri = like CONCAT('%',#{infoSourceCondition.searchWord},'%') or iso.site_uri like CONCAT('%',#{searchWord},'%')
) )
</if> </if>
group by iso.web_site_name group by iso.web_site_name
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</select> </select>
<select id="directSourceColumnList" resultType="com.zzsn.event.entity.InfoSource"> <select id="directSourceColumnList" resultType="com.zzsn.event.entity.InfoSource">
select iso.site_name, iso.site_uri select iso.id, iso.site_name, iso.site_uri
from info_source iso from info_source iso
where iso.web_site_name = #{webSiteName} where iso.web_site_name = #{webSiteName}
order by iso.create_time order by iso.create_time
......
...@@ -51,11 +51,19 @@ ...@@ -51,11 +51,19 @@
</select> </select>
<select id="bindKeyWordsList" resultType="com.zzsn.event.vo.KeyWordsPage"> <select id="bindKeyWordsList" resultType="com.zzsn.event.vo.KeyWordsPage">
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId,a.binding_type FROM key_words b SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId,a.binding_type
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id LEFT JOIN keywords_type d ON d.id = c.type_id
where 1=1 and a.subject_id = #{subjectId} where a.subject_id = #{subjectId}
group by b.id group by b.id
</select> </select>
<select id="subjectBindWordInfo" resultType="com.zzsn.event.vo.SearchWordVO">
SELECT b.id,b.key_word as searchInfo,b.words_name as wordName,a.type as searchScope,a.binding_type
FROM key_words b
INNER JOIN subject_keywords_map a ON a.keywords_id = b.id
where a.subject_id = #{subjectId}
</select>
</mapper> </mapper>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
order by d.create_time desc order by d.create_time desc
</select> </select>
<resultMap id="subjectSampleFileInfoVOMap" type="com.zzsn.event.vo.SubjectSampleFileInfoVO"> <resultMap id="SubjectDetailVOMap" type="com.zzsn.event.vo.SubjectDetailVO">
<result column="subject_name" property="subjectName"/> <result column="subject_name" property="subjectName"/>
<result column="subjectTypeName" property="subjectTypeName"/> <result column="subjectTypeName" property="subjectTypeName"/>
<result column="remark" property="remark"/> <result column="remark" property="remark"/>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
</collection> </collection>
</resultMap> </resultMap>
<select id="queryInfo" resultMap="subjectSampleFileInfoVOMap"> <select id="queryInfo" resultMap="SubjectDetailVOMap">
select s.subject_name, select s.subject_name,
s.remark, s.remark,
s.status, s.status,
......
...@@ -64,7 +64,7 @@ public class EventSimpleService { ...@@ -64,7 +64,7 @@ public class EventSimpleService {
event.setIncreAnaRule(20); event.setIncreAnaRule(20);
event.setTotalAnaRule(50); event.setTotalAnaRule(50);
event.setTimeAnaRule(5); event.setTimeAnaRule(5);
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue()); String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.EVENT_DEFAULT.getValue());
event.setEventCode(subjectCode); event.setEventCode(subjectCode);
//默认发布 //默认发布
event.setPublishStatus(1); event.setPublishStatus(1);
......
...@@ -3,6 +3,7 @@ package com.zzsn.event.service; ...@@ -3,6 +3,7 @@ package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO; import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.KeyWordsPage; import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectKeywordsMap; import com.zzsn.event.vo.SubjectKeywordsMap;
import java.util.List; import java.util.List;
...@@ -48,4 +49,6 @@ public interface ISubjectKeywordsMapService extends IService<SubjectKeywordsMap> ...@@ -48,4 +49,6 @@ public interface ISubjectKeywordsMapService extends IService<SubjectKeywordsMap>
* @date 2024/12/23 * @date 2024/12/23
*/ */
List<KeyWordsPage> bindKeyWordsList(String subjectId); List<KeyWordsPage> bindKeyWordsList(String subjectId);
List<SearchWordVO> subjectBindWordInfo(String subjectId);
} }
...@@ -45,7 +45,7 @@ public interface SubjectService extends IService<Subject> { ...@@ -45,7 +45,7 @@ public interface SubjectService extends IService<Subject> {
* @author lkg * @author lkg
* @date 2025/1/8 * @date 2025/1/8
*/ */
SubjectSampleFileInfoVO queryInfo(String subjectId); SubjectDetailVO queryInfo(String subjectId);
/** /**
* 新增专题 * 新增专题
...@@ -62,6 +62,15 @@ public interface SubjectService extends IService<Subject> { ...@@ -62,6 +62,15 @@ public interface SubjectService extends IService<Subject> {
void updateMain(SubjectPage subjectPage); void updateMain(SubjectPage subjectPage);
/** /**
* 启用/禁用
*
* @param subject 参数
* @author lkg
* @date 2025/1/9
*/
void updateStatus(Subject subject);
/**
* 删除 * 删除
* *
* @param subjectId 专题/事件id * @param subjectId 专题/事件id
......
package com.zzsn.event.service;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectSimpleVO;
import java.util.List;
/**
* 简化专题创建流程
*
* @author lkg
* @date 2025/1/9
*/
public interface SubjectSimpleService {
Subject createSubject(SubjectSimpleVO subjectSimpleVO);
void editSubject(SubjectSimpleVO subjectSimpleVO);
List<SearchWordVO> subjectBindWordInfo(String subjectId);
}
...@@ -289,7 +289,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -289,7 +289,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
event.setIncreAnaRule(20); event.setIncreAnaRule(20);
event.setTotalAnaRule(50); event.setTotalAnaRule(50);
event.setTimeAnaRule(5); event.setTimeAnaRule(5);
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue()); String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.EVENT_DEFAULT.getValue());
event.setEventCode(subjectCode); event.setEventCode(subjectCode);
//默认发布 //默认发布
event.setPublishStatus(1); event.setPublishStatus(1);
......
...@@ -689,7 +689,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -689,7 +689,7 @@ public class InformationServiceImpl implements InformationService {
private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) { private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) {
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(labelModelVos)) { if (CollectionUtils.isNotEmpty(labelModelVos)) {
List<Label> list = info.getLabels(); List<Label> list = info.getLabels();
List<LabelInfo> labelInfos = new ArrayList<>(); List<LabelInfo> labelInfos = new ArrayList<>();
//获取专题打的标签 //获取专题打的标签
...@@ -705,7 +705,6 @@ public class InformationServiceImpl implements InformationService { ...@@ -705,7 +705,6 @@ public class InformationServiceImpl implements InformationService {
if (StringUtils.isNotBlank(label.getLabelMark()) && if (StringUtils.isNotBlank(label.getLabelMark()) &&
(label.getLabelMark().contains(labelModelVo.getLabelMark()) || ("company_label".equals(labelModelVo.getLabelType()) && "company_label".equals(label.getLabelRemarks())))) { (label.getLabelMark().contains(labelModelVo.getLabelMark()) || ("company_label".equals(labelModelVo.getLabelType()) && "company_label".equals(label.getLabelRemarks())))) {
labelList.add(label); labelList.add(label);
} }
} }
} }
......
...@@ -6,6 +6,7 @@ import com.zzsn.event.mapper.SubjectKeywordsMapMapper; ...@@ -6,6 +6,7 @@ import com.zzsn.event.mapper.SubjectKeywordsMapMapper;
import com.zzsn.event.service.ISubjectKeywordsMapService; import com.zzsn.event.service.ISubjectKeywordsMapService;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO; import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.KeyWordsPage; import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectKeywordsMap; import com.zzsn.event.vo.SubjectKeywordsMap;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -45,4 +46,9 @@ public class SubjectKeywordsMapServiceImpl extends ServiceImpl<SubjectKeywordsMa ...@@ -45,4 +46,9 @@ public class SubjectKeywordsMapServiceImpl extends ServiceImpl<SubjectKeywordsMa
public List<KeyWordsPage> bindKeyWordsList(String subjectId) { public List<KeyWordsPage> bindKeyWordsList(String subjectId) {
return baseMapper.bindKeyWordsList(subjectId); return baseMapper.bindKeyWordsList(subjectId);
} }
@Override
public List<SearchWordVO> subjectBindWordInfo(String subjectId) {
return baseMapper.subjectBindWordInfo(subjectId);
}
} }
...@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl; ...@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
...@@ -20,29 +21,20 @@ import com.zzsn.event.enums.BindTypeEnum; ...@@ -20,29 +21,20 @@ import com.zzsn.event.enums.BindTypeEnum;
import com.zzsn.event.enums.CodePrefixEnum; import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.mapper.SubjectMapper; import com.zzsn.event.mapper.SubjectMapper;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.*; import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.search.TotalHits;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
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.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.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.util.ObjectUtil;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
...@@ -59,8 +51,6 @@ import java.util.stream.Collectors; ...@@ -59,8 +51,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements SubjectService { public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements SubjectService {
@Resource
private RestHighLevelClient client;
@Autowired @Autowired
private CodeGenerateUtil codeGenerateUtil; private CodeGenerateUtil codeGenerateUtil;
@Autowired @Autowired
...@@ -147,7 +137,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -147,7 +137,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
@Override @Override
public SubjectSampleFileInfoVO queryInfo(String subjectId) { public SubjectDetailVO queryInfo(String subjectId) {
return baseMapper.queryInfo(subjectId); return baseMapper.queryInfo(subjectId);
} }
...@@ -157,14 +147,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -157,14 +147,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
Subject subject = new Subject(); Subject subject = new Subject();
//事件专题的默认分析规则参数-必填 //事件专题的默认分析规则参数-必填
BeanUtils.copyProperties(subjectPage, subject); BeanUtils.copyProperties(subjectPage, subject);
String cron;
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue()); String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue());
subject.setSubjectCode(subjectCode); subject.setSubjectCode(subjectCode);
if (StringUtils.isEmpty(subject.getUnit()) || null == subject.getSpace()) { String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace());
cron = CronUtil.getRandomCron();
} else {
cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace());
}
subject.setCron(cron); subject.setCron(cron);
baseMapper.insert(subject); baseMapper.insert(subject);
//插入专题-类别、项目的绑定关系 //插入专题-类别、项目的绑定关系
...@@ -177,6 +162,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -177,6 +162,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
public void updateMain(SubjectPage subjectPage) { public void updateMain(SubjectPage subjectPage) {
Subject subject = new Subject(); Subject subject = new Subject();
BeanUtils.copyProperties(subjectPage, subject); BeanUtils.copyProperties(subjectPage, subject);
String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace());
subject.setCron(cron);
//先记录老的信息状态 //先记录老的信息状态
Subject oldSubject = baseMapper.selectById(subject.getId()); Subject oldSubject = baseMapper.selectById(subject.getId());
baseMapper.updateById(subject); baseMapper.updateById(subject);
...@@ -189,14 +176,14 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -189,14 +176,14 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
saveMapMain(subject, subjectPage); saveMapMain(subject, subjectPage);
//判断专题状态是否启用(启用时控制xxljob调度启动,关闭时控制xxljob关闭),随着状态的改变发消息给python //判断专题状态是否启用(启用时控制xxljob调度启动,关闭时控制xxljob关闭),随着状态的改变发消息给python
if (!subject.getStatus().equals(oldSubject.getStatus())) { /* if (!subject.getStatus().equals(oldSubject.getStatus())) {
if (subject.getStatus() == 1) { if (subject.getStatus() == 1) {
send(subject.getId(), "1"); send(subject.getId(), "1");
} else if (subject.getStatus() == 0) { } else if (subject.getStatus() == 0) {
//向python发起停止处理请求 //向python发起停止处理请求
send(subject.getId(), "0"); send(subject.getId(), "0");
} }
} }*/
//判断开始时间和结束时间是否发生变动 //判断开始时间和结束时间是否发生变动
Date newTimeEnable = subjectPage.getTimeEnable(); Date newTimeEnable = subjectPage.getTimeEnable();
...@@ -215,6 +202,20 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -215,6 +202,20 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
@Override @Override
public void updateStatus(Subject subject) {
baseMapper.updateById(subject);
CompletableFuture.runAsync(()->{
Integer status = subject.getStatus();
if (status == 1) {
send(subject.getId(), "1");
} else if (status == 0) {
//向python发起停止处理请求
send(subject.getId(), "0");
}
});
}
@Override
public void deleteMain(String subjectId) { public void deleteMain(String subjectId) {
baseMapper.deleteById(subjectId); baseMapper.deleteById(subjectId);
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(()->{
......
...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectType; import com.zzsn.event.entity.SubjectType;
import com.zzsn.event.mapper.SubjectTypeMapper; import com.zzsn.event.mapper.SubjectTypeMapper;
import com.zzsn.event.service.ISubjectTypeService; import com.zzsn.event.service.ISubjectTypeService;
...@@ -21,7 +20,10 @@ import org.springframework.beans.BeanUtils; ...@@ -21,7 +20,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
......
...@@ -14,7 +14,7 @@ import lombok.Setter; ...@@ -14,7 +14,7 @@ import lombok.Setter;
public class SearchWordVO { public class SearchWordVO {
/** /**
* 关键词检索范围(1-标题;2-全文;3-来源;4-正文) * 关键词检索范围(1-标题;2-正文;3-全文;4-来源)
*/ */
private Integer searchScope; private Integer searchScope;
...@@ -33,4 +33,11 @@ public class SearchWordVO { ...@@ -33,4 +33,11 @@ public class SearchWordVO {
*/ */
private String searchLogicRelationship; private String searchLogicRelationship;
/*-------------------一下参数--创建专题时使用-研究中心---------------------------*/
/**关键词组id*/
private String id;
/**关键词组名称*/
private String wordName;
/**专题绑定关键词的绑定类型(1:绑定为采集词,2:绑定为过滤词,3绑定为排除词组)*/
private String bindingType;
} }
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
* @date 2025/1/8 * @date 2025/1/8
*/ */
@Data @Data
public class SubjectSampleFileInfoVO { public class SubjectDetailVO {
/**专题名称*/ /**专题名称*/
private String subjectName; private String subjectName;
...@@ -40,4 +40,6 @@ public class SubjectSampleFileInfoVO { ...@@ -40,4 +40,6 @@ public class SubjectSampleFileInfoVO {
private String subjectTypeName; private String subjectTypeName;
/**专题下的样例文章*/ /**专题下的样例文章*/
private List<SubjectSampleFile> sampleFileList; private List<SubjectSampleFile> sampleFileList;
/**关键词信息*/
private List<SearchWordVO> keywords;
} }
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Date;
import java.util.List;
/**
* 简化流程后的入参对象-研究中心
*
* @author lkg
* @date 2025/1/9
*/
@Data
public class SubjectSimpleVO {
private String id;
private String subjectName;
private String subjectTypeId;
private String projectId;
/**定时单位(1分;2小时;3日;4月)*/
private String unit;
/**定时数值*/
private Integer space;
private String remark;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date timeEnable;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date timeDisable;
private String library;
private Integer dataSource;
private Integer facePublic;
private List<SearchWordVO> keywords;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论