提交 dd1ad20b 作者: yanxin

绑定标签兼容人物服务-专家库 和 旧版企业人物标签

上级 31faf612
package com.zzsn.event.controller.common;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
......@@ -12,6 +16,8 @@ import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.InfoSource;
import com.zzsn.event.entity.InfoSourceGroup;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.feign.api.RemoteSystemService;
import com.zzsn.event.feign.entity.SysDict;
import com.zzsn.event.service.*;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
......@@ -58,6 +64,8 @@ public class RelationBindController {
private SubjectDictMapService subjectDictMapService;
@Autowired
private SysDictItemService dictItemService;
@Autowired
private RemoteSystemService remoteSystemService;
/**
* 项目列表
......@@ -300,7 +308,55 @@ public class RelationBindController {
List<KeyWordsPage> bindKeyWordsList = keyWordsService.bindKeyWordsList(subjectIdList, groupName, wordName);
return Result.OK(bindKeyWordsList);
}
/**
* 专题可绑定的标签树
* @author yanxin
* @date 2025/5/7
*/
@GetMapping("/bindLabelTreeList")
public Result<?> bindLabelTreeList() {
Result<List<Tree<String>>> dictTreeList = remoteSystemService.treeListContainsDict();
//添加老版本人物、企业标签
List<SysDict> oldLabelList = commonService.selectOldLabelTypeList();
if (CollectionUtil.isNotEmpty(oldLabelList)){
SysDict sysDict = new SysDict();
sysDict.setId("1");
sysDict.setParentId("0");
sysDict.setHasChild("1");
sysDict.setDictName("旧版标签");
oldLabelList.add(sysDict);
List<TreeNode<String>> nodeList = getTreeNodes(oldLabelList);
List<Tree<String>> treeList = TreeUtil.build(nodeList, "0");
dictTreeList.getResult().addAll(treeList);
}
//人物分类
List<SysDict> leaderLabelList = commonService.selectLeaderTypeList();
if (CollectionUtil.isNotEmpty(leaderLabelList)){
SysDict sysDict = new SysDict();
sysDict.setId("2");
sysDict.setParentId("0");
sysDict.setHasChild("1");
sysDict.setDictName("人物管理-专家库");
leaderLabelList.add(sysDict);
List<TreeNode<String>> nodeList = getTreeNodes(leaderLabelList);
List<Tree<String>> treeList = TreeUtil.build(nodeList, "0");
dictTreeList.getResult().addAll(treeList);
}
return dictTreeList;
}
private List<TreeNode<String>> getTreeNodes(List<SysDict> list) {
List<TreeNode<String>> nodeList = new ArrayList<>();
list.forEach(e -> {
TreeNode<String> treeNode = new TreeNode<>();
treeNode.setExtra(BeanUtil.beanToMap(e,false,true));
treeNode.setId(e.getId());
treeNode.setName(e.getDictName());
treeNode.setParentId(e.getParentId());
nodeList.add(treeNode);
});
return nodeList;
}
/**
* 专题绑定标签(用于人工打标)
*
......
package com.zzsn.event.feign.api;
import cn.hutool.core.lang.tree.Tree;
import com.zzsn.event.constant.Result;
import com.zzsn.event.feign.entity.SysDictItem;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(value = "jeecg-system")
public interface RemoteSystemService {
//feign调用测试、查询数据字典值
@GetMapping("/sys/dictItem/remoteList")
String sysDictItemList(@RequestBody SysDictItem sysDictItem, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNo") Integer pageNo);
@GetMapping("/sys/dictType/treeListContainsDict")
Result<List<Tree<String>>> treeListContainsDict();
}
package com.zzsn.event.feign.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -87,5 +88,16 @@ public class SysDict implements Serializable {
*/
private Integer leafNode;
/**
* 是否包含子节点
*/
@TableField(exist = false)
private String hasChild;
/**
* 是否为字典
*/
@TableField(exist = false)
private String isDict;
}
package com.zzsn.event.mapper;
import com.zzsn.event.feign.entity.SysDict;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Mapper;
......@@ -103,4 +104,8 @@ public interface CommonMapper {
List<LabelItemMapVO> infoSourceLabelsBySidList(@Param("sidList") List<String> sidList);
List<SubjectSourceVO> bindSourceCount(@Param("subjectIds") List<String> subjectIds);
List<SysDict> selectOldLabelTypeList();
List<SysDict> selectLeaderTypeList();
}
......@@ -11,11 +11,11 @@ import java.util.Collection;
import java.util.List;
/**
* @author lenovo
* @description 针对表【subject_dict_map(专题-字典关系表)】的数据库操作Mapper
* @createDate 2025-03-28 11:56:32
* @Entity com.zzsn.event.entity.SubjectDictMap
*/
* @author lenovo
* @description 针对表【subject_dict_map(专题-字典关系表)】的数据库操作Mapper
* @createDate 2025-03-28 11:56:32
* @Entity com.zzsn.event.entity.SubjectDictMap
*/
@Mapper
public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
......@@ -28,14 +28,19 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
*/
List<DictVO> boundList(@Param("subjectId") String subjectId);
List<String> boundIdList(@Param("subjectId") String subjectId);
/**
* 流程中标签模型绑定的数据字典信息
*
* @param subjectId
* @return
*/
List<DictVO> boundArrangeList(@Param("subjectId") String subjectId);
/**
* 老逻辑中标签模型绑定的数据字典信息
*
* @param subjectId
* @return
*/
......@@ -43,10 +48,13 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
/**
* 查询非数据字典的标签类型
*
* @param ids
* @return
*/
List<DictVO> findLabelType(@Param("ids") List<String> ids);
List<DictVO> findLeaderLabelType(@Param("ids") List<String> ids);
}
......
......@@ -246,4 +246,14 @@
on (a.subject_id = b.subject_id and a.source_id = b.source_id)
where b.source_id is null group by a.subject_id
</select>
<select id="selectOldLabelTypeList" resultType="com.zzsn.event.feign.entity.SysDict">
select id,if(pid='0','1',pid) parentId,label_name dictName,has_child hasChild,if(has_child=0,'1',null) isDict from sys_base_label_type
where id not IN ('1602218529184993281','1602220733056864258') and category = 0
</select>
<select id="selectLeaderTypeList" resultType="com.zzsn.event.feign.entity.SysDict">
select id,if(pid='0','2',pid) parentId,type_name dictName,has_child hasChild,if(has_child=0,'1',null) isDict
from character_category_structure where category = 2
</select>
</mapper>
......@@ -18,6 +18,11 @@
inner join clb_system.sys_dict d on m.dict_id = d.id
where m.subject_id = #{subjectId}
</select>
<select id="boundIdList" resultType="String">
select dict_id
from subject_dict_map
where subject_id = #{subjectId}
</select>
<select id="boundArrangeList" resultType="com.zzsn.event.vo.DictVO">
SELECT
......@@ -59,4 +64,11 @@
</foreach>
</select>
<select id="findLeaderLabelType" resultType="com.zzsn.event.vo.DictVO">
select id,type_name as name,'internet_experts' label_mark,'experts' label_type,'bind' type from character_category_structure where category = 2
and id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>
......@@ -2,6 +2,7 @@ package com.zzsn.event.service;
import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.entity.ClbLabelItem;
import com.zzsn.event.feign.entity.SysDict;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
......@@ -116,4 +117,8 @@ public interface CommonService {
* @return
*/
Map<String, Integer> bindSourceCount(List<String> subjectIds);
List<SysDict> selectOldLabelTypeList();
List<SysDict> selectLeaderTypeList();
}
......@@ -8,6 +8,7 @@ import com.zzsn.event.entity.*;
import com.zzsn.event.enums.KeyWordsTypeEnum;
import com.zzsn.event.enums.ModelTypeEnum;
import com.zzsn.event.enums.ScoreTypeEnum;
import com.zzsn.event.feign.entity.SysDict;
import com.zzsn.event.mapper.CommonMapper;
import com.zzsn.event.service.*;
import com.zzsn.event.util.DateUtil;
......@@ -362,6 +363,16 @@ public class CommonServiceImpl implements CommonService {
return map;
}
@Override
public List<SysDict> selectOldLabelTypeList() {
return commonMapper.selectOldLabelTypeList();
}
@Override
public List<SysDict> selectLeaderTypeList() {
return commonMapper.selectLeaderTypeList();
}
//获取树状结构
private List<ModelVO> getTreeList(List<ModelVO> authTypeList){
List<ModelVO> topList = new ArrayList<>();
......
......@@ -51,6 +51,18 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
public List<DictVO> boundList(String subjectId) {
//直接绑定的字典
List<DictVO> dictVOS = baseMapper.boundList(subjectId);
List<String> boundIds = baseMapper.boundIdList(subjectId);
if(boundIds.size()>dictVOS.size()){
List<String> ids = dictVOS.stream().map(DictVO::getId).collect(Collectors.toList());
List<String> lids = new ArrayList<>(boundIds);
lids.removeIf(ids::contains);
//添加老版本标签绑定
dictVOS.addAll(baseMapper.findLabelType(lids));
}
if(boundIds.size()>dictVOS.size()){
//添加人物标签绑定
dictVOS.addAll(baseMapper.findLeaderLabelType(boundIds));
}
//流程中标签模型绑定字典
List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectId);
dictVOS.addAll(dictArrange);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论