提交 b7e434a9 作者: 925993793@qq.com

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

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