提交 d27fa86d 作者: obcy

【修改专题数据范围接口,修改绑定信息源查询接口】

上级 5cc7774b
...@@ -860,6 +860,18 @@ public class SubjectManageController { ...@@ -860,6 +860,18 @@ public class SubjectManageController {
List<InfoSourceLabelVO> bindList = clbLabelService.bindInfoSourceLabelInfo(subjectId); List<InfoSourceLabelVO> bindList = clbLabelService.bindInfoSourceLabelInfo(subjectId);
return Result.OK(bindList); return Result.OK(bindList);
} }
/**
* 更新subject的数据范围
* @param subjectId 专题id
*/
@GetMapping("/subjectUpdateScope")
public Result<?> subjectUpdateScope(@RequestParam(name = "subjectId") String subjectId,
@RequestParam(name = "type") String type,
@RequestParam(name = "scop" , defaultValue = "") String scop
) {
Subject subject = subjectService.subjectUpdateScope(subjectId,type,scop);
return Result.OK(subject);
}
/** /**
* 绑定信息源标签数据 * 绑定信息源标签数据
......
...@@ -7,9 +7,11 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -7,9 +7,11 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.InfoSource; import com.zzsn.event.entity.InfoSource;
import com.zzsn.event.entity.InfoSourceGroup; import com.zzsn.event.entity.InfoSourceGroup;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
...@@ -116,7 +118,30 @@ public class RelationBindController { ...@@ -116,7 +118,30 @@ public class RelationBindController {
} }
subjectIdList.add(subjectId); subjectIdList.add(subjectId);
} }
IPage<InfoSourceVo> pageList = infoSourceService.bindInfoSourcePageList(infoSourceCondition, subjectIdList, pageNo, pageSize); //查询
IPage<InfoSourceVo> pageList = null;
if (CollectionUtil.isNotEmpty(subjectIdList) && subjectIdList.size() == 1 && subjectId.equals(subjectIdList.get(0))) {
Subject byId = subjectService.getById(subjectId);
if (ObjectUtil.isNotNull(byId) && StringUtils.isNotEmpty(byId.getDataScope()) && byId.getDataScope().contains("1")) {
Page<InfoSource> page = new Page<>(pageNo, pageSize);
return Result.OK(infoSourceService.page(page,
Wrappers.<InfoSource>lambdaQuery()
.eq(ObjectUtil.isNotNull(infoSourceCondition.getCrawlType()),InfoSource::getCrawlType, infoSourceCondition.getCrawlType())
.eq(StrUtil.isNotBlank(infoSourceCondition.getStatus()),InfoSource::getStatus, infoSourceCondition.getStatus())
.like(StrUtil.isNotBlank(infoSourceCondition.getWebSiteName()),InfoSource::getWebSiteName, infoSourceCondition.getWebSiteName())
.like(StrUtil.isNotBlank(infoSourceCondition.getSiteName()),InfoSource::getSiteName, infoSourceCondition.getSiteName())
.like(StrUtil.isNotBlank(infoSourceCondition.getSiteUri()),InfoSource::getSiteUri, infoSourceCondition.getSiteUri())
.orderByDesc(InfoSource::getCreateTime)
));
}else {
pageList = infoSourceService.bindInfoSourcePageList(infoSourceCondition, subjectIdList, pageNo, pageSize);
}
}else {
pageList = infoSourceService.bindInfoSourcePageList(infoSourceCondition, subjectIdList, pageNo, pageSize);
}
return Result.OK(pageList); return Result.OK(pageList);
} }
......
...@@ -69,4 +69,8 @@ public class InfoSource implements Serializable { ...@@ -69,4 +69,8 @@ public class InfoSource implements Serializable {
/**原创来源(中文逗号隔开)*/ /**原创来源(中文逗号隔开)*/
private String originalSource; private String originalSource;
/**爬虫类别*/
private String crawlType;
/**爬虫类别*/
private String status;
} }
...@@ -114,5 +114,7 @@ public class Subject implements Serializable { ...@@ -114,5 +114,7 @@ public class Subject implements Serializable {
/**专题分类id*/ /**专题分类id*/
@TableField(exist = false) @TableField(exist = false)
private String typeId; private String typeId;
/**数据范围(是否是全库) - 采集库全库-1,企业库全库-2,政策库全库-3*/
private String dataScope;
} }
...@@ -202,4 +202,7 @@ public interface SubjectService extends IService<Subject> { ...@@ -202,4 +202,7 @@ public interface SubjectService extends IService<Subject> {
void deleteBindNew(SubjectPage subjectPage); void deleteBindNew(SubjectPage subjectPage);
String getMinCreateTime(List<String> subjectIdList); String getMinCreateTime(List<String> subjectIdList);
Subject subjectUpdateScope(String subjectId, String type, String scop);
} }
...@@ -905,6 +905,44 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -905,6 +905,44 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
return baseMapper.getMinCreateTime(subjectIdList); return baseMapper.getMinCreateTime(subjectIdList);
} }
@Override
public Subject subjectUpdateScope(String subjectId, String type, String scop) {
Subject byId = super.getById(subjectId);
if (ObjectUtil.isNotNull(byId)){
String dataScope = byId.getDataScope();
if (StrUtil.isNotBlank(dataScope)){
List<String> scopeList = Arrays.asList(dataScope.split(","));
if (StrUtil.equals(type,"1") && "1".equals(scop)){
scopeList.add("1");
}else if (StrUtil.equals(type,"1") && "0".equals(scop)){
scopeList.remove("1");
}
if (StrUtil.equals(type,"2") && "1".equals(scop)){
scopeList.add("2");
}else if (StrUtil.equals(type,"2") && "0".equals(scop)){
scopeList.remove("2");
}
if (StrUtil.equals(type,"3") && "1".equals(scop)){
scopeList.add("3");
}else if (StrUtil.equals(type,"3") && "0".equals(scop)){
scopeList.remove("3");
}
scopeList = scopeList.stream().distinct().collect(Collectors.toList());
String join = StrUtil.join(",", scopeList);
byId.setDataScope(join);
this.updateById(byId);
}else {
if ("1".equals(scop)) {
byId.setDataScope(scop);
}
this.updateById(byId);
}
}
return byId;
}
private void unBindInfoSourceGroup(SubjectPage subjectPage) { private void unBindInfoSourceGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType(); String sourceBindType = subjectPage.getSourceBindType();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论