提交 95f969c5 作者: 925993793@qq.com

自定义专题

上级 a7157ff7
package com.zzsn.event.controller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 事件后台管理-事件分类
*
* @author lkg
* @date 2024/4/29
*/
@Slf4j
@Api(tags = "-事件分类")
@RestController
@RequestMapping("/plat/manage/subjectType")
public class EventTypeController {
}
......@@ -296,8 +296,16 @@ public class FileController {
OutputStream outputstream = null;
ByteArrayOutputStream bos = null;
try {
List<SpecialInformation> informationList = esService.exportList(searchCondition);
Map<String, Object> map = formatDocData(informationList, null, searchCondition.getExportType());
String[] fetchFields = null;
Integer exportType = searchCondition.getExportType();
if (exportType == 1) {
fetchFields = new String[]{"id", "title", "summary", "origin", "publishDate", "sourceAddress"};
} else if (exportType == 2) {
fetchFields = new String[]{"id", "title", "content", "origin", "publishDate", "sourceAddress"};
}
searchCondition.setFetchFields(fetchFields);
List<SpecialInformation> informationList = esService.informationList(searchCondition);
Map<String, Object> map = formatDocData(informationList, null, exportType);
Template template = FreeMarkerConfiguration.get().getTemplate("EVENT_DATA_REPORT.ftl", "UTF-8");
bos = new ByteArrayOutputStream();
template.process(map, new OutputStreamWriter(bos));
......@@ -336,6 +344,8 @@ public class FileController {
private byte[] getBytes(EventDataCondition searchCondition, Integer pageSize) {
String[] fetchFields = new String[]{"score", "title", "titleRaw", "summary", "summaryRaw", "content", "contentRaw", "author", "origin", "publishDate", "sourceAddress", "classificationType", "hitWords", "labels"};
searchCondition.setFetchFields(fetchFields);
searchCondition.setPageSize(pageSize);
byte[] bytes = null;
try {
......@@ -348,7 +358,7 @@ public class FileController {
SXSSFWorkbook workbook = new SXSSFWorkbook();
for (int i = 1; ; i++) {
searchCondition.setPageNo(i);
List<SpecialInformation> informationList = esService.exportList(searchCondition);
List<SpecialInformation> informationList = esService.informationList(searchCondition);
log.info("本次循环-{},数据量为-{}", i, informationList.size());
if (CollectionUtils.isEmpty(informationList)) {
break;
......@@ -549,24 +559,24 @@ public class FileController {
String title = Utility.getValueAfterReplaceSpecialWordNotEnter(subjectDataVo.getTitle());
String sourceAddress = subjectDataVo.getSourceAddress();
String origin = subjectDataVo.getOrigin();
String summary = subjectDataVo.getSummary();
if (StringUtils.isNotEmpty(summary)) {
summary = Utility.getValueAfterReplaceSpecialWordNotEnter(Utility.TransferHTML2Text(summary));
}
String publishDate = subjectDataVo.getPublishDate();
String contentStr = subjectDataVo.getContent();
if (StringUtils.isNotEmpty(contentStr)) {
contentStr = Utility.getValueAfterReplaceSpecialWordNotEnter(Utility.TransferHTML2Text(contentStr));
}
String info = StringUtils.isNotEmpty(origin) ? "(来源:" + origin + ",发布时间:" + publishDate + ")" : "(发布时间:" + publishDate + ")";
Map<String, Object> content = new HashMap<>();
content.put("id", rid);
content.put("title", title);
content.put("url", Utility.getValueAfterReplaceSpecialWordNotEnter(sourceAddress));
if (type == 1) {
String summary = subjectDataVo.getSummary();
if (StringUtils.isNotEmpty(summary)) {
summary = Utility.getValueAfterReplaceSpecialWordNotEnter(Utility.TransferHTML2Text(summary));
}
content.put("info", summary + info);
} else {
content.put("info", info);
String contentStr = subjectDataVo.getContent();
if (StringUtils.isNotEmpty(contentStr)) {
contentStr = Utility.getValueAfterReplaceSpecialWordNotEnter(Utility.TransferHTML2Text(contentStr));
}
content.put("contentStr", contentStr);
}
contents.add(content);
......
......@@ -14,6 +14,8 @@ import com.zzsn.event.es.EsService;
import com.zzsn.event.service.*;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
import com.zzsn.event.xxljob.entity.XxlJobInfo;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
......@@ -62,6 +64,8 @@ public class SubjectManageController {
private EsService esService;
@Autowired
SubjectKeywordsGroupRelationService subjectKeywordsGroupRelationService;
@Autowired
private ScoreModelService scoreModelService;
@Value("${hotWords.extractUrl}")
......@@ -92,16 +96,29 @@ public class SubjectManageController {
public Result<?> queryPageListByTypeId(SubjectCondition subjectCondition,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Integer facePublic = subjectCondition.getFacePublic();
if (facePublic == null) {
UserVo loginUser = AuthUtil.getLoginUser();
subjectCondition.setUsername(loginUser.getUsername());
}
IPage<SubjectPage> pageList = subjectService.pageList(subjectCondition, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 推荐关键词
*
* @param files 眼里文章
* @param words 输入词
* @author lkg
* @date 2024/12/26
*/
@PostMapping("/recommendWordList")
public Result<?> recommendWordList(MultipartFile[] files,String words){
//// TODO: 2024/12/24
public Result<?> recommendWordList(MultipartFile[] files, String words) {
// todo
JSONObject jsonObject = new JSONObject();
jsonObject.put("article","12");
jsonObject.put("word","12");
jsonObject.put("article", "12");
jsonObject.put("word", "12");
return Result.OK(jsonObject);
}
......@@ -238,7 +255,6 @@ public class SubjectManageController {
* 专题直接屏蔽的信息源列表(不包括专题屏蔽的信息源组下的信息源)(专题列表页)
*
* @param infoSourceCondition 筛选条件
* @param subjectId 专题id
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
......@@ -246,10 +262,9 @@ public class SubjectManageController {
*/
@GetMapping("/unBindInfoSourceList")
public Result<?> unBindInfoSourceList(InfoSourceCondition infoSourceCondition,
@RequestParam(name = "subjectId", defaultValue = "0") String subjectId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
IPage<InfoSourceVo> pageList = infoSourceService.unBindSourcePageList(infoSourceCondition, subjectId, pageNo, pageSize);
IPage<InfoSourceVo> pageList = infoSourceService.unBindSourcePageList(infoSourceCondition, pageNo, pageSize);
return Result.OK(pageList);
}
......@@ -419,6 +434,33 @@ public class SubjectManageController {
}
/**
* 配置打分模型
*
* @param scoreModelVo 配置信息
* @author lkg
* @date 2024/12/27
*/
@PostMapping("/configScoreModel")
public Result<?> configScoreModel(@RequestBody ScoreModelVo scoreModelVo) {
scoreModelService.addOrUpdate(scoreModelVo, 1);
return Result.OK();
}
/**
* 专题打分模型配置信息详情
*
* @param subjectId 专题id
* @param type 打分模型种类(1:通用 2:专家观点 3:案例)
* @author lkg
* @date 2024/12/27
*/
@GetMapping("/scoreModelInfo")
public Result<?> scoreModelInfo(@RequestParam String subjectId, @RequestParam(defaultValue = "1") String type) {
JSONObject jsonObject = scoreModelService.scoreModelInfo(subjectId, type);
return Result.OK(jsonObject);
}
/**
* 数据资源绑定-专题配置页
*
* @param subjectPage 参数
......@@ -484,7 +526,7 @@ public class SubjectManageController {
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "subjectId", required = false) String subjectId) {
List<CountVO> countVOS = esService.groupByOrigin(subjectId, "publishDate",startDate, endDate, size);
List<CountVO> countVOS = esService.groupByOrigin(subjectId, "publishDate", startDate, endDate, size);
return Result.OK(countVOS);
}
......@@ -528,6 +570,21 @@ public class SubjectManageController {
return Result.OK(resultMap);
}
/*
* 热词词云-专题分析页
*
* @param subjectId
* @param size
* @author lkg
* @date 2024/12/27
*/
@GetMapping("/keywordsCount")
public Result<?> keywordsCount(@RequestParam String subjectId,@RequestParam(defaultValue = "100") Integer size){
Set<String> excludeKeywords = commonService.getExcludeKeywords(subjectId);
List<CountVO> countVOS = esService.keywordsCount(subjectId, new ArrayList<>(excludeKeywords),size);
return Result.OK(countVOS);
}
private void extractHotWords(SubjectPage subjectPage) {
if (StringUtils.isNotEmpty(subjectPage.getYnExtractHotWords()) && "1".equals(subjectPage.getYnExtractHotWords())) {
Map<String, String> param = new HashMap<>();
......
......@@ -9,10 +9,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.SubjectUserCondition;
import com.zzsn.event.enums.LabelTypeEnum;
import com.zzsn.event.es.EsService;
import com.zzsn.event.service.CommonService;
import com.zzsn.event.service.InformationService;
import com.zzsn.event.service.SubjectUserConditionService;
import com.zzsn.event.service.*;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo;
......@@ -47,6 +46,10 @@ public class InformationController {
private CommonService commonService;
@Autowired
private SubjectUserConditionService subjectUserConditionService;
@Autowired
private LabelEntityService labelEntityService;
@Autowired
private SysBaseLabelTypeService sysBaseLabelTypeService;
@Value("${python.judgeDuplicateUrl:}")
private String judgeDuplicateUrl;
......@@ -102,12 +105,12 @@ public class InformationController {
* @date 2024/2/28
*/
@GetMapping("/search/condition/list")
public Result<?> queryInfo(@RequestParam String relationId){
public Result<?> queryInfo(@RequestParam String relationId) {
UserVo user = AuthUtil.getLoginUser();
String userId = user.getId();
LambdaQueryWrapper<SubjectUserCondition> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectUserCondition::getUserId,userId)
.eq(SubjectUserCondition::getRelationId,relationId);
queryWrapper.eq(SubjectUserCondition::getUserId, userId)
.eq(SubjectUserCondition::getRelationId, relationId);
List<SubjectUserCondition> list = subjectUserConditionService.list(queryWrapper);
return Result.OK(list);
}
......@@ -120,7 +123,7 @@ public class InformationController {
* @date 2024/2/28
*/
@PostMapping("/search/condition/modify")
public Result<?> modify(@RequestBody SubjectUserCondition condition){
public Result<?> modify(@RequestBody SubjectUserCondition condition) {
UserVo user = AuthUtil.getLoginUser();
String userId = user.getId();
condition.setUserId(userId);
......@@ -136,7 +139,7 @@ public class InformationController {
* @date 2024/2/29
*/
@GetMapping("/search/condition/delete")
public Result<?> delete(@RequestParam String id){
public Result<?> delete(@RequestParam String id) {
subjectUserConditionService.removeById(id);
return Result.OK();
}
......@@ -149,8 +152,8 @@ public class InformationController {
* @author lkg
* @date 2024/12/24
*/
@GetMapping("/getListBySubjectId")
public Result<?> getListBySubjectId(@RequestParam String subjectId){
@GetMapping("/label/listBySubjectId")
public Result<?> getListBySubjectId(@RequestParam String subjectId) {
List<String> subjectIds = new ArrayList<>();
subjectIds.add(subjectId);
List<LabelModelVo> sysBaseLabelTypeVos = commonService.subjectModelBindLabels(subjectIds);
......@@ -158,8 +161,34 @@ public class InformationController {
}
/**
* 标签下的标签值信息
*
* @param labelVo 筛选条件
* @param pageNo 当前页
* @param pageSize 每页返回条数
* @author lkg
* @date 2024/12/27
*/
@PostMapping("/label/entityList")
public Result<?> entityByLabel(@RequestBody SysLabelVo labelVo,
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize) {
Object list = labelEntityService.pageList(labelVo, pageNo, pageSize);
return Result.OK(list);
}
/**
* 获取企业标签列表-树型结构
*
* @author lkg
* @date 2024/12/27
*/
@GetMapping("/label/companyLabelTree")
public Result<?> companyLabelList() {
List<LabelTypeVO> tree = sysBaseLabelTypeService.labelTypeTree(LabelTypeEnum.ENTERPRISE.getValue());
return Result.OK(tree);
}
/**
* 事件对应专题库的资讯分页列表
......@@ -171,7 +200,7 @@ public class InformationController {
@PostMapping("/subjectPageList")
public Result<?> subjectPageList(@RequestBody EventDataCondition subjectInfoVo) {
UserVo userVo = AuthUtil.getLoginUser();
IPage<DisplayInfo> pageList = informationService.subjectPageList(userVo,subjectInfoVo);
IPage<DisplayInfo> pageList = informationService.subjectPageList(userVo, subjectInfoVo);
return Result.OK(pageList);
}
......@@ -294,7 +323,7 @@ public class InformationController {
* @date 2024/12/24
*/
@PostMapping("/collect")
public Result<?> collect(@RequestBody CollectionInfo collectionInfo){
public Result<?> collect(@RequestBody CollectionInfo collectionInfo) {
informationService.collect(collectionInfo);
return Result.OK();
}
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.InfoSource;
import com.zzsn.event.entity.InfoSourceGroup;
import com.zzsn.event.service.*;
import com.zzsn.event.util.tree.Node;
......@@ -56,6 +57,23 @@ public class RelationBindController {
}
/**
* 信息源分页列表
*
* @param infoSourceCondition 筛选条件
* @param pageNo 当前页
* @param pageSize 每页返回条数
* @author lkg
* @date 2024/12/26
*/
@GetMapping("/infoSource/pageList")
public Result<?> infoSourcePageList(InfoSourceCondition infoSourceCondition,
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize) {
IPage<InfoSource> pageList = infoSourceService.pageList(infoSourceCondition, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 专题/事件绑定的信息源-列表页
*
* @param infoSourceCondition 筛选条件
......@@ -98,9 +116,9 @@ public class RelationBindController {
* @date 2024/12/23
*/
@GetMapping("/group/searchList")
public Result<?> searchList(@RequestParam String searchWord){
public Result<?> searchList(@RequestParam String searchWord) {
LambdaQueryWrapper<InfoSourceGroup> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.like(InfoSourceGroup::getGroupName,searchWord);
queryWrapper.like(InfoSourceGroup::getGroupName, searchWord);
List<InfoSourceGroup> list = infoSourceGroupService.list(queryWrapper);
return Result.OK(list);
}
......@@ -112,7 +130,7 @@ public class RelationBindController {
* @date 2024/12/23
*/
@GetMapping("/groupAndTypeTree")
public Result<?> groupAndTypeTree(){
public Result<?> groupAndTypeTree() {
List<GroupTreeVO> tree = infoSourceGroupService.GroupAndTypeTree();
return Result.OK(tree);
}
......@@ -165,7 +183,7 @@ public class RelationBindController {
@PostMapping(value = "/modifyInfoSourceInfo")
public Result<?> modifyInfoSourceInfo(@RequestBody InfoSourceGroupPage infoSourceGroupPage) {
if (StrUtil.isBlank(infoSourceGroupPage.getSubjectId()) || StrUtil.isBlank(infoSourceGroupPage.getId())
|| ObjectUtil.isEmpty(infoSourceGroupPage.getSourceType())){
|| ObjectUtil.isEmpty(infoSourceGroupPage.getSourceType())) {
return Result.OK("请检查参数");
}
subjectInfoSourceMapService.modifyInfoSourceInfo(infoSourceGroupPage);
......
package com.zzsn.event.controller.common;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.es.EsService;
import com.zzsn.event.service.IInfoSourceService;
import com.zzsn.event.service.SubjectService;
import com.zzsn.event.util.DateUtil;
import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.EventDataCondition;
import com.zzsn.event.vo.OverviewAnalysisVO;
import com.zzsn.event.vo.es.SpecialInformation;
import com.zzsn.event.entity.InfoSource;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 统计分析
......@@ -23,12 +32,145 @@ public class StatisticalAnalysisController {
@Autowired
private EsService esService;
@Autowired
private SubjectService subjectService;
@Autowired
private IInfoSourceService infoSourceService;
/**
* 概述分析
*
* @param subjectId 专题id
* @author lkg
* @date 2024/12/26
*/
@GetMapping("overview")
public Result<OverviewAnalysisVO> overviewAnalysis(@RequestParam String subjectId){
OverviewAnalysisVO overviewAnalysisVO = new OverviewAnalysisVO();
Subject subject = subjectService.getById(subjectId);
overviewAnalysisVO.setSubjectName(subject.getSubjectName());
overviewAnalysisVO.setTimeEnable(subject.getTimeEnable());
overviewAnalysisVO.setTimeDisable(subject.getTimeDisable());
int count = esService.count(subjectId, DateUtil.dateToString(subject.getTimeEnable()), DateUtil.dateToString(subject.getTimeDisable()));
overviewAnalysisVO.setInfoCount(count);
//todo 专题下绑定的信息源分类下的信息源数量
return Result.OK(overviewAnalysisVO);
}
/**
* 资讯趋势分析
*
* @param searchCondition 筛选条件
* @author lkg
* @date 2024/12/25
*/
@PostMapping("/dataTrend")
public Result<List<CountVO>> dataTrend(@RequestBody EventDataCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>();
List<String> ids = searchCondition.getIds();
if (CollectionUtils.isEmpty(ids)) {
dataList = esService.groupByDate(searchCondition);
} else {
String[] fetchFields = new String[]{"id", "publishDate"};
searchCondition.setFetchFields(fetchFields);
List<SpecialInformation> informationList = esService.informationList(searchCondition);
String groupType = searchCondition.getGroupType();
String format = null;
if ("year".equalsIgnoreCase(groupType)) {
format = "yyyy";
} else if ("month".equalsIgnoreCase(groupType)) {
format = "yyyy-MM";
} else if ("day".equalsIgnoreCase(groupType)) {
format = "yyyy-MM-dd";
} else if ("hout".equalsIgnoreCase(groupType)) {
format = "HH:00:00";
}
if (format != null) {
String finalFormat = format;
Map<String, List<SpecialInformation>> dateMap = informationList.stream()
.collect(Collectors .groupingBy(item -> DateUtil.formatStr(item.getPublishDate(), "yyyy-MM-dd HH:mm:ss", finalFormat)));
for (Map.Entry<String, List<SpecialInformation>> entry : dateMap.entrySet()) {
CountVO countVO = new CountVO();
countVO.setName(entry.getKey());
countVO.setValue((long) entry.getValue().size());
dataList.add(countVO);
}
}
}
return Result.OK(dataList);
}
/**
* 资讯类型分布
*
* @param searchCondition 筛选条件
* @author lkg
* @date 2024/12/26
*/
@PostMapping("/dataType/distribution")
public Result<?> dataTypeDistribution(@RequestBody EventDataCondition searchCondition) {
List<CountVO> dataList = new ArrayList<>();
List<String> ids = searchCondition.getIds();
if (CollectionUtils.isEmpty(ids)) {
dataList = esService.groupByClassificationType(searchCondition);
} else {
String[] fetchFields = new String[]{"id", "classificationType"};
searchCondition.setFetchFields(fetchFields);
List<SpecialInformation> informationList = esService.informationList(searchCondition);
Map<Integer, List<SpecialInformation>> map = informationList.stream()
.collect(Collectors .groupingBy(SpecialInformation::getClassificationType));
for (Map.Entry<Integer, List<SpecialInformation>> entry : map.entrySet()) {
CountVO countVO = new CountVO();
//todo 获取字典值
// countVO.setName(entry.getKey());
countVO.setValue((long) entry.getValue().size());
dataList.add(countVO);
}
}
return Result.OK(dataList);
}
/**
* 资讯来源分析
*
* @param searchCondition 筛选条件
* @author lkg
* @date 2024/12/26
*/
@PostMapping("/dataSource")
public Result<?> dataSource(@RequestBody EventDataCondition searchCondition){
//todo 实现
return Result.OK();
}
@GetMapping("/dataTrend")
public Result<?> dataTrend(@RequestParam String subjectId,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
List<CountVO> subjectDatabaseByTime = esService.getSubjectDatabaseByTime(startDate, endDate, "month", subjectId, null, null);
return Result.OK(subjectDatabaseByTime);
/**
*资讯数量top的信息源统计
*
* @param searchCondition 筛选条件
* @author lkg
* @date 2024/12/26
*/
@PostMapping("/infoSource/dataCount/top")
public Result<?> infoSourceDataCountTop(@RequestBody EventDataCondition searchCondition){
List<CountVO> dataList = new ArrayList<>();
List<String> ids = searchCondition.getIds();
if (CollectionUtils.isEmpty(ids)) {
dataList = esService.groupBySourceId(searchCondition);
} else {
String[] fetchFields = new String[]{"id", "sid"};
searchCondition.setFetchFields(fetchFields);
List<SpecialInformation> informationList = esService.informationList(searchCondition);
Map<String, List<SpecialInformation>> map = informationList.stream()
.collect(Collectors .groupingBy(SpecialInformation::getSid));
for (Map.Entry<String, List<SpecialInformation>> entry : map.entrySet()) {
CountVO countVO = new CountVO();
String sid = entry.getKey();
InfoSource infoSource = infoSourceService.getById(sid);
countVO.setName(infoSource.getSiteName());
countVO.setValue((long) entry.getValue().size());
dataList.add(countVO);
}
}
return Result.OK(dataList);
}
}
......@@ -10,7 +10,6 @@ import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.SubjectTreeVO;
import com.zzsn.event.vo.SubjectTypeVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -98,31 +97,30 @@ public class SubjectTypeController {
}
/**
* 专题页左侧树
* 专题和分类树型结构
*
* @author lkg
* @date 2024/4/29
*/
@GetMapping("/subjectAndTypeTree")
public Result<?> subjectAndTypeTree() {
List<SubjectTreeVO> tree = subjectTypeService.subjectAndTypeTree();
public Result<?> subjectAndTypeTree(@RequestParam(required = false) Integer facePublic) {
List<SubjectTreeVO> tree = subjectTypeService.subjectAndTypeTree(facePublic);
return Result.OK(tree);
}
/**
* 专题类别-通过父级id列表查询
* 通过父级id列表查询-专题页左侧异步树
*
* @return
*/
@GetMapping(value = "/subjectAndTypeByParentId")
public Result<?> subjectAndTypeByParentId(@RequestParam(name = "subjectType", defaultValue = "0") String subjectType,
@RequestParam(name = "parentId", defaultValue = "0") String parentId) {
List<SubjectTypeVo> allList = subjectTypeService.subjectListByType(subjectType, parentId);
public Result<?> subjectAndTypeByParentId( @RequestParam(name = "parentId", defaultValue = "0") String parentId) {
List<SubjectTypeVo> allList = subjectTypeService.subjectListByType(parentId);
return Result.OK(allList);
}
/**
* 事件页左侧树
* 事件和分类树型结构
*
* @author lkg
* @date 2024/4/29
......@@ -134,14 +132,13 @@ public class SubjectTypeController {
}
/**
* 专题类别-通过父级id列表查询
* 通过父级id列表查询-事件页左侧异步树
*
* @return
*/
@GetMapping(value = "/eventAndTypeByParentId")
public Result<?> eventAndTypeByParentId(@RequestParam(name = "subjectType", defaultValue = "0") String subjectType,
@RequestParam(name = "parentId", defaultValue = "0") String parentId) {
List<SubjectTypeVo> allList = subjectTypeService.eventListByType(subjectType, parentId);
public Result<?> eventAndTypeByParentId(@RequestParam(name = "parentId", defaultValue = "0") String parentId) {
List<SubjectTypeVo> allList = subjectTypeService.eventListByType(parentId);
return Result.OK(allList);
}
}
......@@ -108,7 +108,7 @@ public class EventManageController {
*/
@GetMapping("/regionTree")
public Result<?> regionTree(@RequestParam Integer type) {
List<Node> nodes = labelEntityService.regionTree(type);
List<LabelTypeVO> nodes = labelEntityService.regionTree(type);
return Result.OK(nodes);
}
......
package com.zzsn.event.xxljob.entity;
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
......
......@@ -38,6 +38,10 @@ public class Subject implements Serializable {
private String pagePolicy;
/**状态*/
private Integer status;
/**是否公开(0-未公开;1-已公开)*/
private Integer facePublic;
/**数据来源(0-平台数据;1-全网搜)*/
private Integer dataSource;
/**启用时间*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
......
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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 标签类别
* @Author: jeecg-boot
* @Date: 2022-05-12
* @Version: V1.0
*/
@Data
@TableName("sys_base_label_type")
@ApiModel(value="sys_base_label_type对象", description="标签类别")
public class SysBaseLabelType implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**标签编码*/
@Excel(name = "标签编码", width = 15)
@ApiModelProperty(value = "标签编码")
private String labelCode;
/**标签名称*/
@Excel(name = "标签名称", width = 15)
@ApiModelProperty(value = "标签名称")
private String labelName;
/**标签标识*/
@Excel(name = "标签标识", width = 15)
@ApiModelProperty(value = "标签标识")
private String labelMark;
/**说明*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private String explanation;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**父级节点*/
@Excel(name = "父级节点", width = 15)
@ApiModelProperty(value = "父级节点")
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
/**排序*/
private Integer orderNo;
/**顶层id*/
private String topId;
/**标签类别(如企业、自定义等)*/
private String labelType;
/**标签类型(0-非自定义;1-自定义)*/
private Integer category;
}
package com.zzsn.event.enums;
import lombok.Getter;
/**
* 标签分类
*
* @author lkg
* @date 2024/5/11
*/
@Getter
public enum LabelTypeEnum {
ENTERPRISE("company_label"),
REGION("region_label"),
INDUSTRY("industry_label"),
CHARACTER("character_label"),
CUSTOM("custom_label");
private final String value;
LabelTypeEnum(String value) {
this.value = value;
}
}
......@@ -89,4 +89,7 @@ public interface CommonMapper {
* @date 2024/12/20
*/
List<LabelModelVo> subjectModelBindLabels(@Param("subjectIds") List<String> subjectIds);
List<String> getExcludeKeywords(@Param("databaseIds") List<String> databaseIds);
}
......@@ -160,14 +160,6 @@ public interface EventMapper extends BaseMapper<Event> {
*/
List<EventNewPlatVO> newPlatPageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量(专题分类)-新平台管理
*
* @param subjectCondition 筛选条件
* @author lkg
* @date 2024/4/28
*/
Integer newPlatCount(@Param("subjectCondition") SubjectCondition subjectCondition);
/**
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.vo.InfoSourceCondition;
import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.xxljob.entity.InfoSource;
import com.zzsn.event.entity.InfoSource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -18,6 +19,14 @@ import java.util.List;
@Mapper
public interface InfoSourceMapper extends BaseMapper<InfoSource> {
/**
* 信息源分页列表
*
* @param infoSourceCondition 筛选条件
* @author lkg
* @date 2024/12/26
*/
Page<InfoSource> pageList(@Param("infoSourceCondition") InfoSourceCondition infoSourceCondition, Page<InfoSource> page);
/**
* 信息源信息列表
......@@ -54,30 +63,9 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* 专题直接屏蔽的信息源列表(不包括专题屏蔽的信息源组下的信息源)
*
* @param infoSourceCondition 筛选条件
* @param subjectId 专题id
* @param offset 偏移量
* @param pageSize 返回条数
* @param page 分页参数
* @author lkg
* @date 2024/4/30
*/
List<InfoSourceVo> unBindSourcePageList(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, @Param("subjectId") String subjectId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 专题直接屏蔽的信息源数量(不包括专题屏蔽的信息源组下的信息源)
*
* @param infoSourceCondition 筛选条件
* @param subjectId 专题id
* @author lkg
* @date 2024/4/30
*/
Long unBindSourceCount(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, @Param("subjectId") String subjectId);
/**
* 专题绑定的信息源总数量
*
* @param subjectIds 专题id
* @author lkg
* @date 2024/4/24
*/
Integer bindSourceCount(@Param("subjectIds") List<String> subjectIds);
Page<InfoSourceVo> unBindSourcePageList(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, Page<InfoSourceVo> page);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.vo.KeywordsVO;
......@@ -18,10 +19,9 @@ import java.util.List;
@Mapper
public interface KeyWordsMapper extends BaseMapper<KeyWords> {
List<KeyWordsPage> pageList(@Param("keyWords") KeyWords keyWords, @Param("typeIds") List<String> typeIds, @Param("offset") Integer offset,
@Param("pageSize") Integer pageSize, @Param("subjectId") String subjectId, @Param("search") int search, @Param("bindingType") String bindingType);
Integer totalCount(@Param("keyWords") KeyWords keyWords, @Param("typeIds") List<String> typeIds, @Param("subjectId") String subjectId, @Param("search") int search, @Param("bindingType") String bindingType);
Page<KeyWordsPage> pageList(@Param("keyWords") KeyWords keyWords, @Param("typeIds") List<String> typeIds,
@Param("subjectId") String subjectId, @Param("search") int search,
@Param("bindingType") String bindingType, Page<KeyWordsPage> page);
KeyWordsPage selectKeyWordsById(@Param("keyWordsId") String keyWordsId);
......@@ -43,25 +43,13 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> {
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @param offset 偏移量
* @param pageSize 返回条数
* @param page 分页参数
* @author lkg
* @date 2024/5/7
*/
List<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds,
Page<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds,
@Param("groupName") String groupName, @Param("wordName") String wordName,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 专题绑定关键词信息-总数量
*
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @author lkg
* @date 2024/5/7
*/
Long bindKeyWordsCount(@Param("subjectIds") List<String> subjectIds, @Param("groupName") String groupName, @Param("wordName") String wordName);
Page<KeyWordsPage> page);
/**
* 专题/事件绑定关键词组的数量
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.LabelTypeVO;
import com.zzsn.event.vo.SysLabelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -36,16 +38,53 @@ public interface LabelEntityMapper extends BaseMapper<LabelEntity> {
* @author lkg
* @date 2024/12/23
*/
List<Node> regionInList(@Param("level") Integer level);
List<LabelTypeVO> regionInList(@Param("level") Integer level);
/**
* 国际地域信息列表
*
* @author lkg
* @date 2024/4/9
*/
List<Node> regionOutList();
List<LabelTypeVO> regionOutList();
/**
* 国标行业信息列表
*
* @author lkg
* @date 2024/12/27
*/
List<LabelTypeVO> industryList();
/**
* 企业类标签下的标签实体分页列表
*
* @param labelIds 标签id集合
* @param name 实体名称
* @author lkg
* @date 2024/12/27
*/
Page<SysLabelVo> queryCustomLabel(@Param("labelIdList") List<String> labelIds,@Param("name") String name,Page<SysLabelVo> page);
/**
* 企业类标签下的标签实体(企业)分页列表
*
* @param labelIds 标签id集合
* @param name 实体(企业)名称
* @author lkg
* @date 2024/12/27
*/
Page<SysLabelVo> queryCompanyLabel(@Param("labelIdList") List<String> labelIds,@Param("name") String name,Page<SysLabelVo> page);
/**
* 企业类标签下的标签实体(人物)分页列表
*
* @param labelIds 标签id集合
* @param name 实体(人物)名称
* @author lkg
* @date 2024/12/27
*/
Page<SysLabelVo> queryGovernmentLeaders(@Param("labelIdList") List<String> labelIds,@Param("name") String name,Page<SysLabelVo> page);
List<SysLabelVo> queryCustomLabel(@Param("sysLabelVo") SysLabelVo sysLabelVo);
}
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.vo.SubjectCondition;
import com.zzsn.event.vo.SubjectPage;
......@@ -22,12 +23,11 @@ public interface SubjectMapper extends BaseMapper<Subject> {
* 专题分页列表
*
* @param subjectCondition 查询条件
* @param offset 偏移量
* @param pageSize 返回条数
* @param page 分页参数
* @author lkg
* @date 2024/12/18
*/
List<SubjectPage> pageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
Page<SubjectPage> pageList(@Param("subjectCondition") SubjectCondition subjectCondition, Page<SubjectPage> page);
/**
* 专题详情
......
......@@ -44,7 +44,7 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
* @author lkg
* @date 2024/4/29
*/
List<SubjectTreeVO> subjectAndTypeTree();
List<SubjectTreeVO> subjectAndTypeTree(@Param("facePublic") Integer facePublic,@Param("username") String createBy);
/**
* 可用的事件和分类列表
*
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysBaseLabelType;
import com.zzsn.event.vo.LabelTypeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 标签类别
* @Author: jeecg-boot
* @Date: 2022-05-12
* @Version: V1.0
*/
@Mapper
public interface SysBaseLabelTypeMapper extends BaseMapper<SysBaseLabelType> {
/**
* 标签信息列表
*
* @author lkg
* @date 2024/12/27
*/
List<LabelTypeVO> labelTypeList(@Param("labelType") String labelType);
}
......@@ -131,4 +131,23 @@
where s.is_delete = 0
and s.status = 1
</select>
<select id="getExcludeKeywords" resultType="String">
select keyword from clb_keyword_conf where ((type = 0 and range_type = 0)
<if test="databaseIds!=null and databaseIds.size()>0">
or (type = 0 and database_id in
<foreach collection="databaseIds" item="databaseId" separator="," open="(" close=")">
#{databaseId}
</foreach>
)
</if>
)
<if test="databaseIds!=null and databaseIds.size()>0">
and keyword not in (select keyword from clb_keyword_conf where type = 1 and database_id in
<foreach collection="databaseIds" item="databaseId" separator="," open="(" close=")">
#{databaseId}
</foreach>)
</if>
</select>
</mapper>
......@@ -328,46 +328,6 @@
order by d.sort_order,d.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="newPlatCount" resultType="Integer">
select count(1) from (
SELECT distinct d.id
from event d
INNER JOIN
(
select stm.subject_id from subject_type_map stm
where 1=1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and stm.type_id in
<foreach collection="subjectCondition.typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on d.id = m.subject_id
INNER JOIN
(
select psm.subject_id from project_subject_map psm
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and psm.id = #{subjectCondition.projectId}
</if>
) n
on d.id = n.subject_id
where 1 = 1
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and d.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and d.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and d.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
</select>
<select id="topEventList" resultType="com.zzsn.event.vo.EventTopVO">
select distinct a.* from(
......
......@@ -2,6 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.InfoSourceMapper">
<select id="pageList" resultType="com.zzsn.event.entity.InfoSource">
select iso.id,iso.web_site_name,iso.site_name,iso.site_uri,iso.`status`,iso.crawl_type
from info_source iso where 1=1
<if test="infoSourceCondition.webSiteName!=null and infoSourceCondition.webSiteName != ''">
and iso.web_site_name like CONCAT('%',#{infoSourceCondition.webSiteName},'%')
</if>
<if test="infoSourceCondition.siteName!=null and infoSourceCondition.siteName != ''">
and iso.site_name like CONCAT('%',#{infoSourceCondition.siteName},'%')
</if>
<if test="infoSourceCondition.siteUri!=null and infoSourceCondition.siteUri != ''">
and iso.site_uri = #{infoSourceCondition.siteUri}
</if>
<if test="infoSourceCondition.status!=null and infoSourceCondition.status != ''">
and iso.status = #{infoSourceCondition.status}
</if>
<if test="infoSourceCondition.crawlType!=null and infoSourceCondition.crawlType != 0">
and iso.crawl_type = #{infoSourceCondition.crawlType}
</if>
order by iso.create_time desc
</select>
<select id="queryInfoSource" resultType="com.zzsn.event.vo.InfoSourceVo">
select t.*, g.infoSourceNatureIds as natureIds, g.infoSourceNatureNames, k.infoSourceGroupNames from (
......@@ -165,7 +185,7 @@
<select id="unBindSourcePageList" resultType="com.zzsn.event.vo.InfoSourceVo">
select s.id,s.info_source_code,s.web_site_name,s.site_name,s.site_uri,s.status,s.create_time from info_source s
inner join subject_info_source_map sm on s.id = sm.source_id
where sm.type = 3 and sm.subject_id = #{subjectId}
where sm.type = 3 and sm.subject_id = #{infoSourceVo.subjectId}
<if test="infoSourceVo.webSiteName!=null and infoSourceVo.webSiteName != ''">
and s.web_site_name like CONCAT('%',#{infoSourceVo.webSiteName},'%')
</if>
......@@ -182,76 +202,5 @@
and s.crawl_type = #{infoSourceVo.crawlType}
</if>
order by s.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="unBindSourceCount" resultType="Long">
select count(1) from info_source s
inner join subject_info_source_map sm on s.id = sm.source_id
where sm.type = 3 and sm.subject_id = #{subjectId}
<if test="infoSourceVo.webSiteName!=null and infoSourceVo.webSiteName != ''">
and s.web_site_name like CONCAT('%',#{infoSourceVo.webSiteName},'%')
</if>
<if test="infoSourceVo.siteName!=null and infoSourceVo.siteName != ''">
and s.site_name like CONCAT('%',#{infoSourceVo.siteName},'%')
</if>
<if test="infoSourceVo.siteUri!=null and infoSourceVo.siteUri != ''">
and s.site_uri = #{infoSourceVo.siteUri}
</if>
<if test="infoSourceVo.status!=null and infoSourceVo.status != ''">
and s.status = #{infoSourceVo.status}
</if>
<if test="infoSourceVo.crawlType!=null and infoSourceVo.crawlType != 0">
and s.crawl_type = #{infoSourceVo.crawlType}
</if>
</select>
<select id="bindSourceCount" resultType="Integer">
select count(1) from
(
select distinct x.id from (
select iso.id from info_source_group_map m inner join info_source iso on m.source_id = iso.id
where m.group_id in (
select source_id from subject_info_source_map where type in(2,5)
<if test="subjectIds != null and subjectIds.size() > 0">
and subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by source_id
)
union
select iso.id from subject_info_source_map sm inner join info_source iso on sm.source_id = iso.id where sm.type = 1
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x where 1=1
and x.id not in(
select distinct y.source_id from (
select m.source_id from info_source_group_map m
where m.group_id in (
select source_id from subject_info_source_map where type = 4
<if test="subjectIds != null and subjectIds.size() > 0">
and subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by source_id
)
union
select sm.source_id from subject_info_source_map sm where sm.type = 3
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) y
)
) q
</select>
</mapper>
......@@ -34,40 +34,8 @@
</if>
GROUP BY d.id
order by d.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="totalCount" resultType="Integer">
SELECT count(1) from key_words d
LEFT JOIN keywords_type_map b ON b.keywords_id = d.id
LEFT JOIN keywords_type c ON b.type_id = c.id
where 1 = 1
<if test="typeIds!=null and typeIds.size()>0">
and b.type_id in
<foreach collection="typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="keyWords.wordsName!=null and keyWords.wordsName != ''">
and d.words_name like CONCAT('%',#{keyWords.wordsName},'%')
</if>
<if test="keyWords.keyWord!=null and keyWords.keyWord != ''">
and d.key_word like CONCAT('%',#{keyWords.keyWord},'%')
</if>
<if test="keyWords.status!=null and keyWords.status != ''">
and d.status = #{keyWords.status}
</if>
<if test="search!=null and search !=''">
and d.id not in
(
SELECT keywords_id from subject_keywords_map
where subject_id = #{subjectId}
<if test="bindingType!=null and bindingType != ''">
and binding_type = #{bindingType}
</if>
)
</if>
</select>
<select id="selectKeyWordsById" resultType="com.zzsn.event.vo.KeyWordsPage">
SELECT a.*, b.type_id as keyWordsTypeId, c.type_name as keyWordsTypeName
......@@ -118,30 +86,6 @@
order by x.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="bindKeyWordsCount" resultType="Long">
select count(1) from (
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId
FROM key_words b
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 d ON d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by b.id
) x
where 1=1
<if test="groupName != null and groupName !=''">
and x.words_name like CONCAT('%',#{groupName},'%')
</if>
<if test="wordName != null and wordName !=''">
and x.key_word like CONCAT('%',#{wordName},'%')
</if>
</select>
<select id="bindCount" resultType="Integer">
select count(1)
......
......@@ -31,16 +31,19 @@
where m.label_id = #{labelTypeId}
</select>
<select id="regionInList" resultType="com.zzsn.event.util.tree.Node">
select id, name,pid,top_id from sys_base_domestic_region where 1=1
<select id="regionInList" resultType="com.zzsn.event.vo.LabelTypeVO">
select id, name,pid,top_id,'region_in' as labelMark,'region_label' as labelType from sys_base_domestic_region where 1=1
<if test="level != null">
and level = #{level}
</if>
</select>
<select id="regionOutList" resultType="com.zzsn.event.util.tree.Node">
select id,name_cn as name,pid,top_id from sys_base_region
<select id="regionOutList" resultType="com.zzsn.event.vo.LabelTypeVO">
select id,name_cn as name,pid,top_id,'region_out' as labelMark,'region_label' as labelType from sys_base_region
</select>
<select id="industryList" resultType="com.zzsn.event.vo.LabelTypeVO">
select id,name_cn as name,pid,top_id,'standard-industry' as labelMark,'industry_label' as labelType from sys_base_industry
</select>
<select id="queryCustomLabel" resultType="com.zzsn.event.vo.SysLabelVo">
......@@ -48,14 +51,48 @@
inner join label_entity b on a.relation_id = b.id and b.pid = 0
left join sys_base_label_type c on a.label_id = c.id
where 1=1
<if test="sysLabelVo.labelIdList!=null and sysLabelVo.labelIdList.size()>0">
<if test="labelIdList!=null and labelIdList.size()>0">
and a.label_id in
<foreach collection="labelIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="name!=null and name != ''">
and b.name like concat('%',#{name},'%')
</if>
</select>
<select id="queryCompanyLabel" resultType="com.zzsn.event.vo.SysLabelVo">
select b.social_credit_code as id, b.name as name, a.label_id as labelTypeId, a.label_type as labelType, c.label_mark as labelMark
from sys_base_enterprise b
inner join sys_base_label_type_map a on a.relation_id = b.social_credit_code
inner join sys_base_label_type c on a.label_id = c.id
where 1=1
<if test="labelIdList!=null and labelIdList.size()>0">
and a.label_id in
<foreach collection="labelIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="name!=null and name != ''">
and b.name like concat('%',#{name},'%')
</if>
</select>
<select id="queryGovernmentLeaders" resultType="com.zzsn.event.vo.SysLabelVo">
select b.id as id, b.name as name, a.label_id as labelTypeId, a.label_type as labelType, c.label_mark as labelMark from sys_base_label_type_map a
inner join government_leaders b on a.relation_id = b.id
left join sys_base_label_type c on a.label_id = c.id
where 1=1
<if test="labelIdList!=null and labelIdList.size()>0">
and a.label_id in
<foreach collection="sysLabelVo.labelIdList" item="item" open="(" close=")" separator=",">
<foreach collection="labelIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="sysLabelVo.name!=null and sysLabelVo.name != ''">
and b.name like concat('%',#{sysLabelVo.name},'%')
<if test="name!=null and name != ''">
and b.name like concat('%',#{name},'%')
</if>
</select>
</mapper>
......@@ -4,8 +4,7 @@
<select id="pageList" resultType="com.zzsn.event.vo.SubjectPage">
SELECT distinct d.*, c.id as subjectTypeId, c.type_name as subjectTypeName, g.id as projectId, g.project_name as
projectName
from subject d
projectName from subject d
INNER JOIN subject_type_map b ON b.subject_id = d.id
INNER JOIN subject_type c ON b.type_id = c.id
LEFT JOIN project_subject_map f ON f.subject_id = d.id
......@@ -26,6 +25,9 @@
<if test="subjectCondition.status!=null">
and d.status = #{subjectCondition.status}
</if>
<if test="subjectCondition.facePublic!=null">
and d.face_public = #{subjectCondition.facePublic}
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
......@@ -35,8 +37,10 @@
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and g.id = #{subjectCondition.projectId}
</if>
<if test="subjectCondition.username!=null and subjectCondition.username != ''">
and d.create_by = #{subjectCondition.username}
</if>
order by d.sort_order,d.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="selectSubjectById" resultType="com.zzsn.event.vo.SubjectPage">
......
......@@ -18,35 +18,48 @@
<select id="subjectAndTypeTree" resultType="com.zzsn.event.vo.SubjectTreeVO">
select x.*
from (
select s.id,
s.type_name as name,
s.pid,
'false' as ynSubject,
null as startTime,
null as endTime,
s.create_time
from subject_type s
where s.category = 1
and s.status = 1
union
select n.id, n.name, m.id as pid, 'true' as ynSubject, n.start_time, n.end_time, n.create_time
from (
select s.id, s.type_name as name, s.pid
from subject_type s
where s.category = 1
and s.status = 1
) m
inner join subject_type_map stm on m.id = stm.type_id
inner join
(
select s.id,
s.subject_name as name,
s.time_enable as start_time,
s.time_disable as end_time,
s.create_time
from subject s
) n on stm.subject_id = n.id
) x
select s.id,
s.type_name as name,
s.pid,
'false' as ynSubject,
null as startTime,
null as endTime,
s.create_time
from subject_type s
where s.category = 1
and s.status = 1
<if test="username!=null and username != ''">
and s.create_by = #{username}
</if>
union
select n.id, n.name, m.id as pid, 'true' as ynSubject, n.start_time, n.end_time, n.create_time
from (
select s.id, s.type_name as name, s.pid
from subject_type s
where s.category = 1
and s.status = 1
<if test="username!=null and username != ''">
and s.create_by = #{username}
</if>
) m
inner join subject_type_map stm on m.id = stm.type_id
inner join
(
select s.id,
s.subject_name as name,
s.time_enable as start_time,
s.time_disable as end_time,
s.create_time
from subject s
where 1 = 1
<if test="facePublic!=null">
and s.face_public = #{facePublic}
</if>
<if test="username!=null and username != ''">
and s.create_by = #{username}
</if>
) n on stm.subject_id = n.id
) x
order by x.create_time desc
</select>
......
<?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.SysBaseLabelTypeMapper">
<select id="labelTypeList" resultType="com.zzsn.event.vo.LabelTypeVO">
select id,label_name as name,pid,label_mark,label_type from sys_base_label_type
where 1 = 1
<if test="labelType != null and labelType != ''">
and label_type = #{labelType}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 公用服务
......@@ -51,8 +52,6 @@ public interface CommonService {
List<KeyWordsPage> selectKeyWordsListById(String subjectId);
List<InfoSourceGroupPage> selectInfoSourceListById(String subjectId);
/**
* 专题/事件绑定 关键词组数量
*
......@@ -82,4 +81,9 @@ public interface CommonService {
* @date 2024/12/20
*/
List<LabelModelVo> subjectModelBindLabels(List<String> subjectIds);
/**
* 根据专题或栏目配置查询关键词黑名单
*/
Set<String> getExcludeKeywords(String databaseIds);
}
......@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.InfoSourceCondition;
import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.xxljob.entity.InfoSource;
import com.zzsn.event.entity.InfoSource;
import java.util.List;
......@@ -16,6 +16,9 @@ import java.util.List;
*/
public interface IInfoSourceService extends IService<InfoSource> {
IPage<InfoSource> pageList(InfoSourceCondition infoSourceCondition, Integer pageNo, Integer pageSize);
/**
* 专题绑定信息源列表
*
......@@ -32,13 +35,12 @@ public interface IInfoSourceService extends IService<InfoSource> {
* 专题直接屏蔽的信息源列表(不包括专题屏蔽的信息源组下的信息源)
*
* @param infoSourceCondition 筛选条件
* @param subjectId 专题id
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/30
*/
IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition, String subjectId, Integer pageNo, Integer pageSize);
IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition,Integer pageNo, Integer pageSize);
/**
......
......@@ -63,16 +63,17 @@ public interface ISubjectTypeService extends IService<SubjectType> {
void delete(String typeId);
/**
* 可用的专题和分类列表
* 专题和分类列表
*
* @param facePublic 是否公开(0-未公开;1-已公开)
* @author lkg
* @date 2024/4/29
* @date 2024/12/26
*/
List<SubjectTreeVO> subjectAndTypeTree();
List<SubjectTreeVO> subjectAndTypeTree(Integer facePublic);
List<SubjectTypeVo> subjectListByType(String subjectType, String parentId);
List<SubjectTypeVo> subjectListByType(String parentId);
List<SubjectTypeVo> eventListByType(String subjectType, String parentId);
List<SubjectTypeVo> eventListByType(String parentId);
/**
* 可用的事件和分类列表
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.LabelTypeVO;
import com.zzsn.event.vo.SysLabelVo;
import java.util.List;
......@@ -13,6 +15,10 @@ import java.util.List;
*/
public interface LabelEntityService extends IService<LabelEntity> {
String ROOT_ID = "0";
Object pageList(SysLabelVo sysLabelVo, Integer pageNo, Integer pageSize);
/**
* 根据分类获取标签列表
*
......@@ -23,15 +29,21 @@ public interface LabelEntityService extends IService<LabelEntity> {
List<LabelEntity> listByType(String labelTypeId);
/**
* 地域信息列表
* 地域信息列表-树型结构
*
* @param type 类别(1-国际;2-国内)
* @author lkg
* @date 2024/4/10
*/
List<Node> regionTree(Integer type);
List<LabelTypeVO> regionTree(Integer type);
List<Node> firstLevelRegions();
List<LabelTypeVO> firstLevelRegions();
List<SysLabelVo> queryCustomLabel(SysLabelVo sysLabelVo);
/**
* 国标行业列表-树型结构
*
* @author lkg
* @date 2024/12/27
*/
List<LabelTypeVO> industryTree();
}
package com.zzsn.event.service;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ScoreModel;
import com.zzsn.event.vo.ScoreModelVo;
......@@ -17,4 +18,6 @@ public interface ScoreModelService extends IService<ScoreModel> {
void addOrUpdate(ScoreModelVo scoreModel,Integer category);
List<ScoreModelVo> queryScoreModel(String subjectId, String type);
JSONObject scoreModelInfo(String subjectId, String type);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysBaseLabelType;
import com.zzsn.event.vo.LabelTypeVO;
import java.util.List;
/**
* @Description: 标签类别
* @Author: jeecg-boot
* @Date: 2022-05-12
* @Version: V1.0
*/
public interface SysBaseLabelTypeService extends IService<SysBaseLabelType> {
String ROOT_ID = "0";
/**
* 获取下级所有节点的id集合
*
* @param id 标签id
* @author lkg
* @date 2024/12/27
*/
List<String> belowList(String id);
/**
* 标签类别树
*
* @param labelType 标签类别
* @author lkg
* @date 2024/12/27
*/
List<LabelTypeVO> labelTypeTree(String labelType);
}
......@@ -2,6 +2,7 @@ package com.zzsn.event.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.KeyWordsTypeEnum;
......@@ -40,6 +41,8 @@ public class CommonServiceImpl implements CommonService {
private ISubjectModelMapService subjectModelMapService;
@Autowired
private SubjectKeywordsService subjectKeywordsService;
@Autowired
private InfoSourceGroupService infoSourceGroupService;
@Override
......@@ -239,11 +242,6 @@ public class CommonServiceImpl implements CommonService {
}
@Override
public List<InfoSourceGroupPage> selectInfoSourceListById(String subjectId) {
return commonMapper.selectInfoSourceListById(subjectId);
}
@Override
public List<SubjectPage> bindKeyWordsCountList(List<String> idList) {
return commonMapper.bindKeyWordsCountList(idList);
}
......@@ -299,6 +297,19 @@ public class CommonServiceImpl implements CommonService {
return commonMapper.subjectModelBindLabels(subjectIds);
}
@Override
public Set<String> getExcludeKeywords(String databaseIds) {
Set<String> set = new HashSet<>();
if(databaseIds == null){
databaseIds = "";
}
List<String> keywords = commonMapper.getExcludeKeywords(Arrays.asList(databaseIds.split(",")));
if(CollectionUtils.isNotEmpty(keywords)){
set.addAll(keywords);
}
return set;
}
//获取树状结构
private List<ModelVO> getTreeList(List<ModelVO> authTypeList){
List<ModelVO> topList = new ArrayList<>();
......
......@@ -212,7 +212,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
List<String> typeIds = new ArrayList<>();
String subjectTypeId = subjectCondition.getSubjectTypeId();
if (StringUtils.isNotEmpty(subjectTypeId) && !"0".equals(subjectTypeId)) {
typeIds = iSubjectTypeService.belowIdList(subjectTypeId, subjectCondition.getCategory());
typeIds = iSubjectTypeService.belowIdList(subjectTypeId, 2);
}
subjectCondition.setTypeIds(typeIds);
//在根据所有明细节点查出专题列表
......
......@@ -6,15 +6,13 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.InfoSource;
import com.zzsn.event.es.EsService;
import com.zzsn.event.mapper.InfoSourceMapper;
import com.zzsn.event.service.IInfoSourceService;
import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.InfoSourceCondition;
import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.vo.NumVO;
import com.zzsn.event.xxljob.entity.InfoSource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -36,6 +34,12 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
private EsService esService;
@Override
public IPage<InfoSource> pageList(InfoSourceCondition infoSourceCondition, Integer pageNo, Integer pageSize) {
Page<InfoSource> page = new Page<>(pageNo, pageSize);
return baseMapper.pageList(infoSourceCondition, page);
}
@Override
public IPage<InfoSourceVo> bindInfoSourceList(InfoSourceCondition infoSourceCondition, List<String> subjectIds, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize;
if (pageNo == 0) {
......@@ -91,17 +95,14 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
}
@Override
public IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition, String subjectId, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize;
List<InfoSourceVo> pageList = baseMapper.unBindSourcePageList(infoSourceCondition, subjectId, offset, pageSize);
Long count = baseMapper.unBindSourceCount(infoSourceCondition, subjectId);
IPage<InfoSourceVo> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList);
return pageData;
public IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition, Integer pageNo, Integer pageSize) {
Page<InfoSourceVo> page = new Page<>(pageNo, pageSize);
return baseMapper.unBindSourcePageList(infoSourceCondition, page);
}
@Override
public Integer bindSourceCount(List<String> subjectIds) {
return baseMapper.bindSourceCount(subjectIds);
Long count = baseMapper.bindSourceIdCount(null, subjectIds);
return count.intValue();
}
}
......@@ -25,7 +25,7 @@ import com.zzsn.event.vo.es.ESData;
import com.zzsn.event.vo.es.SpecialInformation;
import com.zzsn.event.vo.es.Subjectdatabase;
import com.zzsn.event.vo.log.DataLifecycleLog;
import com.zzsn.event.xxljob.entity.InfoSource;
import com.zzsn.event.entity.InfoSource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
......
......@@ -65,7 +65,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
@Override
public IPage<KeyWordsPage> pageByTypeId(KeyWords keyWords, Integer pageNo, Integer pageSize, String keyWordsTypeId, Boolean search, String subjectId, String bindingType) {
int offset = (pageNo - 1) * pageSize;
//查询类别id的所有明细id
List<String> typeIds = new ArrayList<>();
if (StringUtils.isNotEmpty(keyWordsTypeId) && !"0".equals(keyWordsTypeId)) {
......@@ -78,22 +78,13 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
});
typeIds = TreeUtil.belowList(nodeList,keyWordsTypeId,true);
}
List<KeyWordsPage> pageList;
Integer count;
int searchValue = 0;
if (Boolean.TRUE.equals(search)) {
//查询列表
pageList = baseMapper.pageList(keyWords, typeIds, offset, pageSize, subjectId, 1,bindingType);
//获取总条数
count = baseMapper.totalCount(keyWords, typeIds, subjectId, 1,bindingType);
} else {
//查询列表
pageList = baseMapper.pageList(keyWords, typeIds, offset, pageSize, subjectId, 0,bindingType);
//获取总条数
count = baseMapper.totalCount(keyWords, typeIds, subjectId, 0,bindingType);
searchValue = 1;
}
IPage<KeyWordsPage> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList);
return pageData;
//查询列表
Page<KeyWordsPage> page = new Page<>(pageNo, pageSize);
return baseMapper.pageList(keyWords, typeIds, subjectId, searchValue,bindingType,page);
}
@Override
......@@ -253,12 +244,8 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
@Override
public IPage<KeyWordsPage> bindKeyWordsList(List<String> subjectIds, String groupName, String wordName, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize;
List<KeyWordsPage> wordsList = baseMapper.bindKeyWordsList(subjectIds, groupName, wordName, offset, pageSize);
Long count = baseMapper.bindKeyWordsCount(subjectIds, groupName, wordName);
IPage<KeyWordsPage> page = new Page<>(pageNo, pageSize, count);
page.setRecords(wordsList);
return page;
Page<KeyWordsPage> page = new Page<>(pageNo, pageSize);
return baseMapper.bindKeyWordsList(subjectIds, groupName, wordName, page);
}
@Override
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.enums.LabelTypeEnum;
import com.zzsn.event.mapper.LabelEntityMapper;
import com.zzsn.event.service.LabelEntityService;
import com.zzsn.event.service.SysBaseLabelTypeService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.LabelTypeVO;
import com.zzsn.event.vo.SysLabelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -18,6 +23,31 @@ import java.util.List;
@Service
public class LabelEntityServiceImpl extends ServiceImpl<LabelEntityMapper, LabelEntity> implements LabelEntityService {
@Autowired
private SysBaseLabelTypeService labelTypeService;
@Override
public Object pageList(SysLabelVo sysLabelVo, Integer pageNo, Integer pageSize) {
Page<SysLabelVo> page = new Page<>(pageNo, pageSize);
String labelType = sysLabelVo.getLabelType();
String labelMark = sysLabelVo.getLabelMark();
List<String> labelIds = labelTypeService.belowList(sysLabelVo.getLabelTypeId());
if (LabelTypeEnum.ENTERPRISE.getValue().equals(labelType)) {
return baseMapper.queryCompanyLabel(labelIds,sysLabelVo.getName(),page);
} else if (LabelTypeEnum.CHARACTER.getValue().equals(labelType)) {
return baseMapper.queryGovernmentLeaders(labelIds,sysLabelVo.getName(),page);
} else if (LabelTypeEnum.INDUSTRY.getValue().equals(labelType)) {
return this.industryTree();
} else if (LabelTypeEnum.REGION.getValue().equals(labelType)) {
if ("region_in".equals(labelMark)) {
return this.regionTree(2);
} else if ("region_out".equals(labelMark)) {
return this.regionTree(1);
}
} else {
return baseMapper.queryCustomLabel(labelIds,sysLabelVo.getName(),page);
}
return null;
}
@Override
public List<LabelEntity> listByType(String labelTypeId) {
......@@ -25,23 +55,24 @@ public class LabelEntityServiceImpl extends ServiceImpl<LabelEntityMapper, Label
}
@Override
public List<Node> regionTree(Integer type) {
List<Node> nodes;
public List<LabelTypeVO> regionTree(Integer type) {
List<LabelTypeVO> nodes;
if (type == 1) {
nodes = baseMapper.regionOutList();
} else {
nodes = baseMapper.regionInList(null);
}
return TreeUtil.tree(nodes,"0");
return TreeUtil.tree(nodes,ROOT_ID);
}
@Override
public List<Node> firstLevelRegions() {
public List<LabelTypeVO> firstLevelRegions() {
return baseMapper.regionInList(1);
}
@Override
public List<SysLabelVo> queryCustomLabel(SysLabelVo sysLabelVo) {
return baseMapper.queryCustomLabel(sysLabelVo);
public List<LabelTypeVO> industryTree() {
List<LabelTypeVO> nodes = baseMapper.industryList();
return TreeUtil.tree(nodes,ROOT_ID);
}
}
package com.zzsn.event.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.ScoreModel;
import com.zzsn.event.mapper.ScoreModelMapper;
import com.zzsn.event.service.CommonService;
import com.zzsn.event.service.ISubjectInfoSourceMapService;
import com.zzsn.event.service.ScoreModelService;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.vo.InfoSourceGroupPage;
import com.zzsn.event.vo.ScoreModelVo;
import com.zzsn.event.vo.SubjectScoreModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -29,6 +36,8 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo
@Autowired
private CommonService commonService;
@Autowired
private ISubjectInfoSourceMapService subjectInfoSourceMapService;
@Value("${python.scoreModelUrl}")
private String scoreModelUrl;
......@@ -57,4 +66,90 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo
public List<ScoreModelVo> queryScoreModel(String subjectId, String type){
return baseMapper.selectByInfo(subjectId, type);
}
@Override
public JSONObject scoreModelInfo(String subjectId, String type) {
//先查询数据库是否存在数据
JSONObject jsonObject = new JSONObject();
List<ScoreModelVo> list = baseMapper.selectByInfo(subjectId, type);
if(CollectionUtils.isNotEmpty(list)){
//不为空,则查询数据库存在的信息
jsonObject.put("data", JSONObject.parse(list.get(0).getData().toString()));
return jsonObject;
}else{
//为空,返回默认值
return defaultInfo(subjectId,type);
}
}
private JSONObject defaultInfo(String subjectId,String type){
JSONObject jsonObject = new JSONObject();
List<SubjectScoreModel> allList = new ArrayList<>();
SubjectScoreModel subjectScoreModel = new SubjectScoreModel();
subjectScoreModel.setName("信息源组");
subjectScoreModel.setIndexWeight((double)10);
//1.查出绑定的信息源
JSONObject infoSourceGroupPages = subjectInfoSourceMapService.bindInfoSource(subjectId);
JSONArray bindList = infoSourceGroupPages.getJSONArray("bindList");
List<InfoSourceGroupPage> infoSourceGroupList = JSONArray.parseArray(bindList.toJSONString(), InfoSourceGroupPage.class);
List<SubjectScoreModel> childrenList = new ArrayList<>();
for(InfoSourceGroupPage infoSourceGroupPage : infoSourceGroupList){
SubjectScoreModel subjectScoreModel1 = new SubjectScoreModel();
subjectScoreModel1.setInfoSourceGroupId(infoSourceGroupPage.getId());
subjectScoreModel1.setId(infoSourceGroupPage.getId());
subjectScoreModel1.setName(infoSourceGroupPage.getGroupName());
subjectScoreModel1.setFraction(80);
childrenList.add(subjectScoreModel1);
}
subjectScoreModel.setChildren(childrenList);
allList.add(subjectScoreModel);
//2.文章长度
SubjectScoreModel subjectScoreModel2 = new SubjectScoreModel();
subjectScoreModel2.setName("文章长度");
if ("1".equals(type) || "2".equals(type) || "4".equals(type) || "5".equals(type)) {
subjectScoreModel2.setIndexWeight((double) 15);
} else if ("3".equals(type)) {
subjectScoreModel2.setIndexWeight((double)10);
}
subjectScoreModel2.setKeyWordsLowerLimit(500);
subjectScoreModel2.setKeyWordsTopLimit(2500);
allList.add(subjectScoreModel2);
//3.内容
SubjectScoreModel subjectScoreModel3 = new SubjectScoreModel();
subjectScoreModel3.setName("内容");
List<SubjectScoreModel> contentChildrenList = new ArrayList<>();
SubjectScoreModel subjectScoreModel1 = new SubjectScoreModel();
SubjectScoreModel subjectScoreModel4 = new SubjectScoreModel();
if ("1".equals(type) || "2".equals(type) || "4".equals(type) || "5".equals(type)) {
subjectScoreModel1.setName("内容-关键词");
subjectScoreModel1.setIndexWeight((double)75);
subjectScoreModel1.setTitleWeight((double)10);
subjectScoreModel1.setKeyWordsLowerLimit(3);
subjectScoreModel1.setKeyWordsTopLimit(15);
contentChildrenList.add(subjectScoreModel1);
} else if ("3".equals(type)) {
subjectScoreModel1.setName("内容-关键词");
subjectScoreModel1.setIndexWeight((double)10);
subjectScoreModel1.setTitleWeight((double)10);
subjectScoreModel1.setKeyWordsLowerLimit(3);
subjectScoreModel1.setKeyWordsTopLimit(15);
subjectScoreModel1.setKeyWords("现状|基本情况|做法|经验|特征|特点|成效|成果|趋势|机遇|挑战|问题|难点|难题|不足|建议");
contentChildrenList.add(subjectScoreModel1);
subjectScoreModel4.setName("内容-关键词");
subjectScoreModel4.setIndexWeight((double)70);
subjectScoreModel4.setTitleWeight((double)10);
subjectScoreModel4.setKeyWordsLowerLimit(3);
subjectScoreModel4.setKeyWordsTopLimit(15);
contentChildrenList.add(subjectScoreModel4);
}
subjectScoreModel3.setChildren(contentChildrenList);
allList.add(subjectScoreModel3);
JSONArray array= JSONArray.parseArray(JSON.toJSONString(allList));
jsonObject.put("data",array);
return jsonObject;
}
}
......@@ -99,18 +99,18 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Override
public Page<SubjectPage> pageList(SubjectCondition subjectCondition, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize;
//查询类别id的所有明细id
List<String> typeIds = new ArrayList<>();
String subjectTypeId = subjectCondition.getSubjectTypeId();
if (StringUtils.isNotEmpty(subjectTypeId) && !"0".equals(subjectTypeId)) {
typeIds = subjectTypeService.belowIdList(subjectTypeId, subjectCondition.getCategory());
typeIds = subjectTypeService.belowIdList(subjectTypeId, 1);
}
subjectCondition.setTypeIds(typeIds);
//在根据所有明细节点查出专题列表
List<SubjectPage> pageList = baseMapper.pageList(subjectCondition, offset, pageSize);
if (CollUtil.isNotEmpty(pageList)) {
List<String> idList = pageList.stream().map(SubjectPage::getId).collect(Collectors.toList());
Page<SubjectPage> page = new Page<>(pageNo, pageSize);
Page<SubjectPage> pageList = baseMapper.pageList(subjectCondition, page);
List<SubjectPage> records = pageList.getRecords();
if (CollUtil.isNotEmpty(records)) {
List<String> idList = records.stream().map(SubjectPage::getId).collect(Collectors.toList());
Map<String, Integer> infoSourceNumMap = new HashMap<>();
Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(idList).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum));
Map<String, List<SubjectInfoSourceLabelTypeVo>> collect = commonService.bindSourceList(idList).stream().collect(Collectors.groupingBy(SubjectInfoSourceLabelTypeVo::getSubjectId));
......@@ -124,7 +124,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
Map<String, Integer> unCheckCountMap = subjectInfoCountMap(idList, checkStatus);
Map<String, Integer> subjectInfoCountMap = subjectInfoCountMap(idList, null);
//查询每个专题绑定的信息源数量及关键词数量
for (SubjectPage subjectPage1 : pageList) {
for (SubjectPage subjectPage1 : records) {
int keyWordsNum = null == keyWordsNumMap.get(subjectPage1.getId()) ? 0 : keyWordsNumMap.get(subjectPage1.getId());
int infoSourceNum = null == infoSourceNumMap.get(subjectPage1.getId()) ? 0 : infoSourceNumMap.get(subjectPage1.getId());
//查询每个专题现有的信息数量
......@@ -136,9 +136,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
subjectPage1.setKeyWordsNum(keyWordsNum);
}
}
Page<SubjectPage> pageData = new Page<>(pageNo, pageSize);
pageData.setRecords(pageList);
return pageData;
return pageList;
}
@Override
......
......@@ -10,6 +10,7 @@ import com.zzsn.event.mapper.SubjectTypeMapper;
import com.zzsn.event.service.ISubjectTypeService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.vo.SubjectPage;
import com.zzsn.event.vo.SubjectTreeVO;
import com.zzsn.event.vo.SubjectTypeVo;
......@@ -90,9 +91,13 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
}
@Override
public List<SubjectTreeVO> subjectAndTypeTree() {
public List<SubjectTreeVO> subjectAndTypeTree(Integer facePublic) {
String username = null;
if (facePublic == null) {
username = AuthUtil.getLoginUser().getUsername();
}
List<SubjectTreeVO> tree = new ArrayList<>();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree(facePublic,username);
if (CollectionUtils.isNotEmpty(subjectTreeVOS)) {
tree = TreeUtil.tree(subjectTreeVOS, "0");
tree.forEach(this::subjectNumCount);
......@@ -113,7 +118,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
}
@Override
public List<SubjectTypeVo> subjectListByType(String subjectType, String parentId) {
public List<SubjectTypeVo> subjectListByType(String parentId) {
if (!parentId.equals("0")) {
SubjectType subjectTypeVo1 = this.getById(parentId);
if (StringUtils.isEmpty(subjectTypeVo1.getHasChild()) || "0".equals(subjectTypeVo1.getHasChild())) {
......@@ -177,7 +182,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
}
@Override
public List<SubjectTypeVo> eventListByType(String subjectType, String parentId) {
public List<SubjectTypeVo> eventListByType(String parentId) {
if (!parentId.equals("0")) {
SubjectType subjectTypeVo1 = this.getById(parentId);
if (StringUtils.isEmpty(subjectTypeVo1.getHasChild()) || "0".equals(subjectTypeVo1.getHasChild())) {
......@@ -246,7 +251,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
List<SubjectTypeVo> tempList = pidMap.get(subjectTypeVo.getId());
if (tempList != null) {
List<SubjectTypeVo> finalList = tempList.stream()
.filter(item -> null == item.getHasChild() && org.springframework.util.StringUtils.isEmpty(item.getHasChild()) || "0".equals(item.getHasChild()))
.filter(item -> null == item.getHasChild() && StringUtils.isEmpty(item.getHasChild()) || "0".equals(item.getHasChild()))
.collect(Collectors.toList());
finalAllList.addAll(finalList);
tempList.removeAll(finalList);
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysBaseLabelType;
import com.zzsn.event.mapper.SysBaseLabelTypeMapper;
import com.zzsn.event.service.SysBaseLabelTypeService;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.LabelTypeVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 标签类别
* @Author: jeecg-boot
* @Date: 2022-05-12
* @Version: V1.0
*/
@Service
public class SysBaseLabelTypeServiceImpl extends ServiceImpl<SysBaseLabelTypeMapper, SysBaseLabelType> implements SysBaseLabelTypeService {
@Override
public List<String> belowList(String id) {
List<LabelTypeVO> labelTypeVOS = baseMapper.labelTypeList(null);
return TreeUtil.belowList(labelTypeVOS, id,true);
}
@Override
public List<LabelTypeVO> labelTypeTree(String labelType) {
List<LabelTypeVO> labelTypeVOS = baseMapper.labelTypeList(labelType);
return TreeUtil.tree(labelTypeVOS,ROOT_ID);
}
}
......@@ -77,6 +77,8 @@ public class EventDataCondition {
private Integer minScore;
//最大得分
private Integer maxScore;
//es查询字段数组
private String[] fetchFields;
//排序参数
//排序字段
......@@ -94,4 +96,12 @@ public class EventDataCondition {
private List<String> ids;
//导出方式(1-摘要;2-正文)
private Integer exportType;
//聚合分组类型-按日期集合分析时使用
private String groupType;
//选择的前num条数据-专题分析时使用
private Integer num;
//信息源id集合-统计分析资讯量最多的信息源时使用
private List<String> sourceIdList;
}
package com.zzsn.event.vo;
import lombok.Getter;
import lombok.Setter;
/**
*
*
* @author lkg
* @date 2024/8/30
*/
@Getter
@Setter
public class EventDigDataVO extends SubjectDataVo{
private String processDate;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 事件挖掘任务
*
* @author lkg
* @date 2024/9/13
*/
@Getter
@Setter
public class EventExtractTaskVO {
private String id;
private String taskName;
private String projectName;
private String columnId;
private String columnName;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date lastUpdateTime;
private Integer taskStatus;
private Integer extractEventCount;
private Integer noCheckExtractEventCount;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
*
* @author lkg
* @date 2024/4/8
*/
@Data
public class EventExtractVO {
private String id;
private String eventName;
private Integer eventType;
private String typeName;
private String eventLabel;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date extractTime;
private Integer checkStatus;
private String relatedId;
}
......@@ -11,14 +11,29 @@ import lombok.Data;
@Data
public class InfoSourceCondition {
/**信息源名称,微信公众号名称,微博名称*/
/**
* 信息源名称,微信公众号名称,微博名称
*/
private String webSiteName;
/**栏目名称*/
/**
* 栏目名称
*/
private String siteName;
/**栏目URL,微信公众号URL,微博URL*/
/**
* 栏目URL,微信公众号URL,微博URL
*/
private String siteUri;
/**状态*/
/**
* 状态
*/
private String status;
/**爬虫类别*/
/**
* 爬虫类别
*/
private int crawlType;
/**
* 专题id/事件id-获取专题绑定信息源信息时使用
*/
private String subjectId = "0";
}
package com.zzsn.event.vo;
import com.zzsn.event.util.tree.Node;
import lombok.Data;
/**
* 标签信息
*
* @author lkg
* @date 2024/12/27
*/
@Data
public class LabelTypeVO extends Node {
/**
* 标签标识
*/
private String labelMark;
/**
* 标签类别(如企业、自定义等)
*/
private String labelType;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 专题-概述分析实体
*
* @author lkg
* @date 2024/12/26
*/
@Getter
@Setter
public class OverviewAnalysisVO {
/**专题名称*/
private String subjectName;
/**启用时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date timeEnable;
/**停用时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date timeDisable;
/**资讯数量*/
private Integer infoCount;
/**各分类下信息源数量*/
private List<CountVO> countList;
}
......@@ -28,6 +28,8 @@ public class SubjectCondition {
private String startTime;
/**结束时间*/
private String endTime;
/**类别(1-专题;2-事件)*/
private Integer category;
/**是否公开(0-未公开;1-已公开)*/
private Integer facePublic;
/**用户账号*/
private String username;
}
......@@ -54,6 +54,10 @@ public class SubjectPage {
@Excel(name = "状态", width = 15, dicCode = "clb_subject_status")
@ApiModelProperty(value = "状态")
private Integer status = 0;
/**是否公开(0-未公开;1-已公开)*/
private Integer facePublic;
/**数据来源(0-平台数据;1-全网搜)*/
private Integer dataSource;
/**启用时间*/
@Excel(name = "启用时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
......
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
@Data
public class SubjectScoreModel {
/**名称对应的id(可以为空)*/
private String id;
/**指标名称*/
private String name;
/**指标权重*/
private Double indexWeight;
/**信息源打分*/
private Integer fraction;
/**标题权重*/
private Double titleWeight;
/**关键词下限*/
private Integer keyWordsLowerLimit;
/**关键词上限*/
private Integer keyWordsTopLimit;
/**关键词*/
private String keyWords;
/**子节点*/
private List<SubjectScoreModel> children;
private String infoSourceGroupId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论