提交 af2be853 作者: 925993793@qq.com

自定义专题-逻辑调整

上级 07e846b3
...@@ -16,7 +16,7 @@ import com.zzsn.event.service.*; ...@@ -16,7 +16,7 @@ import com.zzsn.event.service.*;
import com.zzsn.event.util.*; import com.zzsn.event.util.*;
import com.zzsn.event.util.user.AuthUtil; import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.EventDataCondition; import com.zzsn.event.vo.InfoDataSearchCondition;
import com.zzsn.event.vo.LabelModelVo; import com.zzsn.event.vo.LabelModelVo;
import com.zzsn.event.vo.es.AttachmentInfo; import com.zzsn.event.vo.es.AttachmentInfo;
import com.zzsn.event.vo.es.Label; import com.zzsn.event.vo.es.Label;
...@@ -197,7 +197,7 @@ public class FileController { ...@@ -197,7 +197,7 @@ public class FileController {
* @date 2024/12/25 * @date 2024/12/25
*/ */
@PostMapping("/exportXls") @PostMapping("/exportXls")
public void exportXls(@RequestBody EventDataCondition searchCondition, HttpServletResponse response) { public void exportXls(@RequestBody InfoDataSearchCondition searchCondition, HttpServletResponse response) {
int count = esService.getCount(searchCondition); int count = esService.getCount(searchCondition);
if (count > 0) { if (count > 0) {
String subjectId = searchCondition.getSubjectId(); String subjectId = searchCondition.getSubjectId();
...@@ -270,7 +270,7 @@ public class FileController { ...@@ -270,7 +270,7 @@ public class FileController {
* @date 2024/12/25 * @date 2024/12/25
*/ */
@PostMapping("/exportDoc") @PostMapping("/exportDoc")
public void exportDoc(@RequestBody EventDataCondition searchCondition, HttpServletResponse response) { public void exportDoc(@RequestBody InfoDataSearchCondition searchCondition, HttpServletResponse response) {
OutputStream outputstream = null; OutputStream outputstream = null;
ByteArrayOutputStream bos = null; ByteArrayOutputStream bos = null;
try { try {
...@@ -321,7 +321,7 @@ public class FileController { ...@@ -321,7 +321,7 @@ public class FileController {
} }
private byte[] getBytes(EventDataCondition searchCondition, Integer pageSize) { private byte[] getBytes(InfoDataSearchCondition searchCondition, Integer pageSize) {
String[] fetchFields = new String[]{"score", "title", "titleRaw", "summary", "summaryRaw", "content", "contentRaw", "author", "origin", "publishDate", "sourceAddress", "classificationType", "hitWords", "labels"}; String[] fetchFields = new String[]{"score", "title", "titleRaw", "summary", "summaryRaw", "content", "contentRaw", "author", "origin", "publishDate", "sourceAddress", "classificationType", "hitWords", "labels"};
searchCondition.setFetchFields(fetchFields); searchCondition.setFetchFields(fetchFields);
searchCondition.setPageSize(pageSize); searchCondition.setPageSize(pageSize);
......
package com.zzsn.event.controller; package com.zzsn.event.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Assert;
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.obs.services.model.PutObjectResult; import com.obs.services.model.PutObjectResult;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
...@@ -22,7 +16,6 @@ import com.zzsn.event.util.*; ...@@ -22,7 +16,6 @@ import com.zzsn.event.util.*;
import com.zzsn.event.util.user.AuthUtil; import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.DisplayInfo;
import com.zzsn.event.vo.es.SpecialInformation; import com.zzsn.event.vo.es.SpecialInformation;
import com.zzsn.event.xxljob.entity.XxlJobInfo; import com.zzsn.event.xxljob.entity.XxlJobInfo;
import com.zzsn.event.xxljob.service.IXxlJobInfoService; import com.zzsn.event.xxljob.service.IXxlJobInfoService;
...@@ -31,13 +24,6 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -31,13 +24,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
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;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -53,7 +39,6 @@ import java.time.format.DateTimeFormatter; ...@@ -53,7 +39,6 @@ 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;
/** /**
* 平台事件管理页 * 平台事件管理页
...@@ -610,20 +595,33 @@ public class SubjectManageController { ...@@ -610,20 +595,33 @@ public class SubjectManageController {
*/ */
@PostMapping("/bindInfoSourceLabel") @PostMapping("/bindInfoSourceLabel")
public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) { public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) {
if (StringUtils.isNotEmpty(subjectSourceTagVO.getSubjectId())) { String subjectId = subjectSourceTagVO.getSubjectId();
if (StringUtils.isNotEmpty(subjectId)) {
return Result.FAIL("专题id不能为空"); return Result.FAIL("专题id不能为空");
} }
if (CollectionUtils.isEmpty(subjectSourceTagVO.getLabelCodes()) && CollectionUtils.isEmpty(subjectSourceTagVO.getLabelItemCodes())) { List<String> labelCodes = subjectSourceTagVO.getLabelCodes();
List<String> labelItemCodes = subjectSourceTagVO.getLabelItemCodes();
if (CollectionUtils.isEmpty(labelCodes) && CollectionUtils.isEmpty(labelItemCodes)) {
return Result.FAIL("参数不全"); return Result.FAIL("参数不全");
} }
String subjectId = subjectSourceTagVO.getSubjectId();
List<String> sourceIds = CollectionUtils.isNotEmpty(subjectSourceTagVO.getLabelCodes()) ? subjectSourceTagVO.getLabelCodes() : subjectSourceTagVO.getLabelItemCodes();
List<SubjectInfoSourceMap> dataList = new ArrayList<>(); List<SubjectInfoSourceMap> dataList = new ArrayList<>();
for (String sourceId : sourceIds) { if (CollectionUtils.isNotEmpty(labelCodes)) {
SubjectInfoSourceMap subjectInfoSourceMap = new SubjectInfoSourceMap(); for (String labelCode : labelCodes) {
subjectInfoSourceMap.setSubjectId(subjectId); SubjectInfoSourceMap subjectInfoSourceMap = new SubjectInfoSourceMap();
subjectInfoSourceMap.setSourceId(sourceId); subjectInfoSourceMap.setSubjectId(subjectId);
dataList.add(subjectInfoSourceMap); subjectInfoSourceMap.setSourceId(labelCode);
subjectInfoSourceMap.setType(6);
dataList.add(subjectInfoSourceMap);
}
}
if (CollectionUtils.isNotEmpty(labelItemCodes)) {
for (String labelItemCode : labelItemCodes) {
SubjectInfoSourceMap subjectInfoSourceMap = new SubjectInfoSourceMap();
subjectInfoSourceMap.setSubjectId(subjectId);
subjectInfoSourceMap.setSourceId(labelItemCode);
subjectInfoSourceMap.setType(7);
dataList.add(subjectInfoSourceMap);
}
} }
subjectInfoSourceMapService.saveBatch(dataList); subjectInfoSourceMapService.saveBatch(dataList);
return Result.OK(); return Result.OK();
...@@ -631,7 +629,24 @@ public class SubjectManageController { ...@@ -631,7 +629,24 @@ public class SubjectManageController {
/** /**
* 信息源分页列表(专题绑定定向信息源时使用) * 专题绑定的定向信息源分页列表(专题绑定定向信息源时使用-研究中心)
*
* @param subjectId 专题id
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2025/1/4
*/
@GetMapping("/subjectBindDirectSourcePageList")
public Result<?> subjectBindDirectSourcePageList(@RequestParam String subjectId,
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize) {
IPage<Map<String, Object>> page = infoSourceService.subjectBindDirectSourcePageList(subjectId, pageNo, pageSize);
return Result.OK(page);
}
/**
* 信息源分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -648,7 +663,7 @@ public class SubjectManageController { ...@@ -648,7 +663,7 @@ public class SubjectManageController {
} }
/** /**
* 信息源下栏目分页列表(专题绑定定向信息源时使用) * 信息源下栏目分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -665,7 +680,7 @@ public class SubjectManageController { ...@@ -665,7 +680,7 @@ public class SubjectManageController {
} }
/** /**
* 添加定向信息源(专题绑定定向信息源时使用) * 添加定向信息源(专题绑定定向信息源时使用-研究中心)
* *
* @param subjectSourceVO 参数 * @param subjectSourceVO 参数
* @author lkg * @author lkg
...@@ -690,7 +705,7 @@ public class SubjectManageController { ...@@ -690,7 +705,7 @@ public class SubjectManageController {
/** /**
* 新增信息源 * 新增信息源-研究中心
* *
* @param subjectInfoSourceMiddleMap 参数 * @param subjectInfoSourceMiddleMap 参数
* @author lkg * @author lkg
...@@ -716,7 +731,7 @@ public class SubjectManageController { ...@@ -716,7 +731,7 @@ public class SubjectManageController {
} }
/** /**
* 信息源导入模板下载 * 信息源导入模板下载-研究中心
* *
* @author lkg * @author lkg
* @date 2024/06/21 * @date 2024/06/21
...@@ -728,9 +743,9 @@ public class SubjectManageController { ...@@ -728,9 +743,9 @@ public class SubjectManageController {
} }
/** /**
* 导入信息源 * 导入信息源-研究中心
* *
* @param file excel文件 * @param file excel文件
* @param subjectId 专题id * @param subjectId 专题id
* @author lkg * @author lkg
* @date 2025/1/4 * @date 2025/1/4
...@@ -800,14 +815,14 @@ public class SubjectManageController { ...@@ -800,14 +815,14 @@ public class SubjectManageController {
String replace = siteUri.replace("https://", "").replace("http://", ""); String replace = siteUri.replace("https://", "").replace("http://", "");
if (replace.equalsIgnoreCase(domain) || replace.equalsIgnoreCase(domain + "/")) { if (replace.equalsIgnoreCase(domain) || replace.equalsIgnoreCase(domain + "/")) {
List<InfoSource> infoSources = matchInfoSourceByUri(domain, 2); List<InfoSource> infoSources = matchInfoSourceByUri(domain, 2);
supplyData(subjectId, webSiteName,siteUri, mapDataSet, configDataSet, infoSources); supplyData(subjectId, webSiteName, siteUri, mapDataSet, configDataSet, infoSources);
} else { } else {
List<InfoSource> infoSources = matchInfoSourceByUri(siteUri, 1); List<InfoSource> infoSources = matchInfoSourceByUri(siteUri, 1);
supplyData(subjectId, webSiteName,siteUri, mapDataSet, configDataSet, infoSources); supplyData(subjectId, webSiteName, siteUri, mapDataSet, configDataSet, infoSources);
} }
} else { } else {
List<InfoSource> infoSources = matchInfoSourceByUri(siteUri, 1); List<InfoSource> infoSources = matchInfoSourceByUri(siteUri, 1);
supplyData(subjectId, webSiteName,siteUri, mapDataSet, configDataSet, infoSources); supplyData(subjectId, webSiteName, siteUri, mapDataSet, configDataSet, infoSources);
} }
} }
...@@ -849,7 +864,7 @@ public class SubjectManageController { ...@@ -849,7 +864,7 @@ public class SubjectManageController {
* @date 2024/12/26 * @date 2024/12/26
*/ */
@PostMapping("/recommendSourceList") @PostMapping("/recommendSourceList")
public Result<?> recommendSourceList(@RequestBody EventDataCondition searchCondition) { public Result<?> recommendSourceList(@RequestBody InfoDataSearchCondition searchCondition) {
List<InfoSource> infoSources = new ArrayList<>(); List<InfoSource> infoSources = new ArrayList<>();
String[] fetchFields = new String[]{"id", "sid"}; String[] fetchFields = new String[]{"id", "sid"};
searchCondition.setFetchFields(fetchFields); searchCondition.setFetchFields(fetchFields);
...@@ -972,7 +987,7 @@ public class SubjectManageController { ...@@ -972,7 +987,7 @@ public class SubjectManageController {
private List<StatisticsKeyWordVo> extractWords(String words) { private List<StatisticsKeyWordVo> extractWords(String words) {
List<StatisticsKeyWordVo> wordList = new ArrayList<>(); List<StatisticsKeyWordVo> wordList = new ArrayList<>();
String[] fetchFields = new String[]{"title", "content"}; String[] fetchFields = new String[]{"title", "content"};
EventDataCondition searchCondition = new EventDataCondition(); InfoDataSearchCondition searchCondition = new InfoDataSearchCondition();
searchCondition.setFetchFields(fetchFields); searchCondition.setFetchFields(fetchFields);
List<SearchWordVO> searchWordList = new ArrayList<>(); List<SearchWordVO> searchWordList = new ArrayList<>();
SearchWordVO searchWord = new SearchWordVO(); SearchWordVO searchWord = new SearchWordVO();
...@@ -983,7 +998,7 @@ public class SubjectManageController { ...@@ -983,7 +998,7 @@ public class SubjectManageController {
searchWordList.add(searchWord); searchWordList.add(searchWord);
searchCondition.setSearchWordList(searchWordList); searchCondition.setSearchWordList(searchWordList);
try { try {
IPage<SpecialInformation> page = esService.pageListByCondtion(searchCondition, null); IPage<SpecialInformation> page = esService.pageListByCondition(searchCondition, null);
if (page.getTotal() > 0) { if (page.getTotal() > 0) {
StringBuilder text = new StringBuilder(); StringBuilder text = new StringBuilder();
List<SpecialInformation> records = page.getRecords(); List<SpecialInformation> records = page.getRecords();
......
...@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -63,7 +62,7 @@ public class InformationController { ...@@ -63,7 +62,7 @@ public class InformationController {
* @date 2024/5/6 * @date 2024/5/6
*/ */
@PostMapping("/collectPageList") @PostMapping("/collectPageList")
public Result<?> collectPageList(@RequestBody EventDataCondition eventDataCondition) { public Result<?> collectPageList(@RequestBody InfoDataSearchCondition eventDataCondition) {
IPage<EventDataVO> pageList = informationService.collectPageList(eventDataCondition); IPage<EventDataVO> pageList = informationService.collectPageList(eventDataCondition);
return Result.OK(pageList); return Result.OK(pageList);
} }
...@@ -198,7 +197,7 @@ public class InformationController { ...@@ -198,7 +197,7 @@ public class InformationController {
* @date 2024/5/6 * @date 2024/5/6
*/ */
@PostMapping("/subjectPageList") @PostMapping("/subjectPageList")
public Result<?> subjectPageList(@RequestBody EventDataCondition subjectInfoVo) { public Result<?> subjectPageList(@RequestBody InfoDataSearchCondition subjectInfoVo) {
UserVo userVo = AuthUtil.getLoginUser(); UserVo userVo = AuthUtil.getLoginUser();
IPage<DisplayInfo> pageList = informationService.subjectPageList(userVo, subjectInfoVo); IPage<DisplayInfo> pageList = informationService.subjectPageList(userVo, subjectInfoVo);
return Result.OK(pageList); return Result.OK(pageList);
......
...@@ -167,7 +167,7 @@ public class RelationBindController { ...@@ -167,7 +167,7 @@ public class RelationBindController {
* @author lkg * @author lkg
* @date 2024/12/18 * @date 2024/12/18
*/ */
@GetMapping(value = "/bindInfoSourceGroup") @GetMapping(value = "/bindInfoSourceGroupList")
public Result<?> bindInfoSource(@RequestParam(name = "subjectId") String subjectId) { public Result<?> bindInfoSource(@RequestParam(name = "subjectId") String subjectId) {
JSONObject infoSourceGroupPages = subjectInfoSourceMapService.bindInfoSource(subjectId); JSONObject infoSourceGroupPages = subjectInfoSourceMapService.bindInfoSource(subjectId);
return Result.OK(infoSourceGroupPages); return Result.OK(infoSourceGroupPages);
......
...@@ -53,7 +53,7 @@ public class StatisticalAnalysisController { ...@@ -53,7 +53,7 @@ public class StatisticalAnalysisController {
* @date 2024/12/26 * @date 2024/12/26
*/ */
@GetMapping("overview") @GetMapping("overview")
public Result<OverviewAnalysisVO> overviewAnalysis(@RequestBody EventDataCondition searchCondition) { public Result<OverviewAnalysisVO> overviewAnalysis(@RequestBody InfoDataSearchCondition searchCondition) {
OverviewAnalysisVO overviewAnalysisVO = new OverviewAnalysisVO(); OverviewAnalysisVO overviewAnalysisVO = new OverviewAnalysisVO();
Subject subject = subjectService.getById(searchCondition.getSubjectId()); Subject subject = subjectService.getById(searchCondition.getSubjectId());
overviewAnalysisVO.setSubjectName(subject.getSubjectName()); overviewAnalysisVO.setSubjectName(subject.getSubjectName());
...@@ -98,7 +98,7 @@ public class StatisticalAnalysisController { ...@@ -98,7 +98,7 @@ public class StatisticalAnalysisController {
* @date 2024/12/25 * @date 2024/12/25
*/ */
@PostMapping("/dataTrend") @PostMapping("/dataTrend")
public Result<List<CountVO>> dataTrend(@RequestBody EventDataCondition searchCondition) { public Result<List<CountVO>> dataTrend(@RequestBody InfoDataSearchCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>(); List<CountVO> dataList = new ArrayList<>();
if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) { if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) {
dataList = esService.groupByDate(searchCondition); dataList = esService.groupByDate(searchCondition);
...@@ -140,7 +140,7 @@ public class StatisticalAnalysisController { ...@@ -140,7 +140,7 @@ public class StatisticalAnalysisController {
* @date 2024/12/26 * @date 2024/12/26
*/ */
@PostMapping("/dataType/distribution") @PostMapping("/dataType/distribution")
public Result<?> dataTypeDistribution(@RequestBody EventDataCondition searchCondition) { public Result<?> dataTypeDistribution(@RequestBody InfoDataSearchCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>(); List<CountVO> dataList = new ArrayList<>();
if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) { if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) {
dataList = esService.groupByClassificationType(searchCondition); dataList = esService.groupByClassificationType(searchCondition);
...@@ -168,7 +168,7 @@ public class StatisticalAnalysisController { ...@@ -168,7 +168,7 @@ public class StatisticalAnalysisController {
* @date 2024/12/26 * @date 2024/12/26
*/ */
@PostMapping("/dataSource") @PostMapping("/dataSource")
public Result<?> dataSource(@RequestBody EventDataCondition searchCondition) { public Result<?> dataSource(@RequestBody InfoDataSearchCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>(); List<CountVO> dataList = new ArrayList<>();
List<Label> bindLabelList = bindLabelList(searchCondition.getSubjectId()); List<Label> bindLabelList = bindLabelList(searchCondition.getSubjectId());
if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) { if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) {
...@@ -200,7 +200,7 @@ public class StatisticalAnalysisController { ...@@ -200,7 +200,7 @@ public class StatisticalAnalysisController {
* @date 2024/12/26 * @date 2024/12/26
*/ */
@PostMapping("/infoSource/dataCount/top") @PostMapping("/infoSource/dataCount/top")
public Result<?> infoSourceDataCountTop(@RequestBody EventDataCondition searchCondition) { public Result<?> infoSourceDataCountTop(@RequestBody InfoDataSearchCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>(); List<CountVO> dataList = new ArrayList<>();
if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) { if (CollectionUtils.isEmpty(searchCondition.getIds()) && searchCondition.getNum() == null) {
dataList = esService.groupBySourceId(searchCondition); dataList = esService.groupBySourceId(searchCondition);
......
...@@ -592,7 +592,7 @@ public class EsService { ...@@ -592,7 +592,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/5/6 * @date 2024/5/6
*/ */
public IPage<EventDataVO> collectPageList(EventDataCondition eventDataCondition) { public IPage<EventDataVO> collectPageList(InfoDataSearchCondition eventDataCondition) {
SearchRequest searchRequest = new SearchRequest(Constants.COLLECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.COLLECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数 //设置分页参数
...@@ -713,7 +713,7 @@ public class EsService { ...@@ -713,7 +713,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/5/6 * @date 2024/5/6
*/ */
public IPage<SpecialInformation> pageListByCondtion(EventDataCondition searchCondition,List<String> subjectIdList) throws IOException { public IPage<SpecialInformation> pageListByCondition(InfoDataSearchCondition searchCondition, List<String> subjectIdList) throws IOException {
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数 //设置分页参数
...@@ -1065,7 +1065,7 @@ public class EsService { ...@@ -1065,7 +1065,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/7/8 * @date 2024/7/8
*/ */
public int getCount(EventDataCondition searchCondition) { public int getCount(InfoDataSearchCondition searchCondition) {
int count = 0; int count = 0;
List<String> ids = searchCondition.getIds(); List<String> ids = searchCondition.getIds();
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
...@@ -1098,7 +1098,7 @@ public class EsService { ...@@ -1098,7 +1098,7 @@ public class EsService {
* *
* @param searchCondition 查询条件封装 * @param searchCondition 查询条件封装
*/ */
public List<SpecialInformation> informationList(EventDataCondition searchCondition) { public List<SpecialInformation> informationList(InfoDataSearchCondition searchCondition) {
String[] indexArr = EsIndexUtil.getIndexIntervalYear(Constants.SUBJECT_INDEX, searchCondition.getStartTime(), searchCondition.getEndTime()); String[] indexArr = EsIndexUtil.getIndexIntervalYear(Constants.SUBJECT_INDEX, searchCondition.getStartTime(), searchCondition.getEndTime());
SearchRequest searchRequest = new SearchRequest(indexArr); SearchRequest searchRequest = new SearchRequest(indexArr);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -1386,7 +1386,7 @@ public class EsService { ...@@ -1386,7 +1386,7 @@ public class EsService {
*/ */
public List<CountVO> getSubjectDatabaseByTime(String startDate, String endDate, String type, String subjectId, Integer isFreeCheck, Integer checkStatus) { public List<CountVO> getSubjectDatabaseByTime(String startDate, String endDate, String type, String subjectId, Integer isFreeCheck, Integer checkStatus) {
//构建查询(聚合)条件 //构建查询(聚合)条件
EventDataCondition searchCondition = new EventDataCondition(); InfoDataSearchCondition searchCondition = new InfoDataSearchCondition();
searchCondition.setSubjectId(subjectId); searchCondition.setSubjectId(subjectId);
searchCondition.setStartTime(startDate); searchCondition.setStartTime(startDate);
searchCondition.setEndTime(endDate); searchCondition.setEndTime(endDate);
...@@ -1403,7 +1403,7 @@ public class EsService { ...@@ -1403,7 +1403,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/30 * @date 2024/12/30
*/ */
public List<CountVO> overView(EventDataCondition searchCondition) { public List<CountVO> overView(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>(); List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -1458,7 +1458,7 @@ public class EsService { ...@@ -1458,7 +1458,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/26 * @date 2024/12/26
*/ */
public List<CountVO> groupByDate(EventDataCondition searchCondition) { public List<CountVO> groupByDate(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>(); List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -1515,7 +1515,7 @@ public class EsService { ...@@ -1515,7 +1515,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/26 * @date 2024/12/26
*/ */
public List<CountVO> groupByClassificationType(EventDataCondition searchCondition) { public List<CountVO> groupByClassificationType(InfoDataSearchCondition searchCondition) {
return groupByTerm(searchCondition, "group", "classificationType",false); return groupByTerm(searchCondition, "group", "classificationType",false);
} }
...@@ -1526,7 +1526,7 @@ public class EsService { ...@@ -1526,7 +1526,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/26 * @date 2024/12/26
*/ */
public List<CountVO> groupBySourceId(EventDataCondition searchCondition) { public List<CountVO> groupBySourceId(InfoDataSearchCondition searchCondition) {
return groupByTerm(searchCondition, "groupSid", "sid.keyword", false); return groupByTerm(searchCondition, "groupSid", "sid.keyword", false);
} }
...@@ -1537,7 +1537,7 @@ public class EsService { ...@@ -1537,7 +1537,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/26 * @date 2024/12/26
*/ */
public List<CountVO> groupByInfoSourceTag(EventDataCondition searchCondition) { public List<CountVO> groupByInfoSourceTag(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>(); List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -1592,7 +1592,7 @@ public class EsService { ...@@ -1592,7 +1592,7 @@ public class EsService {
//构建查询语句 //构建查询语句
List<String> subjectIds = new ArrayList<>(); List<String> subjectIds = new ArrayList<>();
subjectIds.add(subjectId); subjectIds.add(subjectId);
BoolQueryBuilder boolQuery = buildQuery(new EventDataCondition(), subjectIds); BoolQueryBuilder boolQuery = buildQuery(new InfoDataSearchCondition(), subjectIds);
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("groupKeywords") TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("groupKeywords")
.field("keyWordsList.keyword") .field("keyWordsList.keyword")
...@@ -1630,7 +1630,7 @@ public class EsService { ...@@ -1630,7 +1630,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/27 * @date 2024/12/27
*/ */
private List<CountVO> groupByTerm(EventDataCondition searchCondition, String groupName, String field, boolean sort) { private List<CountVO> groupByTerm(InfoDataSearchCondition searchCondition, String groupName, String field, boolean sort) {
List<CountVO> list = new ArrayList<>(); List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -1677,7 +1677,7 @@ public class EsService { ...@@ -1677,7 +1677,7 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/12/25 * @date 2024/12/25
*/ */
private BoolQueryBuilder buildQuery(EventDataCondition searchCondition, List<String> subjectIdList) { private BoolQueryBuilder buildQuery(InfoDataSearchCondition searchCondition, List<String> subjectIdList) {
//创建查询对象 //创建查询对象
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
if (CollectionUtils.isNotEmpty(subjectIdList)) { if (CollectionUtils.isNotEmpty(subjectIdList)) {
......
...@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description: 信息源表 * @Description: 信息源表
...@@ -71,26 +72,37 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -71,26 +72,37 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
/** /**
* 信息源分页列表(专题绑定定向信息源时使用) * 专题绑定的定向信息源分页列表(专题绑定定向信息源时使用-研究中心)
*
* @param subjectId 专题id
* @author lkg
* @date 2025/1/6
*/
Page<Map<String, Object>> subjectBindDirectInfoSourceList(@Param("subjectId") String subjectId, Page<Map<String, Object>> page);
/**
* 信息源分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param page 分页参数 * @param page 分页参数
* @author lkg * @author lkg
* @date 2025/1/4 * @date 2025/1/4
*/ */
Page<String> directSourceList(@Param("searchWord") String searchWord, Page<String> page); Page<String> infoSourcePageList(@Param("searchWord") String searchWord, Page<String> page);
/** /**
* 信息源下栏目分页列表(专题绑定定向信息源时使用) * 信息源下栏目分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
* @param page 分页参数 * @param page 分页参数
* @author lkg * @author lkg
* @date 2025/1/4 * @date 2025/1/4
*/ */
Page<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName, Page<InfoSource> page); Page<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName, Page<InfoSource> page);
/** /**
* 信息源下栏目列表(专题绑定定向信息源时使用) * 信息源下栏目列表(专题绑定定向信息源时使用-研究中心)
* *
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
* @author lkg * @author lkg
......
...@@ -205,7 +205,24 @@ ...@@ -205,7 +205,24 @@
</select> </select>
<select id="directSourceList" resultType="String"> <select id="subjectBindDirectInfoSourceList" resultType="Map">
select a.*
from (
select iso.web_site_name, 1 as `status`
from info_source iso
inner join subject_info_source_map sm on iso.id = sm.source_id and sm.type = #{subjectId}
where sm.subject_id = '1'
group by iso.web_site_name
union
select info_source_name as web_site_name, 0 as `status`
from subject_info_source_middle_map
where subject_id = #{subjectId}
group by info_source_name
) a
order by status desc ,web_site_name asc
</select>
<select id="infoSourcePageList" resultType="String">
select iso.web_site_name select iso.web_site_name
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 != ''">
...@@ -219,8 +236,9 @@ ...@@ -219,8 +236,9 @@
</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.site_name, iso.site_uri
from info_source iso where iso.web_site_name = #{webSiteName} from info_source iso
where iso.web_site_name = #{webSiteName}
order by iso.create_time order by iso.create_time
</select> </select>
</mapper> </mapper>
...@@ -7,6 +7,7 @@ import com.zzsn.event.vo.InfoSourceVo; ...@@ -7,6 +7,7 @@ import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.entity.InfoSource; import com.zzsn.event.entity.InfoSource;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description: 信息源表 * @Description: 信息源表
...@@ -54,7 +55,18 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -54,7 +55,18 @@ public interface IInfoSourceService extends IService<InfoSource> {
/** /**
* 信息源分页列表(专题绑定定向信息源时使用) * 专题绑定的定向信息源分页列表(专题绑定定向信息源时使用-研究中心)
*
* @param subjectId 专题id
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2025/1/4
*/
IPage<Map<String, Object>> subjectBindDirectSourcePageList(String subjectId, Integer pageNo, Integer pageSize);
/**
* 信息源分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -65,7 +77,7 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -65,7 +77,7 @@ public interface IInfoSourceService extends IService<InfoSource> {
IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize); IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize);
/** /**
* 信息源下栏目分页列表(专题绑定定向信息源时使用) * 信息源下栏目分页列表(专题绑定定向信息源时使用-研究中心)
* *
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -76,7 +88,7 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -76,7 +88,7 @@ public interface IInfoSourceService extends IService<InfoSource> {
IPage<InfoSource> directSourceColumnPageList(String webSiteName, Integer pageNo, Integer pageSize); IPage<InfoSource> directSourceColumnPageList(String webSiteName, Integer pageNo, Integer pageSize);
/** /**
* 信息源下栏目列表(专题绑定定向信息源时使用) * 信息源下栏目列表(专题绑定定向信息源时使用-研究中心)
* *
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
* @author lkg * @author lkg
......
...@@ -6,7 +6,6 @@ import com.zzsn.event.entity.ClbFileOperationLog; ...@@ -6,7 +6,6 @@ import com.zzsn.event.entity.ClbFileOperationLog;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.DisplayInfo; import com.zzsn.event.vo.es.DisplayInfo;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,7 +25,7 @@ public interface InformationService { ...@@ -26,7 +25,7 @@ public interface InformationService {
* @author lkg * @author lkg
* @date 2024/5/6 * @date 2024/5/6
*/ */
IPage<EventDataVO> collectPageList(EventDataCondition eventDataCondition); IPage<EventDataVO> collectPageList(InfoDataSearchCondition eventDataCondition);
/** /**
* 专题库资讯分页列表 * 专题库资讯分页列表
...@@ -36,7 +35,7 @@ public interface InformationService { ...@@ -36,7 +35,7 @@ public interface InformationService {
* @author lkg * @author lkg
* @date 2024/5/6 * @date 2024/5/6
*/ */
IPage<DisplayInfo> subjectPageList(UserVo userVo, EventDataCondition subjectInfo); IPage<DisplayInfo> subjectPageList(UserVo userVo, InfoDataSearchCondition subjectInfo);
/** /**
* 资讯详情 * 资讯详情
......
...@@ -108,9 +108,15 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou ...@@ -108,9 +108,15 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
} }
@Override @Override
public IPage<Map<String, Object>> subjectBindDirectSourcePageList(String subjectId, Integer pageNo, Integer pageSize) {
Page<Map<String, Object>> page = new Page<>(pageNo, pageSize);
return baseMapper.subjectBindDirectInfoSourceList(subjectId, page);
}
@Override
public IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize) { public IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize) {
Page<String> page = new Page<>(pageNo, pageSize); Page<String> page = new Page<>(pageNo, pageSize);
return baseMapper.directSourceList(searchWord, page); return baseMapper.infoSourcePageList(searchWord, page);
} }
@Override @Override
......
...@@ -37,8 +37,6 @@ import javax.annotation.Resource; ...@@ -37,8 +37,6 @@ import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -88,12 +86,12 @@ public class InformationServiceImpl implements InformationService { ...@@ -88,12 +86,12 @@ public class InformationServiceImpl implements InformationService {
@Override @Override
public IPage<EventDataVO> collectPageList(EventDataCondition eventDataCondition) { public IPage<EventDataVO> collectPageList(InfoDataSearchCondition eventDataCondition) {
return esService.collectPageList(eventDataCondition); return esService.collectPageList(eventDataCondition);
} }
@Override @Override
public IPage<DisplayInfo> subjectPageList(UserVo userVo,EventDataCondition searchCondition) { public IPage<DisplayInfo> subjectPageList(UserVo userVo, InfoDataSearchCondition searchCondition) {
IPage<DisplayInfo> page = new Page<>(searchCondition.getPageNo(), searchCondition.getPageSize()); IPage<DisplayInfo> page = new Page<>(searchCondition.getPageNo(), searchCondition.getPageSize());
List<String> subjectIdList = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
//判断是否是专题 //判断是否是专题
...@@ -121,7 +119,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -121,7 +119,7 @@ public class InformationServiceImpl implements InformationService {
} }
searchCondition.setLabelIds(relationIds); searchCondition.setLabelIds(relationIds);
try { try {
IPage<SpecialInformation> specialInformationIPage = esService.pageListByCondtion(searchCondition,subjectIdList); IPage<SpecialInformation> specialInformationIPage = esService.pageListByCondition(searchCondition,subjectIdList);
long total = specialInformationIPage.getTotal(); long total = specialInformationIPage.getTotal();
if (total > 0) { if (total > 0) {
List<DisplayInfo> dataList = new ArrayList<>(); List<DisplayInfo> dataList = new ArrayList<>();
......
...@@ -5,7 +5,7 @@ import lombok.Data; ...@@ -5,7 +5,7 @@ import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class EventDataCondition { public class InfoDataSearchCondition {
//专题id/专题分类id //专题id/专题分类id
private String subjectId; private String subjectId;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论