提交 0eca7ff2 作者: 925993793@qq.com

【fix】平台接口bug修改

上级 bb9cd8bd
......@@ -99,8 +99,6 @@ public class SubjectManageController {
private PythonUtil pythonUtil;
@Autowired(required = false)
private RemoteModelService remoteModelService;
@Autowired
private ConfigurationMessageService configurationMessageService;
@Value("${kafka.topic.subject.run:}")
private String SUBJECT_MODEL_KAFKA_CHANNEL;
......@@ -455,8 +453,6 @@ public class SubjectManageController {
@GetMapping(value = "/bindKeyWordsList")
public Result<?> bindKeyWordsList(@RequestParam(name = "id") String id,@RequestParam(name = "bindingType",required = false) String bindingType) {
List<KeyWordsPage> bindKeyWordsList = subjectKeywordsMapService.bindKeyWordsList(id,bindingType);
//同步配置到采集
configurationMessageService.bindKeyWordsSend(id);
return Result.OK(bindKeyWordsList);
}
......
......@@ -650,9 +650,7 @@ public class EsService {
}
//装配信息源的条件
if (CollectionUtils.isNotEmpty(infoSourceIdList)) {
BoolQueryBuilder childQuery = QueryBuilders.boolQuery();
childQuery.should(QueryBuilders.termsQuery("sid", infoSourceIdList));
boolQuery.must(childQuery);
boolQuery.must(QueryBuilders.termsQuery("sid", infoSourceIdList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList())));
} else {
return new Page<>();
}
......
......@@ -36,13 +36,13 @@
SELECT s.id,s.subject_name as name,m.type_id as pid,'0' as subjectCount,s.create_time,'true' as ynSubject
FROM subject s
inner join `subject_type_map` m on s.id = m.subject_id
order by s.create_time
order by s.sort_order,s.create_time desc
</select>
<select id="typeBindEventList" resultType="com.zzsn.event.vo.SubjectTypeTreeVO">
SELECT s.id,s.event_name as name,m.type_id as pid,'0' as subjectCount,s.create_time,'true' as ynSubject
FROM event s
inner join `subject_type_map` m on s.id = m.subject_id
order by s.create_time
order by s.sort_order,s.create_time desc
</select>
<select id="subjectsByFacePublic" resultType="com.zzsn.event.vo.SubjectTreeVO">
......@@ -204,4 +204,4 @@
) x
order by x.create_time desc
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -147,7 +147,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
//查询绑定的流程
List<ClbModelArrange> clbModelArranges = clbModelArrangeService.listBySubjectIds(idList);
if (CollectionUtil.isNotEmpty(clbModelArranges)){
if (CollectionUtil.isNotEmpty(clbModelArranges)) {
clbModelArranges.forEach(e -> e.setType(SourceTypeEnum.getValueNameByValue(e.getType())));
Map<String, List<ClbModelArrange>> collect = clbModelArranges.stream().collect(Collectors.groupingBy(ClbModelArrange::getSubjectId));
records.forEach(e -> {
......@@ -180,9 +180,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
@Override
public Page<Node> visiblePageList(String username,Integer type, String subjectName, Integer pageNo, Integer pageSize) {
public Page<Node> visiblePageList(String username, Integer type, String subjectName, Integer pageNo, Integer pageSize) {
Page<String> page = new Page<>(pageNo, pageSize);
return baseMapper.visibleList(username,type, subjectName, page);
return baseMapper.visibleList(username, type, subjectName, page);
}
@Override
......@@ -244,11 +244,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
updateWrapper.set(Subject::getFirstOpenTime, new Date());
updateWrapper.set(Subject::getEstimateStatus, "预估中");
//第一次启用时,添加redis缓存,,用于向专题里进数据
if(byId.getSubjectType() == 3){
if (byId.getSubjectType() == 3) {
//复合专题根据绑定的专题数据时间确定要入库的数据时间范围
List<String> ids = this.baseMapper.getBindSubjectIds(byId.getId());
informationService.supplyByCondition(subjectId, ids);
}else{
} else {
setRedisCache(subjectId);
}
}
......@@ -374,6 +374,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
@Override
@Transactional
public void keyWordsBind(SubjectPage subjectPage) {
List<String> idList = subjectPage.getKeyWordsIds();
List<SubjectKeywordsMap> mapList = new ArrayList<>();
......@@ -393,18 +394,21 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
@Override
@Transactional
public void deleteBindKeyWords(SubjectPage subjectPage) {
List<String> deleteKeyWordsIds = subjectPage.getKeyWordsIds();
if (deleteKeyWordsIds != null && !deleteKeyWordsIds.isEmpty()) {
if (CollectionUtils.isNotEmpty(deleteKeyWordsIds)) {
String subjectId = subjectPage.getId();
subjectKeywordsMapService.remove(Wrappers.<SubjectKeywordsMap>lambdaQuery()
.eq(SubjectKeywordsMap::getSubjectId, subjectPage.getId()).in(SubjectKeywordsMap::getKeywordsId, deleteKeyWordsIds)
.eq(StrUtil.isNotBlank(subjectPage.getBindingType()), SubjectKeywordsMap::getBindingType, subjectPage.getBindingType())
.eq(SubjectKeywordsMap::getSubjectId, subjectId)
.in(SubjectKeywordsMap::getKeywordsId, deleteKeyWordsIds)
.eq(SubjectKeywordsMap::getBindingType, subjectPage.getBindingType())
);
//清除redis里面的绑定关系(包括专题信息,以及搜索引擎)
for (String keyWordsId : deleteKeyWordsIds) {
/*for (String keyWordsId : deleteKeyWordsIds) {
KeyWordsPage keyWordsPage = keyWordsService.getKeyWordsById(keyWordsId);
redisUtil.del(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWordsPage.getWordsCode());
}
}*/
}
//同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectPage.getId());
......@@ -736,7 +740,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Override
public List<KeyWordsPage> bindKeyWordsListByIdsAndBindType(List<String> ids, String bindingType) {
return iKeyWordsService.bindKeyWordsListByIdsAndBindType(ids,bindingType);
return iKeyWordsService.bindKeyWordsListByIdsAndBindType(ids, bindingType);
}
......@@ -748,28 +752,28 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
if (org.springframework.util.StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
if (StrUtil.isBlank(subjectPage.getSourceBindType())){
if (StrUtil.isBlank(subjectPage.getSourceBindType())) {
return Result.FAIL("解绑类型不能为空");
}
if (StrUtil.isBlank(subjectPage.getSourceType())){
if (StrUtil.isBlank(subjectPage.getSourceType())) {
return Result.FAIL("信息源类型不能为空");
}
if(CollectionUtil.isEmpty(bindIds) && ("1".equals(subjectPage.getSourceType()) || "2".equals(subjectPage.getSourceType()))){
if (CollectionUtil.isEmpty(bindIds) && ("1".equals(subjectPage.getSourceType()) || "2".equals(subjectPage.getSourceType()))) {
return Result.FAIL("解绑绑定id不能为空");
}
if(CollectionUtil.isEmpty(subjectPage.getBindLabels()) && "3".equals(subjectPage.getSourceType() )){
if (CollectionUtil.isEmpty(subjectPage.getBindLabels()) && "3".equals(subjectPage.getSourceType())) {
return Result.FAIL("解绑标签不能为空");
}
//绑定信息源组
if (StrUtil.equals(subjectPage.getSourceType(),"1")) {
if (StrUtil.equals(subjectPage.getSourceType(), "1")) {
bindInfoSourceGroup(subjectPage);
}
//绑定信息源
if (StrUtil.equals(subjectPage.getSourceType(),"2")) {
if (StrUtil.equals(subjectPage.getSourceType(), "2")) {
bindInfoSource(subjectPage);
}
//绑定标签
if (StrUtil.equals(subjectPage.getSourceType(),"3")) {
if (StrUtil.equals(subjectPage.getSourceType(), "3")) {
bindLabels(subjectPage);
}
configurationMessageService.bindInfoSourceSend(subjectId);
......@@ -783,64 +787,67 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
public void deleteBindNew(SubjectPage subjectPage) {
//解绑信息源组
if (StrUtil.equals(subjectPage.getSourceType(),"1")) {
if (StrUtil.equals(subjectPage.getSourceType(), "1")) {
unBindInfoSourceGroup(subjectPage);
}
//解绑信息源
if (StrUtil.equals(subjectPage.getSourceType(),"2")) {
if (StrUtil.equals(subjectPage.getSourceType(), "2")) {
unBindInfoSource(subjectPage);
}
//解绑标签
if (StrUtil.equals(subjectPage.getSourceType(),"3")) {
if (StrUtil.equals(subjectPage.getSourceType(), "3")) {
unBindLabels(subjectPage);
}
configurationMessageService.bindInfoSourceSend(subjectPage.getId());
}
private void unBindInfoSourceGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if(CollectionUtil.isEmpty(idList)){
return ;
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.INFO_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_INFO_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_INFO_SOURCE_GROUP.getvalue());
}
}
private void unBindLabels(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<BindLabelVo> bindLabels = subjectPage.getBindLabels();
if(CollectionUtil.isEmpty(bindLabels)){
return ;
if (CollectionUtil.isEmpty(bindLabels)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用标签
unBindLabel(subjectPage, BindTypeEnum.INFO_SOURCE_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向标签
unBindLabel(subjectPage, BindTypeEnum.DIRECTIONA_INFO_SOURCE_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽标签
unBindLabel(subjectPage, BindTypeEnum.EXCLUDE_INFO_SOURCE_LABEL.getvalue());
}
}
private void unBindLabel(SubjectPage subjectPage, Integer type) {
List<BindLabelVo> bindLabels = subjectPage.getBindLabels();
if(CollectionUtil.isEmpty(bindLabels)){
return ;
if (CollectionUtil.isEmpty(bindLabels)) {
return;
}
Set<String> labelCode = new HashSet<>();
Set<String> labelItemCode = new HashSet<>();
......@@ -851,30 +858,32 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
iSubjectInfoSourceMapService.remove(Wrappers.<SubjectInfoSourceMap>lambdaQuery()
.in(SubjectInfoSourceMap::getSourceId,labelCode)
.in(SubjectInfoSourceMap::getSourceItemId,labelItemCode)
.eq(SubjectInfoSourceMap::getSubjectId,subjectPage.getId())
.eq(SubjectInfoSourceMap::getType,type));
.in(SubjectInfoSourceMap::getSourceId, labelCode)
.in(SubjectInfoSourceMap::getSourceItemId, labelItemCode)
.eq(SubjectInfoSourceMap::getSubjectId, subjectPage.getId())
.eq(SubjectInfoSourceMap::getType, type));
}
private void unBindInfoSource(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if(CollectionUtil.isEmpty(idList)){
return ;
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.INFO_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_INFO_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_INFO_SOURCE.getvalue());
}
}
private void unbindInfoSource(SubjectPage subjectPage, List<String> idList, Integer bindType) {
iSubjectInfoSourceMapService.deleteInfoSourceIds(subjectPage.getId(), idList, bindType);
......@@ -900,7 +909,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
scoreModel.setData(jsonArray.toJSONString());
scoreModel.setChangeType(0);
//去除完之后,更新进去
scoreModelService.addOrUpdate(scoreModel,subjectPage.getCategory());
scoreModelService.addOrUpdate(scoreModel, subjectPage.getCategory());
}
}
}
......@@ -910,23 +919,24 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
private void bindInfoSourceGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if(CollectionUtil.isEmpty(idList)){
return ;
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//绑定通用信息源组
bindInfoSource(subjectPage, idList, BindTypeEnum.INFO_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//绑定定向信息源组
bindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_INFO_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//绑定屏蔽信息源组
bindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_INFO_SOURCE_GROUP.getvalue());
}
}
private void bindInfoSource(SubjectPage subjectPage, List<String> idList, Integer type) {
List<SubjectInfoSourceMap> mapList = new ArrayList<>();
for (String infoSourceId : idList) {
......@@ -980,7 +990,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
scoreModelVo.setData(jsonArray.toJSONString());
scoreModelVo.setChangeType(0);
//增加完之后,更新进去
scoreModelService.addOrUpdate(scoreModelVo,subjectPage.getCategory());
scoreModelService.addOrUpdate(scoreModelVo, subjectPage.getCategory());
}
}
iSubjectInfoSourceMapService.saveBatch(mapList);
......@@ -989,44 +999,46 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
private void bindInfoSource(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if(CollectionUtil.isEmpty(idList)){
return ;
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//绑定通用信息源
bindInfoSource(subjectPage, idList, BindTypeEnum.INFO_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//绑定定向信息源
bindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_INFO_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//绑定屏蔽信息源
bindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_INFO_SOURCE.getvalue());
}
}
private void bindLabels(SubjectPage subjectPage) {
String subjectId = subjectPage.getId();
String sourceBindType = subjectPage.getSourceBindType();
List<BindLabelVo> bindLabels = subjectPage.getBindLabels();
if(CollectionUtil.isEmpty(bindLabels)){
return ;
if (CollectionUtil.isEmpty(bindLabels)) {
return;
}
if (StrUtil.equals(sourceBindType,"1")) {
if (StrUtil.equals(sourceBindType, "1")) {
//绑定通用标签信息源
bindLabels(subjectId, bindLabels, BindTypeEnum.INFO_SOURCE_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType,"2")) {
if (StrUtil.equals(sourceBindType, "2")) {
//绑定定向标签信息源
bindLabels(subjectId, bindLabels, BindTypeEnum.DIRECTIONA_INFO_SOURCE_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType,"3")) {
if (StrUtil.equals(sourceBindType, "3")) {
//绑定屏蔽标签信息源
bindLabels(subjectId, bindLabels, BindTypeEnum.EXCLUDE_INFO_SOURCE_LABEL.getvalue());
}
}
private void bindLabels(String subjectId, List<BindLabelVo> bindLabels, Integer bindType) {
List<SubjectInfoSourceMap> mapList = new ArrayList<>();
......
......@@ -53,7 +53,7 @@ public class InfoDataSearchCondition {
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private Integer checkStatus;
//删除标记(1:删除;0:保留)
//删除标记(1:删除;0:未删除)
private Integer deleteFlag = 0;
//关联标签名称
......
......@@ -169,3 +169,16 @@ clb:
default:
processing:
advanceMonth: 6
caiji:
infosourcebind:
url: http://1.95.133.166:8823/baseSourceInfo/api/subject/infoSourceEdit
keyWordsbind:
url: http://1.95.133.166:8823/baseSourceInfo/api/subject/keywordEdit
keyWordsEdit:
url: http://1.95.133.166:8823/baseSourceInfo/api/keyword/edit
allInfosourcebind:
url: http://1.95.133.166:8823/baseSourceInfo/api/subject/infoSourceSave
allKeyWordsBind:
url: http://1.95.133.166:8823/baseSourceInfo/api/subject/keywordSave
projectCode: zzsn_prod
projectName: 克虏宝正式
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论