提交 b7e434a9 作者: 925993793@qq.com

【fix】自定义专题:专题配置变更通知采集逻辑修改;专题新增关键词不必传(空专题);专题列表返回字段增加subjectType

上级 d113a05e
......@@ -164,7 +164,9 @@ public class FileController {
CompletableFuture.runAsync(()->{
//开启日志
ClbFileOperationLog clbFileOperationLog = clbFileOperationLogService.operationStart(multipartFile.getOriginalFilename(), userVo);
//是否置顶(true-是;false-否)
String isTopping = request.getParameter("isTopping");
//是否需要审核(true-是;false-否)
String isExamine = request.getParameter("isExamine");
try {
//1.上传文件到文件服务器
......
......@@ -90,6 +90,8 @@ public class SubjectManageController {
private SubjectInfoSourceMiddleMapService subjectInfoSourceMiddleMapService;
@Autowired
private SysDictItemService sysDictItemService;
@Autowired
private ConfigurationMessageService configurationMessageService;
@Autowired
private ObsUtil obsUtil;
......@@ -734,6 +736,8 @@ public class SubjectManageController {
subjectInfoSourceMapService.remove(queryWrapper);
}
subjectInfoSourceMapService.saveBatch(dataList);
//同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectId);
return Result.OK();
}
......@@ -814,6 +818,8 @@ public class SubjectManageController {
subjectInfoSourceMapService.saveBatch(dataList);
}
}
//同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectSourceVO.getSubjectId());
return Result.OK();
}
......@@ -856,6 +862,8 @@ public class SubjectManageController {
if (CollectionUtils.isNotEmpty(params)) {
params.forEach(item -> item.setType(1));
subjectInfoSourceMapService.saveBatch(params);
//同步配置到采集
configurationMessageService.bindInfoSourceSend(params.get(0).getSubjectId());
}
return Result.OK();
}
......@@ -893,6 +901,8 @@ public class SubjectManageController {
.eq(SubjectInfoSourceMiddleMap::getInfoSourceName, webSiteName));
}
}
//同步配置到采集
configurationMessageService.bindInfoSourceSend(params.get(0).getSubjectId());
return Result.OK();
}
......
......@@ -42,13 +42,13 @@ public class SubjectSimpleController {
*/
@PostMapping("/createSubject")
public Result<?> createSubject(@RequestBody SubjectSimpleVO subjectSimpleVO) {
Subject subject = subjectSimpleService.createSubject(subjectSimpleVO);
//没有关键词,说明是空专题,不需要走数据采集、处理逻辑
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
if (CollectionUtils.isEmpty(keywords)) {
return Result.FAIL("请先添加关键词");
if (CollectionUtils.isNotEmpty(keywords)) {
//插入xxlJob
xxlJobInfoService.subjectInsert(subject);
}
Subject subject = subjectSimpleService.createSubject(subjectSimpleVO);
//插入xxlJob
xxlJobInfoService.subjectInsert(subject);
return Result.OK(subject.getId());
}
......@@ -75,10 +75,6 @@ public class SubjectSimpleController {
*/
@PostMapping("/editSubject")
public Result<?> editSubject(@RequestBody SubjectSimpleVO subjectSimpleVO) {
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
if (CollectionUtils.isEmpty(keywords)) {
return Result.FAIL("请先添加关键词");
}
subjectSimpleService.editSubject(subjectSimpleVO);
return Result.OK();
}
......
......@@ -81,6 +81,7 @@
d.subject_code,
d.library,
d.remark,
d.subject_type,
d.create_time,
d.status,
d.estimate_status,
......@@ -122,6 +123,7 @@
d.subject_code,
d.library,
d.remark,
d.subject_type,
d.create_time,
d.status,
d.estimate_status,
......@@ -190,7 +192,7 @@
left join subject_sample_file f on s.id = f.subject_id
where s.id = #{subjectId}
</select>
<select id="visibleList" resultType="com.zzsn.event.util.tree.Node">
select id,subject_name as name from subject where 1=1
<if test="subjectName != null and subjectName != ''">
......
......@@ -103,34 +103,35 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
String subjectId = subject.getId();
//关键词绑定
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
modifyKeyword(subjectId, subject.getSubjectName(), keywords);
//默认绑定tpu流程
List<ClbModelArrangeSubjectMap> tpuList = new ArrayList<>();
ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap();
tpu.setSubjectId(subject.getId());
tpu.setArrangeId("1877652205629173761");
tpu.setType("baseDateToSubject");
tpuList.add(tpu);
ClbModelArrangeSubjectMap tpu1 = new ClbModelArrangeSubjectMap();
tpu1.setSubjectId(subject.getId());
tpu1.setArrangeId("1887436365952548866");
tpu1.setType("yjzxPlatFormToSubject");
tpuList.add(tpu1);
clbModelArrangeSubjectMapService.saveBatch(tpuList);
//默认通用打分配置
String defaultConfig = "[{\"id\": \"1-1\", \"name\": \"信息源组\", \"children\": [], \"indexWeight\": 10}, {\"id\": \"1-2\", \"name\": \"文章长度\", \"indexWeight\": 15, \"keyWordsTopLimit\": 2500, \"keyWordsLowerLimit\": 500}, {\"id\": \"1-3\", \"name\": \"内容\", \"children\": [{\"id\": \"1-3-1\", \"name\": \"内容-关键词\", \"keyWords\": \"KEY_WORD\", \"indexWeight\": 75, \"titleWeight\": 10, \"keyWordsTopLimit\": 15, \"keyWordsLowerLimit\": 3}]}]";
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
defaultConfig = defaultConfig.replace("KEY_WORD", String.join("|", collect.stream().map(SearchWordVO::getSearchInfo).collect(Collectors.toList())));
if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectId, subject.getSubjectName(), keywords);
//默认通用打分配置
String defaultConfig = "[{\"id\": \"1-1\", \"name\": \"信息源组\", \"children\": [], \"indexWeight\": 10}, {\"id\": \"1-2\", \"name\": \"文章长度\", \"indexWeight\": 15, \"keyWordsTopLimit\": 2500, \"keyWordsLowerLimit\": 500}, {\"id\": \"1-3\", \"name\": \"内容\", \"children\": [{\"id\": \"1-3-1\", \"name\": \"内容-关键词\", \"keyWords\": \"KEY_WORD\", \"indexWeight\": 75, \"titleWeight\": 10, \"keyWordsTopLimit\": 15, \"keyWordsLowerLimit\": 3}]}]";
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
defaultConfig = defaultConfig.replace("KEY_WORD", String.join("|", collect.stream().map(SearchWordVO::getSearchInfo).collect(Collectors.toList())));
}
ScoreModel scoreModel = new ScoreModel();
scoreModel.setSubjectId(subjectId);
scoreModel.setType("1");
scoreModel.setData(defaultConfig);
scoreModelService.save(scoreModel);
//同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectId);
//默认绑定tpu流程
List<ClbModelArrangeSubjectMap> tpuList = new ArrayList<>();
ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap();
tpu.setSubjectId(subject.getId());
tpu.setArrangeId("1877652205629173761");
tpu.setType("baseDateToSubject");
tpuList.add(tpu);
ClbModelArrangeSubjectMap tpu1 = new ClbModelArrangeSubjectMap();
tpu1.setSubjectId(subject.getId());
tpu1.setArrangeId("1887436365952548866");
tpu1.setType("yjzxPlatFormToSubject");
tpuList.add(tpu1);
clbModelArrangeSubjectMapService.saveBatch(tpuList);
}
ScoreModel scoreModel = new ScoreModel();
scoreModel.setSubjectId(subjectId);
scoreModel.setType("1");
scoreModel.setData(defaultConfig);
scoreModelService.save(scoreModel);
//同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectId);
configurationMessageService.bindKeyWordsSend(subjectId);
return subject;
}
......@@ -272,10 +273,11 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
subjectService.updateMain(subjectPage);
//关键词绑定
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords);
//同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectSimpleVO.getId());
configurationMessageService.bindKeyWordsSend(subjectSimpleVO.getId());
if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords);
//同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectSimpleVO.getId());
}
}
@Override
......@@ -486,18 +488,21 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private void modifyKeyword(String subjectId, String subjectName, List<SearchWordVO> keywords) {
LambdaQueryWrapper<SubjectKeywordsMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectKeywordsMap::getSubjectId, subjectId);
List<SubjectKeywordsMap> bindList = subjectKeywordsMapService.list(queryWrapper);
List<SubjectKeywordsMap> filterList = bindList.stream().filter(s -> s.getBindingType().equals("2")).collect(Collectors.toList());
//前端传过来的编辑的关键词信息
List<SearchWordVO> updateList = keywords.stream().filter(searchWordVO -> searchWordVO.getId() != null).collect(Collectors.toList());
List<String> updateIdList = updateList.stream().map(SearchWordVO::getId).collect(Collectors.toList());
//专题已绑定的关键词信息
LambdaQueryWrapper<SubjectKeywordsMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectKeywordsMap::getSubjectId, subjectId);
List<SubjectKeywordsMap> bindList = subjectKeywordsMapService.list(queryWrapper);
//比较后,获得要删除的关键词组id集合
List<String> removeIdList = new ArrayList<>();
for (SubjectKeywordsMap subjectKeywordsMap : filterList) {
if (!updateIdList.contains(subjectKeywordsMap.getKeywordsId())) {
removeIdList.add(subjectKeywordsMap.getKeywordsId());
if (CollectionUtils.isNotEmpty(bindList)) {
List<SubjectKeywordsMap> filterList = bindList.stream().filter(s -> s.getBindingType().equals("2")).collect(Collectors.toList());
for (SubjectKeywordsMap subjectKeywordsMap : filterList) {
if (!updateIdList.contains(subjectKeywordsMap.getKeywordsId())) {
removeIdList.add(subjectKeywordsMap.getKeywordsId());
}
}
}
//编辑后保留下来的关键词
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论