提交 b3b75c66 作者: obcy

Merge remote-tracking branch 'origin/event_fusion' into event_fusion

package com.zzsn.event.config; package com.zzsn.event.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
......
...@@ -33,6 +33,8 @@ public class LlmProperties { ...@@ -33,6 +33,8 @@ public class LlmProperties {
private String defaultModel; private String defaultModel;
//是否开启网络搜索 //是否开启网络搜索
private Boolean webSearch; private Boolean webSearch;
//温度
private Float temperature;
} }
/** /**
......
...@@ -908,7 +908,20 @@ public class EventAnalysisController { ...@@ -908,7 +908,20 @@ public class EventAnalysisController {
public void downloadPPT(@RequestParam String versionId, HttpServletResponse response) { public void downloadPPT(@RequestParam String versionId, HttpServletResponse response) {
EventAnalysisVersion eventAnalysisVersion = eventAnalysisVersionService.getById(versionId); EventAnalysisVersion eventAnalysisVersion = eventAnalysisVersionService.getById(versionId);
if (eventAnalysisVersion != null && StringUtils.isNotEmpty(eventAnalysisVersion.getPptPath())) { if (eventAnalysisVersion != null && StringUtils.isNotEmpty(eventAnalysisVersion.getPptPath())) {
commonService.downloadTemplate(response, eventAnalysisVersion.getPptPath()); String pptPath = eventAnalysisVersion.getPptPath();
JSONObject jsonObject = JSON.parseObject(pptPath);
Integer code = jsonObject.getInteger("code");
if (code == 200) {
commonService.downloadTemplate(response, jsonObject.getString("result"));
} else {
String json = JSON.toJSONString(Result.FAIL("PPT生成失败"));
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=utf-8");
try (PrintWriter writer = response.getWriter()) {
writer.println(json);
} catch (Exception ignored) {
}
}
} else { } else {
String json = JSON.toJSONString(Result.FAIL(201, "PPT还在生成中。。。")); String json = JSON.toJSONString(Result.FAIL(201, "PPT还在生成中。。。"));
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
......
package com.zzsn.event.llm; package com.zzsn.event.llm;
import com.zzsn.event.config.properties.LlmProperties;
/** /**
* 模型调用 * 模型调用
*/ */
...@@ -15,4 +17,14 @@ public interface LlmService { ...@@ -15,4 +17,14 @@ public interface LlmService {
* @return 大模型响应结果 * @return 大模型响应结果
*/ */
String model(String modelType, String modelName, String system, String content); String model(String modelType, String modelName, String system, String content);
/**
* 千问模型调用
*
* @param modelConfig 模型配置信息
* @param system 提示词
* @param content 引用内容
* @return 大模型响应结果
*/
String qwenModel(LlmProperties.ModelConfig modelConfig, String system, String content);
} }
...@@ -136,6 +136,9 @@ public class LlmServiceImpl implements LlmService { ...@@ -136,6 +136,9 @@ public class LlmServiceImpl implements LlmService {
.messages(Arrays.asList(systemMsg, userMsg)) .messages(Arrays.asList(systemMsg, userMsg))
.resultFormat(GenerationParam.ResultFormat.MESSAGE) .resultFormat(GenerationParam.ResultFormat.MESSAGE)
.build(); .build();
if (modelConfig.getTemperature() != null) {
param.setTemperature(modelConfig.getTemperature());
}
GenerationResult call = gen.call(param); GenerationResult call = gen.call(param);
return call.getOutput().getChoices().get(0).getMessage().getContent(); return call.getOutput().getChoices().get(0).getMessage().getContent();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -22,29 +22,29 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> { ...@@ -22,29 +22,29 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
/** /**
* 专题绑定的数据字典信息 * 专题绑定的数据字典信息
* *
* @param subjectId 专题id * @param subjectIdList 专题id
* @author lkg * @author lkg
* @date 2025/3/28 * @date 2025/3/28
*/ */
List<DictVO> boundList(@Param("subjectId") String subjectId); List<DictVO> boundList(@Param("subjectIdList") List<String> subjectIdList);
List<String> boundIdList(@Param("subjectId") String subjectId); List<String> boundIdList(@Param("subjectIdList") List<String> subjectIdList);
/** /**
* 流程中标签模型绑定的数据字典信息 * 流程中标签模型绑定的数据字典信息
* *
* @param subjectId * @param subjectIdList
* @return * @return
*/ */
List<DictVO> boundArrangeList(@Param("subjectId") String subjectId); List<DictVO> boundArrangeList(@Param("subjectIdList") List<String> subjectIdList);
/** /**
* 老逻辑中标签模型绑定的数据字典信息 * 老逻辑中标签模型绑定的数据字典信息
* *
* @param subjectId * @param subjectIdList
* @return * @return
*/ */
List<DictVO> boundOldList(@Param("subjectId") String subjectId); List<DictVO> boundOldList(@Param("subjectIdList") List<String> subjectIdList);
/** /**
* 查询非数据字典的标签类型 * 查询非数据字典的标签类型
......
...@@ -125,4 +125,6 @@ public interface SubjectMapper extends BaseMapper<Subject> { ...@@ -125,4 +125,6 @@ public interface SubjectMapper extends BaseMapper<Subject> {
List<String> getBindSubjectIds(@Param("id") String id); List<String> getBindSubjectIds(@Param("id") String id);
String getMinCreateTime(@Param("subjectIdList") List<String> subjectIdList); String getMinCreateTime(@Param("subjectIdList") List<String> subjectIdList);
List<String> getIdListByType(@Param("typeId") String typeId);
} }
...@@ -16,12 +16,18 @@ ...@@ -16,12 +16,18 @@
select d.id,d.dict_code as code,d.dict_name as name,'bind' as type select d.id,d.dict_code as code,d.dict_name as name,'bind' as type
from subject_dict_map m 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 in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select> </select>
<select id="boundIdList" resultType="String"> <select id="boundIdList" resultType="String">
select dict_id select dict_id
from subject_dict_map from subject_dict_map
where subject_id = #{subjectId} where subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select> </select>
<select id="boundArrangeList" resultType="com.zzsn.event.vo.DictVO"> <select id="boundArrangeList" resultType="com.zzsn.event.vo.DictVO">
...@@ -39,7 +45,11 @@ ...@@ -39,7 +45,11 @@
WHERE WHERE
arrange_id IN arrange_id IN
(SELECT DISTINCT arrange_id FROM clb_model_arrange_subject_map (SELECT DISTINCT arrange_id FROM clb_model_arrange_subject_map
WHERE subject_id = #{subjectId} AND del_flag = 0 ) WHERE subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
AND del_flag = 0 )
AND del_flag = 0 AND del_flag = 0
AND base_node_id = '1872120615905812482') AND base_node_id = '1872120615905812482')
and (label_id is not null or dict_code is not null) and (label_id is not null or dict_code is not null)
...@@ -53,7 +63,11 @@ ...@@ -53,7 +63,11 @@
WHERE WHERE
type = 3 AND id IN type = 3 AND id IN
(SELECT DISTINCT model_id FROM subject_model_map (SELECT DISTINCT model_id FROM subject_model_map
WHERE subject_id = #{subjectId} AND type = 3) WHERE subject_id in
<foreach collection="subjectIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
AND type = 3)
</select> </select>
<select id="findLabelType" resultType="com.zzsn.event.vo.DictVO"> <select id="findLabelType" resultType="com.zzsn.event.vo.DictVO">
......
...@@ -148,6 +148,8 @@ ...@@ -148,6 +148,8 @@
SELECT d.id, SELECT d.id,
d.subject_name, d.subject_name,
d.subject_code, d.subject_code,
d.time_enable,
d.time_disable,
d.library, d.library,
d.remark, d.remark,
d.subject_type, d.subject_type,
...@@ -327,4 +329,8 @@ ...@@ -327,4 +329,8 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="getIdListByType" resultType="java.lang.String">
select DISTINCT subject_id from subject_type_map where type_id = #{typeId}
</select>
</mapper> </mapper>
...@@ -4,20 +4,32 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -4,20 +4,32 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ScoreModel; import com.zzsn.event.entity.ScoreModel;
import com.zzsn.event.vo.ScoreModelVo; import com.zzsn.event.vo.ScoreModelVo;
import com.zzsn.event.vo.SearchWordVO;
import java.util.List; import java.util.List;
/** /**
* @Description: 打分模型 * @Description: 打分模型
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2021-12-17 * @Date: 2021-12-17
* @Version: V1.0 * @Version: V1.0
*/ */
public interface ScoreModelService extends IService<ScoreModel> { public interface ScoreModelService extends IService<ScoreModel> {
void addOrUpdate(ScoreModelVo scoreModel,Integer category); void addOrUpdate(ScoreModelVo scoreModel, Integer category);
List<ScoreModelVo> queryScoreModel(String subjectId, String type); List<ScoreModelVo> queryScoreModel(String subjectId, String type);
JSONObject scoreModelInfo(String subjectId, String type); JSONObject scoreModelInfo(String subjectId, String type);
/**
* 通用打分模型编辑(关键词)
*
* @param subjectId 专题id
* @param keywords 关键词信息
* @author lkg
* @date 2025/9/1
*/
void commonModifyByKeyword(String subjectId, List<SearchWordVO> keywords);
} }
...@@ -212,4 +212,11 @@ public interface SubjectService extends IService<Subject> { ...@@ -212,4 +212,11 @@ public interface SubjectService extends IService<Subject> {
Subject getSubjectOrEventById(String id); Subject getSubjectOrEventById(String id);
/**根据编码查询专题或者事件*/ /**根据编码查询专题或者事件*/
Subject getSubjectOrEvent(String subjectCode); Subject getSubjectOrEvent(String subjectCode);
/**
* 根据分组获取专题id列表
* @param typeId
* @return
*/
List<String> getIdListByType(String typeId);
} }
...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; ...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.obs.services.model.PutObjectResult; import com.obs.services.model.PutObjectResult;
import com.zzsn.event.constant.Constants; import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
import com.zzsn.event.enums.AnalysisColumnEnum; import com.zzsn.event.enums.AnalysisColumnEnum;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
...@@ -517,9 +518,6 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -517,9 +518,6 @@ public class AnalysisServiceImpl implements AnalysisService {
InputStream inputStream = connection.getInputStream(); InputStream inputStream = connection.getInputStream();
PutObjectResult putObjectResult = obsUtil.uploadFile("event_ppt/" + eventId + "_" + timestamp + ".pptx", inputStream); PutObjectResult putObjectResult = obsUtil.uploadFile("event_ppt/" + eventId + "_" + timestamp + ".pptx", inputStream);
pptFile = putObjectResult.getObjectKey(); pptFile = putObjectResult.getObjectKey();
LambdaUpdateWrapper<EventAnalysisVersion> update = Wrappers.lambdaUpdate();
update.set(EventAnalysisVersion::getPptPath, pptFile).eq(EventAnalysisVersion::getId, versionId);
eventAnalysisVersionService.update(update);
break; break;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -535,6 +533,15 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -535,6 +533,15 @@ public class AnalysisServiceImpl implements AnalysisService {
} }
} }
} }
Result<String> result;
if (pptFile == null) {
result = Result.FAIL("ppt生成失败");
} else {
result = Result.OK(pptFile);
}
LambdaUpdateWrapper<EventAnalysisVersion> update = Wrappers.lambdaUpdate();
update.set(EventAnalysisVersion::getPptPath, JSON.toJSONString(result)).eq(EventAnalysisVersion::getId, versionId);
eventAnalysisVersionService.update(update);
return pptFile; return pptFile;
} }
......
...@@ -14,6 +14,7 @@ import com.zzsn.event.service.ISubjectInfoSourceMapService; ...@@ -14,6 +14,7 @@ import com.zzsn.event.service.ISubjectInfoSourceMapService;
import com.zzsn.event.service.ScoreModelService; import com.zzsn.event.service.ScoreModelService;
import com.zzsn.event.vo.InfoSourceGroupPage; import com.zzsn.event.vo.InfoSourceGroupPage;
import com.zzsn.event.vo.ScoreModelVo; import com.zzsn.event.vo.ScoreModelVo;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectScoreModel; import com.zzsn.event.vo.SubjectScoreModel;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,6 +23,8 @@ import org.springframework.stereotype.Service; ...@@ -22,6 +23,8 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/** /**
* @Description: 打分模型 * @Description: 打分模型
...@@ -81,8 +84,48 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo ...@@ -81,8 +84,48 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo
} }
} }
@Override
public void commonModifyByKeyword(String subjectId, List<SearchWordVO> keywordList) {
LambdaQueryWrapper<ScoreModel> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(ScoreModel::getSubjectId,subjectId)
.eq(ScoreModel::getType,"1");
ScoreModel scoreModel = this.getOne(queryWrapper);
String keyword = keywordList.stream().map(SearchWordVO::getSearchInfo).collect(Collectors.joining("|"));
if(scoreModel == null){
//默认通用打分配置
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}]}]";
defaultConfig = defaultConfig.replace("KEY_WORD", keyword);
scoreModel = new ScoreModel();
scoreModel.setSubjectId(subjectId);
scoreModel.setType("1");
scoreModel.setData(defaultConfig);
this.save(scoreModel);
} else {
JSONArray jsonArray = JSON.parseArray((scoreModel.getData().toString()));
Optional<Object> first = jsonArray.stream().filter(e -> {
JSONObject jsonObject = (JSONObject) e;
String name = jsonObject.getString("name");
return "内容".equals(name);
}).findFirst();
if (first.isPresent()) {
JSONObject jsonObject = (JSONObject) first.get();
JSONArray children = jsonObject.getJSONArray("children");
Optional<Object> wordFirst = children.stream().filter(e -> {
JSONObject jsonObject1 = (JSONObject) e;
String name = jsonObject1.getString("name");
return "内容-关键词".equals(name);
}).findFirst();
if (wordFirst.isPresent()) {
JSONObject wordJsonObject = (JSONObject) wordFirst.get();
wordJsonObject.put("keyWords",keyword);
}
}
scoreModel.setData(JSON.toJSONString(jsonArray));
this.updateById(scoreModel);
}
}
private JSONObject defaultInfo(String subjectId,String type){ private JSONObject defaultInfo(String subjectId, String type){
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
List<SubjectScoreModel> allList = new ArrayList<>(); List<SubjectScoreModel> allList = new ArrayList<>();
SubjectScoreModel subjectScoreModel = new SubjectScoreModel(); SubjectScoreModel subjectScoreModel = new SubjectScoreModel();
......
...@@ -3,19 +3,19 @@ package com.zzsn.event.service.impl; ...@@ -3,19 +3,19 @@ package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectDictMap; import com.zzsn.event.entity.SubjectDictMap;
import com.zzsn.event.service.SubjectDictMapService; import com.zzsn.event.service.SubjectDictMapService;
import com.zzsn.event.mapper.SubjectDictMapMapper; import com.zzsn.event.mapper.SubjectDictMapMapper;
import com.zzsn.event.service.SubjectService;
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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -27,6 +27,9 @@ import java.util.stream.Stream; ...@@ -27,6 +27,9 @@ import java.util.stream.Stream;
@Service @Service
public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, SubjectDictMap> implements SubjectDictMapService{ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, SubjectDictMap> implements SubjectDictMapService{
@Autowired
private SubjectService subjectService;
@Override @Override
public void modify(SubjectBindLabelParam bindLabelParam) { public void modify(SubjectBindLabelParam bindLabelParam) {
String subjectId = bindLabelParam.getSubjectId(); String subjectId = bindLabelParam.getSubjectId();
...@@ -49,9 +52,18 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, ...@@ -49,9 +52,18 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
@Override @Override
public List<DictVO> boundList(String subjectId) { public List<DictVO> boundList(String subjectId) {
Subject byId = subjectService.getById(subjectId);
List<String> subjectIdList = Collections.singletonList(subjectId);
if(byId == null){
//不是专题时,根据分组获取专题列表
subjectIdList = subjectService.getIdListByType(subjectId);
}
if(subjectIdList.isEmpty()){
return new ArrayList<>();
}
//直接绑定的字典 //直接绑定的字典
List<DictVO> dictVOS = baseMapper.boundList(subjectId); List<DictVO> dictVOS = baseMapper.boundList(subjectIdList);
List<String> boundIds = baseMapper.boundIdList(subjectId); List<String> boundIds = baseMapper.boundIdList(subjectIdList);
if(boundIds.size()>dictVOS.size()){ if(boundIds.size()>dictVOS.size()){
List<String> ids = dictVOS.stream().map(DictVO::getId).collect(Collectors.toList()); List<String> ids = dictVOS.stream().map(DictVO::getId).collect(Collectors.toList());
List<String> lids = new ArrayList<>(boundIds); List<String> lids = new ArrayList<>(boundIds);
...@@ -64,11 +76,11 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper, ...@@ -64,11 +76,11 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
dictVOS.addAll(baseMapper.findLeaderLabelType(boundIds)); dictVOS.addAll(baseMapper.findLeaderLabelType(boundIds));
} }
//流程中标签模型绑定字典 //流程中标签模型绑定字典
List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectId); List<DictVO> dictArrange = baseMapper.boundArrangeList(subjectIdList);
dictVOS.addAll(dictArrange); dictVOS.addAll(dictArrange);
if(dictArrange.isEmpty()){ if(dictArrange.isEmpty()){
//未绑定流程的(可能)查询老逻辑保定的字典 //未绑定流程的(可能)查询老逻辑保定的字典
List<DictVO> dictOld = baseMapper.boundOldList(subjectId); List<DictVO> dictOld = baseMapper.boundOldList(subjectIdList);
dictVOS.addAll(dictOld); dictVOS.addAll(dictOld);
} }
dictVOS.forEach(dictVO -> { dictVOS.forEach(dictVO -> {
......
...@@ -1545,6 +1545,12 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -1545,6 +1545,12 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
} }
@Override
public List<String> getIdListByType(String typeId) {
return this.baseMapper.getIdListByType(typeId);
}
@Override @Override
public Subject getSubjectOrEventById(String id) { public Subject getSubjectOrEventById(String id) {
......
...@@ -110,16 +110,10 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -110,16 +110,10 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
if (CollectionUtils.isNotEmpty(keywords)) { if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectId, subject.getSubjectName(), keywords); modifyKeyword(subjectId, subject.getSubjectName(), keywords);
//默认通用打分配置 //默认通用打分配置
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}]}]";
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList()); List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) { if (CollectionUtils.isNotEmpty(collect)) {
defaultConfig = defaultConfig.replace("KEY_WORD", String.join("|", collect.stream().map(SearchWordVO::getSearchInfo).collect(Collectors.toList()))); scoreModelService.commonModifyByKeyword(subjectId, collect);
} }
ScoreModel scoreModel = new ScoreModel();
scoreModel.setSubjectId(subjectId);
scoreModel.setType("1");
scoreModel.setData(defaultConfig);
scoreModelService.save(scoreModel);
//同步配置到采集 //同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectId,null); configurationMessageService.bindKeyWordsSend(subjectId,null);
//默认绑定tpu流程 //默认绑定tpu流程
...@@ -150,8 +144,11 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -150,8 +144,11 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords(); List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
if (CollectionUtils.isNotEmpty(keywords)) { if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectId, subject.getSubjectName(), keywords); modifyKeyword(subjectId, subject.getSubjectName(), keywords);
//同步配置到采集 //默认通用打分配置
//configurationMessageService.bindKeyWordsSend(subjectId,1); List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
scoreModelService.commonModifyByKeyword(subjectId, collect);
}
//默认绑定tpu流程 //默认绑定tpu流程
ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap(); ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap();
tpu.setSubjectId(subject.getId()); tpu.setSubjectId(subject.getId());
...@@ -371,12 +368,18 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -371,12 +368,18 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
BeanUtils.copyProperties(subjectSimpleVO, subjectPage); BeanUtils.copyProperties(subjectSimpleVO, subjectPage);
subjectPage.setProjectId(PROJECT_ID); subjectPage.setProjectId(PROJECT_ID);
subjectService.updateMain(subjectPage); subjectService.updateMain(subjectPage);
String subjectId = subjectSimpleVO.getId();
//关键词绑定 //关键词绑定
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords(); List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
if (CollectionUtils.isNotEmpty(keywords)) { if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords); modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords);
//默认通用打分配置
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
scoreModelService.commonModifyByKeyword(subjectId, collect);
}
//同步配置到采集 //同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectSimpleVO.getId(),null); configurationMessageService.bindKeyWordsSend(subjectId,null);
} }
} }
...@@ -386,12 +389,18 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -386,12 +389,18 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
BeanUtils.copyProperties(subjectSimpleVO, subjectPage); BeanUtils.copyProperties(subjectSimpleVO, subjectPage);
subjectPage.setProjectId("1955112691539480577"); subjectPage.setProjectId("1955112691539480577");
subjectService.updateMain(subjectPage); subjectService.updateMain(subjectPage);
String subjectId = subjectSimpleVO.getId();
//关键词绑定 //关键词绑定
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords(); List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
if (CollectionUtils.isNotEmpty(keywords)) { if (CollectionUtils.isNotEmpty(keywords)) {
modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords); modifyKeyword(subjectSimpleVO.getId(), subjectSimpleVO.getSubjectName(), keywords);
//默认通用打分配置
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
scoreModelService.commonModifyByKeyword(subjectId, collect);
}
//同步配置到采集 //同步配置到采集
configurationMessageService.bindKeyWordsSend(subjectSimpleVO.getId(),1); configurationMessageService.bindKeyWordsSend(subjectId,1);
} }
} }
......
...@@ -203,4 +203,8 @@ public class SubjectPage { ...@@ -203,4 +203,8 @@ public class SubjectPage {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
private Date latestDataDate; private Date latestDataDate;
/**采集状态(定制专题)*/
private String collectStatus;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论