提交 86bde111 作者: ZhangJingKun

相关报道查询

上级 f02bd524
......@@ -15,6 +15,8 @@
<description>人物库</description>
<properties>
<java.version>1.8</java.version>
<!--打包跳过测试-->
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
......
......@@ -2,10 +2,11 @@ package com.zzsn.leaderbase.controller;
import com.zzsn.leaderbase.service.CharacterDetailsService;
import com.zzsn.leaderbase.service.CorrelationEnterpriseService;
import com.zzsn.leaderbase.service.EsServer;
import com.zzsn.leaderbase.service.LearningAchievementService;
import com.zzsn.leaderbase.service.impl.CisXgraPaperServiceImpl;
import com.zzsn.leaderbase.vo.DetailsListVo;
import com.zzsn.leaderbase.vo.Result;
import com.zzsn.leaderbase.util.EsUtil;
import com.zzsn.leaderbase.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -35,6 +36,9 @@ public class CharacterDetailsController {
@Autowired
CorrelationEnterpriseService correlationEnterpriseService;
@Autowired
EsServer esServer;
/**
* 重要讲话 相关报道查询
* @param detailsListVo
......@@ -85,9 +89,12 @@ public class CharacterDetailsController {
return Result.error("索引有误!");
}
}
return characterDetailsService.getInformation(index, id);
return esServer.getInformation(index, id);
}
/**
* 学术信息查询
* 根据人物uid
......@@ -162,7 +169,24 @@ public class CharacterDetailsController {
@RequestParam(name="uid",required=true) String uid,
@RequestParam(name="name",required=true) String name
) {
return characterDetailsService.getCharacterBaike(uid, name);
return esServer.getCharacterBaike(uid, name);
}
/**
* 根据关键字从es中查询相关报道
* @param relatedReportsVo
* @return
*/
@PostMapping("/getRelatedReportsList")
public Result<?> getRelatedReportsList(@RequestBody RelatedReportsVo relatedReportsVo) {
//参数校验
Integer pageNo = relatedReportsVo.getPageNo();
if(pageNo < 1)
return Result.error("页码不能小于1!");
if(relatedReportsVo.getKeyword() == null || "".equals(relatedReportsVo.getKeyword()))
return Result.error("搜索关键词不能为空!");
return esServer.getRelatedReportsList(relatedReportsVo);
}
}
......@@ -122,7 +122,7 @@ public class CharacterInfoController {
/**
* 审核
* 审核(废弃)
* @param characterCheckVo
* @return
*/
......@@ -134,7 +134,7 @@ public class CharacterInfoController {
}
/**
* 根据id 取消人物 审核
* 根据id 取消人物 审核 (废弃)
* @param id
* @return
*/
......
......@@ -15,7 +15,4 @@ public interface CharacterDetailsService extends IService<CorrelationInformation
Result<?> informationList(DetailsListVo detailsListVo);
Result<?> getInformation(String articleIndex, String articleId);
Result<?> getCharacterBaike(String uid, String name);
}
package com.zzsn.leaderbase.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.leaderbase.util.EsUtil;
import com.zzsn.leaderbase.vo.RelatedReportsVo;
import com.zzsn.leaderbase.vo.Result;
import com.zzsn.leaderbase.vo.SubjectInfoVo;
import com.zzsn.leaderbase.vo.UserServerCharacterVo;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.naming.directory.SearchResult;
import java.io.IOException;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/20 11:06
* @Content:
*/
@Service
@Slf4j
public class EsServer {
@Autowired
private EsUtil esUtil;
private final static String USERSERVER_CHARACTER = "userserver_character";
private final static String SUBJECTDATABASE = "subjectdatabase";
public Result<?> getInformation(String index, String id){
SubjectInfoVo subjectInfo = esUtil.getInfoByid(index,id, SubjectInfoVo.class);
return Result.OK(subjectInfo);
}
public Result<?> getCharacterBaike(String uid, String name){
UserServerCharacterVo vo = esUtil.getCharacterBaike(USERSERVER_CHARACTER, uid, name, UserServerCharacterVo.class);
if(vo == null)
return Result.OK("该人物没有详情信息", null);
return Result.OK(vo);
}
public Result<?> getRelatedReportsList(RelatedReportsVo relatedReportsVo){
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
MultiMatchQueryBuilder multiMatchQueryBuilder = QueryBuilders.multiMatchQuery(relatedReportsVo.getKeyword(), "title", "content", "summary");
searchSourceBuilder.query(multiMatchQueryBuilder);
searchSourceBuilder.sort("publishDate", SortOrder.DESC);
//高亮
//HighlightBuilder highlightBuilder = new HighlightBuilder();
Page<SubjectInfoVo> page = null;
try {
page = esUtil.queryPage(SUBJECTDATABASE, searchSourceBuilder, SubjectInfoVo.class, 1, 10);
} catch (IOException e) {
e.printStackTrace();
}
return Result.OK(page);
}
}
......@@ -30,11 +30,6 @@ public class CharacterDetailsServiceImpl extends ServiceImpl<CharacterDetailsMap
@Autowired
CharacterDetailsMapper characterDetailsMapper;
@Autowired
private EsUtil esUtil;
private final static String USERSERVER_CHARACTER = "userserver_character";
@Override
public Result<?> informationList(DetailsListVo detailsListVo) {
......@@ -66,18 +61,4 @@ public class CharacterDetailsServiceImpl extends ServiceImpl<CharacterDetailsMap
return Result.OK(page);
}
@Override
public Result<?> getInformation(String articleIndex, String articleId) {
SubjectInfoVo subjectInfo = esUtil.getInfoByid(articleIndex,articleId, SubjectInfoVo.class);
return Result.OK(subjectInfo);
}
@Override
public Result<?> getCharacterBaike(String uid, String name) {
UserServerCharacterVo vo = esUtil.getCharacterBaike(USERSERVER_CHARACTER, uid, name, UserServerCharacterVo.class);
if(vo == null)
return Result.OK("该人物没有详情信息", null);
return Result.OK(vo);
}
}
......@@ -6,10 +6,13 @@
<select id="getList" resultType="com.zzsn.leaderbase.vo.CharacterVo">
select * from (
select a.id,a.uid,a.name,a.sex,a.birthplace,a.birthday,a.native_place,a.school,a.speciality,a.education,a.expert_occupation,a.head_sculpture,a.biographical_notes,a.category,a.award_records,a.part_time_job,a.research_field,a.evaluate,a.status,b.company_original,b.department_original,b.duty_original,b.company,b.department,b.duty,b.take_office_time,b.take_office_time_end,b.take_office_status,b.change_url,b.duties_update_time,b.duties_update_reason,b.check_status,b.check_result,b.article_id,b.article_title,b.update_desc,b.original_id,b.new_id,b.merge_status,a.create_by,a.create_time,a.update_by,a.update_time
select a.id,a.uid,a.name,a.sex,a.birthplace,a.birthday,a.native_place,a.school,a.speciality,a.education,a.expert_occupation,a.head_sculpture,a.biographical_notes,a.category,a.award_records,a.part_time_job,a.research_field,a.evaluate,a.status,
b.type_id,c.type_name,b.company_original,b.department_original,b.duty_original,b.company,b.department,b.duty,b.take_office_time,b.take_office_time_end,b.take_office_status,b.change_url,b.duties_update_time,b.duties_update_reason,b.check_status,b.check_result,b.article_id,b.article_title,b.update_desc,b.original_id,b.new_id,b.merge_status,a.create_by,a.create_time,a.update_by,a.update_time
from character_basic_info a
LEFT JOIN character_change_info b
INNER JOIN character_change_info b
on a.id = b.id
LEFT JOIN character_category_structure c
ON b.type_id = c.id
where 1 = 1
and (b.status != 0 or b.status IS NULL)
<if test="name != null and name != ''">
......@@ -30,7 +33,9 @@
<if test="category != null and category != ''">
AND a.category = #{category}
</if>
<if test="typeId != null and typeId != ''">
AND b.type_id = #{typeId}
</if>
)t1
<if test="order != null and order != ''">
ORDER BY ${column} ${order}
......@@ -43,7 +48,7 @@
<select id="getCount" resultType="int">
SELECT count(1)
from character_basic_info a
LEFT JOIN character_change_info b
INNER JOIN character_change_info b
on a.id = b.id
where 1 = 1
and (b.status != 0 or b.status IS NULL)
......@@ -65,15 +70,21 @@
<if test="category != null and category != ''">
AND a.category = #{category}
</if>
<if test="typeId != null and typeId != ''">
AND b.type_id = #{typeId}
</if>
</select>
<select id="checkList" resultType="com.zzsn.leaderbase.vo.CharacterVo">
select a.id,a.uid,a.name,a.sex,a.birthplace,a.birthday,a.native_place,a.school,a.speciality,a.education,a.expert_occupation,a.head_sculpture,a.biographical_notes,a.category,a.award_records,a.part_time_job,a.research_field,a.evaluate,a.status,b.company_original,b.department_original,b.duty_original,b.company,b.department,b.duty,b.take_office_time,b.take_office_time_end,b.take_office_status,b.change_url,b.duties_update_time,b.duties_update_reason,b.check_status,b.check_result,b.article_id,b.article_title,b.update_desc,b.original_id,b.new_id,b.merge_status,a.create_by,a.create_time,a.update_by,a.update_time
select a.id,a.uid,a.name,a.sex,a.birthplace,a.birthday,a.native_place,a.school,a.speciality,a.education,a.expert_occupation,a.head_sculpture,a.biographical_notes,a.category,a.award_records,a.part_time_job,a.research_field,a.evaluate,a.status,
b.type_id,c.type_name,b.company_original,b.department_original,b.duty_original,b.company,b.department,b.duty,b.take_office_time,b.take_office_time_end,b.take_office_status,b.change_url,b.duties_update_time,b.duties_update_reason,b.check_status,b.check_result,b.article_id,b.article_title,b.update_desc,b.original_id,b.new_id,b.merge_status,a.create_by,a.create_time,a.update_by,a.update_time
from character_basic_info a
LEFT JOIN character_change_info b
INNER JOIN character_change_info b
on a.id = b.id
LEFT JOIN character_category_structure c
ON b.type_id = c.id
where 1 = 1
and (b.status != 0 or b.status IS NULL)
AND b.article_id like '%${articleId}%'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论