提交 0857edbd 作者: yanxin

专题查询绑定标签自动识别标签模型

上级 4840a326
...@@ -39,7 +39,6 @@ import org.springframework.http.HttpHeaders; ...@@ -39,7 +39,6 @@ import org.springframework.http.HttpHeaders;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import sun.security.pkcs10.PKCS10;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
......
...@@ -7,6 +7,7 @@ import com.zzsn.event.vo.DictVO; ...@@ -7,6 +7,7 @@ import com.zzsn.event.vo.DictVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -26,6 +27,26 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> { ...@@ -26,6 +27,26 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
* @date 2025/3/28 * @date 2025/3/28
*/ */
List<DictVO> boundList(@Param("subjectId") String subjectId); List<DictVO> boundList(@Param("subjectId") String subjectId);
/**
* 流程中标签模型绑定的数据字典信息
* @param subjectId
* @return
*/
List<DictVO> boundArrangeList(@Param("subjectId") String subjectId);
/**
* 老逻辑中标签模型绑定的数据字典信息
* @param subjectId
* @return
*/
List<DictVO> boundOldList(@Param("subjectId") String subjectId);
/**
* 查询非数据字典的标签类型
* @param ids
* @return
*/
List<DictVO> findLabelType(@Param("ids") List<String> ids);
} }
......
...@@ -13,8 +13,48 @@ ...@@ -13,8 +13,48 @@
</resultMap> </resultMap>
<select id="boundList" resultType="com.zzsn.event.vo.DictVO"> <select id="boundList" resultType="com.zzsn.event.vo.DictVO">
select d.id,d.dict_code as code,d.dict_name as name from subject_dict_map m select d.id,d.dict_code as code,d.dict_name as name,'bind' as type
from subject_dict_map m
inner join clb_system.sys_dict d on m.dict_id = d.id inner join clb_system.sys_dict d on m.dict_id = d.id
where m.subject_id = #{subjectId} where m.subject_id = #{subjectId}
</select> </select>
<select id="boundArrangeList" resultType="com.zzsn.event.vo.DictVO">
SELECT
label_id as id,if(dict_code = '', null, dict_code) as code,name,'model' as type
FROM
clb_algorithm_model
WHERE
type = 3
AND id IN (
SELECT
model_id
FROM
clb_model_arrange_node
WHERE
arrange_id IN
(SELECT DISTINCT arrange_id FROM clb_model_arrange_subject_map
WHERE subject_id = #{subjectId} AND del_flag = 0 )
AND base_node_id = '1872120615905812482')
and (label_id is not null or dict_code is not null)
</select>
<select id="boundOldList" resultType="com.zzsn.event.vo.DictVO">
SELECT
label_id as id,if(dict_code = '', null, dict_code) as code,name,'model' as type
FROM
clb_algorithm_model
WHERE
type = 3 AND id IN
(SELECT DISTINCT model_id FROM subject_model_map
WHERE subject_id = #{subjectId} AND type = 3)
</select>
<select id="findLabelType" resultType="com.zzsn.event.vo.DictVO">
select id,label_name as name,label_mark,label_type,'model' type from sys_base_label_type where
id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
...@@ -9,10 +9,15 @@ import com.zzsn.event.mapper.SubjectDictMapMapper; ...@@ -9,10 +9,15 @@ import com.zzsn.event.mapper.SubjectDictMapMapper;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.DictVO; import com.zzsn.event.vo.DictVO;
import com.zzsn.event.vo.SubjectBindLabelParam; import com.zzsn.event.vo.SubjectBindLabelParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author lenovo * @author lenovo
...@@ -44,7 +49,24 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, ...@@ -44,7 +49,24 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
@Override @Override
public List<DictVO> boundList(String subjectId) { public List<DictVO> boundList(String subjectId) {
return baseMapper.boundList(subjectId); //直接绑定的字典
List<DictVO> dictVOS = baseMapper.boundList(subjectId);
//流程中标签模型绑定字典
List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectId);
dictVOS.addAll(dictArrange);
if(dictArrange.isEmpty()){
//未绑定流程的(可能)查询老逻辑保定的字典
List<DictVO> dictOld = baseMapper.boundOldList(subjectId);
dictVOS.addAll(dictOld);
}
List<String> ids = dictVOS.stream().filter(dictVO -> StringUtils.isEmpty(dictVO.getCode())).map(DictVO::getId).collect(Collectors.toList());
if(!ids.isEmpty()){
//添加到开头,优先保留这部分数据
dictVOS.addAll(0,baseMapper.findLabelType(ids));
}
//按照id和code去重
dictVOS = dictVOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getId() + o.getCode()))), ArrayList::new));
return dictVOS;
} }
} }
......
...@@ -2,6 +2,8 @@ package com.zzsn.event.vo; ...@@ -2,6 +2,8 @@ package com.zzsn.event.vo;
import lombok.Data; import lombok.Data;
import java.util.Objects;
/** /**
* *
* *
...@@ -14,4 +16,20 @@ public class DictVO { ...@@ -14,4 +16,20 @@ public class DictVO {
private String id; private String id;
private String code; private String code;
private String name; private String name;
private String labelMark;
private String labelType;
//bind:绑定标签 model:模型标签
private String type;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DictVO dictVO = (DictVO) o;
return Objects.equals(id, dictVO.id) && Objects.equals(code, dictVO.code);
}
} }
...@@ -11,6 +11,8 @@ import java.util.List; ...@@ -11,6 +11,8 @@ import java.util.List;
*/ */
@Data @Data
public class EventDataVO { public class EventDataVO {
//数据唯一id
private String uniqueCode;
//说明:...Raw 表示原文,即原语言 //说明:...Raw 表示原文,即原语言
//作者 //作者
private String author; private String author;
......
...@@ -118,7 +118,7 @@ public class InfoDataSearchCondition { ...@@ -118,7 +118,7 @@ public class InfoDataSearchCondition {
//es查询字段数组 //es查询字段数组
private String[] fetchFields; private String[] fetchFields;
//排除字段数组 //排除字段数组
private String[] excludeFields = new String[]{"content", "contentWithTag"}; private String[] excludeFields = new String[]{"content", "contentWithTag","contentRaw", "contentWithTagRaw"};
//排序参数 //排序参数
//排序字段 //排序字段
......
...@@ -7,7 +7,8 @@ import java.util.List; ...@@ -7,7 +7,8 @@ import java.util.List;
@Data @Data
public class DisplayInfo { public class DisplayInfo {
//数据唯一id
private String uniqueCode;
//es的索引名 //es的索引名
private String dbIndex; private String dbIndex;
//说明:...Raw 表示原文,即原语言 //说明:...Raw 表示原文,即原语言
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论