提交 6775426b 作者: 925993793@qq.com

自定义专题bug修改、增加总数量、模型推荐数量字段、替换导入模板

上级 10413a88
...@@ -333,6 +333,7 @@ public class FileController { ...@@ -333,6 +333,7 @@ public class FileController {
header.put("原文链接", "sourceAddress"); header.put("原文链接", "sourceAddress");
header.put("发布时间", "publishDate"); header.put("发布时间", "publishDate");
header.put("正文内容", "content"); header.put("正文内容", "content");
header.put("摘要", "summary");
reader.setHeaderAlias(header); reader.setHeaderAlias(header);
List<FileDataVO> informationList = reader.read(0, 1, FileDataVO.class); List<FileDataVO> informationList = reader.read(0, 1, FileDataVO.class);
informationService.importDataInfo(informationList,subjectId); informationService.importDataInfo(informationList,subjectId);
......
...@@ -1159,7 +1159,7 @@ public class SubjectManageController { ...@@ -1159,7 +1159,7 @@ public class SubjectManageController {
} }
/** /**
* 单数据填充 * 单数据填充
* *
* @param subjectId 专题id * @param subjectId 专题id
* @param webSiteName 信息源名称 * @param webSiteName 信息源名称
......
...@@ -30,6 +30,8 @@ public class SubjectStatisticInfo { ...@@ -30,6 +30,8 @@ public class SubjectStatisticInfo {
private String id; private String id;
/**信息总数量*/ /**信息总数量*/
private Integer totalNum; private Integer totalNum;
/**模型推荐数量*/
private Integer modelNum;
/**待审核数量*/ /**待审核数量*/
private Integer unCheckNum; private Integer unCheckNum;
/**绑定信息源数量*/ /**绑定信息源数量*/
......
...@@ -1855,12 +1855,13 @@ public class EsService { ...@@ -1855,12 +1855,13 @@ public class EsService {
* 专题信息数量统计 * 专题信息数量统计
* *
* @param subjectIds 专题id集合 * @param subjectIds 专题id集合
* @param auditStatus 审核状态 * @param auditStatus 审核状态-平台(null-全部;1-通过;2-未审核;3-暂定;4-删除;5-免审核)
* @param auditStatus 审核状态-研究中心(0-全部;1-模型推荐;2-精选;3-待定;4-移除)
* @param type 是否多层聚合(先按专题,再按发布时间) * @param type 是否多层聚合(先按专题,再按发布时间)
* @author lkg * @author lkg
* @date 2025/3/25 * @date 2025/3/25
*/ */
public List<StatisticVO> subjectStatisticInfo(List<String> subjectIds, Integer auditStatus, Integer type) { public List<StatisticVO> subjectStatisticInfo(List<String> subjectIds, Integer auditStatus,Integer status, Integer type) {
List<StatisticVO> list = new ArrayList<>(); List<StatisticVO> 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();
...@@ -1870,6 +1871,9 @@ public class EsService { ...@@ -1870,6 +1871,9 @@ public class EsService {
if (auditStatus != null) { if (auditStatus != null) {
searchCondition.setAuditStatus(auditStatus); searchCondition.setAuditStatus(auditStatus);
} }
if (status != null) {
searchCondition.setStatus(status);
}
BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds); BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds);
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("group_subject"); TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("group_subject");
......
...@@ -151,10 +151,16 @@ ...@@ -151,10 +151,16 @@
d.status, d.status,
d.estimate_status, d.estimate_status,
d.create_by, d.create_by,
c.type_name as subjectTypeName c.type_name as subjectTypeName,
s.total_num,
s.un_check_num,
s.bind_source_num,
s.bind_keyword_num,
s.latest_data_date
from subject d from subject d
LEFT JOIN subject_type_map b ON b.subject_id = d.id LEFT JOIN subject_type_map b ON b.subject_id = d.id
LEFT JOIN subject_type c ON b.type_id = c.id LEFT JOIN subject_type c ON b.type_id = c.id
LEFT JOIN subject_statistic_info s on s.subject_id = d.id
where 1 = 1 where 1 = 1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0"> <if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and b.type_id in and b.type_id in
...@@ -196,10 +202,16 @@ ...@@ -196,10 +202,16 @@
d.status, d.status,
d.estimate_status, d.estimate_status,
d.create_by, d.create_by,
c.type_name as subjectTypeName c.type_name as subjectTypeName,
s.total_num,
s.un_check_num,
s.bind_source_num,
s.bind_keyword_num,
s.latest_data_date
from subject d from subject d
LEFT JOIN subject_type_map b ON b.subject_id = d.id LEFT JOIN subject_type_map b ON b.subject_id = d.id
LEFT JOIN subject_type c ON b.type_id = c.id LEFT JOIN subject_type c ON b.type_id = c.id
LEFT JOIN subject_statistic_info s on s.subject_id = d.id
where where
((d.face_public = 1 and d.create_by = #{username}) or (d.face_public = 1 and ${sql})) ((d.face_public = 1 and d.create_by = #{username}) or (d.face_public = 1 and ${sql}))
<if test="subjectCondition.environment !=null and subjectCondition.environment !=''"> <if test="subjectCondition.environment !=null and subjectCondition.environment !=''">
...@@ -296,7 +308,7 @@ ...@@ -296,7 +308,7 @@
SELECT MIN(create_time) FROM `subject` WHERE 1=1 SELECT MIN(create_time) FROM `subject` WHERE 1=1
<if test="subjectIdList != null"> <if test="subjectIdList != null">
<foreach collection="subjectIdList" item="item" open="and id in (" close=")" separator=","> <foreach collection="subjectIdList" item="item" open="and id in (" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
</select> </select>
......
...@@ -156,10 +156,13 @@ public class InformationServiceImpl implements InformationService { ...@@ -156,10 +156,13 @@ public class InformationServiceImpl implements InformationService {
for (SpecialInformation specialInformation : records) { for (SpecialInformation specialInformation : records) {
DisplayInfo info = new DisplayInfo(); DisplayInfo info = new DisplayInfo();
BeanUtils.copyProperties(specialInformation, info); BeanUtils.copyProperties(specialInformation, info);
String publishDate = EsDateUtil.esFieldDateMapping(info.getPublishDate()); String publishDate = info.getPublishDate();
String dateFormat = searchCondition.getDateFormat(); if (StringUtils.isNotEmpty(publishDate) && publishDate.length() > 10) {
if (!dateFormat.equals("yyyy-MM-dd HH:mm:ss")) { publishDate = EsDateUtil.esFieldDateMapping(info.getPublishDate());
info.setPublishDate(DateUtil.formatStr(publishDate,"yyyy-MM-dd HH:mm:ss", dateFormat)); String dateFormat = searchCondition.getDateFormat();
if (!dateFormat.equals("yyyy-MM-dd HH:mm:ss")) {
info.setPublishDate(DateUtil.formatStr(publishDate,"yyyy-MM-dd HH:mm:ss", dateFormat));
}
} }
//标签处理 //标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId()); List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId());
...@@ -1066,6 +1069,9 @@ public class InformationServiceImpl implements InformationService { ...@@ -1066,6 +1069,9 @@ public class InformationServiceImpl implements InformationService {
if (StringUtils.isNotEmpty(info.getContent())) { if (StringUtils.isNotEmpty(info.getContent())) {
specialInformation.setContent(info.getContent()); specialInformation.setContent(info.getContent());
} }
if (StringUtils.isNotEmpty(info.getSummary())) {
specialInformation.setContent(info.getSummary());
}
specialInformation.setCheckStatus(1); specialInformation.setCheckStatus(1);
specialInformation.setDeleteFlag(0); specialInformation.setDeleteFlag(0);
specialInformation.setTopNum(0); specialInformation.setTopNum(0);
......
...@@ -205,13 +205,6 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -205,13 +205,6 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(subjectIds).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum)); Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(subjectIds).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum));
//按专题分组,统计绑定信息源的数量 //按专题分组,统计绑定信息源的数量
Map<String, Integer> sourceCountMap = commonService.bindSourceCount(subjectIds); Map<String, Integer> sourceCountMap = commonService.bindSourceCount(subjectIds);
//专题统计信息-总数量、最新资讯日期
List<StatisticVO> totalAndLatestDateList = esService.subjectStatisticInfo(subjectIds, null, 1);
Map<String,StatisticVO> totalAndLatestDateMap = totalAndLatestDateList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e -> e));
//专题统计信息-待审核数量
List<StatisticVO> unCheckNumList = esService.subjectStatisticInfo(subjectIds, 2, null);
Map<String, StatisticVO> unCheckNumMap = unCheckNumList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e->e));
//绑定全部信息源的专题 //绑定全部信息源的专题
Map<String, Integer> infoSourceNumMap = new HashMap<>(); Map<String, Integer> infoSourceNumMap = new HashMap<>();
List<Subject> subjects = baseMapper.selectBatchIds(subjectIds); List<Subject> subjects = baseMapper.selectBatchIds(subjectIds);
...@@ -224,12 +217,22 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -224,12 +217,22 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
}); });
} }
//专题统计信息-总数量、最新资讯日期
List<StatisticVO> totalAndLatestDateList = esService.subjectStatisticInfo(subjectIds, null,null, 1);
Map<String,StatisticVO> totalAndLatestDateMap = totalAndLatestDateList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e -> e));
//专题统计信息-待审核数量
List<StatisticVO> unCheckNumList = esService.subjectStatisticInfo(subjectIds, 2,null, null);
Map<String, StatisticVO> unCheckNumMap = unCheckNumList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e->e));
//专题统计信息-模型推荐数量
List<StatisticVO> modelNumList = esService.subjectStatisticInfo(subjectIds, null,1, null);
Map<String, StatisticVO> modelNumMap = modelNumList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e->e));
for (String subjectId : subjectIds) { for (String subjectId : subjectIds) {
SubjectStatisticInfo subjectStatisticInfo = new SubjectStatisticInfo(); SubjectStatisticInfo subjectStatisticInfo = new SubjectStatisticInfo();
subjectStatisticInfo.setSubjectId(subjectId); subjectStatisticInfo.setSubjectId(subjectId);
subjectStatisticInfo.setTotalNum(totalAndLatestDateMap.get(subjectId).getCount()); subjectStatisticInfo.setTotalNum(totalAndLatestDateMap.get(subjectId).getCount());
subjectStatisticInfo.setLatestDataDate(totalAndLatestDateMap.get(subjectId).getPublishDate()); subjectStatisticInfo.setLatestDataDate(totalAndLatestDateMap.get(subjectId).getPublishDate());
subjectStatisticInfo.setUnCheckNum(unCheckNumMap.get(subjectId).getCount()); subjectStatisticInfo.setUnCheckNum(unCheckNumMap.get(subjectId).getCount());
subjectStatisticInfo.setModelNum(modelNumMap.get(subjectId).getCount());
if (infoSourceNumMap.containsKey(subjectId)) { if (infoSourceNumMap.containsKey(subjectId)) {
subjectStatisticInfo.setBindSourceNum(infoSourceNumMap.get(subjectId)); subjectStatisticInfo.setBindSourceNum(infoSourceNumMap.get(subjectId));
} else { } else {
......
...@@ -32,15 +32,8 @@ public class SubjectStatisticTask { ...@@ -32,15 +32,8 @@ public class SubjectStatisticTask {
@Autowired @Autowired
private SubjectStatisticInfoService subjectStatisticInfoService; private SubjectStatisticInfoService subjectStatisticInfoService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
@Scheduled(cron = "0 30 0 * * ?") @Scheduled(cron = "0 30 0 * * ?")
public void statistic() { public void statistic() {
if(yjzxEnable){
//研究中心不需要此任务
return;
}
LambdaQueryWrapper<Subject> queryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<Subject> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.select(Subject::getId).eq(Subject::getSubjectType, 1); queryWrapper.select(Subject::getId).eq(Subject::getSubjectType, 1);
List<Subject> list = subjectService.list(queryWrapper); List<Subject> list = subjectService.list(queryWrapper);
......
...@@ -12,6 +12,7 @@ import lombok.Data; ...@@ -12,6 +12,7 @@ import lombok.Data;
public class FileDataVO { public class FileDataVO {
private String title; private String title;
private String summary;
private String content; private String content;
private String author; private String author;
private String origin; private String origin;
......
...@@ -185,4 +185,17 @@ public class SubjectPage { ...@@ -185,4 +185,17 @@ public class SubjectPage {
private String environment; private String environment;
/**是否处理无发布时间的资讯:1是,0否--默认为0*/ /**是否处理无发布时间的资讯:1是,0否--默认为0*/
private Integer noPublishTimeFlag=0; private Integer noPublishTimeFlag=0;
/**信息总数量*/
private Integer totalNum;
/**待审核数量*/
private Integer unCheckNum;
/**绑定信息源数量*/
private Integer bindSourceNum;
/**绑定关键词组数量*/
private Integer bindKeywordNum;
/**最新数据日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date latestDataDate;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论